Bug 448515 - Instill client.mk what profiledbuild means on comm-central; Copy the missing parts from m-c to c-c (updated to latest trunk).
authorNomis101 <Nomis101@web.de>
Sat, 13 Mar 2010 02:51:35 +0100
changeset 5166 34948b9a20168026f9207a778dc6454704032f5b
parent 5165 5f560aa814de4baa42a2da4c0f47ce2c5df3de79
child 5167 eca0ae9a63220940f6ef4b987b922f8fd4b8de25
push idunknown
push userunknown
push dateunknown
bugs448515
Bug 448515 - Instill client.mk what profiledbuild means on comm-central; Copy the missing parts from m-c to c-c (updated to latest trunk). r=Callek.
client.mk
--- a/client.mk
+++ b/client.mk
@@ -184,16 +184,39 @@ all build clean depend distclean export 
 build_all: build
 build_all_dep: alldep
 build_all_depend: alldep
 clobber clobber_all: clean
 
 # Do everything from scratch
 everything: clean build
 
+####################################
+# Profile-Guided Optimization
+#  To use this, you should set the following variables in your mozconfig
+#    mk_add_options PROFILE_GEN_SCRIPT=/path/to/profile-script
+#
+#  The profile script should exercise the functionality to be included
+#  in the profile feedback.
+#
+#  This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this
+#  is usable in multi-pass builds, where you might not have a runnable
+#  application until all the build passes and postflight scripts have run.
+ifdef MOZ_OBJDIR
+  PGO_OBJDIR = $(MOZ_OBJDIR)
+else
+  PGO_OBJDIR := $(TOPSRCDIR)
+endif
+
+profiledbuild::
+	$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_GENERATE=1
+	OBJDIR=${PGO_OBJDIR} $(PROFILE_GEN_SCRIPT)
+	$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
+	$(MAKE) -f $(TOPSRCDIR)/client.mk build MOZ_PROFILE_USE=1
+
 #####################################################
 # Build date unification
 
 ifdef MOZ_UNIFY_BDATE
 ifndef MOZ_BUILD_DATE
 ifdef MOZ_BUILD_PROJECTS
 MOZ_BUILD_DATE = $(shell $(PYTHON) $(TOPSRCDIR)/mozilla/toolkit/xre/make-platformini.py --print-buildid)
 export MOZ_BUILD_DATE
@@ -323,17 +346,17 @@ endif
 
 build::  $(OBJDIR)/Makefile $(OBJDIR)/config.status
 	$(MOZ_MAKE)
 
 ####################################
 # Other targets
 
 # Pass these target onto the real build system
-install export libs clean realclean distclean alldep:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
+install export libs clean realclean distclean alldep maybe_clobber_profiledbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
 	$(MOZ_MAKE) $@
 
 ####################################
 # Postflight
 
 build alldep postflight::
 ifdef MOZ_POSTFLIGHT
 	set -e; \
@@ -382,9 +405,9 @@ cleansrcdir:
 echo-variable-%:
 	@echo $($*)
 
 # This makefile doesn't support parallel execution. It does pass
 # MOZ_MAKE_FLAGS to sub-make processes, so they will correctly execute
 # in parallel.
 .NOTPARALLEL:
 
-.PHONY: checkout real_checkout depend build export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all
+.PHONY: checkout real_checkout depend build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all
\ No newline at end of file