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 # We only want to generate buildid.h once, during the export phase.
28 ifeq ($(MAKECMDGOALS
),buildid.h
)
29 $(MDDEPDIR
)/buildid.h.stub
: FORCE
31 ifeq ($(MAKECMDGOALS
),source-repo.h
)
32 $(MDDEPDIR
)/source-repo.h.stub
: FORCE
35 source-repo.h
: $(MDDEPDIR
)/source-repo.h.stub
36 buildid.h
: $(MDDEPDIR
)/buildid.h.stub
37 # Add explicit dependencies that moz.build can't declare yet.
38 build
/$(MDDEPDIR
)/application.ini.stub
: source-repo.h buildid.h
40 BUILD_BACKEND_FILES
:= $(addprefix backend.
,$(addsuffix Backend
,$(BUILD_BACKENDS
)))
43 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
44 # rules.mk doesn't run early enough.
45 $(RUNNABLE_TIERS
) binaries
:: CLOBBER
$(BUILD_BACKEND_FILES
)
52 CLOBBER
: $(topsrcdir
)/CLOBBER
53 @echo
'STOP! The CLOBBER file has changed.'
54 @echo
'Please run the build through "mach build".'
58 install_manifests
:= \
59 $(addprefix dist/,branding
include public private xpi-stage
) \
62 # Skip the dist/bin install manifest when using the hybrid
63 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
64 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
65 # install manifest non-existent (non-existent manifests being skipped)
66 ifeq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
67 install_manifests
+= dist/bin
69 install_manifest_depends
= \
71 $(BUILD_BACKEND_FILES
) \
74 .PHONY
: install-manifests
75 install-manifests
: $(addprefix install-
,$(install_manifests
))
77 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
78 # to recurse in the faster/ directory in parallel of install manifests.
79 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
80 install-manifests
: faster
83 $(MAKE
) -C faster FASTER_RECURSIVE_MAKE
=1
86 .PHONY
: $(addprefix install-
,$(install_manifests
))
87 $(addprefix install-
,$(install_manifests
)): install-
%: $(install_manifest_depends
)
88 ifneq (,$(filter FasterMake
+RecursiveMake
,$(BUILD_BACKENDS
)))
89 @
# If we're using the hybrid FasterMake/RecursiveMake backend, we want
90 @
# to ensure the FasterMake end doesn't have install manifests for the
91 @
# same directory, because that would blow up
92 $(if
$(wildcard _build_manifests
/install/$(subst /,_
,$*)),$(if
$(wildcard faster
/install_
$(subst /,_
,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle
$*)))
94 $(foreach manifest
,$(wildcard _build_manifests
/install/$(subst /,_
,$*)),$(call py_action
,process_install_manifest
$*,$(if
$(filter copy
,$(NSDISTMODE
)),--no-symlinks
)--track install_
$(subst /,_
,$*).track
$* $(manifest
)))
96 # Dummy wrapper rule to allow the faster backend to piggy back
97 $(addprefix install-
,$(subst /,_
,$(filter dist/%,$(install_manifests
)))): install-dist_
%: install-dist
/% ;
100 install-tests
: install-test-files
102 .PHONY
: install-test-files
104 $(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
)
106 include $(topsrcdir
)/build
/moz-automation.mk
108 # Dummy rule for the cases below where we don't depend on dist/include
111 # For the binaries rule, not all the install manifests matter, so force only
112 # the interesting ones to be done.
113 recurse_pre-export
: install-manifests
115 @
$(MAKE
) install-manifests install_manifests
=dist/include
117 ifdef BUILD_VERBOSE_LOG
122 $(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
)
124 ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
125 recurse_android-fat-aar-artifact
:
126 $(call py_action
,fat_aar
,\
127 $(addprefix --armeabi-v7a
$(MOZ_FETCHES_DIR
)/,$(MOZ_ANDROID_FAT_AAR_ARMEABI_V7A
)) \
128 $(addprefix --arm64-v8a
$(MOZ_FETCHES_DIR
)/,$(MOZ_ANDROID_FAT_AAR_ARM64_V8A
)) \
129 $(addprefix --x86
$(MOZ_FETCHES_DIR
)/,$(MOZ_ANDROID_FAT_AAR_X86
)) \
130 $(addprefix --x86-64
$(MOZ_FETCHES_DIR
)/,$(MOZ_ANDROID_FAT_AAR_X86_64
)) \
131 --distdir
$(abspath
$(DIST
)/fat-aar
))
134 ifeq ($(MOZ_BUILD_APP
),mobile
/android
)
136 recurse_android-stage-package
: stage-package
138 recurse_android-archive-geckoview
:
139 GRADLE_INVOKED_WITHIN_MACH_BUILD
=1 $(topsrcdir
)/mach
--log-no-times android archive-geckoview
142 ifdef MOZ_WIDGET_TOOLKIT
144 # Additional makefile targets to call automated test suites
145 include $(topsrcdir
)/testing
/testsuite-targets.mk
150 $(call BUILDSTATUS
,TIERS
$(TIERS
) $(if
$(MOZ_AUTOMATION
),$(MOZ_AUTOMATION_TIERS
)))
152 include $(topsrcdir
)/config
/rules.mk
154 ifdef SCCACHE_VERBOSE_STATS
156 -$(CCACHE
) --show-adv-stats
--stats-format
=json
> '$(UPLOAD_PATH)/sccache-stats.json'
157 @echo
"===SCCACHE STATS==="
158 -$(CCACHE
) --show-adv-stats
159 @echo
"==================="
162 ifdef MOZ_CRASHREPORTER
163 include $(topsrcdir
)/toolkit
/mozapps
/installer
/package-name.mk
167 .PHONY
: prepsymbolsarchive
170 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
172 ifndef MOZ_AUTOMATION
173 prepsymbolsarchive
: recurse_syms
176 .PHONY
: symbolsfullarchive
177 symbolsfullarchive
: prepsymbolsarchive
178 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
179 $(call py_action
,symbols_archive
$(SYMBOL_FULL_ARCHIVE_BASENAME
).
tar.zst
,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
180 $(abspath
$(DIST
)/crashreporter-symbols
) \
183 .PHONY
: symbolsarchive
184 symbolsarchive
: prepsymbolsarchive
185 $(RM
) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
186 $(call py_action
,symbols_archive
$(SYMBOL_ARCHIVE_BASENAME
).zip
,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
187 $(abspath
$(DIST
)/crashreporter-symbols
))
189 ifdef MOZ_CRASHREPORTER
190 # Set MOZ_ENABLE_FULL_SYMBOLS to enable generation and upload of the full
191 # crashreporter symbols archives
192 ifdef MOZ_ENABLE_FULL_SYMBOLS
193 buildsymbols
: symbolsfullarchive symbolsarchive
195 buildsymbols
: symbolsarchive
196 endif # MOZ_ENABLE_FULL_SYMBOLS
199 @echo
"Skipping symbols generation because MOZ_CRASHREPORTER is not set."
203 ifdef MOZ_CRASHREPORTER
204 $(PYTHON3
) -u
$(topsrcdir
)/toolkit
/crashreporter
/tools
/upload_symbols.py
'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
207 .PHONY
: package-generated-sources
208 package-generated-sources
:
209 $(call py_action
,package_generated_sources
,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
212 # Delegate js-specific rules to js
216 source-package
install:
219 # Every export rule depends on config/export, but the rule for config/export
220 # doesn't exist when building js non-standalone.
221 .PHONY
: config
/export
226 # There used to be build interdependencies here. They are now in config/recurse.mk