Bug 1564744 [wpt PR 17603] - [PW] Make PW canvas transform account for device scale...
[gecko.git] / Makefile.in
bloba8643799a6cd96078541735c2555eb17885a8205
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 ifneq (mobile/android,$(MOZ_BUILD_APP))
42 $(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub: FORCE
43 endif
44 source-repo.h: $(MDDEPDIR)/source-repo.h.stub
45 buildid.h: $(MDDEPDIR)/buildid.h.stub
46 endif
48 BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS)))
50 ifndef TEST_MOZBUILD
51 ifndef MOZ_PROFILE_USE
52 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
53 # rules.mk doesn't run early enough.
54 $(RUNNABLE_TIERS) binaries:: CLOBBER $(BUILD_BACKEND_FILES)
55 endif
56 endif
58 ifdef JS_STANDALONE
59 .PHONY: CLOBBER
60 CLOBBER:
61 else
62 CLOBBER: $(topsrcdir)/CLOBBER
63 @echo 'STOP! The CLOBBER file has changed.'
64 @echo 'Please run the build through "mach build".'
65 @exit 1
66 endif
68 install_manifests := \
69 $(addprefix dist/,branding include public private xpi-stage) \
70 _tests \
71 $(NULL)
72 # Skip the dist/bin install manifest when using the hybrid
73 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
74 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
75 # install manifest non-existent (non-existent manifests being skipped)
76 ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
77 install_manifests += dist/bin
78 endif
79 install_manifest_depends = \
80 CLOBBER \
81 $(BUILD_BACKEND_FILES) \
82 $(NULL)
84 .PHONY: install-manifests
85 install-manifests: $(addprefix install-,$(install_manifests))
87 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
88 # to recurse in the faster/ directory in parallel of install manifests.
89 ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
90 install-manifests: faster
91 .PHONY: faster
92 faster:
93 $(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
94 endif
96 .PHONY: $(addprefix install-,$(install_manifests))
97 $(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
98 ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
99 @# If we're using the hybrid FasterMake/RecursiveMake backend, we want
100 @# to ensure the FasterMake end doesn't have install manifests for the
101 @# same directory, because that would blow up
102 $(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
103 endif
104 $(addprefix $(call py_action,process_install_manifest,--track install_$(subst /,_,$*).track $*) ,$(wildcard _build_manifests/install/$(subst /,_,$*)))
106 # Dummy wrapper rule to allow the faster backend to piggy back
107 $(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ;
109 .PHONY: install-tests
110 install-tests: install-test-files
112 .PHONY: install-test-files
113 install-test-files:
114 $(call py_action,process_install_manifest,--track install__test_files.track _tests _build_manifests/install/_test_files)
116 include $(topsrcdir)/build/moz-automation.mk
118 # dist and _tests should be purged during cleaning. However, we don't want them
119 # purged during PGO builds because they contain some auto-generated files.
120 ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
121 GARBAGE_DIRS += dist _tests
122 endif
124 # Dummy rule for the cases below where we don't depend on dist/include
125 recurse_pre-export::
127 # Windows PGO builds don't perform a clean before the 2nd pass. So, we want
128 # to preserve content for the 2nd pass on Windows. Everywhere else, we always
129 # process the install manifests as part of export.
130 # For the binaries rule, not all the install manifests matter, so force only
131 # the interesting ones to be done.
132 ifdef MOZ_1TIER_PGO
133 ifndef NO_PROFILE_GUIDED_OPTIMIZE
134 ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
135 recurse_pre-export:: install-manifests
136 binaries::
137 @$(MAKE) install-manifests install_manifests=dist/include
138 endif
139 endif
140 else # !MOZ_1TIER_PGO (normal build)
141 recurse_pre-export:: install-manifests
142 binaries::
143 @$(MAKE) install-manifests install_manifests=dist/include
144 endif
146 # Host binaries are not produced for macOS consumers: that is, there's
147 # no macOS-hosted job to produce them at this time. Therefore we
148 # enable --host-bins only for automation builds, which only require Linux and
149 # Windows host binaries.
150 recurse_artifact:
151 $(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)
153 ifdef MOZ_EME_WIN32_ARTIFACT
154 recurse_win32-artifact:
155 rm -rf $(DIST)/i686
156 $(topsrcdir)/mach --log-no-times artifact install --job $(if $(MOZ_PGO),win32-pgo,win32-opt) --no-tests --distdir $(DIST)/i686
157 mv $(DIST)/i686/bin/* $(DIST)/i686
158 endif
160 ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
161 recurse_android-fat-aar-artifact:
162 $(call py_action,fat_aar,$(MOZ_ANDROID_FAT_AAR_ARCHITECTURES) --distdir $(abspath $(DIST)/fat-aar))
163 endif # MOZ_ANDROID_FAT_AAR_ARCHITECTURES
165 ifdef MOZ_WIDGET_TOOLKIT
166 ifdef ENABLE_TESTS
167 # Additional makefile targets to call automated test suites
168 include $(topsrcdir)/testing/testsuite-targets.mk
169 endif
170 endif
172 default all::
173 $(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
175 # PGO build target.
176 profiledbuild::
177 $(call BUILDSTATUS,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use)
178 $(call BUILDSTATUS,TIER_START pgo_profile_generate)
179 $(MAKE) default MOZ_PROFILE_GENERATE=1 MOZ_LTO=
180 $(call BUILDSTATUS,TIER_FINISH pgo_profile_generate)
181 $(call BUILDSTATUS,TIER_START pgo_package)
182 $(MAKE) package MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
183 rm -f jarlog/en-US.log
184 $(call BUILDSTATUS,TIER_FINISH pgo_package)
185 $(call BUILDSTATUS,TIER_START pgo_profile)
186 JARLOG_FILE=jarlog/en-US.log $(PYTHON) $(topsrcdir)/build/pgo/profileserver.py
187 $(call BUILDSTATUS,TIER_FINISH pgo_profile)
188 $(call BUILDSTATUS,TIER_START pgo_clobber)
189 $(MAKE) maybe_clobber_profiledbuild
190 $(call BUILDSTATUS,TIER_FINISH pgo_clobber)
191 $(call BUILDSTATUS,TIER_START pgo_profile_use)
192 $(MAKE) default MOZ_PROFILE_USE=1 MOZ_1TIER_PGO=1
193 $(call BUILDSTATUS,TIER_FINISH pgo_profile_use)
195 # Change default target to PGO build if PGO is enabled.
196 ifdef MOZ_PGO
197 ifdef COMPILE_ENVIRONMENT
198 # If one of these is already set in addition to PGO we are doing a single phase
199 # of PGO in isolation, so don't override the default target.
200 ifeq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
201 OVERRIDE_DEFAULT_GOAL := profiledbuild
202 endif
203 endif
204 endif
206 include $(topsrcdir)/config/rules.mk
208 ifdef SCCACHE_VERBOSE_STATS
209 default::
210 -$(CCACHE) --show-stats --stats-format=json > sccache-stats.json
211 @echo "===SCCACHE STATS==="
212 -$(CCACHE) --show-stats
213 @echo "==================="
214 endif
216 distclean::
217 $(RM) $(DIST_GARBAGE)
219 ifdef MOZ_CRASHREPORTER
220 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
222 endif
224 .PHONY: prepsymbolsarchive
225 prepsymbolsarchive:
226 echo packing symbols
227 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
229 ifndef MOZ_AUTOMATION
230 prepsymbolsarchive: recurse_syms
231 endif
233 .PHONY: symbolsfullarchive
234 symbolsfullarchive: prepsymbolsarchive
235 $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
236 $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
237 $(abspath $(DIST)/crashreporter-symbols) \
238 --full-archive)
240 .PHONY: symbolsarchive
241 symbolsarchive: prepsymbolsarchive
242 $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
243 $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
244 $(abspath $(DIST)/crashreporter-symbols))
246 ifdef MOZ_CRASHREPORTER
247 # Set MOZ_DISABLE_FULL_SYMBOLS to disable generation and upload of the full
248 # crashreporter symbols archives
249 ifdef MOZ_DISABLE_FULL_SYMBOLS
250 buildsymbols: symbolsarchive
251 else
252 buildsymbols: symbolsfullarchive symbolsarchive
253 endif # MOZ_DISABLE_FULL_SYMBOLS
254 else
255 buildsymbols:
256 endif
258 uploadsymbols:
259 ifdef MOZ_CRASHREPORTER
260 $(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
261 endif
263 .PHONY: update-packaging
264 update-packaging:
265 $(MAKE) -C tools/update-packaging
267 .PHONY: package-generated-sources
268 package-generated-sources:
269 $(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
271 # PGO support, but we can't do this test in client.mk
272 # No point in clobbering if PGO has been explicitly disabled.
273 ifdef NO_PROFILE_GUIDED_OPTIMIZE
274 maybe_clobber_profiledbuild:
275 else
276 maybe_clobber_profiledbuild: clean
277 ifneq (,$(findstring clang,$(CC_TYPE)))
278 $(LLVM_PROFDATA) merge -o $(DEPTH)/merged.profdata $(DEPTH)/*.profraw
279 endif
280 endif # NO_PROFILE_GUIDED_OPTIMIZE
282 .PHONY: maybe_clobber_profiledbuild
284 ifdef JS_STANDALONE
285 # Delegate js-specific rules to js
286 check-%:
287 $(MAKE) -C js/src $@
289 source-package install:
290 $(MAKE) -C js/src $@
292 # Every export rule depends on config/export, but the rule for config/export
293 # doesn't exist when building js non-standalone.
294 .PHONY: config/export
295 config/export:
297 endif
299 # There used to be build interdependencies here. They are now in config/recurse.mk