mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
e11506c714
This patch makes it so we write the sccache log directly to the artifact directory, so that it will be uploaded even if the build fails. It also makes the log slightly more verbose. Both of these should help with diagnosing sccache failures in CI. The sccache log will no longer be explicitly gzip compressed, but some Taskcluster client implementations will store it as gzip compressed. Differential Revision: https://phabricator.services.mozilla.com/D6187 --HG-- extra : moz-landing-system : lando
343 lines
11 KiB
Makefile
343 lines
11 KiB
Makefile
#
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
ifeq (,$(MAKE_VERSION))
|
|
$(error GNU Make is required)
|
|
endif
|
|
make_min_ver := 3.81
|
|
ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
|
|
$(error GNU Make $(make_min_ver) or higher is required)
|
|
endif
|
|
|
|
export TOPLEVEL_BUILD := 1
|
|
|
|
default::
|
|
|
|
ifndef TEST_MOZBUILD
|
|
ifdef MOZ_BUILD_APP
|
|
include $(wildcard $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk)
|
|
endif
|
|
endif
|
|
|
|
include $(topsrcdir)/config/config.mk
|
|
|
|
GARBAGE_DIRS += _javagen _profile staticlib
|
|
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
|
|
config/autoconf.mk \
|
|
mozilla-config.h \
|
|
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
|
|
.mozconfig.mk
|
|
|
|
ifndef MOZ_PROFILE_USE
|
|
# Automation builds should always have a new buildid, but for the sake of not
|
|
# re-linking libxul on every incremental build we do not enforce this for
|
|
# developer builds. Tests always need a new buildid as well.
|
|
ifneq (,$(MOZ_AUTOMATION)$(MOZ_BUILD_DATE)$(TEST_MOZBUILD))
|
|
$(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub: FORCE
|
|
endif
|
|
# Additionally, provide a dummy target during tests, because
|
|
# faster/rules.mk will expect these targets to exist.
|
|
ifdef TEST_MOZBUILD
|
|
source-repo.h: $(MDDEPDIR)/source-repo.h.stub
|
|
buildid.h: $(MDDEPDIR)/buildid.h.stub
|
|
endif
|
|
endif
|
|
|
|
ifdef JS_STANDALONE
|
|
configure_dir = $(topsrcdir)/js/src
|
|
else
|
|
configure_dir = $(topsrcdir)
|
|
endif
|
|
|
|
BUILD_BACKEND_FILES := $(addprefix backend.,$(addsuffix Backend,$(BUILD_BACKENDS)))
|
|
|
|
ifndef TEST_MOZBUILD
|
|
ifndef MOZ_PROFILE_USE
|
|
# We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
|
|
# rules.mk doesn't run early enough.
|
|
$(TIERS) binaries:: CLOBBER $(configure_dir)/configure config.status $(BUILD_BACKEND_FILES)
|
|
ifdef MOZ_WIDGET_TOOLKIT
|
|
ifdef COMPILE_ENVIRONMENT
|
|
$(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
ifdef JS_STANDALONE
|
|
.PHONY: CLOBBER
|
|
CLOBBER:
|
|
else
|
|
CLOBBER: $(topsrcdir)/CLOBBER
|
|
@echo 'STOP! The CLOBBER file has changed.'
|
|
@echo 'Please run the build through "mach build".'
|
|
@exit 1
|
|
endif
|
|
|
|
config.status: $(configure_dir)/configure $(configure_dir)/old-configure
|
|
js/src/config.status: $(topsrcdir)/js/src/configure $(topsrcdir)/js/src/old-configure
|
|
config.status js/src/config.status:
|
|
@echo 'STOP! $? has changed and needs to be run again.'
|
|
@echo 'Please rerun it.'
|
|
@echo 'To ignore this message, touch "$(CURDIR)/$@",'
|
|
@echo 'but your build might not succeed.'
|
|
@exit 1
|
|
|
|
# Regenerate the build backend if it is out of date. We only have this rule in
|
|
# this main make file because having it in rules.mk and applied to partial tree
|
|
# builds resulted in a world of hurt. Gory details are in bug 877308.
|
|
#
|
|
# The mach build driver will ensure the backend is up to date for partial tree
|
|
# builds. This cleanly avoids most of the pain.
|
|
|
|
ifndef TEST_MOZBUILD
|
|
|
|
.PHONY: backend
|
|
backend: $(BUILD_BACKEND_FILES)
|
|
|
|
include $(topsrcdir)/build/rebuild-backend.mk
|
|
|
|
Makefile: $(BUILD_BACKEND_FILES)
|
|
@$(TOUCH) $@
|
|
|
|
default:: $(BUILD_BACKEND_FILES)
|
|
endif
|
|
|
|
install_manifests := \
|
|
$(addprefix dist/,branding include public private xpi-stage) \
|
|
_tests \
|
|
$(NULL)
|
|
# Skip the dist/bin install manifest when using the hybrid
|
|
# FasterMake/RecursiveMake backend. This is a hack until bug 1241744 moves
|
|
# xpidl handling to FasterMake in that case, mechanically making the dist/bin
|
|
# install manifest non-existent (non-existent manifests being skipped)
|
|
ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
|
|
install_manifests += dist/bin
|
|
endif
|
|
install_manifest_depends = \
|
|
CLOBBER \
|
|
$(configure_dir)/configure \
|
|
config.status \
|
|
$(BUILD_BACKEND_FILES) \
|
|
$(NULL)
|
|
|
|
ifdef MOZ_WIDGET_TOOLKIT
|
|
ifdef COMPILE_ENVIRONMENT
|
|
install_manifest_depends += \
|
|
$(topsrcdir)/js/src/configure \
|
|
js/src/config.status \
|
|
$(NULL)
|
|
endif
|
|
endif
|
|
|
|
.PHONY: install-manifests
|
|
install-manifests: $(addprefix install-,$(install_manifests))
|
|
|
|
# If we're using the hybrid FasterMake/RecursiveMake backend, we want
|
|
# to recurse in the faster/ directory in parallel of install manifests.
|
|
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
|
|
install-manifests: faster
|
|
.PHONY: faster
|
|
faster:
|
|
$(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
|
|
endif
|
|
|
|
.PHONY: $(addprefix install-,$(install_manifests))
|
|
$(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
|
|
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
|
|
@# If we're using the hybrid FasterMake/RecursiveMake backend, we want
|
|
@# to ensure the FasterMake end doesn't have install manifests for the
|
|
@# same directory, because that would blow up
|
|
$(if $(wildcard _build_manifests/install/$(subst /,_,$*)),$(if $(wildcard faster/install_$(subst /,_,$*)*),$(error FasterMake and RecursiveMake ends of the hybrid build system want to handle $*)))
|
|
endif
|
|
$(addprefix $(call py_action,process_install_manifest,--track install_$(subst /,_,$*).track $*) ,$(wildcard _build_manifests/install/$(subst /,_,$*)))
|
|
|
|
# Dummy wrapper rule to allow the faster backend to piggy back
|
|
$(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))): install-dist_%: install-dist/% ;
|
|
|
|
.PHONY: install-tests
|
|
install-tests: install-test-files
|
|
|
|
.PHONY: install-test-files
|
|
install-test-files:
|
|
$(call py_action,process_install_manifest,--track install__test_files.track _tests _build_manifests/install/_test_files)
|
|
|
|
include $(topsrcdir)/build/moz-automation.mk
|
|
|
|
# dist and _tests should be purged during cleaning. However, we don't want them
|
|
# purged during PGO builds because they contain some auto-generated files.
|
|
ifneq ($(filter-out maybe_clobber_profiledbuild,$(MAKECMDGOALS)),)
|
|
GARBAGE_DIRS += dist _tests
|
|
endif
|
|
|
|
# Dummy rule for the cases below where we don't depend on dist/include
|
|
recurse_pre-export::
|
|
|
|
# Windows PGO builds don't perform a clean before the 2nd pass. So, we want
|
|
# to preserve content for the 2nd pass on Windows. Everywhere else, we always
|
|
# process the install manifests as part of export.
|
|
# For the binaries rule, not all the install manifests matter, so force only
|
|
# the interesting ones to be done.
|
|
ifdef MOZ_PROFILE_USE
|
|
ifndef NO_PROFILE_GUIDED_OPTIMIZE
|
|
ifneq ($(OS_ARCH)_$(GNU_CC), WINNT_)
|
|
recurse_pre-export:: install-manifests
|
|
binaries::
|
|
@$(MAKE) install-manifests install_manifests=dist/include
|
|
endif
|
|
endif
|
|
else # !MOZ_PROFILE_USE (normal build)
|
|
recurse_pre-export:: install-manifests
|
|
binaries::
|
|
@$(MAKE) install-manifests install_manifests=dist/include
|
|
endif
|
|
|
|
recurse_artifact:
|
|
$(topsrcdir)/mach --log-no-times artifact install
|
|
|
|
ifdef MOZ_WIDGET_TOOLKIT
|
|
ifdef ENABLE_TESTS
|
|
# Additional makefile targets to call automated test suites
|
|
include $(topsrcdir)/testing/testsuite-targets.mk
|
|
endif
|
|
endif
|
|
|
|
default all::
|
|
$(call BUILDSTATUS,TIERS $(TIERS) $(if $(MOZ_AUTOMATION),$(MOZ_AUTOMATION_TIERS)))
|
|
|
|
# PGO build target.
|
|
profiledbuild::
|
|
$(call BUILDSTATUS,TIERS pgo_profile_generate pgo_package pgo_profile pgo_clobber pgo_profile_use)
|
|
$(call BUILDSTATUS,TIER_START pgo_profile_generate)
|
|
$(MAKE) default MOZ_PROFILE_GENERATE=1
|
|
$(call BUILDSTATUS,TIER_FINISH pgo_profile_generate)
|
|
$(call BUILDSTATUS,TIER_START pgo_package)
|
|
$(MAKE) package MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
|
|
rm -f jarlog/en-US.log
|
|
$(call BUILDSTATUS,TIER_FINISH pgo_package)
|
|
$(call BUILDSTATUS,TIER_START pgo_profile)
|
|
JARLOG_FILE=jarlog/en-US.log $(PYTHON) $(topsrcdir)/build/pgo/profileserver.py 10
|
|
$(call BUILDSTATUS,TIER_FINISH pgo_profile)
|
|
$(call BUILDSTATUS,TIER_START pgo_clobber)
|
|
$(MAKE) maybe_clobber_profiledbuild
|
|
$(call BUILDSTATUS,TIER_FINISH pgo_clobber)
|
|
$(call BUILDSTATUS,TIER_START pgo_profile_use)
|
|
$(MAKE) default MOZ_PROFILE_USE=1 $(if $(CLANG_CL),MOZ_PROFILE_ORDER_FILE=$(topobjdir)/cygprofile.txt)
|
|
$(call BUILDSTATUS,TIER_FINISH pgo_profile_use)
|
|
|
|
# Change default target to PGO build if PGO is enabled.
|
|
ifdef MOZ_PGO
|
|
OVERRIDE_DEFAULT_GOAL := profiledbuild
|
|
endif
|
|
|
|
include $(topsrcdir)/config/rules.mk
|
|
|
|
ifdef SCCACHE_VERBOSE_STATS
|
|
default::
|
|
-$(CCACHE) --show-stats --stats-format=json > sccache-stats.json
|
|
@echo "===SCCACHE STATS==="
|
|
-$(CCACHE) --show-stats
|
|
@echo "==================="
|
|
endif
|
|
|
|
distclean::
|
|
$(RM) $(DIST_GARBAGE)
|
|
|
|
ifdef MOZ_CRASHREPORTER
|
|
include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
|
|
|
|
endif
|
|
|
|
.PHONY: prepsymbolsarchive
|
|
prepsymbolsarchive:
|
|
echo packing symbols
|
|
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
|
|
|
|
ifndef MOZ_AUTOMATION
|
|
prepsymbolsarchive: recurse_syms
|
|
endif
|
|
|
|
.PHONY: symbolsfullarchive
|
|
symbolsfullarchive: prepsymbolsarchive
|
|
$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
|
|
$(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
|
|
$(abspath $(DIST)/crashreporter-symbols) \
|
|
--full-archive)
|
|
|
|
.PHONY: symbolsarchive
|
|
symbolsarchive: prepsymbolsarchive
|
|
$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
|
|
$(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
|
|
$(abspath $(DIST)/crashreporter-symbols))
|
|
|
|
ifdef MOZ_CRASHREPORTER
|
|
# Set MOZ_DISABLE_FULL_SYMBOLS to disable generation and upload of the full
|
|
# crashreporter symbols archives
|
|
ifdef MOZ_DISABLE_FULL_SYMBOLS
|
|
buildsymbols: symbolsarchive
|
|
else
|
|
buildsymbols: symbolsfullarchive symbolsarchive
|
|
endif # MOZ_DISABLE_FULL_SYMBOLS
|
|
else
|
|
buildsymbols:
|
|
endif
|
|
|
|
uploadsymbols:
|
|
ifdef MOZ_CRASHREPORTER
|
|
$(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
|
|
endif
|
|
|
|
.PHONY: update-packaging
|
|
update-packaging:
|
|
$(MAKE) -C tools/update-packaging
|
|
|
|
.PHONY: package-generated-sources
|
|
package-generated-sources:
|
|
$(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)')
|
|
|
|
#XXX: this is a hack, since we don't want to clobber for MSVC
|
|
# PGO support, but we can't do this test in client.mk
|
|
# No point in clobbering if PGO has been explicitly disabled.
|
|
ifdef NO_PROFILE_GUIDED_OPTIMIZE
|
|
maybe_clobber_profiledbuild:
|
|
else
|
|
ifneq ($(CC_TYPE),msvc)
|
|
maybe_clobber_profiledbuild: clean
|
|
ifneq (,$(findstring clang,$(CC_TYPE)))
|
|
$(LLVM_PROFDATA) merge -o $(DEPTH)/merged.profdata $(DEPTH)/*.profraw
|
|
endif
|
|
else
|
|
maybe_clobber_profiledbuild:
|
|
$(RM) $(DIST)/bin/*.pgc
|
|
find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
|
|
endif # msvc
|
|
endif # NO_PROFILE_GUIDED_OPTIMIZE
|
|
|
|
.PHONY: maybe_clobber_profiledbuild
|
|
|
|
# Look for R_386_PC32 relocations in shared libs, these
|
|
# break x86_64 builds and SELinux users.
|
|
ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
|
|
check::
|
|
@relcount=`find $(DIST)/bin -name '*.so' | xargs objdump -R | grep R_386_PC32 | wc -l` && if test $$relcount -gt 0; then echo 'FAILED: R_386_PC32 relocations detected in a shared library. Did you use a system header without adding it to config/system-headers?'; exit 1; else echo 'PASSED'; fi
|
|
endif
|
|
|
|
ifdef JS_STANDALONE
|
|
# Delegate js-specific rules to js
|
|
check-%:
|
|
$(MAKE) -C js/src $@
|
|
|
|
source-package install:
|
|
$(MAKE) -C js/src $@
|
|
|
|
# Every export rule depends on config/export, but the rule for config/export
|
|
# doesn't exist when building js non-standalone.
|
|
.PHONY: config/export
|
|
config/export:
|
|
|
|
endif
|
|
|
|
# There used to be build interdependencies here. They are now in config/recurse.mk
|