Bug 1852149 Part 1 - Add margin-rule pref r=firefox-style-system-reviewers,emilio
[gecko.git] / Makefile.in
blob2d75b534c530d8918b4d8a0ea18b895adcc91260
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 $(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub: FORCE
28 endif
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)))
36 ifndef TEST_MOZBUILD
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)
40 endif
42 ifdef JS_STANDALONE
43 .PHONY: CLOBBER
44 CLOBBER:
45 else
46 CLOBBER: $(topsrcdir)/CLOBBER
47 @echo 'STOP! The CLOBBER file has changed.'
48 @echo 'Please run the build through "mach build".'
49 @exit 1
50 endif
52 install_manifests := \
53 $(addprefix dist/,branding include public private xpi-stage) \
54 _tests \
55 $(NULL)
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
62 endif
63 install_manifest_depends = \
64 CLOBBER \
65 $(BUILD_BACKEND_FILES) \
66 $(NULL)
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
75 .PHONY: faster
76 faster:
77 $(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
78 endif
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 $*)))
87 endif
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/% ;
93 .PHONY: install-tests
94 install-tests: install-test-files
96 .PHONY: install-test-files
97 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
103 recurse_pre-export:
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
108 binaries::
109 @$(MAKE) install-manifests install_manifests=dist/include
111 ifdef BUILD_VERBOSE_LOG
112 verbose_flag = -v
113 endif
115 recurse_artifact:
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))
126 endif
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
134 endif
136 ifdef MOZ_WIDGET_TOOLKIT
137 ifdef ENABLE_TESTS
138 # Additional makefile targets to call automated test suites
139 include $(topsrcdir)/testing/testsuite-targets.mk
140 endif
141 endif
143 default all::
144 $(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
146 include $(topsrcdir)/config/rules.mk
148 ifdef SCCACHE_VERBOSE_STATS
149 default::
150 -$(CCACHE) --show-adv-stats --stats-format=json > '$(UPLOAD_PATH)/sccache-stats.json'
151 @echo "===SCCACHE STATS==="
152 -$(CCACHE) --show-adv-stats
153 @echo "==================="
154 endif
156 ifdef MOZ_CRASHREPORTER
157 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
159 endif
161 .PHONY: prepsymbolsarchive
162 prepsymbolsarchive:
163 echo packing symbols
164 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
166 ifndef MOZ_AUTOMATION
167 prepsymbolsarchive: recurse_syms
168 endif
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) \
175 --full-archive)
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
188 else
189 buildsymbols: symbolsarchive
190 endif # MOZ_ENABLE_FULL_SYMBOLS
191 else
192 buildsymbols:
193 @echo "Skipping symbols generation because MOZ_CRASHREPORTER is not set."
194 endif
196 uploadsymbols:
197 ifdef MOZ_CRASHREPORTER
198 $(PYTHON3) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
199 endif
201 .PHONY: package-generated-sources
202 package-generated-sources:
203 $(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
205 ifdef JS_STANDALONE
206 # Delegate js-specific rules to js
207 check-%:
208 $(MAKE) -C js/src $@
210 source-package install:
211 $(MAKE) -C js/src $@
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
216 config/export:
218 endif
220 # There used to be build interdependencies here. They are now in config/recurse.mk