Bug 1593728 Part 2: [devtools] Add a simple log message param and function to a conso...
[gecko.git] / Makefile.in
blob6292d5b349eea22ded0094ae0988bb724d75b65f
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 GARBAGE_DIRS += config.statusd
35 DIST_GARBAGE = config.cache config.log config.status config-defs.h \
36 config/autoconf.mk \
37 mozilla-config.h \
38 xpcom/xpcom-config.h \
39 .mozconfig.mk
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
47 BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS)))
49 ifndef TEST_MOZBUILD
50 # We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
51 # rules.mk doesn't run early enough.
52 $(RUNNABLE_TIERS) binaries:: CLOBBER $(BUILD_BACKEND_FILES)
53 endif
55 ifdef JS_STANDALONE
56 .PHONY: CLOBBER
57 CLOBBER:
58 else
59 CLOBBER: $(topsrcdir)/CLOBBER
60 @echo 'STOP! The CLOBBER file has changed.'
61 @echo 'Please run the build through "mach build".'
62 @exit 1
63 endif
65 install_manifests := \
66 $(addprefix dist/,branding include public private xpi-stage) \
67 _tests \
68 $(NULL)
69 # Skip the dist/bin install manifest when using the hybrid
70 # FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
71 # xpidl handling to FasterMake in that case, mechanically making the dist/bin
72 # install manifest non-existent (non-existent manifests being skipped)
73 ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
74 install_manifests += dist/bin
75 endif
76 install_manifest_depends = \
77 CLOBBER \
78 $(BUILD_BACKEND_FILES) \
79 $(NULL)
81 .PHONY: install-manifests
82 install-manifests: $(addprefix install-,$(install_manifests))
84 # If we're using the hybrid FasterMake/RecursiveMake backend, we want
85 # to recurse in the faster/ directory in parallel of install manifests.
86 ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
87 install-manifests: faster
88 .PHONY: faster
89 faster:
90 $(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
91 endif
93 .PHONY: $(addprefix install-,$(install_manifests))
94 $(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
95 ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
96 @# If we're using the hybrid FasterMake/RecursiveMake backend, we want
97 @# to ensure the FasterMake end doesn't have install manifests for the
98 @# same directory, because that would blow up
99 $(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
100 endif
101 $(addprefix $(call py_action,process_install_manifest,$(if $(filter copy,$(NSDISTMODE)),--no-symlinks )--track install_$(subst /,_,$*).track $*) ,$(wildcard _build_manifests/install/$(subst /,_,$*)))
103 # Dummy wrapper rule to allow the faster backend to piggy back
104 $(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ;
106 .PHONY: install-tests
107 install-tests: install-test-files
109 .PHONY: install-test-files
110 install-test-files:
111 $(call py_action,process_install_manifest,$(if $(filter copy,$(NSDISTMODE)),--no-symlinks )--track install__test_files.track _tests _build_manifests/install/_test_files)
113 include $(topsrcdir)/build/moz-automation.mk
115 # dist and _tests should be purged during cleaning.
116 GARBAGE_DIRS += dist _tests
118 # Dummy rule for the cases below where we don't depend on dist/include
119 recurse_pre-export::
121 # For the binaries rule, not all the install manifests matter, so force only
122 # the interesting ones to be done.
123 recurse_pre-export:: install-manifests
124 binaries::
125 @$(MAKE) install-manifests install_manifests=dist/include
127 ifdef BUILD_VERBOSE_LOG
128 verbose_flag = -v
129 endif
131 # Host binaries are not produced for macOS consumers: that is, there's
132 # no macOS-hosted job to produce them at this time. Therefore we
133 # enable --host-bins only for automation builds, which only require Linux and
134 # Windows host binaries.
135 recurse_artifact:
136 $(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) $(verbose_flag)
138 ifdef MOZ_EME_WIN32_ARTIFACT
139 recurse_win32-artifact:
140 rm -rf $(DIST)/i686
141 $(topsrcdir)/mach --log-no-times artifact install --job $(if $(MOZ_PGO),win32-pgo,win32-opt) --no-tests --distdir $(DIST)/i686 $(verbose_flag)
142 mv $(DIST)/i686/bin/* $(DIST)/i686
143 endif
145 ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
146 recurse_android-fat-aar-artifact:
147 $(call py_action,fat_aar,\
148 $(addprefix --armeabi-v7a $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_ARMEABI_V7A)) \
149 $(addprefix --arm64-v8a $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_ARM64_V8A)) \
150 $(addprefix --x86 $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_X86)) \
151 $(addprefix --x86-64 $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_X86_64)) \
152 --distdir $(abspath $(DIST)/fat-aar))
153 endif
155 ifeq ($(MOZ_BUILD_APP),mobile/android)
157 recurse_android-stage-package: stage-package
159 recurse_android-archive-geckoview:
160 GRADLE_INVOKED_WITHIN_MACH_BUILD=1 $(topsrcdir)/mach --log-no-times android archive-geckoview
161 endif
163 ifdef MOZ_WIDGET_TOOLKIT
164 ifdef ENABLE_TESTS
165 # Additional makefile targets to call automated test suites
166 include $(topsrcdir)/testing/testsuite-targets.mk
167 endif
168 endif
170 default all::
171 $(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
173 include $(topsrcdir)/config/rules.mk
175 ifdef SCCACHE_VERBOSE_STATS
176 default::
177 -$(CCACHE) --show-stats --stats-format=json > sccache-stats.json
178 @echo "===SCCACHE STATS==="
179 -$(CCACHE) --show-stats
180 @echo "==================="
181 endif
183 distclean::
184 $(RM) $(DIST_GARBAGE)
186 ifdef MOZ_CRASHREPORTER
187 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
189 endif
191 .PHONY: prepsymbolsarchive
192 prepsymbolsarchive:
193 echo packing symbols
194 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
196 ifndef MOZ_AUTOMATION
197 prepsymbolsarchive: recurse_syms
198 endif
200 .PHONY: symbolsfullarchive
201 symbolsfullarchive: prepsymbolsarchive
202 $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
203 $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
204 $(abspath $(DIST)/crashreporter-symbols) \
205 --full-archive)
207 .PHONY: symbolsarchive
208 symbolsarchive: prepsymbolsarchive
209 $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
210 $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
211 $(abspath $(DIST)/crashreporter-symbols))
213 ifdef MOZ_CRASHREPORTER
214 # Set MOZ_ENABLE_FULL_SYMBOLS to enable generation and upload of the full
215 # crashreporter symbols archives
216 ifdef MOZ_ENABLE_FULL_SYMBOLS
217 buildsymbols: symbolsfullarchive symbolsarchive
218 else
219 buildsymbols: symbolsarchive
220 endif # MOZ_ENABLE_FULL_SYMBOLS
221 else
222 buildsymbols:
223 endif
225 uploadsymbols:
226 ifdef MOZ_CRASHREPORTER
227 $(PYTHON3) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
228 endif
230 .PHONY: update-packaging
231 update-packaging:
232 $(MAKE) -C tools/update-packaging
234 .PHONY: package-generated-sources
235 package-generated-sources:
236 $(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
238 ifdef JS_STANDALONE
239 # Delegate js-specific rules to js
240 check-%:
241 $(MAKE) -C js/src $@
243 source-package install:
244 $(MAKE) -C js/src $@
246 # Every export rule depends on config/export, but the rule for config/export
247 # doesn't exist when building js non-standalone.
248 .PHONY: config/export
249 config/export:
251 endif
253 # There used to be build interdependencies here. They are now in config/recurse.mk