2013-09-04 23:08:43 -07:00
|
|
|
# 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
|
|
|
|
|
2014-07-18 16:46:33 -07:00
|
|
|
# Make sure that anything that needs to be defined in moz.build wasn't
|
|
|
|
# overwritten after including rules.mk.
|
|
|
|
_eval_for_side_effects := $(CHECK_MOZBUILD_VARIABLES)
|
|
|
|
|
2013-09-19 18:44:11 -07:00
|
|
|
# The traditional model of directory traversal with make is as follows:
|
|
|
|
# make -C foo
|
|
|
|
# Entering foo
|
|
|
|
# make -C bar
|
|
|
|
# Entering foo/bar
|
|
|
|
# make -C baz
|
|
|
|
# Entering foo/baz
|
|
|
|
# make -C qux
|
|
|
|
# Entering qux
|
|
|
|
#
|
|
|
|
# Pseudo derecurse transforms the above into:
|
|
|
|
# make -C foo
|
|
|
|
# make -C foo/bar
|
|
|
|
# make -C foo/baz
|
|
|
|
# make -C qux
|
|
|
|
|
2014-07-09 22:11:52 -07:00
|
|
|
ifeq (.,$(DEPTH))
|
2013-09-19 18:44:11 -07:00
|
|
|
|
|
|
|
include root.mk
|
|
|
|
|
|
|
|
# Disable build status for mach in top directories without TIERS.
|
|
|
|
# In practice this disables it when recursing under js/src, which confuses mach.
|
|
|
|
ifndef TIERS
|
|
|
|
BUILDSTATUS =
|
|
|
|
endif
|
|
|
|
|
2014-07-28 16:58:28 -07:00
|
|
|
# Main rules (export, compile, libs and tools) call recurse_* rules.
|
2013-09-19 18:44:11 -07:00
|
|
|
# This wrapping is only really useful for build status.
|
2014-07-28 16:58:28 -07:00
|
|
|
compile libs export tools::
|
2014-03-26 18:36:25 -07:00
|
|
|
$(call BUILDSTATUS,TIER_START $@)
|
2013-09-19 18:44:11 -07:00
|
|
|
+$(MAKE) recurse_$@
|
|
|
|
$(call BUILDSTATUS,TIER_FINISH $@)
|
|
|
|
|
2014-07-28 16:58:28 -07:00
|
|
|
# Special rule that does install-manifests (cf. Makefile.in) + compile
|
|
|
|
binaries::
|
|
|
|
+$(MAKE) recurse_compile
|
|
|
|
|
2013-09-19 18:44:11 -07:00
|
|
|
# Carefully avoid $(eval) type of rule generation, which makes pymake slower
|
|
|
|
# than necessary.
|
|
|
|
# Get current tier and corresponding subtiers from the data in root.mk.
|
2014-07-28 16:58:28 -07:00
|
|
|
CURRENT_TIER := $(filter $(foreach tier,compile libs export tools,recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
|
2013-09-19 18:44:11 -07:00
|
|
|
ifneq (,$(filter-out 0 1,$(words $(CURRENT_TIER))))
|
|
|
|
$(error $(CURRENT_TIER) not supported on the same make command line)
|
|
|
|
endif
|
2013-10-01 16:53:23 -07:00
|
|
|
CURRENT_TIER := $(subst recurse_,,$(CURRENT_TIER:-deps=))
|
2013-09-19 18:44:11 -07:00
|
|
|
|
|
|
|
# The rules here are doing directory traversal, so we don't want further
|
|
|
|
# recursion to happen when running make -C subdir $tier. But some make files
|
|
|
|
# further call make -C something else, and sometimes expect recursion to
|
|
|
|
# happen in that case (see browser/metro/locales/Makefile.in for example).
|
|
|
|
# Conveniently, every invocation of make increases MAKELEVEL, so only stop
|
|
|
|
# recursion from happening at current MAKELEVEL + 1.
|
|
|
|
ifdef CURRENT_TIER
|
|
|
|
ifeq (0,$(MAKELEVEL))
|
|
|
|
export NO_RECURSE_MAKELEVEL=1
|
|
|
|
else
|
|
|
|
export NO_RECURSE_MAKELEVEL=$(word $(MAKELEVEL),2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Get all directories traversed for all subtiers in the current tier, or use
|
|
|
|
# directly the $(*_dirs) variables available in root.mk when there is no
|
|
|
|
# TIERS (like for js/src).
|
2014-07-22 21:28:54 -07:00
|
|
|
CURRENT_DIRS := $($(CURRENT_TIER)_dirs)
|
2013-09-19 18:44:11 -07:00
|
|
|
|
2014-07-24 15:14:40 -07:00
|
|
|
# Need a list of compile targets because we can't use pattern rules:
|
|
|
|
# https://savannah.gnu.org/bugs/index.php?42833
|
|
|
|
.PHONY: $(compile_targets)
|
|
|
|
$(compile_targets):
|
2014-08-06 10:58:53 -07:00
|
|
|
$(call SUBMAKE,$(@F),$(@D))
|
2014-07-24 15:14:40 -07:00
|
|
|
|
2014-09-04 01:44:01 -07:00
|
|
|
# The compile tier has different rules from other tiers.
|
|
|
|
ifneq ($(CURRENT_TIER),compile)
|
2014-07-24 15:14:40 -07:00
|
|
|
|
2013-09-19 18:44:11 -07:00
|
|
|
# Recursion rule for all directories traversed for all subtiers in the
|
|
|
|
# current tier.
|
2013-10-02 13:51:19 -07:00
|
|
|
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
|
2014-07-24 15:14:40 -07:00
|
|
|
$(call SUBMAKE,$(CURRENT_TIER),$*)
|
2013-09-19 18:44:11 -07:00
|
|
|
|
2014-07-22 21:28:54 -07:00
|
|
|
.PHONY: $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS))
|
|
|
|
|
2013-10-01 16:53:23 -07:00
|
|
|
# Dummy rules for possibly inexisting dependencies for the above tier targets
|
|
|
|
$(addsuffix /Makefile,$(CURRENT_DIRS)) $(addsuffix /backend.mk,$(CURRENT_DIRS)):
|
|
|
|
|
2014-07-28 16:55:55 -07:00
|
|
|
ifeq ($(CURRENT_TIER),export)
|
2014-07-24 15:14:40 -07:00
|
|
|
# At least build/export requires config/export for buildid, but who knows what
|
|
|
|
# else, so keep this global dependency to make config/export first for now.
|
|
|
|
$(addsuffix /$(CURRENT_TIER),$(filter-out config,$(CURRENT_DIRS))): config/$(CURRENT_TIER)
|
|
|
|
|
2013-09-19 21:30:17 -07:00
|
|
|
# The export tier requires nsinstall, which is built from config. So every
|
2014-07-24 15:14:40 -07:00
|
|
|
# subdirectory traversal needs to happen after building nsinstall in config, which
|
|
|
|
# is done with the config/host target. Note the config/host target only exists if
|
|
|
|
# nsinstall is actually built, which it is not on Windows, because we use
|
|
|
|
# nsinstall.py there.
|
|
|
|
ifneq (,$(filter config/host, $(compile_targets)))
|
|
|
|
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): config/host
|
2013-09-19 21:30:17 -07:00
|
|
|
endif
|
2014-07-24 15:14:40 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
endif # ifeq ($(CURRENT_TIER),compile)
|
2013-09-19 21:30:17 -07:00
|
|
|
|
2013-09-19 18:44:11 -07:00
|
|
|
else
|
|
|
|
|
2014-01-19 16:10:33 -08:00
|
|
|
# Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above
|
|
|
|
ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
|
2013-09-19 18:44:11 -07:00
|
|
|
|
2014-07-28 16:58:28 -07:00
|
|
|
compile libs export tools::
|
2013-09-19 18:44:11 -07:00
|
|
|
|
|
|
|
else
|
2013-09-04 23:08:43 -07:00
|
|
|
#########################
|
|
|
|
# Tier traversal handling
|
|
|
|
#########################
|
|
|
|
|
2013-09-05 17:17:59 -07:00
|
|
|
ifdef TIERS
|
|
|
|
|
2013-09-19 18:44:11 -07:00
|
|
|
libs export tools::
|
2014-03-26 18:36:25 -07:00
|
|
|
$(call BUILDSTATUS,TIER_START $@)
|
2013-09-19 18:44:11 -07:00
|
|
|
$(foreach tier,$(TIERS), $(if $(filter-out libs_precompile tools_precompile,$@_$(tier)), \
|
2014-03-26 19:16:45 -07:00
|
|
|
$(foreach dir, $(tier_$(tier)_dirs), $(call TIER_DIR_SUBMAKE,$@,$(tier),$(dir),$@))))
|
2013-09-05 17:17:59 -07:00
|
|
|
$(call BUILDSTATUS,TIER_FINISH $@)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2013-09-04 23:08:43 -07:00
|
|
|
define CREATE_SUBTIER_TRAVERSAL_RULE
|
2014-07-28 16:57:59 -07:00
|
|
|
.PHONY: $(1)
|
2013-09-04 23:08:43 -07:00
|
|
|
|
|
|
|
$(1):: $$(SUBMAKEFILES)
|
|
|
|
$$(LOOP_OVER_DIRS)
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2014-07-28 16:58:28 -07:00
|
|
|
$(foreach subtier,export libs tools,$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
|
2013-09-04 23:08:43 -07:00
|
|
|
|
2014-08-25 17:33:58 -07:00
|
|
|
ifndef TOPLEVEL_BUILD
|
|
|
|
libs:: target host
|
|
|
|
endif
|
|
|
|
|
2013-09-19 18:44:11 -07:00
|
|
|
endif # ifdef TIERS
|
|
|
|
|
2014-01-19 16:10:33 -08:00
|
|
|
endif # ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
|
2013-09-19 18:44:11 -07:00
|
|
|
|
2014-07-09 22:11:52 -07:00
|
|
|
endif # ifeq (.,$(DEPTH))
|
2013-10-02 13:51:19 -07:00
|
|
|
|
2013-11-15 20:40:53 -08:00
|
|
|
recurse:
|
|
|
|
@$(RECURSED_COMMAND)
|
|
|
|
$(LOOP_OVER_DIRS)
|
2014-09-04 01:44:01 -07:00
|
|
|
|
|
|
|
ifeq (.,$(DEPTH))
|
|
|
|
# Interdependencies for parallel export.
|
|
|
|
js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
|
|
|
|
accessible/xpcom/export: xpcom/xpidl/export
|
|
|
|
ifdef ENABLE_CLANG_PLUGIN
|
|
|
|
$(filter-out build/clang-plugin/%,$(compile_targets)): build/clang-plugin/target build/clang-plugin/tests/target
|
|
|
|
build/clang-plugin/tests/target: build/clang-plugin/target
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Interdependencies that moz.build world don't know about yet for compilation.
|
|
|
|
# Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
|
|
|
|
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
|
|
|
|
toolkit/library/target: widget/gtk/mozgtk/gtk3/target
|
|
|
|
endif
|
|
|
|
ifdef MOZ_LDAP_XPCOM
|
|
|
|
ldap/target: config/external/nss/target mozglue/build/target
|
|
|
|
toolkit/library/target: ldap/target
|
|
|
|
endif
|
|
|
|
ifndef MOZ_FOLD_LIBS
|
|
|
|
ifndef MOZ_NATIVE_SQLITE
|
|
|
|
config/external/nss/target: db/sqlite3/src/target
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
|
|
|
|
mozglue/build/target: memory/replace/dummy/target
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|