1999-12-15 09:40:24 +00:00
#
2012-05-21 11:12:37 +00: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 03:34:44 +00:00
2009-03-11 20:32:10 +00:00
i f e q ( , $( MAKE_VERSION ) )
$( error GNU Make is required )
e n d i f
2013-10-16 22:55:14 +00: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 20:32:10 +00:00
e n d i f
2013-05-17 17:54:53 +00:00
export TOPLEVEL_BUILD := 1
2008-12-19 14:50:24 +00:00
default ::
2005-11-08 17:53:54 +00:00
2016-02-09 05:36:07 +00:00
i f n d e f T E S T _ M O Z B U I L D
2014-01-13 22:38:40 +00:00
i f d e f M O Z _ B U I L D _ A P P
2016-03-18 09:24:54 +00:00
i n c l u d e $( wildcard $ ( topsrcdir ) /$ ( MOZ_BUILD_APP ) /build .mk )
2014-01-13 22:38:40 +00:00
e n d i f
2016-02-09 05:36:07 +00:00
e n d i f
2002-10-25 05:59:52 +00:00
2008-12-19 14:50:24 +00:00
i n c l u d e $( topsrcdir ) / c o n f i g / c o n f i g . m k
2019-06-06 04:35:02 +00:00
i f n e q ( m o b i l e / a n d r o i d , $( MOZ_BUILD_APP ) )
2018-06-22 22:10:39 +00: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 05:36:07 +00:00
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 01:02:48 +00:00
BUILD_BACKEND_FILES := $( addprefix backend.,$( addsuffix Backend,$( BUILD_BACKENDS) ) )
2015-11-30 08:43:06 +00:00
i f n d e f T E S T _ M O Z B U I L D
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 01:02:48 +00:00
# We need to explicitly put BUILD_BACKEND_FILES here otherwise the rule in
# rules.mk doesn't run early enough.
2019-07-15 23:50:31 +00:00
$(RUNNABLE_TIERS) binaries :: CLOBBER $( BUILD_BACKEND_FILES )
2014-03-21 02:52:25 +00:00
e n d i f
2008-12-19 14:50:24 +00:00
2014-02-11 01:37:47 +00:00
i f d e f J S _ S T A N D A L O N E
2014-01-13 22:38:40 +00:00
.PHONY : CLOBBER
CLOBBER :
e l s e
2013-03-29 17:34:58 +00:00
CLOBBER : $( topsrcdir ) /CLOBBER
2013-12-02 21:34:21 +00:00
@echo 'STOP! The CLOBBER file has changed.'
2017-10-27 17:19:05 +00:00
@echo 'Please run the build through "mach build".'
2013-03-29 17:34:58 +00:00
@exit 1
2014-01-13 22:38:40 +00:00
e n d i f
2013-03-29 17:34:58 +00:00
2014-09-05 01:27:39 +00:00
install_manifests := \
2018-05-15 14:05:23 +00:00
$( addprefix dist/,branding include public private xpi-stage) \
2014-09-05 01:27:39 +00:00
_tests \
$( NULL)
2016-01-22 02:13:26 +00: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 00:49:44 +00: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 01:02:48 +00:00
$( BUILD_BACKEND_FILES) \
2013-09-17 00:49:44 +00:00
$( NULL)
.PHONY : install -manifests
2014-09-05 01:27:39 +00:00
install-manifests : $( addprefix install -,$ ( install_manifests ) )
2013-09-17 00:49:44 +00:00
2016-01-22 02:13:26 +00: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 14:05:23 +00:00
faster :
2016-01-22 02:13:26 +00:00
$( MAKE) -C faster FASTER_RECURSIVE_MAKE = 1
e n d i f
2017-08-10 18:58:04 +00:00
.PHONY : $( addprefix install -,$ ( install_manifests ) )
2016-01-21 09:10:57 +00:00
$(addprefix install-,$(install_manifests)) : install -%: $( install_manifest_depends )
2016-01-22 02:13:26 +00: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
2020-07-07 02:16:12 +00:00
$( addprefix $( call py_action,process_install_manifest,$( if $( filter copy,$( NSDISTMODE) ) ,--no-symlinks ) --track install_$( subst /,_,$* ) .track $* ) ,$( wildcard _build_manifests/install/$( subst /,_,$* ) ) )
2013-09-17 00:49:44 +00:00
2015-09-25 08:18:45 +00:00
# Dummy wrapper rule to allow the faster backend to piggy back
2016-01-23 19:39:18 +00:00
$(addprefix install-,$(subst /,_,$(filter dist/%,$(install_manifests)))) : install -dist_ %: install -dist /% ;
2015-09-25 08:18:45 +00:00
2014-09-05 01:27:39 +00:00
.PHONY : install -tests
2016-04-04 21:56:52 +00:00
install-tests : install -test -files
.PHONY : install -test -files
install-test-files :
2020-07-07 02:16:12 +00:00
$( call py_action,process_install_manifest,$( if $( filter copy,$( NSDISTMODE) ) ,--no-symlinks ) --track install__test_files.track _tests _build_manifests/install/_test_files)
2014-09-05 01:27:39 +00:00
2014-05-16 18:37:31 +00: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-24 22:05:43 +00:00
2017-08-09 19:35:15 +00:00
# Dummy rule for the cases below where we don't depend on dist/include
recurse_pre-export ::
2014-09-05 01:27:39 +00:00
# For the binaries rule, not all the install manifests matter, so force only
# the interesting ones to be done.
2016-01-21 08:08:53 +00:00
recurse_pre-export :: install -manifests
2013-10-01 23:53:23 +00:00
binaries ::
2017-08-08 21:07:07 +00:00
@$( MAKE) install-manifests install_manifests = dist/include
2013-09-17 00:49:44 +00:00
2020-07-21 19:49:55 +00:00
i f d e f B U I L D _ V E R B O S E _ L O G
verbose_flag = -v
e n d i f
2016-06-01 17:48:53 +00:00
recurse_artifact :
2021-10-28 11:05:04 +00:00
$( PYTHON3) $( topsrcdir) /mach --log-no-times artifact install$( if $( MOZ_ARTIFACT_BUILD_SYMBOLS) , --symbols$( addprefix = ,$( filter full,$( MOZ_ARTIFACT_BUILD_SYMBOLS) ) ) ) $( verbose_flag)
2016-06-01 17:48:53 +00:00
2019-03-05 08:41:04 +00: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
2020-11-03 22:46:57 +00:00
$( PYTHON3) $( topsrcdir) /mach --log-no-times artifact install --job win32-opt --no-tests --distdir $( DIST) /i686 $( verbose_flag)
2019-03-05 08:41:04 +00:00
mv $( DIST) /i686/bin/* $( DIST) /i686
e n d i f
2019-05-30 15:22:09 +00: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 :
2020-05-05 20:04:30 +00:00
$( call py_action,fat_aar,\
2019-08-01 22:04:46 +00:00
$( addprefix --armeabi-v7a $( MOZ_FETCHES_DIR) /,$( MOZ_ANDROID_FAT_AAR_ARMEABI_V7A) ) \
$( addprefix --arm64-v8a $( MOZ_FETCHES_DIR) /,$( MOZ_ANDROID_FAT_AAR_ARM64_V8A) ) \
$( addprefix --x86 $( MOZ_FETCHES_DIR) /,$( MOZ_ANDROID_FAT_AAR_X86) ) \
$( addprefix --x86-64 $( MOZ_FETCHES_DIR) /,$( MOZ_ANDROID_FAT_AAR_X86_64) ) \
2019-07-30 15:35:12 +00:00
--distdir $( abspath $( DIST) /fat-aar) )
e n d i f
2019-05-30 15:22:09 +00:00
2019-08-21 03:07:16 +00:00
i f e q ( $( MOZ_BUILD_APP ) , m o b i l e / a n d r o i d )
recurse_android-stage-package : stage -package
recurse_android-archive-geckoview :
GRADLE_INVOKED_WITHIN_MACH_BUILD = 1 $( topsrcdir) /mach --log-no-times android archive-geckoview
e n d i f
2017-10-05 05:50:01 +00: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 14:50:24 +00: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-13 22:38:40 +00:00
e n d i f
2008-12-19 14:50:24 +00:00
2013-09-05 06:07:57 +00:00
default all ::
2014-11-06 00:29:11 +00:00
$( call BUILDSTATUS,TIERS $( TIERS) $( if $( MOZ_AUTOMATION) ,$( MOZ_AUTOMATION_TIERS) ) )
2013-08-20 20:03:39 +00:00
2013-09-06 00:17:59 +00:00
i n c l u d e $( topsrcdir ) / c o n f i g / r u l e s . m k
2013-08-20 20:03:39 +00:00
2016-08-25 22:39:57 +00: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 19:06:22 +00:00
-$( CCACHE) --show-stats --stats-format= json > sccache-stats.json
2016-08-25 22:39:57 +00:00
@echo "===SCCACHE STATS==="
-$( CCACHE) --show-stats
@echo "==================="
2017-07-20 02:31:14 +00:00
e n d i f
2016-08-25 22:39:57 +00:00
2016-05-30 17:45:19 +00: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 14:18:50 +00: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 17:45:19 +00:00
e n d i f
2007-09-10 17:36:17 +00:00
2017-02-10 16:34:08 +00:00
.PHONY : prepsymbolsarchive
prepsymbolsarchive :
2007-01-11 23:42:21 +00:00
echo packing symbols
2009-11-04 14:59:47 +00:00
$( NSINSTALL) -D $( DIST) /$( PKG_PATH)
2016-10-04 12:57:35 +00:00
2017-02-10 16:34:08 +00: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 12:57:35 +00:00
.PHONY : symbolsfullarchive
2017-02-10 16:34:08 +00:00
symbolsfullarchive : prepsymbolsarchive
2020-07-31 20:27:54 +00:00
$( RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
$( call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
2017-04-28 03:37:11 +00:00
$( abspath $( DIST) /crashreporter-symbols) \
2018-07-11 23:38:37 +00:00
--full-archive)
2016-10-04 12:57:35 +00:00
.PHONY : symbolsarchive
2017-02-10 16:34:08 +00:00
symbolsarchive : prepsymbolsarchive
2017-04-28 03:37:11 +00:00
$( RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip'
2020-05-05 20:04:30 +00:00
$( call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \
2018-07-11 23:38:37 +00:00
$( abspath $( DIST) /crashreporter-symbols) )
2016-10-04 12:57:35 +00:00
i f d e f M O Z _ C R A S H R E P O R T E R
2020-07-31 10:01:54 +00:00
# Set MOZ_ENABLE_FULL_SYMBOLS to enable generation and upload of the full
2018-07-30 20:23:14 +00:00
# crashreporter symbols archives
2020-07-31 10:01:54 +00:00
i f d e f M O Z _ E N A B L E _ F U L L _ S Y M B O L S
2020-07-31 09:36:14 +00:00
buildsymbols : symbolsfullarchive symbolsarchive
2020-07-31 10:01:54 +00:00
e l s e
buildsymbols : symbolsarchive
e n d i f # MOZ_ENABLE_FULL_SYMBOLS
2016-10-04 12:57:35 +00:00
e l s e
buildsymbols :
e n d i f
2007-01-11 23:42:21 +00:00
2006-12-06 01:16:05 +00:00
uploadsymbols :
2007-08-08 15:19:57 +00:00
i f d e f M O Z _ C R A S H R E P O R T E R
2020-07-31 20:27:54 +00:00
$( PYTHON3) -u $( topsrcdir) /toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
2006-12-06 01:16:05 +00:00
e n d i f
2009-12-20 14:25:48 +00:00
2017-07-31 16:47:08 +00:00
.PHONY : package -generated -sources
package-generated-sources :
2020-05-05 20:04:30 +00:00
$( call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)' )
2017-07-31 16:47:08 +00:00
2014-02-11 01:37:47 +00:00
i f d e f J S _ S T A N D A L O N E
2014-01-13 22:38:40 +00: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 01:37:47 +00:00
e n d i f
2013-03-04 19:11:55 +00:00
2014-09-04 08:44:01 +00:00
# There used to be build interdependencies here. They are now in config/recurse.mk