Bug 1242074 - Reorder pattern rules to placate GNU Make 3.81; r?glandium draft
authorGregory Szorc <gps@mozilla.com>
Fri, 22 Jan 2016 15:58:48 -0800
changeset 324444 d06092dde64d22be476ef1f9e0232eda87d48325
parent 324322 7104d650a97d895cbbc64d53462bf86a04658abe
child 513392 d7c6d24cbb1f733990997bac741ab5a09647fb36
push id9917
push usergszorc@mozilla.com
push dateSat, 23 Jan 2016 00:03:56 +0000
reviewersglandium
bugs1242074, 1239217
milestone46.0a1
Bug 1242074 - Reorder pattern rules to placate GNU Make 3.81; r?glandium Recent changes in bug 1239217 added the faster backend to the default build mechanism for artifact builds. This seems to have uncovered a difference in behavior between GNU Make 3.81 and newer. Starting with GNU Make 3.82, pattern rules are selected according to shortest stem. Before, they are used in definition order. So, we change the order of the pattern rules so the longest prefixes are first. This should result in the same behavior on various GNU Make implementations.
config/faster/rules.mk
--- a/config/faster/rules.mk
+++ b/config/faster/rules.mk
@@ -63,31 +63,31 @@ endif
 
 .PHONY: FORCE
 
 # Extra define to trigger some workarounds. We should strive to limit the
 # use of those. As of writing the only ones are in
 # toolkit/content/buildconfig.html and browser/locales/jar.mn.
 ACDEFINES += -DBUILD_FASTER
 
-# Generic rule to fall back to the recursive make backend
-$(TOPOBJDIR)/%: FORCE
-	$(MAKE) -C $(dir $@) $(notdir $@)
-
 # Files under the faster/ sub-directory, however, are not meant to use the
 # fallback
 $(TOPOBJDIR)/faster/%: ;
 
 # And files under dist/ are meant to be copied from their first dependency
 # if there is no other rule.
 $(TOPOBJDIR)/dist/%:
 	rm -f $@
 	mkdir -p $(@D)
 	cp $< $@
 
+# Generic rule to fall back to the recursive make backend
+$(TOPOBJDIR)/%: FORCE
+	$(MAKE) -C $(dir $@) $(notdir $@)
+
 # Install files using install manifests
 #
 # The list of base directories is given in INSTALL_MANIFESTS. The
 # corresponding install manifests are named correspondingly, with forward
 # slashes replaced with underscores, and prefixed with `install_`. That is,
 # the install manifest for `dist/bin` would be `install_dist_bin`.
 $(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(TOPOBJDIR)/config/buildid
 	@# For now, force preprocessed files to be reprocessed every time.