config/recurse.mk
author Mark Banner <bugzilla@standard8.plus.com>
Mon, 03 Feb 2014 20:15:24 +0000
changeset 16836 4d564c1d9df635e9f1a664b6a76178a0e859641c
parent 16474 f4c921623a74e0751c182a054b28935f64182d14
child 20686 f200e20f0ea9739b812204a913c82751d29c0d7c
permissions -rw-r--r--
Added tag RELEASE_BASE_20140203 for changeset 874f4107c0fd a=releasemerge ba=releasemerge DONTBUILD CLOSED TREE

# 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
#########################

ifdef TIERS

compile libs export tools::
	$(call BUILDSTATUS,TIER_START $@ $(filter-out $(if $(filter export,$@),,precompile),$(TIERS)))
	$(foreach tier,$(TIERS), $(if $(filter-out compile_precompile libs_precompile tools_precompile,$@_$(tier)), \
		$(call BUILDSTATUS,SUBTIER_START $@ $(tier) $(if $(filter libs,$@),$(tier_$(tier)_staticdirs)) $(tier_$(tier)_dirs)) \
		$(if $(filter libs,$@),$(foreach dir, $(tier_$(tier)_staticdirs), $(call TIER_DIR_SUBMAKE,$@,$(tier),$(dir),,1))) \
		$(foreach dir, $(tier_$(tier)_dirs), $(call TIER_DIR_SUBMAKE,$@,$(tier),$(dir),$@)) \
		$(call BUILDSTATUS,SUBTIER_FINISH $@ $(tier))))
	$(call BUILDSTATUS,TIER_FINISH $@)

else

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 compile libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))

compile export:: $(SUBMAKEFILES)
	$(LOOP_OVER_TOOL_DIRS)

tools:: $(SUBMAKEFILES)
	$(foreach dir,$(TOOL_DIRS),$(call SUBMAKE,libs,$(dir)))

endif