| 1 |
# |
| 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/. |
| 5 |
|
| 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 |
| 13 |
|
| 14 |
export TOPLEVEL_BUILD := 1 |
| 15 |
|
| 16 |
default:: |
| 17 |
|
| 18 |
ifndef TEST_MOZBUILD |
| 19 |
ifdef MOZ_BUILD_APP |
| 20 |
include $(wildcard $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk) |
| 21 |
endif |
| 22 |
endif |
| 23 |
|
| 24 |
include $(topsrcdir)/config/config.mk |
| 25 |
|
| 26 |
ifneq (mobile/android,$(MOZ_BUILD_APP)) |
| 27 |
# We only want to generate buildid.h once, during the (recurse) export phase. |
| 28 |
# faster make build the files explicitly so also match thoses |
| 29 |
ifneq ($(filter $(MAKECMDGOALS),recurse_export buildid.h source-repo.h),) |
| 30 |
$(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub: FORCE |
| 31 |
endif |
| 32 |
endif |
| 33 |
source-repo.h: $(MDDEPDIR)/source-repo.h.stub |
| 34 |
buildid.h: $(MDDEPDIR)/buildid.h.stub |
| 35 |
# Add explicit dependencies that moz.build can't declare yet. |
| 36 |
build/$(MDDEPDIR)/application.ini.stub: source-repo.h buildid.h |
| 37 |
|
| 38 |
BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS))) |
| 39 |
|
| 40 |
ifndef TEST_MOZBUILD |
| 41 |
# We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in |
| 42 |
# rules.mk doesn't run early enough. |
| 43 |
$(RUNNABLE_TIERS) binaries:: CLOBBER $(BUILD_BACKEND_FILES) |
| 44 |
endif |
| 45 |
|
| 46 |
ifdef JS_STANDALONE |
| 47 |
.PHONY: CLOBBER |
| 48 |
CLOBBER: |
| 49 |
else |
| 50 |
CLOBBER: $(topsrcdir)/CLOBBER |
| 51 |
@echo 'STOP! The CLOBBER file has changed.' |
| 52 |
@echo 'Please run the build through "mach build".' |
| 53 |
@exit 1 |
| 54 |
endif |
| 55 |
|
| 56 |
install_manifests := \ |
| 57 |
$(addprefix dist/,branding include public private xpi-stage) \ |
| 58 |
_tests \ |
| 59 |
$(NULL) |
| 60 |
# Skip the dist/bin install manifest when using the hybrid |
| 61 |
# FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves |
| 62 |
# xpidl handling to FasterMake in that case, mechanically making the dist/bin |
| 63 |
# install manifest non-existent (non-existent manifests being skipped) |
| 64 |
ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS))) |
| 65 |
install_manifests += dist/bin |
| 66 |
endif |
| 67 |
install_manifest_depends = \ |
| 68 |
CLOBBER \ |
| 69 |
$(BUILD_BACKEND_FILES) \ |
| 70 |
$(NULL) |
| 71 |
|
| 72 |
.PHONY: install-manifests |
| 73 |
install-manifests: $(addprefix install-,$(install_manifests)) |
| 74 |
|
| 75 |
# If we're using the hybrid FasterMake/RecursiveMake backend, we want |
| 76 |
# to recurse in the faster/ directory in parallel of install manifests. |
| 77 |
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS))) |
| 78 |
install-manifests: faster |
| 79 |
.PHONY: faster |
| 80 |
faster: |
| 81 |
$(MAKE) -C faster FASTER_RECURSIVE_MAKE=1 |
| 82 |
endif |
| 83 |
|
| 84 |
.PHONY: $(addprefix install-,$(install_manifests)) |
| 85 |
$(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends) |
| 86 |
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS))) |
| 87 |
@# If we're using the hybrid FasterMake/RecursiveMake backend, we want |
| 88 |
@# to ensure the FasterMake end doesn't have install manifests for the |
| 89 |
@# same directory, because that would blow up |
| 90 |
$(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*))) |
| 91 |
endif |
| 92 |
$(foreach manifest,$(wildcard _build_manifests/install/$(subst /,_,$*)),$(call py_action,process_install_manifest $*,$(if $(filter copy,$(NSDISTMODE)),--no-symlinks )--track install_$(subst /,_,$*).track $* $(manifest))) |
| 93 |
|
| 94 |
# Dummy wrapper rule to allow the faster backend to piggy back |
| 95 |
$(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ; |
| 96 |
|
| 97 |
.PHONY: install-tests |
| 98 |
install-tests: install-test-files |
| 99 |
|
| 100 |
.PHONY: install-test-files |
| 101 |
install-test-files: |
| 102 |
$(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) |
| 103 |
|
| 104 |
include $(topsrcdir)/build/moz-automation.mk |
| 105 |
|
| 106 |
# Dummy rule for the cases below where we don't depend on dist/include |
| 107 |
recurse_pre-export: |
| 108 |
|
| 109 |
# For the binaries rule, not all the install manifests matter, so force only |
| 110 |
# the interesting ones to be done. |
| 111 |
recurse_pre-export: install-manifests |
| 112 |
binaries:: |
| 113 |
@$(MAKE) install-manifests install_manifests=dist/include |
| 114 |
|
| 115 |
ifdef BUILD_VERBOSE_LOG |
| 116 |
verbose_flag = -v |
| 117 |
endif |
| 118 |
|
| 119 |
recurse_artifact: |
| 120 |
$(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) |
| 121 |
|
| 122 |
ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES |
| 123 |
recurse_android-fat-aar-artifact: |
| 124 |
$(call py_action,fat_aar,\ |
| 125 |
$(addprefix --armeabi-v7a $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_ARMEABI_V7A)) \ |
| 126 |
$(addprefix --arm64-v8a $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_ARM64_V8A)) \ |
| 127 |
$(addprefix --x86 $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_X86)) \ |
| 128 |
$(addprefix --x86-64 $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_X86_64)) \ |
| 129 |
--distdir $(abspath $(DIST)/fat-aar)) |
| 130 |
endif |
| 131 |
|
| 132 |
ifeq ($(MOZ_BUILD_APP),mobile/android) |
| 133 |
|
| 134 |
recurse_android-stage-package: stage-package |
| 135 |
|
| 136 |
recurse_android-archive-geckoview: |
| 137 |
GRADLE_INVOKED_WITHIN_MACH_BUILD=1 $(topsrcdir)/mach --log-no-times android archive-geckoview $(if $(MOZ_AUTOMATION),--no-configuration-cache) |
| 138 |
endif |
| 139 |
|
| 140 |
ifdef MOZ_WIDGET_TOOLKIT |
| 141 |
ifdef ENABLE_TESTS |
| 142 |
# Additional makefile targets to call automated test suites |
| 143 |
include $(topsrcdir)/testing/testsuite-targets.mk |
| 144 |
endif |
| 145 |
endif |
| 146 |
|
| 147 |
default all:: |
| 148 |
$(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS))) |
| 149 |
|
| 150 |
include $(topsrcdir)/config/rules.mk |
| 151 |
|
| 152 |
ifdef SCCACHE_VERBOSE_STATS |
| 153 |
default:: |
| 154 |
-$(CCACHE) --show-adv-stats --stats-format=json > '$(UPLOAD_PATH)/sccache-stats.json' |
| 155 |
@echo "===SCCACHE STATS===" |
| 156 |
-$(CCACHE) --show-adv-stats |
| 157 |
@echo "===================" |
| 158 |
endif |
| 159 |
|
| 160 |
ifdef MOZ_CRASHREPORTER |
| 161 |
include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk |
| 162 |
|
| 163 |
endif |
| 164 |
|
| 165 |
.PHONY: prepsymbolsarchive |
| 166 |
prepsymbolsarchive: |
| 167 |
echo packing symbols |
| 168 |
$(NSINSTALL) -D $(DIST)/$(PKG_PATH) |
| 169 |
|
| 170 |
ifndef MOZ_AUTOMATION |
| 171 |
prepsymbolsarchive: recurse_syms |
| 172 |
endif |
| 173 |
|
| 174 |
.PHONY: symbolsfullarchive |
| 175 |
symbolsfullarchive: prepsymbolsarchive |
| 176 |
$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' |
| 177 |
$(call py_action,symbols_archive $(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \ |
| 178 |
$(abspath $(DIST)/crashreporter-symbols) \ |
| 179 |
--full-archive) |
| 180 |
|
| 181 |
.PHONY: symbolsarchive |
| 182 |
symbolsarchive: prepsymbolsarchive |
| 183 |
$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' |
| 184 |
$(call py_action,symbols_archive $(SYMBOL_ARCHIVE_BASENAME).zip,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \ |
| 185 |
$(abspath $(DIST)/crashreporter-symbols)) |
| 186 |
|
| 187 |
ifdef MOZ_CRASHREPORTER |
| 188 |
# Set MOZ_ENABLE_FULL_SYMBOLS to enable generation and upload of the full |
| 189 |
# crashreporter symbols archives |
| 190 |
ifdef MOZ_ENABLE_FULL_SYMBOLS |
| 191 |
buildsymbols: symbolsfullarchive symbolsarchive |
| 192 |
else |
| 193 |
buildsymbols: symbolsarchive |
| 194 |
endif # MOZ_ENABLE_FULL_SYMBOLS |
| 195 |
else |
| 196 |
buildsymbols: |
| 197 |
@echo "Skipping symbols generation because MOZ_CRASHREPORTER is not set." |
| 198 |
endif |
| 199 |
|
| 200 |
uploadsymbols: |
| 201 |
ifdef MOZ_CRASHREPORTER |
| 202 |
$(PYTHON3) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' |
| 203 |
endif |
| 204 |
|
| 205 |
.PHONY: package-generated-sources |
| 206 |
package-generated-sources: |
| 207 |
$(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)') |
| 208 |
|
| 209 |
ifdef JS_STANDALONE |
| 210 |
# Delegate js-specific rules to js |
| 211 |
check-%: |
| 212 |
$(MAKE) -C js/src $@ |
| 213 |
|
| 214 |
source-package install: |
| 215 |
$(MAKE) -C js/src $@ |
| 216 |
|
| 217 |
# Every export rule depends on config/export, but the rule for config/export |
| 218 |
# doesn't exist when building js non-standalone. |
| 219 |
.PHONY: config/export |
| 220 |
config/export: |
| 221 |
|
| 222 |
endif |
| 223 |
|
| 224 |
# There used to be build interdependencies here. They are now in config/recurse.mk |