2013-09-05 06:08:43 +00: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
|
|
|
|
|
2013-09-20 01:44:11 +00: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-10 05:11:52 +00:00
|
|
|
ifeq (.,$(DEPTH))
|
2013-09-20 01:44:11 +00:00
|
|
|
|
|
|
|
include root.mk
|
|
|
|
|
2014-07-28 23:58:28 +00:00
|
|
|
# Main rules (export, compile, libs and tools) call recurse_* rules.
|
2013-09-20 01:44:11 +00:00
|
|
|
# This wrapping is only really useful for build status.
|
2014-11-06 00:29:11 +00:00
|
|
|
$(TIERS)::
|
2018-06-01 04:08:18 +00:00
|
|
|
$(if $(filter $@,$(MAKECMDGOALS)),$(call BUILDSTATUS,TIERS $@),)
|
2014-03-27 01:36:25 +00:00
|
|
|
$(call BUILDSTATUS,TIER_START $@)
|
2013-09-20 01:44:11 +00:00
|
|
|
+$(MAKE) recurse_$@
|
|
|
|
$(call BUILDSTATUS,TIER_FINISH $@)
|
|
|
|
|
2014-07-28 23:58:28 +00:00
|
|
|
# Special rule that does install-manifests (cf. Makefile.in) + compile
|
|
|
|
binaries::
|
|
|
|
+$(MAKE) recurse_compile
|
|
|
|
|
2013-09-20 01:44:11 +00: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.
|
2018-08-10 19:07:29 +00:00
|
|
|
CURRENT_TIER := $(filter $(foreach tier,$(TIERS) $(non_default_tiers),recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
|
2013-09-20 01:44:11 +00:00
|
|
|
ifneq (,$(filter-out 0 1,$(words $(CURRENT_TIER))))
|
|
|
|
$(error $(CURRENT_TIER) not supported on the same make command line)
|
|
|
|
endif
|
2013-10-01 23:53:23 +00:00
|
|
|
CURRENT_TIER := $(subst recurse_,,$(CURRENT_TIER:-deps=))
|
2013-09-20 01:44:11 +00: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
|
2015-04-23 19:10:30 +00:00
|
|
|
# happen in that case.
|
2013-09-20 01:44:11 +00:00
|
|
|
# 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
|
|
|
|
|
2017-04-04 05:02:45 +00:00
|
|
|
RECURSE = $(if $(RECURSE_TRACE_ONLY),@echo $2/$1,$(call SUBMAKE,$1,$2))
|
|
|
|
|
2014-10-02 00:14:07 +00:00
|
|
|
# Use the $(*_dirs) variables available in root.mk
|
2014-07-23 04:28:54 +00:00
|
|
|
CURRENT_DIRS := $($(CURRENT_TIER)_dirs)
|
2013-09-20 01:44:11 +00:00
|
|
|
|
2014-07-24 22:14:40 +00:00
|
|
|
# Need a list of compile targets because we can't use pattern rules:
|
|
|
|
# https://savannah.gnu.org/bugs/index.php?42833
|
2015-05-26 08:38:15 +00:00
|
|
|
# Only recurse the paths starting with RECURSE_BASE_DIR when provided.
|
2017-04-10 17:27:49 +00:00
|
|
|
.PHONY: $(compile_targets) $(syms_targets)
|
|
|
|
$(compile_targets) $(syms_targets):
|
2017-04-04 05:02:45 +00:00
|
|
|
$(if $(filter $(RECURSE_BASE_DIR)%,$@),$(call RECURSE,$(@F),$(@D)))
|
2014-07-24 22:14:40 +00:00
|
|
|
|
2017-04-10 17:27:49 +00:00
|
|
|
$(syms_targets): %/syms: %/target
|
|
|
|
|
|
|
|
# Only hook symbols targets into the main compile graph in automation.
|
|
|
|
ifdef MOZ_AUTOMATION
|
2018-03-26 21:07:30 +00:00
|
|
|
ifeq (1,$(MOZ_AUTOMATION_BUILD_SYMBOLS))
|
2017-04-10 17:27:49 +00:00
|
|
|
recurse_compile: $(syms_targets)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Create a separate rule that depends on every 'syms' target so that
|
|
|
|
# symbols can be dumped on demand locally.
|
|
|
|
.PHONY: recurse_syms
|
|
|
|
recurse_syms: $(syms_targets)
|
|
|
|
|
2017-04-10 17:27:49 +00:00
|
|
|
# Ensure dump_syms gets built before any syms targets, all of which depend on it.
|
|
|
|
ifneq (,$(filter toolkit/crashreporter/google-breakpad/src/tools/%/dump_syms/host,$(compile_targets)))
|
|
|
|
$(syms_targets): $(filter toolkit/crashreporter/google-breakpad/src/tools/%/dump_syms/host,$(compile_targets))
|
|
|
|
endif
|
|
|
|
|
2014-09-04 08:44:01 +00:00
|
|
|
# The compile tier has different rules from other tiers.
|
|
|
|
ifneq ($(CURRENT_TIER),compile)
|
2014-07-24 22:14:40 +00:00
|
|
|
|
2013-09-20 01:44:11 +00:00
|
|
|
# Recursion rule for all directories traversed for all subtiers in the
|
|
|
|
# current tier.
|
2013-10-02 20:51:19 +00:00
|
|
|
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
|
2017-04-04 05:02:45 +00:00
|
|
|
$(call RECURSE,$(CURRENT_TIER),$*)
|
2013-09-20 01:44:11 +00:00
|
|
|
|
2014-07-23 04:28:54 +00:00
|
|
|
.PHONY: $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS))
|
|
|
|
|
2013-10-01 23:53:23 +00:00
|
|
|
# Dummy rules for possibly inexisting dependencies for the above tier targets
|
|
|
|
$(addsuffix /Makefile,$(CURRENT_DIRS)) $(addsuffix /backend.mk,$(CURRENT_DIRS)):
|
|
|
|
|
2014-07-28 23:55:55 +00:00
|
|
|
ifeq ($(CURRENT_TIER),export)
|
2014-07-24 22:14:40 +00: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-20 04:30:17 +00:00
|
|
|
# The export tier requires nsinstall, which is built from config. So every
|
2014-07-24 22:14:40 +00: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.
|
2015-03-10 06:16:51 +00:00
|
|
|
ifdef COMPILE_ENVIRONMENT
|
2014-07-24 22:14:40 +00:00
|
|
|
ifneq (,$(filter config/host, $(compile_targets)))
|
|
|
|
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): config/host
|
2013-09-20 04:30:17 +00:00
|
|
|
endif
|
2014-07-24 22:14:40 +00:00
|
|
|
endif
|
2015-03-10 06:16:51 +00:00
|
|
|
endif
|
2014-07-24 22:14:40 +00:00
|
|
|
|
|
|
|
endif # ifeq ($(CURRENT_TIER),compile)
|
2013-09-20 04:30:17 +00:00
|
|
|
|
2013-09-20 01:44:11 +00:00
|
|
|
else
|
|
|
|
|
2014-01-20 00:10:33 +00:00
|
|
|
# Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above
|
|
|
|
ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
|
2013-09-20 01:44:11 +00:00
|
|
|
|
2014-11-06 00:29:11 +00:00
|
|
|
$(TIERS)::
|
2013-09-20 01:44:11 +00:00
|
|
|
|
|
|
|
else
|
2013-09-05 06:08:43 +00:00
|
|
|
#########################
|
|
|
|
# Tier traversal handling
|
|
|
|
#########################
|
|
|
|
|
|
|
|
define CREATE_SUBTIER_TRAVERSAL_RULE
|
2014-07-28 23:57:59 +00:00
|
|
|
.PHONY: $(1)
|
2013-09-05 06:08:43 +00:00
|
|
|
|
|
|
|
$(1):: $$(SUBMAKEFILES)
|
|
|
|
$$(LOOP_OVER_DIRS)
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2014-11-06 00:29:11 +00:00
|
|
|
$(foreach subtier,$(filter-out compile,$(TIERS)),$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
|
2013-09-05 06:08:43 +00:00
|
|
|
|
2014-08-26 00:33:58 +00:00
|
|
|
ifndef TOPLEVEL_BUILD
|
2015-04-27 21:55:34 +00:00
|
|
|
ifdef COMPILE_ENVIRONMENT
|
2015-05-26 08:38:15 +00:00
|
|
|
compile::
|
|
|
|
@$(MAKE) -C $(DEPTH) compile RECURSE_BASE_DIR=$(relativesrcdir)/
|
2015-04-27 21:55:34 +00:00
|
|
|
endif # COMPILE_ENVIRONMENT
|
2014-08-26 00:33:58 +00:00
|
|
|
endif
|
|
|
|
|
2014-01-20 00:10:33 +00:00
|
|
|
endif # ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
|
2013-09-20 01:44:11 +00:00
|
|
|
|
2014-07-10 05:11:52 +00:00
|
|
|
endif # ifeq (.,$(DEPTH))
|
2013-10-02 20:51:19 +00:00
|
|
|
|
2013-11-16 04:40:53 +00:00
|
|
|
recurse:
|
|
|
|
@$(RECURSED_COMMAND)
|
|
|
|
$(LOOP_OVER_DIRS)
|
2014-09-04 08:44:01 +00:00
|
|
|
|
|
|
|
ifeq (.,$(DEPTH))
|
|
|
|
# Interdependencies for parallel export.
|
|
|
|
js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
|
|
|
|
accessible/xpcom/export: xpcom/xpidl/export
|
2014-11-13 18:47:23 +00:00
|
|
|
|
2018-03-07 03:19:48 +00:00
|
|
|
# The Android SDK bindings needs to build the Java generator code
|
|
|
|
# source code in order to write the SDK bindings.
|
|
|
|
widget/android/bindings/export: mobile/android/base/export
|
|
|
|
|
2018-03-07 04:09:37 +00:00
|
|
|
# The widget JNI wrapper generator code needs to build the GeckoView
|
|
|
|
# and Fennec source code in order to find JNI wrapper annotations.
|
|
|
|
widget/android/fennec/export: mobile/android/base/export
|
|
|
|
widget/android/export: mobile/android/base/export
|
|
|
|
|
2016-08-09 20:58:18 +00:00
|
|
|
# .xpt generation needs the xpidl lex/yacc files
|
|
|
|
xpcom/xpidl/export: xpcom/idl-parser/xpidl/export
|
|
|
|
|
2018-04-17 04:40:12 +00:00
|
|
|
# CSS2Properties.webidl needs ServoCSSPropList.py from layout/style
|
|
|
|
dom/bindings/export: layout/style/export
|
|
|
|
|
2014-09-04 08:44:01 +00:00
|
|
|
ifdef ENABLE_CLANG_PLUGIN
|
2018-07-05 05:58:09 +00:00
|
|
|
$(filter-out config/host build/unix/stdc++compat/% build/clang-plugin/%,$(compile_targets)): build/clang-plugin/host build/clang-plugin/tests/target
|
|
|
|
build/clang-plugin/tests/target: build/clang-plugin/host
|
2014-09-04 08:44:01 +00:00
|
|
|
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
|
2016-11-19 15:15:35 +00:00
|
|
|
ldap/target: security/target mozglue/build/target
|
2014-09-04 08:44:01 +00:00
|
|
|
toolkit/library/target: ldap/target
|
|
|
|
endif
|
|
|
|
endif
|
2016-02-18 00:03:01 +00:00
|
|
|
# Most things are built during compile (target/host), but some things happen during export
|
|
|
|
# Those need to depend on config/export for system wrappers.
|
2018-07-05 05:58:09 +00:00
|
|
|
$(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/host: config/export
|