Bug 1882468 - Add BUG_COMPONENT for migrated monorepo files in mobile/android/moz...
[gecko.git] / Makefile.in
blob2658629f9183dd1141700806a21a01f9a0527934
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 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
30 endif
31 ifeq ($(MAKECMDGOALS),source-repo.h)
32 $(MDDEPDIR)/source-repo.h.stub: FORCE
33 endif
34 endif
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)))
42 ifndef TEST_MOZBUILD
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)
46 endif
48 ifdef JS_STANDALONE
49 .PHONY: CLOBBER
50 CLOBBER:
51 else
52 CLOBBER: $(topsrcdir)/CLOBBER
53 @echo 'STOP! The CLOBBER file has changed.'
54 @echo 'Please run the build through "mach build".'
55 @exit 1
56 endif
58 install_manifests := \
59 $(addprefix dist/,branding include public private xpi-stage) \
60 _tests \
61 $(NULL)
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
68 endif
69 install_manifest_depends = \
70 CLOBBER \
71 $(BUILD_BACKEND_FILES) \
72 $(NULL)
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
81 .PHONY: faster
82 faster:
83 $(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
84 endif
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 $*)))
93 endif
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/% ;
99 .PHONY: install-tests
100 install-tests: install-test-files
102 .PHONY: install-test-files
103 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
109 recurse_pre-export:
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
114 binaries::
115 @$(MAKE) install-manifests install_manifests=dist/include
117 ifdef BUILD_VERBOSE_LOG
118 verbose_flag = -v
119 endif
121 recurse_artifact:
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))
132 endif
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
140 endif
142 ifdef MOZ_WIDGET_TOOLKIT
143 ifdef ENABLE_TESTS
144 # Additional makefile targets to call automated test suites
145 include $(topsrcdir)/testing/testsuite-targets.mk
146 endif
147 endif
149 default all::
150 $(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
152 include $(topsrcdir)/config/rules.mk
154 ifdef SCCACHE_VERBOSE_STATS
155 default::
156 -$(CCACHE) --show-adv-stats --stats-format=json > '$(UPLOAD_PATH)/sccache-stats.json'
157 @echo "===SCCACHE STATS==="
158 -$(CCACHE) --show-adv-stats
159 @echo "==================="
160 endif
162 ifdef MOZ_CRASHREPORTER
163 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
165 endif
167 .PHONY: prepsymbolsarchive
168 prepsymbolsarchive:
169 echo packing symbols
170 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
172 ifndef MOZ_AUTOMATION
173 prepsymbolsarchive: recurse_syms
174 endif
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) \
181 --full-archive)
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
194 else
195 buildsymbols: symbolsarchive
196 endif # MOZ_ENABLE_FULL_SYMBOLS
197 else
198 buildsymbols:
199 @echo "Skipping symbols generation because MOZ_CRASHREPORTER is not set."
200 endif
202 uploadsymbols:
203 ifdef MOZ_CRASHREPORTER
204 $(PYTHON3) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
205 endif
207 .PHONY: package-generated-sources
208 package-generated-sources:
209 $(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
211 ifdef JS_STANDALONE
212 # Delegate js-specific rules to js
213 check-%:
214 $(MAKE) -C js/src $@
216 source-package install:
217 $(MAKE) -C js/src $@
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
222 config/export:
224 endif
226 # There used to be build interdependencies here. They are now in config/recurse.mk