Bug 1320194 - Use 'wildcard' instead of dummy rules when re-generating build backends, r?glandium
Looking into the config.status path some more, the reason we always rebuild when it is not present is because of the way I implemented missing files in
bug 1242663. However, I think an alternate solution there would be to use $(wildcard) instead of creating dummy rules on every file. so if our dependency file contains:
config.status
foo
bar
The current rules do:
backend.TestManifestBackend: config.status foo bar
re-create backend
config.status foo bar:
Since config.status is missing, make runs the empty rule to try to create it (which does nothing), but that triggers the backend.TestManifestBackend rule. With wildcard this would look like:
backend.TestManifestBackend: $(wildcard config.status foo bar)
re-create backend
Which means make only checks dependencies on the files that actually exist (presumably foo and bar in this case, but not config.status). But when config.status is later created, we'll know to recreate the TestManifestBackend then.
MozReview-Commit-ID: 6NTTmsnxTeT
--- a/build/rebuild-backend.mk
+++ b/build/rebuild-backend.mk
@@ -20,14 +20,12 @@ BACKEND_GENERATION_SCRIPT ?= config.stat
# would only execute the command once.
#
# Credit where due: http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file/3077254#3077254
$(subst .,%,$(BUILD_BACKEND_FILES)):
@echo 'Build configuration changed. Regenerating backend.'
$(PYTHON) $(BACKEND_GENERATION_SCRIPT)
define build_backend_rule
-$(1)_files := $$(shell cat $(1).in)
-$(1): $$($(1)_files)
-$$($(1)_files):
+$(1): $$(wildcard $$(shell cat $(1).in))
endef
$(foreach file,$(BUILD_BACKEND_FILES),$(eval $(call build_backend_rule,$(file))))