1999-12-15 12:40:24 +03:00
#
2012-05-21 15:12:37 +04:00
# 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/.
1998-08-21 07:34:44 +04:00
2009-03-11 23:32:10 +03:00
i f e q ( , $( MAKE_VERSION ) )
$( error GNU Make is required )
e n d i f
2013-10-17 02:55:14 +04:00
make_min_ver := 3.81
i f n e q ( $( make_min_ver ) , $( firstword $ ( sort $ ( make_min_ver ) $ ( MAKE_VERSION ) ) ) )
$( error GNU Make $ ( make_min_ver ) or higher is required )
2009-03-11 23:32:10 +03:00
e n d i f
2013-05-17 21:54:53 +04:00
export TOPLEVEL_BUILD := 1
2008-12-19 17:50:24 +03:00
default ::
2005-11-08 20:53:54 +03:00
2016-02-09 08:36:07 +03:00
i f n d e f T E S T _ M O Z B U I L D
2014-01-14 02:38:40 +04:00
i f d e f M O Z _ B U I L D _ A P P
2016-03-18 12:24:54 +03:00
i n c l u d e $( wildcard $ ( topsrcdir ) /$ ( MOZ_BUILD_APP ) /build .mk )
2014-01-14 02:38:40 +04:00
e n d i f
2016-02-09 08:36:07 +03:00
e n d i f
2002-10-25 09:59:52 +04:00
2008-12-19 17:50:24 +03:00
i n c l u d e $( topsrcdir ) / c o n f i g / c o n f i g . m k
2015-02-13 16:11:57 +03:00
GARBAGE_DIRS += _javagen _profile staticlib
2019-04-09 21:59:19 +03:00
# To share compilation of dependencies, Rust libraries all set their
# CARGO_TARGET_DIR as a subdirectory of topobjdir. Normally, we would add
# RUST*TARGET to GARBAGE_DIRS for those directories building Rust libraries.
# But the directories building Rust libraries don't actually have
# subdirectories to remove. So we add to GARBAGE_DIRS once here, globally,
# for it to have the desired effect.
GARBAGE_DIRS += $( RUST_TARGET)
2012-08-29 10:55:58 +04:00
DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
Bug 627277 - Remove (broken) BeOS support. r=biesi,dwitte,gavin,joe,jorendorff,josh,khuey,mfinkle,neil,Pike,roc,shaver,smontagu,taras
2011-02-19 22:10:24 +03:00
config/autoconf.mk \
2013-08-22 10:55:59 +04:00
mozilla-config.h \
2008-01-29 01:05:47 +03:00
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
2013-09-05 04:01:44 +04:00
.mozconfig.mk
1998-10-28 06:40:33 +03:00
2016-02-09 08:36:07 +03:00
i f n d e f M O Z _ P R O F I L E _ U S E
2019-06-06 07:35:02 +03:00
i f n e q ( m o b i l e / a n d r o i d , $( MOZ_BUILD_APP ) )
2018-06-23 01:10:39 +03:00
$(MDDEPDIR)/buildid.h.stub $(MDDEPDIR)/source-repo.h.stub : FORCE
e n d i f
source-repo.h : $( MDDEPDIR ) /source -repo .h .stub
buildid.h : $( MDDEPDIR ) /buildid .h .stub
2016-02-09 08:36:07 +03:00
e n d i f
Bug 1239217 - Make the RecursiveMake build system create backend files generically. r=gps
The current rule is only for "backend.RecursiveMakeBackend", but, with
the current default of generating both the RecursiveMake and FasterMake
backends, the command creates/refreshes both backends. This is, in fact,
how the FasterMake backend is refreshed in most cases.
Moreover, with an hybrid backends, the generated file is not
"backend.RecursiveMakeBackend" anymore, so we need a more generic way to
handle this.
Furthermore, it's not necessarily desirable for all backends to have a
dependency file to handle the dependencies to refresh the backend, so
generate a plain list instead. This has the side effect of making `mach
build-backend --diff` more readable for changes to that file.
Finally, make the backend.* files created like any other backend file,
such that its diff appears in the `mach build-backend --diff` output.
2016-01-22 04:02:48 +03:00
BUILD_BACKEND_FILES := $( addprefix backend.,$( addsuffix Backend,$( BUILD_BACKENDS) ) )
2015-11-30 11:43:06 +03:00
i f n d e f T E S T _ M O Z B U I L D
2013-04-12 18:03:06 +04:00
i f n d e f M O Z _ P R O F I L E _ U S E
Bug 1239217 - Make the RecursiveMake build system create backend files generically. r=gps
The current rule is only for "backend.RecursiveMakeBackend", but, with
the current default of generating both the RecursiveMake and FasterMake
backends, the command creates/refreshes both backends. This is, in fact,
how the FasterMake backend is refreshed in most cases.
Moreover, with an hybrid backends, the generated file is not
"backend.RecursiveMakeBackend" anymore, so we need a more generic way to
handle this.
Furthermore, it's not necessarily desirable for all backends to have a
dependency file to handle the dependencies to refresh the backend, so
generate a plain list instead. This has the side effect of making `mach
build-backend --diff` more readable for changes to that file.
Finally, make the backend.* files created like any other backend file,
such that its diff appears in the `mach build-backend --diff` output.
2016-01-22 04:02:48 +03:00
# We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
# rules.mk doesn't run early enough.
2018-10-17 01:21:36 +03:00
$(TIERS) binaries :: CLOBBER $( BUILD_BACKEND_FILES )
2014-03-21 06:52:25 +04:00
e n d i f
2015-11-30 11:43:06 +03:00
e n d i f
2008-12-19 17:50:24 +03:00
2014-02-11 05:37:47 +04:00
i f d e f J S _ S T A N D A L O N E
2014-01-14 02:38:40 +04:00
.PHONY : CLOBBER
CLOBBER :
e l s e
2013-03-29 21:34:58 +04:00
CLOBBER : $( topsrcdir ) /CLOBBER
2013-12-03 01:34:21 +04:00
@echo 'STOP! The CLOBBER file has changed.'
2017-10-27 20:19:05 +03:00
@echo 'Please run the build through "mach build".'
2013-03-29 21:34:58 +04:00
@exit 1
2014-01-14 02:38:40 +04:00
e n d i f
2013-03-29 21:34:58 +04:00
2014-09-05 05:27:39 +04:00
install_manifests := \
2018-05-15 17:05:23 +03:00
$( addprefix dist/,branding include public private xpi-stage) \
2014-09-05 05:27:39 +04:00
_tests \
$( NULL)
2016-01-22 05:13:26 +03:00
# 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)
i f e q ( , $( filter FasterMake +RecursiveMake ,$ ( BUILD_BACKENDS ) ) )
install_manifests += dist/bin
e n d i f
2013-09-17 04:49:44 +04:00
install_manifest_depends = \
CLOBBER \
Bug 1239217 - Make the RecursiveMake build system create backend files generically. r=gps
The current rule is only for "backend.RecursiveMakeBackend", but, with
the current default of generating both the RecursiveMake and FasterMake
backends, the command creates/refreshes both backends. This is, in fact,
how the FasterMake backend is refreshed in most cases.
Moreover, with an hybrid backends, the generated file is not
"backend.RecursiveMakeBackend" anymore, so we need a more generic way to
handle this.
Furthermore, it's not necessarily desirable for all backends to have a
dependency file to handle the dependencies to refresh the backend, so
generate a plain list instead. This has the side effect of making `mach
build-backend --diff` more readable for changes to that file.
Finally, make the backend.* files created like any other backend file,
such that its diff appears in the `mach build-backend --diff` output.
2016-01-22 04:02:48 +03:00
$( BUILD_BACKEND_FILES) \
2013-09-17 04:49:44 +04:00
$( NULL)
.PHONY : install -manifests
2014-09-05 05:27:39 +04:00
install-manifests : $( addprefix install -,$ ( install_manifests ) )
2013-09-17 04:49:44 +04:00
2016-01-22 05:13:26 +03:00
# If we're using the hybrid FasterMake/RecursiveMake backend, we want
# to recurse in the faster/ directory in parallel of install manifests.
i f n e q ( , $( filter FasterMake +RecursiveMake ,$ ( BUILD_BACKENDS ) ) )
install-manifests : faster
.PHONY : faster
2018-05-15 17:05:23 +03:00
faster :
2016-01-22 05:13:26 +03:00
$( MAKE) -C faster FASTER_RECURSIVE_MAKE = 1
e n d i f
2017-08-10 21:58:04 +03:00
.PHONY : $( addprefix install -,$ ( install_manifests ) )
2016-01-21 12:10:57 +03:00
$(addprefix install-,$(install_manifests)) : install -%: $( install_manifest_depends )
2016-01-22 05:13:26 +03:00
i f n e q ( , $( 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 $* ) ) )
e n d i f
2017-08-09 00:07:07 +03:00
$( addprefix $( call py_action,process_install_manifest,--track install_$( subst /,_,$* ) .track $* ) ,$( wildcard _build_manifests/install/$( subst /,_,$* ) ) )
2013-09-17 04:49:44 +04:00
2015-09-25 11:18:45 +03:00
# Dummy wrapper rule to allow the faster backend to piggy back
2016-01-23 22:39:18 +03:00
$(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))) : install -dist_ %: install -dist /% ;
2015-09-25 11:18:45 +03:00
2014-09-05 05:27:39 +04:00
.PHONY : install -tests
2016-04-05 00:56:52 +03:00
install-tests : install -test -files
.PHONY : install -test -files
install-test-files :
2017-08-09 00:07:07 +03:00
$( call py_action,process_install_manifest,--track install__test_files.track _tests _build_manifests/install/_test_files)
2014-09-05 05:27:39 +04:00
2014-05-16 22:37:31 +04:00
i n c l u d e $( topsrcdir ) / b u i l d / m o z - a u t o m a t i o n . m k
2013-09-25 02:05:43 +04:00
2015-02-13 16:11:57 +03:00
# 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.
2013-09-25 02:05:43 +04:00
i f n e q ( $( filter -out maybe_clobber_profiledbuild ,$ ( MAKECMDGOALS ) ) , )
2015-02-13 16:11:57 +03:00
GARBAGE_DIRS += dist _tests
2013-09-25 02:05:43 +04:00
e n d i f
2017-08-09 22:35:15 +03:00
# Dummy rule for the cases below where we don't depend on dist/include
recurse_pre-export ::
2013-09-17 04:49:44 +04:00
# 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.
2014-09-05 05:27:39 +04:00
# For the binaries rule, not all the install manifests matter, so force only
# the interesting ones to be done.
2019-06-20 01:06:14 +03:00
i f d e f M O Z _ 1 T I E R _ P G O
2013-09-17 04:49:44 +04:00
i f n d e f N O _ P R O F I L E _ G U I D E D _ O P T I M I Z E
i f n e q ( $( OS_ARCH ) _ $( GNU_CC ) , W I N N T _ )
2016-01-21 11:08:53 +03:00
recurse_pre-export :: install -manifests
2013-10-02 03:53:23 +04:00
binaries ::
2017-08-09 00:07:07 +03:00
@$( MAKE) install-manifests install_manifests = dist/include
2013-09-17 04:49:44 +04:00
e n d i f
e n d i f
2019-06-20 01:06:14 +03:00
e l s e # !MOZ_1TIER_PGO (normal build)
2016-01-21 11:08:53 +03:00
recurse_pre-export :: install -manifests
2013-10-02 03:53:23 +04:00
binaries ::
2017-08-09 00:07:07 +03:00
@$( MAKE) install-manifests install_manifests = dist/include
2013-09-17 04:49:44 +04:00
e n d i f
2019-02-22 01:53:43 +03:00
# Host binaries are not produced for macOS consumers: that is, there's
# no macOS-hosted job to produce them at this time. Therefore we
# enable --host-bins only for automation builds, which only require Linux and
# Windows host binaries.
2016-06-01 20:48:53 +03:00
recurse_artifact :
2019-03-16 00:56:14 +03:00
$( 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)
2016-06-01 20:48:53 +03:00
2019-03-05 11:41:04 +03:00
i f d e f M O Z _ E M E _ W I N 3 2 _ A R T I F A C T
recurse_win32-artifact :
rm -rf $( DIST) /i686
$( topsrcdir) /mach --log-no-times artifact install --job $( if $( MOZ_PGO) ,win32-pgo,win32-opt) --no-tests --distdir $( DIST) /i686
mv $( DIST) /i686/bin/* $( DIST) /i686
e n d i f
2019-05-30 18:22:09 +03:00
i f d e f M O Z _ A N D R O I D _ F A T _ A A R _ A R C H I T E C T U R E S
recurse_android-fat-aar-artifact :
$( call py_action,fat_aar,$( MOZ_ANDROID_FAT_AAR_ARCHITECTURES) --distdir $( abspath $( DIST) /fat-aar) )
e n d i f # MOZ_ANDROID_FAT_AAR_ARCHITECTURES
2017-10-05 08:50:01 +03:00
i f d e f M O Z _ W I D G E T _ T O O L K I T
2008-12-19 17:50:24 +03:00
i f d e f E N A B L E _ T E S T S
# Additional makefile targets to call automated test suites
i n c l u d e $( topsrcdir ) / t e s t i n g / t e s t s u i t e - t a r g e t s . m k
e n d i f
2014-01-14 02:38:40 +04:00
e n d i f
2008-12-19 17:50:24 +03:00
2013-09-05 10:07:57 +04:00
default all ::
2014-11-06 03:29:11 +03:00
$( call BUILDSTATUS,TIERS $( TIERS) $( if $( MOZ_AUTOMATION) ,$( MOZ_AUTOMATION_TIERS) ) )
2013-08-21 00:03:39 +04:00
2017-11-08 02:08:11 +03:00
# 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)
2019-03-06 01:09:46 +03:00
$( MAKE) default MOZ_PROFILE_GENERATE = 1 MOZ_LTO =
2017-11-08 02:08:11 +03:00
$( call BUILDSTATUS,TIER_FINISH pgo_profile_generate)
$( call BUILDSTATUS,TIER_START pgo_package)
2018-08-17 19:40:10 +03:00
$( MAKE) package MOZ_INTERNAL_SIGNING_FORMAT = MOZ_EXTERNAL_SIGNING_FORMAT =
2017-11-08 02:08:11 +03:00
rm -f jarlog/en-US.log
$( call BUILDSTATUS,TIER_FINISH pgo_package)
$( call BUILDSTATUS,TIER_START pgo_profile)
2019-01-10 04:34:39 +03:00
JARLOG_FILE = jarlog/en-US.log $( PYTHON) $( topsrcdir) /build/pgo/profileserver.py
2017-11-08 02:08:11 +03:00
$( 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)
2019-06-20 01:06:14 +03:00
$( MAKE) default MOZ_PROFILE_USE = 1 MOZ_1TIER_PGO = 1
2017-11-08 02:08:11 +03:00
$( call BUILDSTATUS,TIER_FINISH pgo_profile_use)
2017-11-08 03:38:39 +03:00
# Change default target to PGO build if PGO is enabled.
i f d e f M O Z _ P G O
2019-01-09 02:03:27 +03:00
i f d e f C O M P I L E _ E N V I R O N M E N T
2019-01-03 19:16:38 +03:00
# If one of these is already set in addition to PGO we are doing a single phase
# of PGO in isolation, so don't override the default target.
i f e q ( , $( MOZ_PROFILE_GENERATE ) $( MOZ_PROFILE_USE ) )
2017-11-08 03:38:39 +03:00
OVERRIDE_DEFAULT_GOAL := profiledbuild
e n d i f
2019-01-03 19:16:38 +03:00
e n d i f
2019-01-09 02:03:27 +03:00
e n d i f
2017-11-08 03:38:39 +03:00
2013-09-06 04:17:59 +04:00
i n c l u d e $( topsrcdir ) / c o n f i g / r u l e s . m k
2013-08-21 00:03:39 +04:00
2016-08-26 01:39:57 +03:00
i f d e f S C C A C H E _ V E R B O S E _ S T A T S
default ::
2017-04-12 22:06:22 +03:00
-$( CCACHE) --show-stats --stats-format= json > sccache-stats.json
2016-08-26 01:39:57 +03:00
@echo "===SCCACHE STATS==="
-$( CCACHE) --show-stats
@echo "==================="
2017-07-20 05:31:14 +03:00
e n d i f
2016-08-26 01:39:57 +03:00
2000-12-13 00:28:24 +03:00
distclean ::
2013-08-22 10:55:59 +04:00
$( RM) $( DIST_GARBAGE)
2002-03-01 04:01:42 +03:00
2016-05-30 20:45:19 +03:00
i f d e f M O Z _ C R A S H R E P O R T E R
2009-02-17 17:18:50 +03:00
i n c l u d e $( topsrcdir ) / t o o l k i t / m o z a p p s / i n s t a l l e r / p a c k a g e - n a m e . m k
2016-05-30 20:45:19 +03:00
e n d i f
2007-09-10 21:36:17 +04:00
2017-02-10 19:34:08 +03:00
.PHONY : prepsymbolsarchive
prepsymbolsarchive :
2007-01-12 02:42:21 +03:00
echo packing symbols
2009-11-04 17:59:47 +03:00
$( NSINSTALL) -D $( DIST) /$( PKG_PATH)
2016-10-04 15:57:35 +03:00
2017-02-10 19:34:08 +03:00
i f n d e f M O Z _ A U T O M A T I O N
prepsymbolsarchive : recurse_syms
e n d i f
2016-10-04 15:57:35 +03:00
.PHONY : symbolsfullarchive
2017-02-10 19:34:08 +03:00
symbolsfullarchive : prepsymbolsarchive
2017-04-28 06:37:11 +03:00
$( RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
2017-07-11 00:25:04 +03:00
$( call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
2017-04-28 06:37:11 +03:00
$( abspath $( DIST) /crashreporter-symbols) \
2018-07-12 02:38:37 +03:00
--full-archive)
2016-10-04 15:57:35 +03:00
.PHONY : symbolsarchive
2017-02-10 19:34:08 +03:00
symbolsarchive : prepsymbolsarchive
2017-04-28 06:37:11 +03:00
$( RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
2017-07-11 00:25:04 +03:00
$( call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
2018-07-12 02:38:37 +03:00
$( abspath $( DIST) /crashreporter-symbols) )
2016-10-04 15:57:35 +03:00
i f d e f M O Z _ C R A S H R E P O R T E R
2018-07-30 23:23:14 +03:00
# Set MOZ_DISABLE_FULL_SYMBOLS to disable generation and upload of the full
# crashreporter symbols archives
i f d e f M O Z _ D I S A B L E _ F U L L _ S Y M B O L S
buildsymbols : symbolsarchive
e l s e
2016-10-04 15:57:35 +03:00
buildsymbols : symbolsfullarchive symbolsarchive
2018-07-30 23:23:14 +03:00
e n d i f # MOZ_DISABLE_FULL_SYMBOLS
2016-10-04 15:57:35 +03:00
e l s e
buildsymbols :
e n d i f
2007-01-12 02:42:21 +03:00
2006-12-06 04:16:05 +03:00
uploadsymbols :
2007-08-08 19:19:57 +04:00
i f d e f M O Z _ C R A S H R E P O R T E R
2015-05-27 20:50:04 +03:00
$( PYTHON) -u $( topsrcdir) /toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
2006-12-06 04:16:05 +03:00
e n d i f
2009-12-20 17:25:48 +03:00
2014-07-03 07:15:10 +04:00
.PHONY : update -packaging
2014-05-16 22:37:31 +04:00
update-packaging :
$( MAKE) -C tools/update-packaging
2017-07-31 19:47:08 +03:00
.PHONY : package -generated -sources
package-generated-sources :
$( call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)' )
2011-08-31 18:49:42 +04:00
# PGO support, but we can't do this test in client.mk
# No point in clobbering if PGO has been explicitly disabled.
2018-08-08 05:08:48 +03:00
i f d e f N O _ P R O F I L E _ G U I D E D _ O P T I M I Z E
2011-08-31 18:49:42 +04:00
maybe_clobber_profiledbuild :
e l s e
2018-07-10 01:26:09 +03:00
maybe_clobber_profiledbuild : clean
2018-08-08 05:08:48 +03:00
i f n e q ( , $( findstring clang ,$ ( CC_TYPE ) ) )
2018-08-02 00:59:23 +03:00
$( LLVM_PROFDATA) merge -o $( DEPTH) /merged.profdata $( DEPTH) /*.profraw
e n d i f
2018-08-08 05:08:48 +03:00
e n d i f # NO_PROFILE_GUIDED_OPTIMIZE
2011-08-31 18:49:42 +04:00
.PHONY : maybe_clobber_profiledbuild
2014-02-11 05:37:47 +04:00
i f d e f J S _ S T A N D A L O N E
2014-01-14 02:38:40 +04:00
# 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 :
2014-02-11 05:37:47 +04:00
e n d i f
2013-03-04 23:11:55 +04:00
2014-09-04 12:44:01 +04:00
# There used to be build interdependencies here. They are now in config/recurse.mk