Bug 1550245 [wpt PR 16410] - [Animation Worklet] Use document from script state inste...
[gecko.git] / Makefile.in
blob012f69bebfc8fd82edd8191f93471e399d25eab2
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 ifeq (,$(MAKE_VERSION))
7 $(error GNU Make is required)
8 endif
9 make_min_ver := 3.81
10 ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
11 $(error GNU Make $(make_min_ver) or higher is required)
12 endif
14 export TOPLEVEL_BUILD := 1
16 default::
18 ifndef TEST_MOZBUILD
19 ifdef MOZ_BUILD_APP
20 include $(wildcard $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk)
21 endif
22 endif
24 include $(topsrcdir)/config/config.mk
26 GARBAGE_DIRS += _javagen _profile staticlib
27 # To share compilation of dependencies, Rust libraries all set their
28 # CARGO_TARGET_DIR as a subdirectory of topobjdir. Normally, we would add
29 # RUST*TARGET to GARBAGE_DIRS for those directories building Rust libraries.
30 # But the directories building Rust libraries don't actually have
31 # subdirectories to remove. So we add to GARBAGE_DIRS once here, globally,
32 # for it to have the desired effect.
33 GARBAGE_DIRS += $(RUST_TARGET)
34 DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
35 config/autoconf.mk \
36 mozilla-config.h \
37 netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
38 .mozconfig.mk
40 ifndef MOZ_PROFILE_USE
41 # Automation builds should always have a new buildid, but for the sake of not
42 # re-linking libxul on every incremental build we do not enforce this for
43 # developer builds. Tests always need a new buildid as well.
44 ifneq (,$(MOZ_AUTOMATION)$(MOZ_BUILD_DATE)$(TEST_MOZBUILD))
45 $(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub: FORCE
46 endif
47 # Additionally, provide a dummy target during tests, because
48 # faster/rules.mk will expect these targets to exist.
49 ifdef TEST_MOZBUILD
50 source-repo.h: $(MDDEPDIR)/source-repo.h.stub
51 buildid.h: $(MDDEPDIR)/buildid.h.stub
52 endif
53 endif
55 BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS)))
57 ifndef TEST_MOZBUILD
58 ifndef MOZ_PROFILE_USE
59 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
60 # rules.mk doesn't run early enough.
61 $(TIERS) binaries:: CLOBBER $(BUILD_BACKEND_FILES)
62 endif
63 endif
65 ifdef JS_STANDALONE
66 .PHONY: CLOBBER
67 CLOBBER:
68 else
69 CLOBBER: $(topsrcdir)/CLOBBER
70 @echo 'STOP! The CLOBBER file has changed.'
71 @echo 'Please run the build through "mach build".'
72 @exit 1
73 endif
75 install_manifests := \
76 $(addprefix dist/,branding include public private xpi-stage) \
77 _tests \
78 $(NULL)
79 # Skip the dist/bin install manifest when using the hybrid
80 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
81 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
82 # install manifest non-existent (non-existent manifests being skipped)
83 ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
84 install_manifests += dist/bin
85 endif
86 install_manifest_depends = \
87 CLOBBER \
88 $(BUILD_BACKEND_FILES) \
89 $(NULL)
91 .PHONY: install-manifests
92 install-manifests: $(addprefix install-,$(install_manifests))
94 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
95 # to recurse in the faster/ directory in parallel of install manifests.
96 ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
97 install-manifests: faster
98 .PHONY: faster
99 faster:
100 $(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
101 endif
103 .PHONY: $(addprefix install-,$(install_manifests))
104 $(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
105 ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
106 @# If we're using the hybrid FasterMake/RecursiveMake backend, we want
107 @# to ensure the FasterMake end doesn't have install manifests for the
108 @# same directory, because that would blow up
109 $(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
110 endif
111 $(addprefix $(call py_action,process_install_manifest,--track install_$(subst /,_,$*).track $*) ,$(wildcard _build_manifests/install/$(subst /,_,$*)))
113 # Dummy wrapper rule to allow the faster backend to piggy back
114 $(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ;
116 .PHONY: install-tests
117 install-tests: install-test-files
119 .PHONY: install-test-files
120 install-test-files:
121 $(call py_action,process_install_manifest,--track install__test_files.track _tests _build_manifests/install/_test_files)
123 include $(topsrcdir)/build/moz-automation.mk
125 # dist and _tests should be purged during cleaning. However, we don't want them
126 # purged during PGO builds because they contain some auto-generated files.
127 ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
128 GARBAGE_DIRS += dist _tests
129 endif
131 # Dummy rule for the cases below where we don't depend on dist/include
132 recurse_pre-export::
134 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
135 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
136 # process the install manifests as part of export.
137 # For the binaries rule, not all the install manifests matter, so force only
138 # the interesting ones to be done.
139 ifdef MOZ_PROFILE_USE
140 ifndef NO_PROFILE_GUIDED_OPTIMIZE
141 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
142 recurse_pre-export:: install-manifests
143 binaries::
144 @$(MAKE) install-manifests install_manifests=dist/include
145 endif
146 endif
147 else # !MOZ_PROFILE_USE (normal build)
148 recurse_pre-export:: install-manifests
149 binaries::
150 @$(MAKE) install-manifests install_manifests=dist/include
151 endif
153 # Host binaries are not produced for macOS consumers: that is, there's
154 # no macOS-hosted job to produce them at this time. Therefore we
155 # enable --host-bins only for automation builds, which only require Linux and
156 # Windows host binaries.
157 recurse_artifact:
158 $(topsrcdir)/mach --log-no-times artifact install$(if $(MOZ_ARTIFACT_BUILD_SYMBOLS), --symbols$(addprefix =,$(filter full,$(MOZ_ARTIFACT_BUILD_SYMBOLS))))$(if $(MOZ_AUTOMATION), --host-bins)
160 ifdef MOZ_EME_WIN32_ARTIFACT
161 recurse_win32-artifact:
162 rm -rf $(DIST)/i686
163 $(topsrcdir)/mach --log-no-times artifact install --job $(if $(MOZ_PGO),win32-pgo,win32-opt) --no-tests --distdir $(DIST)/i686
164 mv $(DIST)/i686/bin/* $(DIST)/i686
165 endif
167 ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
168 recurse_android-fat-aar-artifact:
169 $(call py_action,fat_aar,$(MOZ_ANDROID_FAT_AAR_ARCHITECTURES) --distdir $(abspath $(DIST)/fat-aar))
170 endif # MOZ_ANDROID_FAT_AAR_ARCHITECTURES
172 ifdef MOZ_WIDGET_TOOLKIT
173 ifdef ENABLE_TESTS
174 # Additional makefile targets to call automated test suites
175 include $(topsrcdir)/testing/testsuite-targets.mk
176 endif
177 endif
179 default all::
180 $(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
182 # PGO build target.
183 profiledbuild::
184 $(call BUILDSTATUS,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use)
185 $(call BUILDSTATUS,TIER_START pgo_profile_generate)
186 $(MAKE) default MOZ_PROFILE_GENERATE=1 MOZ_LTO=
187 $(call BUILDSTATUS,TIER_FINISH pgo_profile_generate)
188 $(call BUILDSTATUS,TIER_START pgo_package)
189 $(MAKE) package MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
190 rm -f jarlog/en-US.log
191 $(call BUILDSTATUS,TIER_FINISH pgo_package)
192 $(call BUILDSTATUS,TIER_START pgo_profile)
193 JARLOG_FILE=jarlog/en-US.log $(PYTHON) $(topsrcdir)/build/pgo/profileserver.py
194 $(call BUILDSTATUS,TIER_FINISH pgo_profile)
195 $(call BUILDSTATUS,TIER_START pgo_clobber)
196 $(MAKE) maybe_clobber_profiledbuild
197 $(call BUILDSTATUS,TIER_FINISH pgo_clobber)
198 $(call BUILDSTATUS,TIER_START pgo_profile_use)
199 $(MAKE) default MOZ_PROFILE_USE=1
200 $(call BUILDSTATUS,TIER_FINISH pgo_profile_use)
202 # Change default target to PGO build if PGO is enabled.
203 ifdef MOZ_PGO
204 ifdef COMPILE_ENVIRONMENT
205 # If one of these is already set in addition to PGO we are doing a single phase
206 # of PGO in isolation, so don't override the default target.
207 ifeq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
208 OVERRIDE_DEFAULT_GOAL := profiledbuild
209 endif
210 endif
211 endif
213 include $(topsrcdir)/config/rules.mk
215 ifdef SCCACHE_VERBOSE_STATS
216 default::
217 -$(CCACHE) --show-stats --stats-format=json > sccache-stats.json
218 @echo "===SCCACHE STATS==="
219 -$(CCACHE) --show-stats
220 @echo "==================="
221 endif
223 distclean::
224 $(RM) $(DIST_GARBAGE)
226 ifdef MOZ_CRASHREPORTER
227 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
229 endif
231 .PHONY: prepsymbolsarchive
232 prepsymbolsarchive:
233 echo packing symbols
234 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
236 ifndef MOZ_AUTOMATION
237 prepsymbolsarchive: recurse_syms
238 endif
240 .PHONY: symbolsfullarchive
241 symbolsfullarchive: prepsymbolsarchive
242 $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
243 $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
244 $(abspath $(DIST)/crashreporter-symbols) \
245 --full-archive)
247 .PHONY: symbolsarchive
248 symbolsarchive: prepsymbolsarchive
249 $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
250 $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
251 $(abspath $(DIST)/crashreporter-symbols))
253 ifdef MOZ_CRASHREPORTER
254 # Set MOZ_DISABLE_FULL_SYMBOLS to disable generation and upload of the full
255 # crashreporter symbols archives
256 ifdef MOZ_DISABLE_FULL_SYMBOLS
257 buildsymbols: symbolsarchive
258 else
259 buildsymbols: symbolsfullarchive symbolsarchive
260 endif # MOZ_DISABLE_FULL_SYMBOLS
261 else
262 buildsymbols:
263 endif
265 uploadsymbols:
266 ifdef MOZ_CRASHREPORTER
267 $(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
268 endif
270 .PHONY: update-packaging
271 update-packaging:
272 $(MAKE) -C tools/update-packaging
274 .PHONY: package-generated-sources
275 package-generated-sources:
276 $(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
278 # PGO support, but we can't do this test in client.mk
279 # No point in clobbering if PGO has been explicitly disabled.
280 ifdef NO_PROFILE_GUIDED_OPTIMIZE
281 maybe_clobber_profiledbuild:
282 else
283 maybe_clobber_profiledbuild: clean
284 ifneq (,$(findstring clang,$(CC_TYPE)))
285 $(LLVM_PROFDATA) merge -o $(DEPTH)/merged.profdata $(DEPTH)/*.profraw
286 endif
287 endif # NO_PROFILE_GUIDED_OPTIMIZE
289 .PHONY: maybe_clobber_profiledbuild
291 ifdef JS_STANDALONE
292 # Delegate js-specific rules to js
293 check-%:
294 $(MAKE) -C js/src $@
296 source-package install:
297 $(MAKE) -C js/src $@
299 # Every export rule depends on config/export, but the rule for config/export
300 # doesn't exist when building js non-standalone.
301 .PHONY: config/export
302 config/export:
304 endif
306 # There used to be build interdependencies here. They are now in config/recurse.mk