summaryrefslogtreecommitdiff
path: root/config/rules.mk
diff options
context:
space:
mode:
Diffstat (limited to 'config/rules.mk')
-rw-r--r--config/rules.mk37
1 files changed, 37 insertions, 0 deletions
diff --git a/config/rules.mk b/config/rules.mk
index 344ad2e5..a8ee1954 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -280,6 +280,13 @@ $(NFSPWD):
$(PROGRAM): $(OBJS)
@$(MAKE_OBJDIR)
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ifdef MOZ_PROFILE_USE
+# In the second pass, we need to merge the pgc files into the pgd file.
+# The compiler would do this for us automatically if they were in the right
+# place, but they're in dist/bin.
+ python $(topsrcdir)/build/win32/pgomerge.py \
+ $(notdir $(PROGRAM:.exe=)) $(DIST)/bin
+endif # MOZ_PROFILE_USE
$(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS)
ifdef MT
@if test -f $@.manifest; then \
@@ -287,6 +294,11 @@ ifdef MT
rm -f $@.manifest; \
fi
endif # MSVC with manifest tool
+ifdef MOZ_PROFILE_GENERATE
+# touch it a few seconds into the future to work around FAT's
+# 2-second granularity
+ touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
+endif # MOZ_PROFILE_GENERATE
else # WINNT && !GCC
$(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS)
endif # WINNT && !GCC
@@ -326,6 +338,10 @@ ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1)
-bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS)
else # AIX 4.1
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+ifdef MOZ_PROFILE_USE
+ python $(topsrcdir)/build/win32/pgomerge.py \
+ $(notdir $(SHARED_LIBRARY:.$(DLL_SUFFIX)=)) $(DIST)/bin
+endif # MOZ_PROFILE_USE
$(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
ifdef MT
@if test -f $@.manifest; then \
@@ -333,6 +349,9 @@ ifdef MT
rm -f $@.manifest; \
fi
endif # MSVC with manifest tool
+ifdef MOZ_PROFILE_GENERATE
+ touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
+endif # MOZ_PROFILE_GENERATE
else # WINNT && !GCC
$(MKSHLIB) $(OBJS) $(RES) $(LDFLAGS) $(EXTRA_LIBS)
endif # WINNT && !GCC
@@ -341,6 +360,24 @@ ifdef ENABLE_STRIP
$(STRIP) $@
endif
+################################################################################
+
+ifdef MOZ_PROFILE_USE
+ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
+# When building with PGO, we have to make sure to re-link
+# in the MOZ_PROFILE_USE phase if we linked in the
+# MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
+# file in the link rule in the GENERATE phase to indicate
+# that we need a relink.
+$(SHARED_LIBRARY): pgo.relink
+
+$(PROGRAM): pgo.relink
+
+endif # WINNT && !GCC
+endif # MOZ_PROFILE_USE
+
+################################################################################
+
ifeq ($(OS_ARCH),WINNT)
$(RES): $(RESNAME)
@$(MAKE_OBJDIR)