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 ifneq (mobile
/android
,$(MOZ_BUILD_APP
))
27 $(MDDEPDIR
)/buildid.h.stub
$(MDDEPDIR
)/source-repo.h.stub
: FORCE
29 source-repo.h
: $(MDDEPDIR
)/source-repo.h.stub
30 buildid.h
: $(MDDEPDIR
)/buildid.h.stub
31 # Add explicit dependencies that moz.build can't declare yet.
32 build
/$(MDDEPDIR
)/application.ini.stub
: source-repo.h buildid.h
34 BUILD_BACKEND_FILES
:= $(addprefix backend.
,$(addsuffix Backend
,$(BUILD_BACKENDS
)))
37 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
38 # rules.mk doesn't run early enough.
39 $(RUNNABLE_TIERS
) binaries
:: CLOBBER
$(BUILD_BACKEND_FILES
)
46 CLOBBER
: $(topsrcdir
)/CLOBBER
47 @echo
'STOP! The CLOBBER file has changed.'
48 @echo
'Please run the build through "mach build".'
52 install_manifests
:= \
53 $(addprefix dist/,branding
include public private xpi-stage
) \
56 # Skip the dist/bin install manifest when using the hybrid
57 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
58 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
59 # install manifest non-existent (non-existent manifests being skipped)
60 ifeq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
61 install_manifests
+= dist/bin
63 install_manifest_depends
= \
65 $(BUILD_BACKEND_FILES
) \
68 .PHONY
: install-manifests
69 install-manifests
: $(addprefix install-
,$(install_manifests
))
71 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
72 # to recurse in the faster/ directory in parallel of install manifests.
73 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
74 install-manifests
: faster
77 $(MAKE
) -C faster FASTER_RECURSIVE_MAKE
=1
80 .PHONY
: $(addprefix install-
,$(install_manifests
))
81 $(addprefix install-
,$(install_manifests
)): install-
%: $(install_manifest_depends
)
82 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
83 @
# If we're using the hybrid FasterMake/RecursiveMake backend, we want
84 @
# to ensure the FasterMake end doesn't have install manifests for the
85 @
# same directory, because that would blow up
86 $(if
$(wildcard _build_manifests
/install/$(subst /,_
,$*)),$(if
$(wildcard faster
/install_
$(subst /,_
,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle
$*)))
88 $(foreach manifest
,$(wildcard _build_manifests
/install/$(subst /,_
,$*)),$(call py_action
,process_install_manifest
$*,$(if
$(filter copy
,$(NSDISTMODE
)),--no-symlinks
)--track install_
$(subst /,_
,$*).track
$* $(manifest
)))
90 # Dummy wrapper rule to allow the faster backend to piggy back
91 $(addprefix install-
,$(subst /,_
,$(filter dist/%,$(install_manifests
)))): install-dist_
%: install-dist
/% ;
94 install-tests
: install-test-files
96 .PHONY
: install-test-files
98 $(call py_action
,process_install_manifest
test/files
,$(if
$(filter copy
,$(NSDISTMODE
)),--no-symlinks
)--track install__test_files.track _tests _build_manifests
/install/_test_files
)
100 include $(topsrcdir
)/build
/moz-automation.mk
102 # Dummy rule for the cases below where we don't depend on dist/include
105 # For the binaries rule, not all the install manifests matter, so force only
106 # the interesting ones to be done.
107 recurse_pre-export
: install-manifests
109 @
$(MAKE
) install-manifests install_manifests
=dist/include
111 ifdef BUILD_VERBOSE_LOG
116 $(PYTHON3
) $(topsrcdir
)/mach
--log-no-times artifact
install$(if
$(MOZ_ARTIFACT_BUILD_SYMBOLS
), --symbols
$(addprefix =,$(filter full
,$(MOZ_ARTIFACT_BUILD_SYMBOLS
)))) $(if
$(ENABLE_TESTS
),,--no-tests
) $(verbose_flag
)
118 ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
119 recurse_android-fat-aar-artifact
:
120 $(call py_action
,fat_aar
,\
121 $(addprefix --armeabi-v7a
$(MOZ_FETCHES_DIR
)/,$(MOZ_ANDROID_FAT_AAR_ARMEABI_V7A
)) \
122 $(addprefix --arm64-v8a
$(MOZ_FETCHES_DIR
)/,$(MOZ_ANDROID_FAT_AAR_ARM64_V8A
)) \
123 $(addprefix --x86
$(MOZ_FETCHES_DIR
)/,$(MOZ_ANDROID_FAT_AAR_X86
)) \
124 $(addprefix --x86-64
$(MOZ_FETCHES_DIR
)/,$(MOZ_ANDROID_FAT_AAR_X86_64
)) \
125 --distdir
$(abspath
$(DIST
)/fat-aar
))
128 ifeq ($(MOZ_BUILD_APP
),mobile
/android
)
130 recurse_android-stage-package
: stage-package
132 recurse_android-archive-geckoview
:
133 GRADLE_INVOKED_WITHIN_MACH_BUILD
=1 $(topsrcdir
)/mach
--log-no-times android archive-geckoview
136 ifdef MOZ_WIDGET_TOOLKIT
138 # Additional makefile targets to call automated test suites
139 include $(topsrcdir
)/testing
/testsuite-targets.mk
144 $(call BUILDSTATUS
,TIERS
$(TIERS
) $(if
$(MOZ_AUTOMATION
),$(MOZ_AUTOMATION_TIERS
)))
146 include $(topsrcdir
)/config
/rules.mk
148 ifdef SCCACHE_VERBOSE_STATS
150 -$(CCACHE
) --show-stats
--stats-format
=json
> '$(UPLOAD_PATH)/sccache-stats.json'
151 @echo
"===SCCACHE STATS==="
152 -$(CCACHE
) --show-stats
153 @echo
"==================="
156 ifdef MOZ_CRASHREPORTER
157 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
161 .PHONY
: prepsymbolsarchive
164 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
166 ifndef MOZ_AUTOMATION
167 prepsymbolsarchive
: recurse_syms
170 .PHONY
: symbolsfullarchive
171 symbolsfullarchive
: prepsymbolsarchive
172 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
173 $(call py_action
,symbols_archive
$(SYMBOL_FULL_ARCHIVE_BASENAME
).
tar.zst
,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
174 $(abspath
$(DIST
)/crashreporter-symbols
) \
177 .PHONY
: symbolsarchive
178 symbolsarchive
: prepsymbolsarchive
179 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
180 $(call py_action
,symbols_archive
$(SYMBOL_ARCHIVE_BASENAME
).zip
,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
181 $(abspath
$(DIST
)/crashreporter-symbols
))
183 ifdef MOZ_CRASHREPORTER
184 # Set MOZ_ENABLE_FULL_SYMBOLS to enable generation and upload of the full
185 # crashreporter symbols archives
186 ifdef MOZ_ENABLE_FULL_SYMBOLS
187 buildsymbols
: symbolsfullarchive symbolsarchive
189 buildsymbols
: symbolsarchive
190 endif # MOZ_ENABLE_FULL_SYMBOLS
193 @echo
"Skipping symbols generation because MOZ_CRASHREPORTER is not set."
197 ifdef MOZ_CRASHREPORTER
198 $(PYTHON3
) -u
$(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.py
'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
201 .PHONY
: package-generated-sources
202 package-generated-sources
:
203 $(call py_action
,package_generated_sources
,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
206 # Delegate js-specific rules to js
210 source-package
install:
213 # Every export rule depends on config/export, but the rule for config/export
214 # doesn't exist when building js non-standalone.
215 .PHONY
: config
/export
220 # There used to be build interdependencies here. They are now in config/recurse.mk