From cc280619c401b9126920eacf6ec21b565cce7429 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 27 Oct 2023 00:01:35 +0000 Subject: [PATCH] Bug 1861288 - Improve coverage of the pre-export and export phases in profiles. r=firefox-build-system-reviewers,ahochheiden At the top-level, what we currently have is something akin to: export: some deps echo BUILDSTATUS TIER_START export make recurse_export ... In practice, what this means is that `some` and `deps` are built outside the export tier/phase. Since recurse_export is itself a recipe with dependencies, we can "just" move `some` and `deps` to become dependencies of recurse_export instead. But since in non top-level directories, recurse_export is not a thing, we still need to keep the dependencies on export there. Unfortunately, we have one instance of something built during recurse_export that relied on its undeclared/undeclarable dependencies being built before recurse_export, so we need to accomodate for that. Also, for some reason, recurse_pre-export was a two-colons recipe, while the other recurse_* recipes were single-colon, so fix that. Come to think of it, the same probably applies to misc and libs, which this would mechanically fix alongside. Incidentally, this also makes those things that ran before recurse_* run in parallel of the other things that run during recurse_*. Differential Revision: https://phabricator.services.mozilla.com/D191913 --- Makefile.in | 6 ++++-- config/config.mk | 2 +- config/recurse.mk | 4 ++-- config/rules.mk | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile.in b/Makefile.in index 731095d26170a..090978f5ff543 100644 --- a/Makefile.in +++ b/Makefile.in @@ -28,6 +28,8 @@ $(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub: FORCE endif source-repo.h: $(MDDEPDIR)/source-repo.h.stub buildid.h: $(MDDEPDIR)/buildid.h.stub +# Add explicit dependencies that moz.build can't declare yet. +build/$(MDDEPDIR)/application.ini.stub: source-repo.h buildid.h BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS))) @@ -98,11 +100,11 @@ install-test-files: include $(topsrcdir)/build/moz-automation.mk # Dummy rule for the cases below where we don't depend on dist/include -recurse_pre-export:: +recurse_pre-export: # For the binaries rule, not all the install manifests matter, so force only # the interesting ones to be done. -recurse_pre-export:: install-manifests +recurse_pre-export: install-manifests binaries:: @$(MAKE) install-manifests install_manifests=dist/include diff --git a/config/config.mk b/config/config.mk index 1cbdf01042d80..ab3085bee947d 100644 --- a/config/config.mk +++ b/config/config.mk @@ -44,7 +44,7 @@ include backend.mk # Add e.g. `export:: $(EXPORT_TARGETS)` rules. The *_TARGETS variables are defined # in backend.mk. -$(foreach tier,$(RUNNABLE_TIERS),$(eval $(tier):: $($(call varize,$(tier))_TARGETS))) +$(foreach tier,$(RUNNABLE_TIERS),$(eval $(if $(filter .,$(DEPTH)),recurse_$(tier):,$(tier)::) $($(call varize,$(tier))_TARGETS))) endif endif diff --git a/config/recurse.mk b/config/recurse.mk index f3a8759303fd9..df313afe5b143 100644 --- a/config/recurse.mk +++ b/config/recurse.mk @@ -159,7 +159,7 @@ ifeq (.,$(DEPTH)) # This is required so that the pre-export tier sees the rules in # mobile/android ifeq ($(MOZ_WIDGET_TOOLKIT),android) -recurse_pre-export:: mobile/android/pre-export +recurse_pre-export: mobile/android/pre-export endif # CSS2Properties.webidl needs ServoCSSPropList.py from layout/style @@ -234,7 +234,7 @@ $(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/host: confi # that run cbindgen, tricking Make into keeping them early. $(rust_targets): $(DEPTH)/.cargo/config ifndef TEST_MOZBUILD -pre-export:: $(DEPTH)/.cargo/config +recurse_pre-export: $(DEPTH)/.cargo/config endif # When building gtest as part of the build (LINK_GTEST_DURING_COMPILE), diff --git a/config/rules.mk b/config/rules.mk index 7ee5416c7966a..f8522fe667ece 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -1000,7 +1000,7 @@ $(foreach category,$(INSTALL_TARGETS),\ ) $(foreach tier,$(INSTALL_TARGETS_TIERS), \ - $(eval $(tier):: $(INSTALL_TARGETS_FILES_$(tier)) $(INSTALL_TARGETS_EXECUTABLES_$(tier))) \ + $(eval $(if $(filter .,$(DEPTH)),recurse_$(tier):,$(tier)::) $(INSTALL_TARGETS_FILES_$(tier)) $(INSTALL_TARGETS_EXECUTABLES_$(tier))) \ ) install_targets_sanity = $(if $(filter-out $(notdir $@),$(notdir $(<))),$(error Looks like $@ has an unexpected dependency on $< which breaks INSTALL_TARGETS)) @@ -1070,7 +1070,7 @@ $(foreach category,$(PP_TARGETS), \ ) $(foreach tier,$(PP_TARGETS_TIERS), \ - $(eval $(tier):: $(PP_TARGETS_RESULTS_$(tier))) \ + $(eval $(if $(filter .,$(DEPTH)),recurse_$(tier):,$(tier)::) $(PP_TARGETS_RESULTS_$(tier))) \ ) PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS_RESULTS_$(tier))))