Bug 1073336 part 9 - Add protected AnimationPlayer::GetPresContext(); r=dbaron
[gecko.git] / config / recurse.mk
blobd073a7dad4194e43c16a0fe3ce46c7f4d176a6cb
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 # You can obtain one at http://mozilla.org/MPL/2.0/.
5 ifndef INCLUDED_RULES_MK
6 include $(topsrcdir)/config/rules.mk
7 endif
9 # Make sure that anything that needs to be defined in moz.build wasn't
10 # overwritten after including rules.mk.
11 _eval_for_side_effects := $(CHECK_MOZBUILD_VARIABLES)
13 # The traditional model of directory traversal with make is as follows:
14 # make -C foo
15 # Entering foo
16 # make -C bar
17 # Entering foo/bar
18 # make -C baz
19 # Entering foo/baz
20 # make -C qux
21 # Entering qux
23 # Pseudo derecurse transforms the above into:
24 # make -C foo
25 # make -C foo/bar
26 # make -C foo/baz
27 # make -C qux
29 ifeq (.,$(DEPTH))
31 include root.mk
33 # Main rules (export, compile, libs and tools) call recurse_* rules.
34 # This wrapping is only really useful for build status.
35 $(TIERS)::
36 $(call BUILDSTATUS,TIER_START $@)
37 +$(MAKE) recurse_$@
38 $(call BUILDSTATUS,TIER_FINISH $@)
40 # Special rule that does install-manifests (cf. Makefile.in) + compile
41 binaries::
42 +$(MAKE) recurse_compile
44 # Carefully avoid $(eval) type of rule generation, which makes pymake slower
45 # than necessary.
46 # Get current tier and corresponding subtiers from the data in root.mk.
47 CURRENT_TIER := $(filter $(foreach tier,$(TIERS),recurse_$(tier) $(tier)-deps),$(MAKECMDGOALS))
48 ifneq (,$(filter-out 0 1,$(words $(CURRENT_TIER))))
49 $(error $(CURRENT_TIER) not supported on the same make command line)
50 endif
51 CURRENT_TIER := $(subst recurse_,,$(CURRENT_TIER:-deps=))
53 # The rules here are doing directory traversal, so we don't want further
54 # recursion to happen when running make -C subdir $tier. But some make files
55 # further call make -C something else, and sometimes expect recursion to
56 # happen in that case (see browser/metro/locales/Makefile.in for example).
57 # Conveniently, every invocation of make increases MAKELEVEL, so only stop
58 # recursion from happening at current MAKELEVEL + 1.
59 ifdef CURRENT_TIER
60 ifeq (0,$(MAKELEVEL))
61 export NO_RECURSE_MAKELEVEL=1
62 else
63 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)
64 endif
65 endif
67 # Use the $(*_dirs) variables available in root.mk
68 CURRENT_DIRS := $($(CURRENT_TIER)_dirs)
70 # Need a list of compile targets because we can't use pattern rules:
71 # https://savannah.gnu.org/bugs/index.php?42833
72 .PHONY: $(compile_targets)
73 $(compile_targets):
74 $(call SUBMAKE,$(@F),$(@D))
76 # The compile tier has different rules from other tiers.
77 ifneq ($(CURRENT_TIER),compile)
79 # Recursion rule for all directories traversed for all subtiers in the
80 # current tier.
81 $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
82 $(call SUBMAKE,$(CURRENT_TIER),$*)
84 .PHONY: $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS))
86 # Dummy rules for possibly inexisting dependencies for the above tier targets
87 $(addsuffix /Makefile,$(CURRENT_DIRS)) $(addsuffix /backend.mk,$(CURRENT_DIRS)):
89 ifeq ($(CURRENT_TIER),export)
90 # At least build/export requires config/export for buildid, but who knows what
91 # else, so keep this global dependency to make config/export first for now.
92 $(addsuffix /$(CURRENT_TIER),$(filter-out config,$(CURRENT_DIRS))): config/$(CURRENT_TIER)
94 # The export tier requires nsinstall, which is built from config. So every
95 # subdirectory traversal needs to happen after building nsinstall in config, which
96 # is done with the config/host target. Note the config/host target only exists if
97 # nsinstall is actually built, which it is not on Windows, because we use
98 # nsinstall.py there.
99 ifneq (,$(filter config/host, $(compile_targets)))
100 $(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): config/host
101 endif
102 endif
104 endif # ifeq ($(CURRENT_TIER),compile)
106 else
108 # Don't recurse if MAKELEVEL is NO_RECURSE_MAKELEVEL as defined above
109 ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
111 $(TIERS)::
113 else
114 #########################
115 # Tier traversal handling
116 #########################
118 define CREATE_SUBTIER_TRAVERSAL_RULE
119 .PHONY: $(1)
121 $(1):: $$(SUBMAKEFILES)
122 $$(LOOP_OVER_DIRS)
124 endef
126 $(foreach subtier,$(filter-out compile,$(TIERS)),$(eval $(call CREATE_SUBTIER_TRAVERSAL_RULE,$(subtier))))
128 ifndef TOPLEVEL_BUILD
129 libs:: target host
130 endif
132 endif # ifeq ($(NO_RECURSE_MAKELEVEL),$(MAKELEVEL))
134 endif # ifeq (.,$(DEPTH))
136 recurse:
137 @$(RECURSED_COMMAND)
138 $(LOOP_OVER_DIRS)
140 ifeq (.,$(DEPTH))
141 # Interdependencies for parallel export.
142 js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
143 accessible/xpcom/export: xpcom/xpidl/export
145 # The widget binding generator code is part of the annotationProcessors.
146 widget/android/bindings/export: build/annotationProcessors/export
148 ifdef ENABLE_CLANG_PLUGIN
149 $(filter-out build/clang-plugin/%,$(compile_targets)): build/clang-plugin/target build/clang-plugin/tests/target
150 build/clang-plugin/tests/target: build/clang-plugin/target
151 endif
153 # Interdependencies that moz.build world don't know about yet for compilation.
154 # Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
155 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
156 toolkit/library/target: widget/gtk/mozgtk/gtk3/target
157 endif
158 ifdef MOZ_LDAP_XPCOM
159 ldap/target: config/external/nss/target mozglue/build/target
160 toolkit/library/target: ldap/target
161 endif
162 ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
163 mozglue/build/target memory/replace/logalloc/replay/target: memory/replace/dummy/target
164 endif
165 ifdef MOZ_CRT
166 mozglue/crt/target: mozglue/build/target
167 endif
169 endif