Bug 1412932 - Move PGO logic from client.mk into root Makefile.in; r=ted

client.mk is going away. This commit moves the PGO build target out of
it.

We move the code to Makefile.in. This likely isn't its final
home, as we'll want to eliminate Makefile.in at some point. However,
it is easier to move things to the root Makefile.in than other
alternatives. Keep in mind that the logic needs access to primitives
like BUILDSTATUS and variables from mk_add_options, which the
Makefile.in mechanism has easy access to.

MozReview-Commit-ID: 4C43lBhZz4l

--HG--
extra : rebase_source : 0ff1e95dcf8cb0082b019713db0cb7f47f0bccb8
extra : source : 0d2083b8edc43fc13c77f71199e0fcaddb32fcfb
This commit is contained in:
Gregory Szorc 2017-11-07 15:08:11 -08:00
parent 44d013856d
commit 67864be6bd
2 changed files with 23 additions and 27 deletions

View File

@ -222,6 +222,26 @@ endif
default all::
$(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
# PGO build target.
profiledbuild::
$(call BUILDSTATUS,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use)
$(call BUILDSTATUS,TIER_START pgo_profile_generate)
$(MAKE) MOZ_PROFILE_GENERATE=1 MOZ_PGO_INSTRUMENTED=1
$(call BUILDSTATUS,TIER_FINISH pgo_profile_generate)
$(call BUILDSTATUS,TIER_START pgo_package)
$(MAKE) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
rm -f jarlog/en-US.log
$(call BUILDSTATUS,TIER_FINISH pgo_package)
$(call BUILDSTATUS,TIER_START pgo_profile)
MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log EXTRA_TEST_ARGS=10 $(MAKE) pgo-profile-run
$(call BUILDSTATUS,TIER_FINISH pgo_profile)
$(call BUILDSTATUS,TIER_START pgo_clobber)
$(MAKE) maybe_clobber_profiledbuild
$(call BUILDSTATUS,TIER_FINISH pgo_clobber)
$(call BUILDSTATUS,TIER_START pgo_profile_use)
$(MAKE) MOZ_PROFILE_USE=1
$(call BUILDSTATUS,TIER_FINISH pgo_profile_use)
include $(topsrcdir)/config/rules.mk
ifdef SCCACHE_VERBOSE_STATS

View File

@ -139,7 +139,7 @@ OBJDIR_TARGETS = install export libs clean realclean distclean upload sdk instal
# The default rule is build
build::
$(MAKE) -f $(TOPSRCDIR)/client.mk $(if $(MOZ_PGO),profiledbuild,realbuild) CREATE_MOZCONFIG_JSON=
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild CREATE_MOZCONFIG_JSON=
# Include baseconfig.mk for its $(MAKE) validation.
include $(TOPSRCDIR)/config/baseconfig.mk
@ -173,29 +173,6 @@ clobber clobber_all: clean
# helper target for mobile
build_and_deploy: build package install
####################################
# Profile-Guided Optimization
# This is up here so that this is usable in multi-pass builds, where you
# might not have a runnable application until all the build passes have run.
profiledbuild::
$(call BUILDSTATUS,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use)
$(call BUILDSTATUS,TIER_START pgo_profile_generate)
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1 MOZ_PGO_INSTRUMENTED=1 CREATE_MOZCONFIG_JSON=
$(call BUILDSTATUS,TIER_FINISH pgo_profile_generate)
$(call BUILDSTATUS,TIER_START pgo_package)
$(MAKE) -C $(OBJDIR) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
rm -f $(OBJDIR)/jarlog/en-US.log
$(call BUILDSTATUS,TIER_FINISH pgo_package)
$(call BUILDSTATUS,TIER_START pgo_profile)
MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log EXTRA_TEST_ARGS=10 $(MAKE) -C $(OBJDIR) pgo-profile-run
$(call BUILDSTATUS,TIER_FINISH pgo_profile)
$(call BUILDSTATUS,TIER_START pgo_clobber)
$(MAKE) -C $(OBJDIR) maybe_clobber_profiledbuild
$(call BUILDSTATUS,TIER_FINISH pgo_clobber)
$(call BUILDSTATUS,TIER_START pgo_profile_use)
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1 CREATE_MOZCONFIG_JSON=
$(call BUILDSTATUS,TIER_FINISH pgo_profile_use)
#####################################################
# Preflight, before building any project
@ -314,7 +291,7 @@ endif
# Build it
realbuild:: $(OBJDIR)/Makefile $(OBJDIR)/config.status
+$(MOZ_MAKE)
+$(MOZ_MAKE) $(if $(MOZ_PGO),profiledbuild)
####################################
# Other targets
@ -327,7 +304,7 @@ $(OBJDIR_TARGETS):: $(OBJDIR)/Makefile $(OBJDIR)/config.status
# Postflight, after building all projects
ifdef MOZ_AUTOMATION
$(if $(MOZ_PGO),profiledbuild,realbuild)::
realbuild::
$(MAKE) -f $(TOPSRCDIR)/client.mk automation/build
endif
@ -350,7 +327,6 @@ echo-variable-%:
.PHONY: \
realbuild \
build \
profiledbuild \
build_all \
clobber \
clobber_all \