Bug 912292 - Always traverse sub-directories after executing rules in the current directory. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 05 Sep 2013 15:08:43 +0900
changeset 158626 0413092be43dfdd5649f715db88e6226460257bf
parent 158625 fc9fb405796e0e17a4734ae633c434abe0e7f7f3
child 158627 ca1ed4b9940ce02ea0d64400360569fe2900dccd
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs912292
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 912292 - Always traverse sub-directories after executing rules in the current directory. r=gps
config/makefiles/target_libs.mk
config/recurse.mk
config/rules.mk
js/src/config/makefiles/target_libs.mk
js/src/config/recurse.mk
js/src/config/rules.mk
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
python/mozbuild/mozbuild/backend/configenvironment.py
python/mozbuild/mozbuild/test/backend/test_recursivemake.py
--- a/config/makefiles/target_libs.mk
+++ b/config/makefiles/target_libs.mk
@@ -26,17 +26,16 @@ ifdef IS_COMPONENT
 	$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
 ifndef NO_COMPONENTS_MANIFEST
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
 endif
 endif # IS_COMPONENT
 endif # SHARED_LIBRARY
 endif # !NO_DIST_INSTALL
-	$(LOOP_OVER_DIRS)
 
 ifndef NO_DIST_INSTALL
 
 ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
 PROGRAMS_EXECUTABLES = $(SIMPLE_PROGRAMS) $(PROGRAM)
 PROGRAMS_DEST ?= $(FINAL_TARGET)
 INSTALL_TARGETS += PROGRAMS
 endif
new file mode 100644
--- /dev/null
+++ b/config/recurse.mk
@@ -0,0 +1,37 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ifndef INCLUDED_RULES_MK
+include $(topsrcdir)/config/rules.mk
+endif
+
+#########################
+# Tier traversal handling
+#########################
+
+define CREATE_SUBTIER_TRAVERSAL_RULE
+PARALLEL_DIRS_$(1) = $$(addsuffix _$(1),$$(PARALLEL_DIRS))
+
+.PHONY: $(1) $$(PARALLEL_DIRS_$(1))
+
+ifdef PARALLEL_DIRS
+$$(PARALLEL_DIRS_$(1)): %_$(1): %/Makefile
+	+@$$(call SUBMAKE,$(1),$$*)
+endif
+
+$(1):: $$(SUBMAKEFILES)
+ifdef PARALLEL_DIRS
+	+@$(MAKE) $$(PARALLEL_DIRS_$(1))
+endif
+	$$(LOOP_OVER_DIRS)
+
+endef
+
+$(foreach subtier,export libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
+
+export:: $(SUBMAKEFILES)
+	$(LOOP_OVER_TOOL_DIRS)
+
+tools:: $(SUBMAKEFILES)
+	$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -711,45 +711,16 @@ everything::
 # Target to only regenerate makefiles
 makefiles: $(SUBMAKEFILES)
 ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
 	$(LOOP_OVER_PARALLEL_DIRS)
 	$(LOOP_OVER_DIRS)
 	$(LOOP_OVER_TOOL_DIRS)
 endif
 
-#########################
-# Tier traversal handling
-#########################
-define CREATE_SUBTIER_TRAVERSAL_RULE
-PARALLEL_DIRS_$(1) = $$(addsuffix _$(1),$$(PARALLEL_DIRS))
-
-.PHONY: $(1) $$(PARALLEL_DIRS_$(1))
-
-ifdef PARALLEL_DIRS
-$(1):: $$(PARALLEL_DIRS_$(1))
-
-$$(PARALLEL_DIRS_$(1)): %_$(1): %/Makefile
-	+@$$(call SUBMAKE,$(1),$$*)
-endif
-
-endef
-
-$(foreach subtier,export libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
-
-export:: $(SUBMAKEFILES)
-	$(LOOP_OVER_DIRS)
-	$(LOOP_OVER_TOOL_DIRS)
-
-
-tools:: $(SUBMAKEFILES)
-	$(LOOP_OVER_DIRS)
-	$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
-
-
 ifneq (,$(filter-out %.$(LIB_SUFFIX),$(SHARED_LIBRARY_LIBS)))
 $(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only)
 endif
 
 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
 
 # Dependencies which, if modified, should cause everything to rebuild
 GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
--- a/js/src/config/makefiles/target_libs.mk
+++ b/js/src/config/makefiles/target_libs.mk
@@ -26,17 +26,16 @@ ifdef IS_COMPONENT
 	$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
 ifndef NO_COMPONENTS_MANIFEST
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
 	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
 endif
 endif # IS_COMPONENT
 endif # SHARED_LIBRARY
 endif # !NO_DIST_INSTALL
-	$(LOOP_OVER_DIRS)
 
 ifndef NO_DIST_INSTALL
 
 ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
 PROGRAMS_EXECUTABLES = $(SIMPLE_PROGRAMS) $(PROGRAM)
 PROGRAMS_DEST ?= $(FINAL_TARGET)
 INSTALL_TARGETS += PROGRAMS
 endif
new file mode 100644
--- /dev/null
+++ b/js/src/config/recurse.mk
@@ -0,0 +1,37 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ifndef INCLUDED_RULES_MK
+include $(topsrcdir)/config/rules.mk
+endif
+
+#########################
+# Tier traversal handling
+#########################
+
+define CREATE_SUBTIER_TRAVERSAL_RULE
+PARALLEL_DIRS_$(1) = $$(addsuffix _$(1),$$(PARALLEL_DIRS))
+
+.PHONY: $(1) $$(PARALLEL_DIRS_$(1))
+
+ifdef PARALLEL_DIRS
+$$(PARALLEL_DIRS_$(1)): %_$(1): %/Makefile
+	+@$$(call SUBMAKE,$(1),$$*)
+endif
+
+$(1):: $$(SUBMAKEFILES)
+ifdef PARALLEL_DIRS
+	+@$(MAKE) $$(PARALLEL_DIRS_$(1))
+endif
+	$$(LOOP_OVER_DIRS)
+
+endef
+
+$(foreach subtier,export libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
+
+export:: $(SUBMAKEFILES)
+	$(LOOP_OVER_TOOL_DIRS)
+
+tools:: $(SUBMAKEFILES)
+	$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -711,45 +711,16 @@ everything::
 # Target to only regenerate makefiles
 makefiles: $(SUBMAKEFILES)
 ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_DIRS))
 	$(LOOP_OVER_PARALLEL_DIRS)
 	$(LOOP_OVER_DIRS)
 	$(LOOP_OVER_TOOL_DIRS)
 endif
 
-#########################
-# Tier traversal handling
-#########################
-define CREATE_SUBTIER_TRAVERSAL_RULE
-PARALLEL_DIRS_$(1) = $$(addsuffix _$(1),$$(PARALLEL_DIRS))
-
-.PHONY: $(1) $$(PARALLEL_DIRS_$(1))
-
-ifdef PARALLEL_DIRS
-$(1):: $$(PARALLEL_DIRS_$(1))
-
-$$(PARALLEL_DIRS_$(1)): %_$(1): %/Makefile
-	+@$$(call SUBMAKE,$(1),$$*)
-endif
-
-endef
-
-$(foreach subtier,export libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
-
-export:: $(SUBMAKEFILES)
-	$(LOOP_OVER_DIRS)
-	$(LOOP_OVER_TOOL_DIRS)
-
-
-tools:: $(SUBMAKEFILES)
-	$(LOOP_OVER_DIRS)
-	$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))
-
-
 ifneq (,$(filter-out %.$(LIB_SUFFIX),$(SHARED_LIBRARY_LIBS)))
 $(error SHARED_LIBRARY_LIBS must contain .$(LIB_SUFFIX) files only)
 endif
 
 HOST_LIBS_DEPS = $(filter %.$(LIB_SUFFIX),$(HOST_LIBS))
 
 # Dependencies which, if modified, should cause everything to rebuild
 GLOBAL_DEPS += Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk
--- a/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
+++ b/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
@@ -38,25 +38,26 @@ EXTERNALLY_MANAGED_MAKE_FILE := 1
 
 """
 
 COMMON_FOOTER = """
 # Skip rules that deal with regenerating Makefiles from Makefile.in files.
 NO_MAKEFILE_RULE = 1
 NO_SUBMAKEFILES_RULE = 1
 
-include $(topsrcdir)/config/rules.mk
-include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include %(common_mk_path)s
 """
 
 COMMON_MK = """# This file was generated by mozmake.py. Do not edit it directly.
 ifndef COMMON_MK_INCLUDED
 COMMON_MK_INCLUDED := 1
 
+include $(topsrcdir)/config/rules.mk
+include $(topsrcdir)/ipc/chromium/chromium-config.mk
+
 ifdef MOZ_DEBUG
 CFLAGS += $(CPPFLAGS_Debug) $(CFLAGS_Debug)
 CXXFLAGS += $(CPPFLAGS_Debug) $(CXXFLAGS_Debug)
 DEFINES += $(DEFINES_Debug)
 LOCAL_INCLUDES += $(INCLUDES_Debug)
 ASFLAGS += $(ASFLAGS_Debug)
 else # non-MOZ_DEBUG
 CFLAGS += $(CPPFLAGS_Release) $(CFLAGS_Release)
@@ -101,16 +102,18 @@ GARBAGE += $(notdir $(COPY_SRCS))
 $(foreach s,$(COPY_SRCS), $(eval $(call COPY_SRC,$(s))))
 endif
 
 # Rules for regenerating Makefiles from GYP files.
 Makefile: %(input_gypfiles)s %(generator)s
 	$(PYTHON) %(commandline)s
 	@$(TOUCH) $@
 endif
+
+include $(topsrcdir)/config/recurse.mk
 """
 
 def ensure_directory_exists(path):
   dir = os.path.dirname(path)
   if dir and not os.path.exists(dir):
     os.makedirs(dir)
 
 def GetFlavor(params):
--- a/python/mozbuild/mozbuild/backend/configenvironment.py
+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
@@ -227,19 +227,17 @@ class ConfigEnvironment(object):
         pp.handleLine('VPATH := @srcdir@\n')
         pp.handleLine('relativesrcdir := @relativesrcdir@\n')
         pp.handleLine('include $(DEPTH)/config/autoconf.mk\n')
         if not stub:
             pp.do_include(self.get_input(path))
         # Empty line to avoid failures when last line in Makefile.in ends
         # with a backslash.
         pp.handleLine('\n')
-        pp.handleLine('ifndef INCLUDED_RULES_MK\n')
-        pp.handleLine('include $(topsrcdir)/config/rules.mk\n')
-        pp.handleLine('endif\n')
+        pp.handleLine('include $(topsrcdir)/config/recurse.mk\n')
         return pp.out.close()
 
     def _get_preprocessor(self, path, extra):
         '''Returns a preprocessor for use by create_config_file and
         create_makefile.
         '''
         pp = Preprocessor()
         pp.context.update(self.substs)
--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
@@ -53,30 +53,28 @@ class TestRecursiveMakeBackend(BackendTe
             'topsrcdir := %s' % env.topsrcdir,
             'srcdir := %s' % env.topsrcdir,
             'VPATH := %s' % env.topsrcdir,
             'relativesrcdir := .',
             'include $(DEPTH)/config/autoconf.mk',
             '',
             'FOO := foo',
             '',
-            'ifndef INCLUDED_RULES_MK',
-            'include $(topsrcdir)/config/rules.mk',
-            'endif',
+            'include $(topsrcdir)/config/recurse.mk',
         ])
 
     def test_missing_makefile_in(self):
         """Ensure missing Makefile.in results in Makefile creation."""
         env = self._consume('stub0', RecursiveMakeBackend)
 
         p = os.path.join(env.topobjdir, 'dir2', 'Makefile')
         self.assertTrue(os.path.exists(p))
 
         lines = [l.strip() for l in open(p, 'rt').readlines()]
-        self.assertEqual(len(lines), 11)
+        self.assertEqual(len(lines), 9)
 
         self.assertTrue(lines[0].startswith('# THIS FILE WAS AUTOMATICALLY'))
 
     def test_backend_mk(self):
         """Ensure backend.mk file is written out properly."""
         env = self._consume('stub0', RecursiveMakeBackend)
 
         p = os.path.join(env.topobjdir, 'backend.mk')