Bug 912292 - Always traverse sub-directories after executing rules in the current directory. r=gps

This commit is contained in:
Mike Hommey 2013-09-05 15:08:43 +09:00
parent 7952a1fee4
commit cb4dfb8bff
9 changed files with 82 additions and 69 deletions

View File

@ -31,7 +31,6 @@ endif
endif # IS_COMPONENT
endif # SHARED_LIBRARY
endif # !NO_DIST_INSTALL
$(LOOP_OVER_DIRS)
ifndef NO_DIST_INSTALL

37
config/recurse.mk Normal file
View File

@ -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)))

View File

@ -716,35 +716,6 @@ ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_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

View File

@ -31,7 +31,6 @@ endif
endif # IS_COMPONENT
endif # SHARED_LIBRARY
endif # !NO_DIST_INSTALL
$(LOOP_OVER_DIRS)
ifndef NO_DIST_INSTALL

37
js/src/config/recurse.mk Normal file
View File

@ -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)))

View File

@ -716,35 +716,6 @@ ifneq (,$(DIRS)$(TOOL_DIRS)$(PARALLEL_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

View File

@ -43,8 +43,6 @@ COMMON_FOOTER = """
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
"""
@ -52,6 +50,9 @@ 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)
@ -106,6 +107,8 @@ Makefile: %(input_gypfiles)s %(generator)s
$(PYTHON) %(commandline)s
@$(TOUCH) $@
endif
include $(topsrcdir)/config/recurse.mk
"""
def ensure_directory_exists(path):

View File

@ -232,9 +232,7 @@ class ConfigEnvironment(object):
# 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):

View File

@ -58,9 +58,7 @@ class TestRecursiveMakeBackend(BackendTester):
'',
'FOO := foo',
'',
'ifndef INCLUDED_RULES_MK',
'include $(topsrcdir)/config/rules.mk',
'endif',
'include $(topsrcdir)/config/recurse.mk',
])
def test_missing_makefile_in(self):
@ -71,7 +69,7 @@ class TestRecursiveMakeBackend(BackendTester):
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'))