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
)
10 ifneq ($(make_min_ver
),$(firstword $(sort $(make_min_ver
) $(MAKE_VERSION
))))
11 $(error GNU Make
$(make_min_ver
) or higher is required
)
14 export TOPLEVEL_BUILD
:= 1
20 include $(wildcard $(topsrcdir
)/$(MOZ_BUILD_APP
)/build.mk
)
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 \
37 netwerk
/necko-config.h xpcom
/xpcom-config.h xpcom
/xpcom-private.h \
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
47 # Additionally, provide a dummy target during tests, because
48 # faster/rules.mk will expect these targets to exist.
50 source-repo.h
: $(MDDEPDIR
)/source-repo.h.stub
51 buildid.h
: $(MDDEPDIR
)/buildid.h.stub
55 BUILD_BACKEND_FILES
:= $(addprefix backend.
,$(addsuffix Backend
,$(BUILD_BACKENDS
)))
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
)
69 CLOBBER
: $(topsrcdir
)/CLOBBER
70 @echo
'STOP! The CLOBBER file has changed.'
71 @echo
'Please run the build through "mach build".'
75 install_manifests
:= \
76 $(addprefix dist/,branding
include public private xpi-stage
) \
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
86 install_manifest_depends
= \
88 $(BUILD_BACKEND_FILES
) \
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
100 $(MAKE
) -C faster FASTER_RECURSIVE_MAKE
=1
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
$*)))
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
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
131 # Dummy rule for the cases below where we don't depend on dist/include
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
144 @
$(MAKE
) install-manifests install_manifests
=dist/include
147 else # !MOZ_PROFILE_USE (normal build)
148 recurse_pre-export
:: install-manifests
150 @
$(MAKE
) install-manifests install_manifests
=dist/include
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.
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
:
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
167 ifdef MOZ_WIDGET_TOOLKIT
169 # Additional makefile targets to call automated test suites
170 include $(topsrcdir
)/testing
/testsuite-targets.mk
175 $(call BUILDSTATUS
,TIERS
$(TIERS
) $(if
$(MOZ_AUTOMATION
),$(MOZ_AUTOMATION_TIERS
)))
179 $(call BUILDSTATUS
,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use
)
180 $(call BUILDSTATUS
,TIER_START pgo_profile_generate
)
181 $(MAKE
) default MOZ_PROFILE_GENERATE
=1 MOZ_LTO
=
182 $(call BUILDSTATUS
,TIER_FINISH pgo_profile_generate
)
183 $(call BUILDSTATUS
,TIER_START pgo_package
)
184 $(MAKE
) package MOZ_INTERNAL_SIGNING_FORMAT
= MOZ_EXTERNAL_SIGNING_FORMAT
=
185 rm -f jarlog
/en-US.log
186 $(call BUILDSTATUS
,TIER_FINISH pgo_package
)
187 $(call BUILDSTATUS
,TIER_START pgo_profile
)
188 JARLOG_FILE
=jarlog
/en-US.log
$(PYTHON
) $(topsrcdir
)/build
/pgo
/profileserver.py
189 $(call BUILDSTATUS
,TIER_FINISH pgo_profile
)
190 $(call BUILDSTATUS
,TIER_START pgo_clobber
)
191 $(MAKE
) maybe_clobber_profiledbuild
192 $(call BUILDSTATUS
,TIER_FINISH pgo_clobber
)
193 $(call BUILDSTATUS
,TIER_START pgo_profile_use
)
194 $(MAKE
) default MOZ_PROFILE_USE
=1 $(if
$(CLANG_CL
),MOZ_PROFILE_ORDER_FILE
=$(topobjdir
)/cygprofile.txt
)
195 $(call BUILDSTATUS
,TIER_FINISH pgo_profile_use
)
197 # Change default target to PGO build if PGO is enabled.
199 ifdef COMPILE_ENVIRONMENT
200 # If one of these is already set in addition to PGO we are doing a single phase
201 # of PGO in isolation, so don't override the default target.
202 ifeq (,$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
203 OVERRIDE_DEFAULT_GOAL
:= profiledbuild
208 include $(topsrcdir
)/config
/rules.mk
210 ifdef SCCACHE_VERBOSE_STATS
212 -$(CCACHE
) --show-stats
--stats-format
=json
> sccache-stats.json
213 @echo
"===SCCACHE STATS==="
214 -$(CCACHE
) --show-stats
215 @echo
"==================="
219 $(RM
) $(DIST_GARBAGE
)
221 ifdef MOZ_CRASHREPORTER
222 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
226 .PHONY
: prepsymbolsarchive
229 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
231 ifndef MOZ_AUTOMATION
232 prepsymbolsarchive
: recurse_syms
235 .PHONY
: symbolsfullarchive
236 symbolsfullarchive
: prepsymbolsarchive
237 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
238 $(call py_action
,symbols_archive
,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
239 $(abspath
$(DIST
)/crashreporter-symbols
) \
242 .PHONY
: symbolsarchive
243 symbolsarchive
: prepsymbolsarchive
244 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
245 $(call py_action
,symbols_archive
,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
246 $(abspath
$(DIST
)/crashreporter-symbols
))
248 ifdef MOZ_CRASHREPORTER
249 # Set MOZ_DISABLE_FULL_SYMBOLS to disable generation and upload of the full
250 # crashreporter symbols archives
251 ifdef MOZ_DISABLE_FULL_SYMBOLS
252 buildsymbols
: symbolsarchive
254 buildsymbols
: symbolsfullarchive symbolsarchive
255 endif # MOZ_DISABLE_FULL_SYMBOLS
261 ifdef MOZ_CRASHREPORTER
262 $(PYTHON
) -u
$(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.py
'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
265 .PHONY
: update-packaging
267 $(MAKE
) -C tools
/update-packaging
269 .PHONY
: package-generated-sources
270 package-generated-sources
:
271 $(call py_action
,package_generated_sources
,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
273 # PGO support, but we can't do this test in client.mk
274 # No point in clobbering if PGO has been explicitly disabled.
275 ifdef NO_PROFILE_GUIDED_OPTIMIZE
276 maybe_clobber_profiledbuild
:
278 maybe_clobber_profiledbuild
: clean
279 ifneq (,$(findstring clang
,$(CC_TYPE
)))
280 $(LLVM_PROFDATA
) merge
-o
$(DEPTH
)/merged.profdata
$(DEPTH
)/*.profraw
282 endif # NO_PROFILE_GUIDED_OPTIMIZE
284 .PHONY
: maybe_clobber_profiledbuild
287 # Delegate js-specific rules to js
291 source-package
install:
294 # Every export rule depends on config/export, but the rule for config/export
295 # doesn't exist when building js non-standalone.
296 .PHONY
: config
/export
301 # There used to be build interdependencies here. They are now in config/recurse.mk