2011-07-07 15:29:41 +00:00
# -*- makefile -*-
2005-03-28 19:36:24 +00:00
# vim:set ts=8 sw=8 sts=8 noet:
1998-03-28 02:44:41 +00:00
#
2012-04-02 17:06:06 +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-03-28 02:44:41 +00:00
#
2009-05-18 18:15:05 +00:00
1998-08-19 20:42:14 +00:00
i f n d e f t o p s r c d i r
2009-05-18 18:15:05 +00:00
$( error topsrcdir was not set ) )
1998-08-19 20:42:14 +00:00
e n d i f
1998-03-28 02:44:41 +00:00
2013-09-05 00:01:45 +00:00
# Define an include-at-most-once flag
i f d e f I N C L U D E D _ R U L E S _ M K
$( error Do not include rules .mk twice !)
e n d i f
INCLUDED_RULES_MK = 1
2000-03-14 03:00:52 +00:00
i f n d e f I N C L U D E D _ C O N F I G _ M K
1998-08-19 20:42:14 +00:00
i n c l u d e $( topsrcdir ) / c o n f i g / c o n f i g . m k
1998-03-28 02:44:41 +00:00
e n d i f
2012-05-15 16:20:30 +00:00
USE_AUTOTARGETS_MK = 1
2014-11-30 01:45:31 +00:00
i n c l u d e $( MOZILLA_DIR ) / c o n f i g / m a k e f i l e s / m a k e u t i l s . m k
2012-04-03 20:08:16 +00:00
2013-08-10 06:57:09 +00:00
i f d e f R E B U I L D _ C H E C K
2020-05-05 19:53:22 +00:00
REPORT_BUILD = $( info $( shell $( PYTHON3) $( MOZILLA_DIR) /config/rebuild_check.py $@ $^) )
2016-04-06 20:49:55 +00:00
REPORT_BUILD_VERBOSE = $( REPORT_BUILD)
2013-08-10 06:57:09 +00:00
e l s e
2018-09-25 19:05:02 +00:00
REPORT_BUILD = $( info $( relativesrcdir) /$( notdir $@ ) )
2016-04-06 20:49:55 +00:00
i f d e f B U I L D _ V E R B O S E _ L O G
REPORT_BUILD_VERBOSE = $( REPORT_BUILD)
e l s e
2018-04-19 07:16:57 +00:00
REPORT_BUILD_VERBOSE = $( call BUILDSTATUS,BUILD_VERBOSE $( relativesrcdir) )
2016-04-06 20:49:55 +00:00
e n d i f
2013-08-10 06:57:09 +00:00
e n d i f
2011-12-08 18:14:06 +00:00
2000-06-21 00:54:56 +00:00
EXEC = exec
2008-12-04 06:25:00 +00:00
################################################################################
# Testing frameworks support
################################################################################
2010-12-03 20:24:22 +00:00
testxpcobjdir = $( DEPTH) /_tests/xpcshell
2008-12-04 06:25:00 +00:00
i f d e f E N A B L E _ T E S T S
i f d e f C P P _ U N I T _ T E S T S
2013-11-07 01:37:45 +00:00
i f d e f C O M P I L E _ E N V I R O N M E N T
2008-12-04 06:25:00 +00:00
# Compile the tests to $(DIST)/bin. Make lots of niceties available by default
# through TestHarness.h, by modifying the list of includes and the libs against
# which stuff links.
2014-07-23 04:29:44 +00:00
SIMPLE_PROGRAMS += $( CPP_UNIT_TESTS)
2008-12-04 06:25:00 +00:00
2013-06-24 17:45:32 +00:00
i f n d e f M O Z _ P R O F I L E _ G E N E R A T E
2014-07-24 22:09:44 +00:00
CPP_UNIT_TESTS_FILES = $( CPP_UNIT_TESTS)
CPP_UNIT_TESTS_DEST = $( DIST) /cppunittests
2014-07-28 23:59:27 +00:00
CPP_UNIT_TESTS_TARGET = target
2014-07-24 22:09:44 +00:00
INSTALL_TARGETS += CPP_UNIT_TESTS
2013-06-24 17:45:32 +00:00
e n d i f
2014-02-10 19:42:19 +00:00
run-cppunittests ::
2020-05-05 19:53:22 +00:00
@$( PYTHON3) $( MOZILLA_DIR) /testing/runcppunittests.py --xre-path= $( DIST) /bin --symbols-path= $( DIST) /crashreporter-symbols $( CPP_UNIT_TESTS)
2014-02-10 19:42:19 +00:00
2013-01-03 20:02:11 +00:00
cppunittests-remote :
2020-05-05 19:53:22 +00:00
$( PYTHON3) -u $( MOZILLA_DIR) /testing/remotecppunittests.py \
2017-03-21 18:20:01 +00:00
--xre-path= $( DEPTH) /dist/bin \
--localLib= $( DEPTH) /dist/$( MOZ_APP_NAME) \
--deviceIP= ${ TEST_DEVICE } \
$( CPP_UNIT_TESTS) $( EXTRA_TEST_ARGS) ; \
2013-01-03 20:02:11 +00:00
2013-11-07 01:37:45 +00:00
e n d i f # COMPILE_ENVIRONMENT
2008-12-04 06:25:00 +00:00
e n d i f # CPP_UNIT_TESTS
e n d i f # ENABLE_TESTS
2003-03-08 05:18:43 +00:00
#
# Library rules
#
2011-05-23 16:54:47 +00:00
# If FORCE_STATIC_LIB is set, build a static library.
2005-10-17 14:57:32 +00:00
# Otherwise, build a shared library.
2003-03-08 05:18:43 +00:00
#
2000-03-31 01:24:48 +00:00
i f n d e f L I B R A R Y
2014-07-23 04:29:09 +00:00
i f d e f R E A L _ L I B R A R Y
2014-07-23 05:01:55 +00:00
i f d e f N O _ E X P A N D _ L I B S
2018-03-20 23:31:05 +00:00
# Only build actual library if it is requested.
Bug 1077151 - Always use expandlibs descriptors when they exist. r=mshal
Currently, when there is both an expandlibs descriptor and an actual static
library, expandlibs picks the static library. This has the side effect that
if there are object files in the static library that aren't directly used,
they're dropped when linking, even when they export symbols that would be
exported in the final linked binary.
In most cases in the code base, files are not dropped that way. The most
notable counter-example is xpcomglue, where actually not dropping files
leads to link failure because of missing symbols those files reference
(yes, that would tend to say the glue is broken in some way).
On the opposite side, there is mozglue, which does have both a descriptor
and a static library (the latter being necessary for the SDK), and that
linking as a static library drops files that shouldn't be dropped (like
jemalloc). We're currently relying on -Wl,--whole-archive for those files
not to be dropped, but that won't really be possible without much hassle
in a world where mozglue dependencies live in moz.build land.
Switching expandlibs to use descriptors when they exist, even when there
is a static library (so, the opposite of the current behavior) allows to
drop -Wl,--whole-archive and prepare for a better future. However, as
mentioned, xpcomglue does still require to be linked through the static
library, so we need to make it a static library only.
To achieve that, we make NO_EXPAND_LIBS now actually mean no expandlibs
and use that to build the various different xpcomglues.
2014-10-04 01:33:00 +00:00
LIBRARY := $( REAL_LIBRARY)
2014-07-23 05:01:55 +00:00
e n d i f
2014-07-23 04:33:06 +00:00
e n d i f
Bug 1077151 - Always use expandlibs descriptors when they exist. r=mshal
Currently, when there is both an expandlibs descriptor and an actual static
library, expandlibs picks the static library. This has the side effect that
if there are object files in the static library that aren't directly used,
they're dropped when linking, even when they export symbols that would be
exported in the final linked binary.
In most cases in the code base, files are not dropped that way. The most
notable counter-example is xpcomglue, where actually not dropping files
leads to link failure because of missing symbols those files reference
(yes, that would tend to say the glue is broken in some way).
On the opposite side, there is mozglue, which does have both a descriptor
and a static library (the latter being necessary for the SDK), and that
linking as a static library drops files that shouldn't be dropped (like
jemalloc). We're currently relying on -Wl,--whole-archive for those files
not to be dropped, but that won't really be possible without much hassle
in a world where mozglue dependencies live in moz.build land.
Switching expandlibs to use descriptors when they exist, even when there
is a static library (so, the opposite of the current behavior) allows to
drop -Wl,--whole-archive and prepare for a better future. However, as
mentioned, xpcomglue does still require to be linked through the static
library, so we need to make it a static library only.
To achieve that, we make NO_EXPAND_LIBS now actually mean no expandlibs
and use that to build the various different xpcomglues.
2014-10-04 01:33:00 +00:00
e n d i f
1999-02-19 03:06:32 +00:00
2011-05-23 16:54:47 +00:00
i f d e f F O R C E _ S H A R E D _ L I B
1998-03-28 02:44:41 +00:00
i f d e f M K S H L I B
1999-05-05 23:38:15 +00:00
2001-12-09 07:08:58 +00:00
i f d e f L I B _ I S _ C _ O N L Y
MKSHLIB = $( MKCSHLIB)
e n d i f
2014-07-10 00:16:19 +00:00
e n d i f # MKSHLIB
e n d i f # FORCE_SHARED_LIB
2011-04-19 04:11:40 +00:00
i f e q ( $( OS_ARCH ) , W I N N T )
2018-10-17 14:38:52 +00:00
2019-05-09 19:52:26 +00:00
#
# This next line captures both the default (non-MOZ_COPY_PDBS)
# case as well as the MOZ_COPY_PDBS-for-mingwclang case.
#
# For the default case, placing the pdb in the build
# directory is needed.
#
# For the MOZ_COPY_PDBS, non-mingwclang case - we need to
# build the pdb next to the executable (handled in the if
# statement immediately below.)
#
# For the MOZ_COPY_PDBS, mingwclang case - we also need to
# build the pdb next to the executable, but this macro doesn't
# work for jsapi-tests which is a little special, so we specify
# the output directory below with MOZ_PROGRAM_LDFLAGS.
#
2018-10-17 14:38:52 +00:00
LINK_PDBFILE ?= $( basename $( @F) ) .pdb
2019-05-09 19:52:26 +00:00
i f d e f M O Z _ C O P Y _ P D B S
i f n e q ( $( CC_TYPE ) , c l a n g )
LINK_PDBFILE = $( basename $@ ) .pdb
e n d i f
e n d i f
2003-03-08 05:18:43 +00:00
i f n d e f G N U _ C C
2001-12-09 07:08:58 +00:00
2017-03-01 17:45:56 +00:00
i f d e f S I M P L E _ P R O G R A M S
2014-03-25 23:12:26 +00:00
COMPILE_PDB_FLAG ?= -Fd$( basename $( @F) ) .pdb
COMPILE_CFLAGS += $( COMPILE_PDB_FLAG)
COMPILE_CXXFLAGS += $( COMPILE_PDB_FLAG)
2019-02-01 11:12:06 +00:00
e n d i f
2008-11-26 19:38:09 +00:00
2001-12-09 07:08:58 +00:00
i f d e f M O Z _ D E B U G
2002-06-17 17:09:57 +00:00
CODFILE = $( basename $( @F) ) .cod
2002-01-01 00:03:57 +00:00
e n d i f
2001-12-09 07:08:58 +00:00
2003-03-08 05:18:43 +00:00
e n d i f # !GNU_CC
2001-12-09 07:08:58 +00:00
e n d i f # WINNT
2015-06-10 15:10:40 +00:00
i f e q ( a r m - D a r w i n , $( CPU_ARCH ) - $( OS_TARGET ) )
i f d e f P R O G R A M
MOZ_PROGRAM_LDFLAGS += -Wl,-rpath -Wl,@executable_path/Frameworks
e n d i f
e n d i f
Bug 1770484 - Make Mac processes not depend on DYLD_LIBRARY_PATH to load libraries r=glandium,gsvelto,mac-reviewers,necko-reviewers,dragana,spohl
Change XUL and other dylibs to be built with an @rpath/<dylib> install name (LC_ID_DYLIB) instead of @executable_path/<dylib>.
Change executables to be built with an @rpath dyld search path set to @executable_path by default so that @rpath/<dylib> dylibs in the same directory can be resolved. For executables not in the same directory as @rpath dylibs, such as plugin-container, set a relative @rpath such as @executable_path/../../../.
Previously, dylib install names were set as @executable_path/<dylib> allowing them to be resolved by dyld for the loading executable if the executable resided in the same directory as the dylib. For executables not in the same directory as the dylibs, dyld resolved these dylibs using DYLD_LIBRARY_PATH set before launching the process by Firefox code. With this change, loading does not rely on DYLD environment variables. Instead, dylibs have an install name set as @rpath/<dylib> and each executable loading a dylib has its @rpath set at compile-time to refer to dylib directory.
Differential Revision: https://phabricator.services.mozilla.com/D147360
2022-06-03 21:14:01 +00:00
# For Mac executables, set the @rpath to be @executable_path by default so that
# shared libraries built with an @rpath install name in the same directory
# as the executable can be resolved. Executables not in the same directory
# should override the @rpath with a relative path such as @executable_path/../
# depending on their install location.
i f e q ( $( OS_ARCH ) , D a r w i n )
MOZ_PROGRAM_LDFLAGS += -Wl,-rpath,@executable_path
e n d i f
2018-10-17 14:38:52 +00:00
i f e q ( $( OS_ARCH ) , W I N N T )
i f e q ( $( CC_TYPE ) , c l a n g )
MOZ_PROGRAM_LDFLAGS += -Wl,-pdb,$( dir $@ ) /$( LINK_PDBFILE)
e n d i f
e n d i f
2011-04-19 04:11:40 +00:00
i f e q ( $( HOST_OS_ARCH ) , W I N N T )
2005-07-06 01:49:32 +00:00
HOST_PDBFILE = $( basename $( @F) ) .pdb
2019-08-27 01:00:18 +00:00
HOST_PDB_FLAG ?= -PDB:$( HOST_PDBFILE)
HOST_C_LDFLAGS += -DEBUG $( HOST_PDB_FLAG)
HOST_CXX_LDFLAGS += -DEBUG $( HOST_PDB_FLAG)
2005-07-06 01:49:32 +00:00
e n d i f
2017-02-01 18:59:41 +00:00
# Don't build SIMPLE_PROGRAMS during the MOZ_PROFILE_GENERATE pass, and do not
# attempt to install them
2011-04-14 09:23:13 +00:00
i f d e f M O Z _ P R O F I L E _ G E N E R A T E
2017-02-01 18:59:41 +00:00
$( foreach category ,$ ( INSTALL_TARGETS ) ,\
$( eval $( category) _FILES := $( foreach file,$( $( category) _FILES) ,$( if $( filter $( SIMPLE_PROGRAMS) ,$( notdir $( file) ) ) ,,$( file) ) ) ) )
2011-04-14 09:23:13 +00:00
SIMPLE_PROGRAMS :=
e n d i f
2013-11-07 01:37:45 +00:00
i f d e f C O M P I L E _ E N V I R O N M E N T
1998-03-28 02:44:41 +00:00
i f n d e f T A R G E T S
2021-10-14 21:09:29 +00:00
TARGETS = $( LIBRARY) $( SHARED_LIBRARY) $( PROGRAM) $( SIMPLE_PROGRAMS) $( HOST_PROGRAM) $( HOST_SIMPLE_PROGRAMS) $( HOST_SHARED_LIBRARY)
1998-03-28 02:44:41 +00:00
e n d i f
2013-07-02 21:40:17 +00:00
COBJS = $( notdir $( CSRCS:.c= .$( OBJ_SUFFIX) ) )
2019-11-27 20:11:59 +00:00
CWASMOBJS = $( notdir $( WASM_CSRCS:.c= .$( WASM_OBJ_SUFFIX) ) )
2013-07-02 21:40:17 +00:00
SOBJS = $( notdir $( SSRCS:.S= .$( OBJ_SUFFIX) ) )
# CPPSRCS can have different extensions (eg: .cpp, .cc)
CPPOBJS = $( notdir $( addsuffix .$( OBJ_SUFFIX) ,$( basename $( CPPSRCS) ) ) )
2019-11-27 20:11:59 +00:00
CPPWASMOBJS = $( notdir $( addsuffix .$( WASM_OBJ_SUFFIX) ,$( basename $( WASM_CPPSRCS) ) ) )
2013-07-02 21:40:17 +00:00
CMOBJS = $( notdir $( CMSRCS:.m= .$( OBJ_SUFFIX) ) )
CMMOBJS = $( notdir $( CMMSRCS:.mm= .$( OBJ_SUFFIX) ) )
2016-03-01 18:47:19 +00:00
# ASFILES can have different extensions (.s, .asm)
ASOBJS = $( notdir $( addsuffix .$( OBJ_SUFFIX) ,$( basename $( ASFILES) ) ) )
Bug 1163224 - add build system support for multiple Rust crates; r=glandium
Our current build system support for Rust compiles any Rust crate into a
so-called staticlib, which is a static library (.a file) that includes
the Rust runtime. That staticlib is then linked into libxul. For
supporting multiple crates, this approach breaks down, as linking
multiple copies of the Rust runtime is going to fail.
For supporting multiple crates, the approach taken here is to compile
each crate into a so-called rlib, which is essentially a staticlib
without the Rust runtime linked in. The build system takes note of
every crate destined for linking with libxul (treating them like static
libraries generated from C/C++ files), and generates a super-crate,
whimsically named "rul", that is compiled as a staticlib (so as to
include the Rust runtime) and then linked into libxul. Thus only one
copy of the Rust runtime is included, and the Rust compiler can take
care of any inter-crate dependencies.
This patch currently only supports Rust code in shared libraries, not in
binaries.
2016-04-21 13:54:01 +00:00
RS_STATICLIB_CRATE_OBJ = $( addprefix lib,$( notdir $( RS_STATICLIB_CRATE_SRC:.rs= .$( LIB_SUFFIX) ) ) )
1998-03-28 02:44:41 +00:00
i f n d e f O B J S
2019-11-27 20:11:59 +00:00
_OBJS = $( COBJS) $( SOBJS) $( CPPOBJS) $( CMOBJS) $( CMMOBJS) $( ASOBJS) $( CWASMOBJS) $( CPPWASMOBJS)
2012-05-15 05:44:32 +00:00
OBJS = $( strip $( _OBJS) )
1998-03-28 02:44:41 +00:00
e n d i f
2020-07-09 12:19:58 +00:00
HOST_COBJS = $( addprefix host_,$( notdir $( HOST_CSRCS:.c= .$( OBJ_SUFFIX) ) ) )
2013-10-22 04:40:27 +00:00
# HOST_CPPOBJS can have different extensions (eg: .cpp, .cc)
2020-07-09 12:19:58 +00:00
HOST_CPPOBJS = $( addprefix host_,$( notdir $( addsuffix .$( OBJ_SUFFIX) ,$( basename $( HOST_CPPSRCS) ) ) ) )
HOST_CMOBJS = $( addprefix host_,$( notdir $( HOST_CMSRCS:.m= .$( OBJ_SUFFIX) ) ) )
HOST_CMMOBJS = $( addprefix host_,$( notdir $( HOST_CMMSRCS:.mm= .$( OBJ_SUFFIX) ) ) )
2000-03-31 07:18:52 +00:00
i f n d e f H O S T _ O B J S
2013-10-22 04:40:27 +00:00
_HOST_OBJS = $( HOST_COBJS) $( HOST_CPPOBJS) $( HOST_CMOBJS) $( HOST_CMMOBJS)
2007-04-27 11:47:10 +00:00
HOST_OBJS = $( strip $( _HOST_OBJS) )
2000-03-31 07:18:52 +00:00
e n d i f
2013-11-07 01:37:45 +00:00
e l s e
LIBRARY :=
SHARED_LIBRARY :=
IMPORT_LIBRARY :=
REAL_LIBRARY :=
PROGRAM :=
SIMPLE_PROGRAMS :=
2018-07-05 05:58:09 +00:00
HOST_SHARED_LIBRARY :=
2013-11-07 01:37:45 +00:00
HOST_PROGRAM :=
HOST_SIMPLE_PROGRAMS :=
2021-07-16 02:38:41 +00:00
e n d i f
2019-11-27 20:11:59 +00:00
2013-08-15 14:45:08 +00:00
i f d e f M A C H
2013-08-27 21:40:07 +00:00
i f n d e f N O _ B U I L D S T A T U S _ M E S S A G E S
2013-09-06 00:17:59 +00:00
d e f i n e B U I L D S T A T U S
2013-12-02 21:34:21 +00:00
@ e c h o 'BUILDSTATUS $1'
2013-09-06 00:17:59 +00:00
e n d e f
2013-08-15 14:45:08 +00:00
e n d i f
2013-08-27 21:40:07 +00:00
e n d i f
2013-08-20 07:06:32 +00:00
2013-06-18 19:22:56 +00:00
d e f i n e S U B M A K E # $(call SUBMAKE,target,directory,static)
2014-07-16 07:36:30 +00:00
+ @ $( MAKE ) $( if $ ( 2) ,-C $ ( 2) ) $( 1)
2009-02-27 21:03:53 +00:00
e n d e f # The extra line is important here! don't delete it
2013-05-23 23:28:09 +00:00
d e f i n e T I E R _ D I R _ S U B M A K E
2013-08-20 07:06:32 +00:00
$( call SUBMAKE ,$ ( 4) ,$ ( 3) ,$ ( 5) )
2013-05-23 23:28:09 +00:00
e n d e f # Ths empty line is important.
2008-12-19 14:50:24 +00:00
i f n e q ( , $( strip $ ( DIRS ) ) )
2000-03-02 03:39:19 +00:00
LOOP_OVER_DIRS = \
2009-02-27 21:03:53 +00:00
$( foreach dir,$( DIRS) ,$( call SUBMAKE,$@ ,$( dir) ) )
2008-12-19 14:50:24 +00:00
e n d i f
2000-11-10 00:55:44 +00:00
1998-07-08 03:49:31 +00:00
#
# Now we can differentiate between objects used to build a library, and
# objects used to build an executable in the same directory.
#
i f n d e f P R O G O B J S
PROGOBJS = $( OBJS)
e n d i f
2000-03-31 07:18:52 +00:00
i f n d e f H O S T _ P R O G O B J S
HOST_PROGOBJS = $( HOST_OBJS)
e n d i f
1999-09-09 09:24:58 +00:00
#
# Tags: emacs (etags), vi (ctags)
# TAG_PROGRAM := ctags -L -
#
TAG_PROGRAM = xargs etags -a
#
2007-04-25 14:26:42 +00:00
# Turn on C++ linking if we have any .cpp or .mm files
2011-08-25 23:37:25 +00:00
# (moved this from config.mk so that config.mk can be included
1999-09-09 09:24:58 +00:00
# before the CPPSRCS are defined)
#
2011-01-24 08:56:40 +00:00
i f n e q ( $( HOST_CPPSRCS ) $( HOST_CMMSRCS ) , )
HOST_CPP_PROG_LINK = 1
e n d i f
1999-09-09 09:24:58 +00:00
2000-03-11 03:08:04 +00:00
#
# MacOS X specific stuff
#
2001-04-05 03:36:56 +00:00
i f e q ( $( OS_ARCH ) , D a r w i n )
2021-10-14 21:09:29 +00:00
i f n e q ( , $( SHARED_LIBRARY ) )
Bug 1770484 - Make Mac processes not depend on DYLD_LIBRARY_PATH to load libraries r=glandium,gsvelto,mac-reviewers,necko-reviewers,dragana,spohl
Change XUL and other dylibs to be built with an @rpath/<dylib> install name (LC_ID_DYLIB) instead of @executable_path/<dylib>.
Change executables to be built with an @rpath dyld search path set to @executable_path by default so that @rpath/<dylib> dylibs in the same directory can be resolved. For executables not in the same directory as @rpath dylibs, such as plugin-container, set a relative @rpath such as @executable_path/../../../.
Previously, dylib install names were set as @executable_path/<dylib> allowing them to be resolved by dyld for the loading executable if the executable resided in the same directory as the dylib. For executables not in the same directory as the dylibs, dyld resolved these dylibs using DYLD_LIBRARY_PATH set before launching the process by Firefox code. With this change, loading does not rely on DYLD environment variables. Instead, dylibs have an install name set as @rpath/<dylib> and each executable loading a dylib has its @rpath set at compile-time to refer to dylib directory.
Differential Revision: https://phabricator.services.mozilla.com/D147360
2022-06-03 21:14:01 +00:00
_LOADER_PATH := @rpath
2021-11-30 21:39:50 +00:00
EXTRA_DSO_LDOPTS += -dynamiclib -install_name $( _LOADER_PATH) /$@ -compatibility_version 1 -current_version 1
2003-06-09 22:25:25 +00:00
e n d i f
2000-03-11 03:08:04 +00:00
e n d i f
2003-01-30 07:41:27 +00:00
2010-04-19 08:39:58 +00:00
#
# GNU doesn't have path length limitation
#
i f e q ( $( OS_ARCH ) , G N U )
OS_CPPFLAGS += -DPATH_MAX= 1024 -DMAXPATHLEN= 1024
e n d i f
2003-03-18 22:04:00 +00:00
#
# MINGW32
#
i f e q ( $( OS_ARCH ) , W I N N T )
i f d e f G N U _ C C
2004-03-16 08:07:25 +00:00
DSO_LDOPTS += -Wl,--out-implib -Wl,$( IMPORT_LIBRARY)
2003-03-18 22:04:00 +00:00
e n d i f
e n d i f
2000-03-31 01:24:48 +00:00
i f e q ( $( USE_TVFS ) , 1 )
IFLAGS1 = -rb
IFLAGS2 = -rb
e l s e
2001-07-24 23:41:43 +00:00
IFLAGS1 = -m 644
IFLAGS2 = -m 755
2000-03-31 01:24:48 +00:00
e n d i f
1999-11-18 02:49:30 +00:00
2001-12-04 21:17:48 +00:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( OS_ARCH ) )
OUTOPTION = -Fo# eol
e l s e
OUTOPTION = -o # eol
e n d i f # WINNT && !GNU_CC
2007-03-26 18:17:02 +00:00
i f e q ( , $( CROSS_COMPILE ) )
HOST_OUTOPTION = $( OUTOPTION)
e l s e
2018-08-20 21:22:44 +00:00
# Windows-to-Windows cross compiles should always use MSVC-style options for
# host compiles.
i f e q ( W I N N T _ W I N N T , $( HOST_OS_ARCH ) _ $( OS_ARCH ) )
2019-02-14 21:45:27 +00:00
i f n e q ( , $( filter -out clang -cl ,$ ( HOST_CC_TYPE ) ) )
2018-08-20 21:22:44 +00:00
$( error MSVC -style compilers should be used for host compilations !)
e n d i f
HOST_OUTOPTION = -Fo# eol
e l s e
2007-03-26 18:17:02 +00:00
HOST_OUTOPTION = -o # eol
2008-02-21 21:02:06 +00:00
e n d i f
2018-08-20 21:22:44 +00:00
e n d i f
1998-03-28 02:44:41 +00:00
################################################################################
2013-10-29 21:53:52 +00:00
# Ensure the build config is up to date. This is done automatically when builds
# are performed through |mach build|. The check here is to catch people not
# using mach. If we ever enforce builds through mach, this code can be removed.
2013-05-17 17:54:56 +00:00
i f n d e f M O Z B U I L D _ B A C K E N D _ C H E C K E D
2013-10-29 21:53:52 +00:00
i f n d e f M A C H
i f n d e f T O P L E V E L _ 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
BUILD_BACKEND_FILES := $( addprefix $( DEPTH) /backend.,$( addsuffix Backend,$( BUILD_BACKENDS) ) )
$(DEPTH)/backend.%Backend :
2013-10-29 21:53:52 +00:00
$( error Build configuration changed. Build with | mach build| or run | mach build-backend| to regenerate build config)
2013-05-21 06:26:20 +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
d e f i n e b u i l d _ b a c k e n d _ r u l e
$(1) : $$( shell cat $ ( 1) .in )
2013-05-21 06:26:20 +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
e n d e f
$( foreach file ,$ ( BUILD_BACKEND_FILES ) ,$ ( eval $ ( call build_backend_rule ,$ ( file ) ) ) )
default :: $( BUILD_BACKEND_FILES )
2013-05-17 17:54:56 +00:00
export MOZBUILD_BACKEND_CHECKED = 1
e n d i f
2013-10-29 21:53:52 +00:00
e n d i f
e n d i f
2013-05-17 17:54:56 +00:00
2005-03-31 21:40:23 +00:00
# The root makefile doesn't want to do a plain export/libs, because
# of the tiers and because of libxul. Suppress the default rules in favor
# of something else. Makefiles which use this var *must* provide a sensible
# default rule before including rules.mk
2006-08-25 10:45:39 +00:00
default all ::
2014-11-06 00:29:11 +00:00
$( foreach tier,$( TIERS) ,$( call SUBMAKE,$( tier) ) )
2005-03-31 21:40:23 +00:00
2019-06-26 02:19:43 +00:00
i f d e f B U I L D _ V E R B O S E _ L O G
2008-07-12 10:55:43 +00:00
ECHO := echo
QUIET :=
e l s e
ECHO := true
QUIET := -q
e n d i f
2010-10-28 18:28:21 +00:00
# Dependencies which, if modified, should cause everything to rebuild
2014-11-30 01:45:31 +00:00
GLOBAL_DEPS += Makefile $( addprefix $( DEPTH) /config/,$( INCLUDED_AUTOCONF_MK) ) $( MOZILLA_DIR) /config/config.mk
2008-11-28 02:26:44 +00:00
2020-08-07 00:50:50 +00:00
i f e q ( $( MOZ_WIDGET_TOOLKIT ) , w i n d o w s )
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
# We always build .res files for programs and shared libraries
2020-08-07 00:50:50 +00:00
resfile = $( notdir $1 ) .res
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
# We also build .res files for simple programs if a corresponding manifest
# exists. We'll generate a .rc file that includes the manifest.
2020-08-11 13:42:24 +00:00
i f d e f G N U _ C C
# Skip on mingw builds because of bug 1657863
resfile_for_manifest =
e l s e
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
resfile_for_manifest = $( if $( wildcard $( srcdir) /$( notdir $1 ) .manifest) ,$( call resfile,$1 ) )
2020-08-11 13:42:24 +00:00
e n d i f
2020-08-07 00:50:50 +00:00
e l s e
resfile =
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
resfile_for_manifest =
2020-08-07 00:50:50 +00:00
e n d i f
2000-03-31 01:24:48 +00:00
##############################################
2013-11-07 01:37:45 +00:00
i f d e f C O M P I L E _ E N V I R O N M E N T
2014-07-24 22:14:40 +00:00
compile :: host target
2018-12-21 23:00:00 +00:00
host :: $( HOST_OBJS ) $( HOST_PROGRAM ) $( HOST_SIMPLE_PROGRAMS ) $( HOST_RUST_PROGRAMS ) $( HOST_RUST_LIBRARY_FILE ) $( HOST_SHARED_LIBRARY )
2014-07-24 22:14:40 +00:00
2021-10-14 21:09:29 +00:00
target :: $( filter -out $ ( MOZBUILD_NON_DEFAULT_TARGETS ) ,$ ( LIBRARY ) $ ( SHARED_LIBRARY ) $ ( PROGRAM ) $ ( SIMPLE_PROGRAMS ) $ ( RUST_LIBRARY_FILE ) $ ( RUST_PROGRAMS ) )
2013-09-06 00:19:32 +00:00
2018-03-20 23:31:05 +00:00
i f n d e f L I B R A R Y
i f d e f O B J S
target :: $( OBJS )
e n d i f
e n d i f
2019-08-16 17:25:05 +00:00
target-objects : $( OBJS ) $( PROGOBJS )
host-objects : $( HOST_OBJS ) $( HOST_PROGOBJS )
2017-04-10 17:27:49 +00:00
syms ::
2014-11-30 01:45:31 +00:00
i n c l u d e $( MOZILLA_DIR ) / c o n f i g / m a k e f i l e s / t a r g e t _ b i n a r i e s . m k
2013-11-07 01:37:45 +00:00
e n d i f
1998-03-28 02:44:41 +00:00
alltags :
2011-04-03 07:16:49 +00:00
$( RM) TAGS
1999-06-11 20:21:48 +00:00
find $( topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $( TAG_PROGRAM)
1998-03-28 02:44:41 +00:00
2017-08-17 20:21:23 +00:00
d e f i n e E X P A N D _ C C _ O R _ C X X
2018-03-20 23:31:05 +00:00
$( if $ ( PROG_IS_C_ONLY_ $ ( 1) ) ,$ ( CC ) ,$ ( CCC ) )
2017-08-17 20:21:23 +00:00
e n d e f
1999-01-23 11:41:15 +00:00
#
# PROGRAM = Foo
# creates OBJS, links with LIBS to create Foo
#
2020-08-07 00:50:50 +00:00
$(PROGRAM) : $( PROGOBJS ) $( STATIC_LIBS ) $( EXTRA_DEPS ) $( call resfile ,$ ( PROGRAM ) ) $( GLOBAL_DEPS ) $( call mkdir_deps ,$ ( FINAL_TARGET ) )
2013-08-10 06:57:09 +00:00
$( REPORT_BUILD)
2001-12-09 07:08:58 +00:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( OS_ARCH ) )
2020-08-07 00:50:50 +00:00
$( LINKER) -OUT:$@ -PDB:$( LINK_PDBFILE) -IMPLIB:$( basename $( @F) ) .lib $( WIN32_EXE_LDFLAGS) $( LDFLAGS) $( MOZ_PROGRAM_LDFLAGS) $( $( notdir $@ ) _OBJS) $( filter %.res,$^) $( STATIC_LIBS) $( SHARED_LIBS) $( OS_LIBS)
2009-09-25 16:50:53 +00:00
e l s e # !WINNT || GNU_CC
2020-08-07 00:50:50 +00:00
$( call EXPAND_CC_OR_CXX,$@ ) -o $@ $( COMPUTED_CXX_LDFLAGS) $( PGO_CFLAGS) $( $( notdir $@ ) _OBJS) $( filter %.res,$^) $( WIN32_EXE_LDFLAGS) $( LDFLAGS) $( STATIC_LIBS) $( MOZ_PROGRAM_LDFLAGS) $( SHARED_LIBS) $( OS_LIBS)
2020-05-05 20:04:30 +00:00
$( call py_action,check_binary,--target $@ )
2001-12-09 07:08:58 +00:00
e n d i f # WINNT && !GNU_CC
2005-04-22 19:06:27 +00:00
2001-10-26 08:36:28 +00:00
i f d e f E N A B L E _ S T R I P
2013-11-11 16:01:22 +00:00
$( STRIP) $( STRIP_FLAGS) $@
2001-10-26 08:36:28 +00:00
e n d i f
2001-10-26 12:39:30 +00:00
i f d e f M O Z _ P O S T _ P R O G R A M _ C O M M A N D
$( MOZ_POST_PROGRAM_COMMAND) $@
e n d i f
1999-01-23 09:36:40 +00:00
2018-06-18 21:22:20 +00:00
$(HOST_PROGRAM) : $( HOST_PROGOBJS ) $( HOST_LIBS ) $( HOST_EXTRA_DEPS ) $( GLOBAL_DEPS ) $( call mkdir_deps ,$ ( DEPTH ) /dist /host /bin )
2013-08-10 06:57:09 +00:00
$( REPORT_BUILD)
2006-01-24 17:25:42 +00:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( HOST_OS_ARCH ) )
2020-02-13 13:40:15 +00:00
$( HOST_LINKER) -OUT:$@ -PDB:$( HOST_PDBFILE) $( $( notdir $@ ) _OBJS) $( WIN32_EXE_LDFLAGS) $( HOST_LDFLAGS) $( HOST_LINKER_LIBPATHS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2002-11-15 03:41:17 +00:00
e l s e
2011-01-24 08:56:40 +00:00
i f e q ( $( HOST_CPP_PROG_LINK ) , 1 )
2018-12-21 23:00:00 +00:00
$( HOST_CXX) -o $@ $( HOST_CXX_LDFLAGS) $( HOST_LDFLAGS) $( $( notdir $@ ) _OBJS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2007-04-27 11:47:10 +00:00
e l s e
2018-12-21 23:00:00 +00:00
$( HOST_CC) -o $@ $( HOST_C_LDFLAGS) $( HOST_LDFLAGS) $( $( notdir $@ ) _OBJS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2011-01-24 08:56:40 +00:00
e n d i f # HOST_CPP_PROG_LINK
2002-11-15 03:41:17 +00:00
e n d i f
2015-04-14 02:07:48 +00:00
i f n d e f C R O S S _ C O M P I L E
2020-05-05 20:04:30 +00:00
$( call py_action,check_binary,--host $@ )
2015-04-14 02:07:48 +00:00
e n d i f
2000-03-31 07:18:52 +00:00
1999-01-23 11:41:15 +00:00
#
# This is an attempt to support generation of multiple binaries
# in one directory, it assumes everything to compile Foo is in
# Foo.o (from either Foo.c or Foo.cpp).
#
# SIMPLE_PROGRAMS = Foo Bar
# creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
#
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
d e f i n e s i m p l e _ p r o g r a m _ d e p s
$1 : $( 1:$ ( BIN_SUFFIX ) =.$ ( OBJ_SUFFIX ) ) $( STATIC_LIBS ) $( EXTRA_DEPS ) $( call resfile_for_manifest ,$ 1) $( GLOBAL_DEPS )
e n d e f
$( foreach p ,$ ( SIMPLE_PROGRAMS ) ,$ ( eval $ ( call simple_program_deps ,$ ( p ) ) ) )
$(SIMPLE_PROGRAMS) :
2013-08-10 06:57:09 +00:00
$( REPORT_BUILD)
2001-12-09 07:08:58 +00:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( OS_ARCH ) )
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
$( LINKER) -out:$@ -pdb:$( LINK_PDBFILE) $( $@ _OBJS) $( filter %.res,$^) $( WIN32_EXE_LDFLAGS) $( LDFLAGS) $( MOZ_PROGRAM_LDFLAGS) $( STATIC_LIBS) $( SHARED_LIBS) $( OS_LIBS)
2000-03-31 01:24:48 +00:00
e l s e
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
$( call EXPAND_CC_OR_CXX,$@ ) $( COMPUTED_CXX_LDFLAGS) $( PGO_CFLAGS) -o $@ $( $@ _OBJS) $( filter %.res,$^) $( WIN32_EXE_LDFLAGS) $( LDFLAGS) $( STATIC_LIBS) $( MOZ_PROGRAM_LDFLAGS) $( SHARED_LIBS) $( OS_LIBS)
2020-05-05 20:04:30 +00:00
$( call py_action,check_binary,--target $@ )
2001-12-09 07:08:58 +00:00
e n d i f # WINNT && !GNU_CC
2005-04-22 19:06:27 +00:00
2001-10-26 08:36:28 +00:00
i f d e f E N A B L E _ S T R I P
2013-11-11 16:01:22 +00:00
$( STRIP) $( STRIP_FLAGS) $@
1999-01-23 12:20:00 +00:00
e n d i f
2001-10-26 12:39:30 +00:00
i f d e f M O Z _ P O S T _ P R O G R A M _ C O M M A N D
$( MOZ_POST_PROGRAM_COMMAND) $@
e n d i f
1999-01-23 11:41:15 +00:00
2018-12-21 23:00:00 +00:00
$(HOST_SIMPLE_PROGRAMS) : host_ %$( HOST_BIN_SUFFIX ) : $( HOST_LIBS ) $( HOST_EXTRA_DEPS ) $( GLOBAL_DEPS )
2013-08-10 06:57:09 +00:00
$( REPORT_BUILD)
2006-01-24 17:25:42 +00:00
i f e q ( W I N N T _ , $( HOST_OS_ARCH ) _ $( GNU_CC ) )
2020-02-13 13:40:15 +00:00
$( HOST_LINKER) -OUT:$@ -PDB:$( HOST_PDBFILE) $( $( notdir $@ ) _OBJS) $( WIN32_EXE_LDFLAGS) $( HOST_LDFLAGS) $( HOST_LINKER_LIBPATHS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2007-03-26 18:29:16 +00:00
e l s e
2007-07-16 18:40:49 +00:00
i f n e q ( , $( HOST_CPPSRCS ) $( USE_HOST_CXX ) )
2018-12-21 23:00:00 +00:00
$( HOST_CXX) $( HOST_OUTOPTION) $@ $( HOST_CXX_LDFLAGS) $( $( notdir $@ ) _OBJS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2005-07-05 17:02:20 +00:00
e l s e
2018-12-21 23:00:00 +00:00
$( HOST_CC) $( HOST_OUTOPTION) $@ $( HOST_C_LDFLAGS) $( $( notdir $@ ) _OBJS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2005-07-05 17:02:20 +00:00
e n d i f
2006-01-24 17:25:42 +00:00
e n d i f
2015-04-14 02:07:48 +00:00
i f n d e f C R O S S _ C O M P I L E
2020-05-05 20:04:30 +00:00
$( call py_action,check_binary,--host $@ )
2015-04-14 02:07:48 +00:00
e n d i f
2000-03-31 07:18:52 +00:00
2018-03-20 23:31:05 +00:00
$(LIBRARY) : $( OBJS ) $( STATIC_LIBS ) $( EXTRA_DEPS ) $( GLOBAL_DEPS )
2013-08-10 06:57:09 +00:00
$( REPORT_BUILD)
2018-03-20 23:31:05 +00:00
$( RM) $( REAL_LIBRARY)
2019-12-09 18:03:49 +00:00
$( AR) $( AR_FLAGS) $( $@ _OBJS)
1999-10-08 05:18:46 +00:00
2019-11-27 20:11:59 +00:00
$(WASM_ARCHIVE) : $( CWASMOBJS ) $( CPPWASMOBJS ) $( STATIC_LIBS ) $( EXTRA_DEPS ) $( GLOBAL_DEPS )
$( REPORT_BUILD_VERBOSE)
2021-07-16 02:38:41 +00:00
$( RM) $( WASM_ARCHIVE)
2021-10-06 08:56:32 +00:00
$( WASM_CXX) -o $@ -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size= $( if $( MOZ_OPTIMIZE) ,262144,1048576) -Wl,--no-entry -Wl,--growable-table $( CWASMOBJS) $( CPPWASMOBJS) -lwasi-emulated-process-clocks
2021-08-11 21:58:52 +00:00
2021-10-26 20:52:06 +00:00
$(addsuffix .c,$(WASM_ARCHIVE)) : $( WASM_ARCHIVE ) $( DIST ) /host /bin /wasm 2c $( HOST_BIN_SUFFIX )
$( DIST) /host/bin/wasm2c$( HOST_BIN_SUFFIX) -o $@ $<
2021-07-16 02:38:41 +00:00
2011-04-19 04:11:40 +00:00
i f e q ( $( OS_ARCH ) , W I N N T )
2012-10-09 08:17:26 +00:00
# Import libraries are created by the rules creating shared libraries.
# The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
# but make will happily consider the import library before it is refreshed
# when rebuilding the corresponding shared library. Defining an empty recipe
# for import libraries forces make to wait for the shared library recipe to
# have run before considering other targets that depend on the import library.
# See bug 795204.
$(IMPORT_LIBRARY) : $( SHARED_LIBRARY ) ;
2002-04-19 02:42:28 +00:00
e n d i f
2018-12-21 23:00:00 +00:00
$(HOST_SHARED_LIBRARY) : Makefile
2018-07-05 05:58:09 +00:00
$( REPORT_BUILD)
$( RM) $@
2019-02-14 21:45:27 +00:00
i f n e q ( , $( filter clang -cl ,$ ( HOST_CC_TYPE ) ) )
2020-02-13 13:40:15 +00:00
$( HOST_LINKER) -DLL -OUT:$@ $( $( notdir $@ ) _OBJS) $( HOST_CXX_LDFLAGS) $( HOST_LDFLAGS) $( HOST_LINKER_LIBPATHS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2018-07-05 05:58:09 +00:00
e l s e
2018-12-21 23:00:00 +00:00
$( HOST_CXX) $( HOST_OUTOPTION) $@ $( $( notdir $@ ) _OBJS) $( HOST_CXX_LDFLAGS) $( HOST_LDFLAGS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2018-07-05 05:58:09 +00:00
e n d i f
2007-06-30 05:20:00 +00:00
# On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
# so instead of deleting .o files after repacking them into a dylib, we make
# symlinks back to the originals. The symlinks are a no-op for stabs debugging,
# so no need to conditionalize on OS version or debugging format.
2020-08-07 00:50:50 +00:00
$(SHARED_LIBRARY) : $( OBJS ) $( call resfile ,$ ( SHARED_LIBRARY ) ) $( STATIC_LIBS ) $( EXTRA_DEPS ) $( GLOBAL_DEPS )
2013-08-10 06:57:09 +00:00
$( REPORT_BUILD)
2011-04-03 07:16:49 +00:00
$( RM) $@
2020-08-07 00:50:50 +00:00
$( MKSHLIB) $( $@ _OBJS) $( filter %.res,$^) $( LDFLAGS) $( STATIC_LIBS) $( SHARED_LIBS) $( EXTRA_DSO_LDOPTS) $( MOZ_GLUE_LDFLAGS) $( OS_LIBS)
2020-05-05 20:04:30 +00:00
$( call py_action,check_binary,--target $@ )
2007-10-10 23:03:14 +00:00
2006-01-23 17:16:17 +00:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( OS_ARCH ) )
e n d i f # WINNT && !GCC
1998-03-28 02:44:41 +00:00
chmod +x $@
2001-10-26 08:36:28 +00:00
i f d e f E N A B L E _ S T R I P
2013-11-11 16:01:22 +00:00
$( STRIP) $( STRIP_FLAGS) $@
2001-10-26 08:36:28 +00:00
e n d i f
1998-03-28 02:44:41 +00:00
2013-07-02 21:40:17 +00:00
# The object file is in the current directory, and the source file can be any
# relative path. This macro adds the dependency obj: src for each source file.
# This dependency must be first for the $< flag to work correctly, and the
# rules that have commands for these targets must not list any other
# prerequisites, or they will override the $< variable.
d e f i n e s r c _ o b j d e p
2018-12-21 22:59:47 +00:00
$(basename $3$(notdir $1)).$2 : $1 $$( call mkdir_deps ,$ $ ( MDDEPDIR ) )
2013-07-02 21:40:17 +00:00
e n d e f
2018-12-21 22:59:47 +00:00
$( foreach f ,$ ( CSRCS ) $ ( SSRCS ) $ ( CPPSRCS ) $ ( CMSRCS ) $ ( CMMSRCS ) $ ( ASFILES ) ,$ ( eval $ ( call src_objdep ,$ ( f ) ,$ ( OBJ_SUFFIX ) ) ) )
2020-07-09 12:19:58 +00:00
$( foreach f ,$ ( HOST_CSRCS ) $ ( HOST_CPPSRCS ) $ ( HOST_CMSRCS ) $ ( HOST_CMMSRCS ) ,$ ( eval $ ( call src_objdep ,$ ( f ) ,$ ( OBJ_SUFFIX ) ,host_ ) ) )
2019-11-27 20:11:59 +00:00
$( foreach f ,$ ( WASM_CSRCS ) $ ( WASM_CPPSRCS ) ,$ ( eval $ ( call src_objdep ,$ ( f ) ,wasm ) ) )
2015-07-21 13:21:40 +00:00
# The Rust compiler only outputs library objects, and so we need different
2015-05-08 22:18:00 +00:00
# mangling to generate dependency rules for it.
Bug 1163224 - add build system support for multiple Rust crates; r=glandium
Our current build system support for Rust compiles any Rust crate into a
so-called staticlib, which is a static library (.a file) that includes
the Rust runtime. That staticlib is then linked into libxul. For
supporting multiple crates, this approach breaks down, as linking
multiple copies of the Rust runtime is going to fail.
For supporting multiple crates, the approach taken here is to compile
each crate into a so-called rlib, which is essentially a staticlib
without the Rust runtime linked in. The build system takes note of
every crate destined for linking with libxul (treating them like static
libraries generated from C/C++ files), and generates a super-crate,
whimsically named "rul", that is compiled as a staticlib (so as to
include the Rust runtime) and then linked into libxul. Thus only one
copy of the Rust runtime is included, and the Rust compiler can take
care of any inter-crate dependencies.
This patch currently only supports Rust code in shared libraries, not in
binaries.
2016-04-21 13:54:01 +00:00
mk_global_crate_libname = $( basename lib$( notdir $1 ) ) .$( LIB_SUFFIX)
crate_src_libdep = $( call mk_global_crate_libname,$1 ) : $1 $$ ( call mkdir_deps,$$ ( MDDEPDIR) )
$( foreach f ,$ ( RS_STATICLIB_CRATE_SRC ) ,$ ( eval $ ( call crate_src_libdep ,$ ( f ) ) ) )
2013-07-02 21:40:17 +00:00
2013-04-09 22:10:25 +00:00
$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS) : $( GLOBAL_DEPS )
2012-03-31 07:24:39 +00:00
2002-11-15 07:24:44 +00:00
# Rules for building native targets must come first because of the host_ prefix
2013-10-22 04:40:27 +00:00
$(HOST_COBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( HOST_CC) $( HOST_OUTOPTION) $@ -c $( HOST_CPPFLAGS) $( HOST_CFLAGS) $( NSPR_CFLAGS) $<
2007-03-26 18:17:02 +00:00
2013-10-22 04:40:27 +00:00
$(HOST_CPPOBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2016-01-12 19:00:24 +00:00
$( call BUILDSTATUS,OBJECT_FILE $@ )
2020-06-03 19:09:52 +00:00
$( HOST_CXX) $( HOST_OUTOPTION) $@ -c $( HOST_CPPFLAGS) $( HOST_CXXFLAGS) $( NSPR_CFLAGS) $<
2002-11-15 07:24:44 +00:00
2013-10-22 04:40:27 +00:00
$(HOST_CMOBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( HOST_CC) $( HOST_OUTOPTION) $@ -c $( HOST_CPPFLAGS) $( HOST_CFLAGS) $( HOST_CMFLAGS) $( NSPR_CFLAGS) $<
2007-04-27 11:47:10 +00:00
2013-10-22 04:40:27 +00:00
$(HOST_CMMOBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( HOST_CXX) $( HOST_OUTOPTION) $@ -c $( HOST_CPPFLAGS) $( HOST_CXXFLAGS) $( HOST_CMMFLAGS) $( NSPR_CFLAGS) $<
2007-04-27 11:47:10 +00:00
2013-07-02 21:40:17 +00:00
$(COBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( CC) $( OUTOPTION) $@ -c $( COMPILE_CFLAGS) $( $( notdir $<) _FLAGS) $<
1998-03-28 02:44:41 +00:00
2019-11-27 20:11:59 +00:00
$(CWASMOBJS) :
$( REPORT_BUILD_VERBOSE)
2021-08-25 07:39:01 +00:00
$( WASM_CC) -o $@ -c $( WASM_CFLAGS) $( $( notdir $<) _FLAGS) $<
2019-11-27 20:11:59 +00:00
Bug 1617794 - Wrap Windows tools with Wine on cross builds. r=dmajor
Windows programs run via Wine don't like Unix absolute paths (they look
like command line arguments), so we need to use relative paths.
Mingw already run fxc2 via wine, but for some reason it doesn't care
about the Unix absolute paths. genshaders does need some adjustements to
run properly with the real fxc.
Now, on actual Windows, because the temporary directory where
tempfile.NamedTemporaryFile creates files by default is not necessarily
on the same drive as where the command runs from, a relative path can't
be constructed. So we also force the temporary file to be created in the
current (obj) directory.
There is no similar concern for other files because we only go from
objdir to srcdir, and the build system already doesn't support both
being on a separate drive.
While here, flush stdout when the genshared script writes to it, so that
the messages are printed out immediately rather than randomly, later,
after output from subprocesses.
Differential Revision: https://phabricator.services.mozilla.com/D64294
--HG--
extra : moz-landing-system : lando
2020-02-27 04:42:57 +00:00
WINEWRAP = $( if $( and $( filter %.exe,$1 ) ,$( WINE) ) ,$( WINE) $1 ,$1 )
# Windows program run via Wine don't like Unix absolute paths (they look
# like command line arguments). So when needed, create relative paths
# from absolute paths. We start with $(DEPTH), which gets us to topobjdir,
# then add "/.." for each component of topobjdir, which gets us to /.
# then we can add the absolute path after that and we have a relative path,
# albeit longer than it could be.
i f d e f W I N E
relativize = $( if $( filter /%,$1 ) ,$( DEPTH) $( subst $( space) ,,$( foreach d,$( subst /, ,$( topobjdir) ) ,/..) ) $1 ,$1 )
e l s e
relativize = $1
e n d i f
2007-10-13 22:14:28 +00:00
i f d e f A S F I L E S
1999-03-08 15:01:13 +00:00
# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
# a '-c' flag.
2013-07-02 21:40:17 +00:00
$(ASOBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
Bug 1617794 - Wrap Windows tools with Wine on cross builds. r=dmajor
Windows programs run via Wine don't like Unix absolute paths (they look
like command line arguments), so we need to use relative paths.
Mingw already run fxc2 via wine, but for some reason it doesn't care
about the Unix absolute paths. genshaders does need some adjustements to
run properly with the real fxc.
Now, on actual Windows, because the temporary directory where
tempfile.NamedTemporaryFile creates files by default is not necessarily
on the same drive as where the command runs from, a relative path can't
be constructed. So we also force the temporary file to be created in the
current (obj) directory.
There is no similar concern for other files because we only go from
objdir to srcdir, and the build system already doesn't support both
being on a separate drive.
While here, flush stdout when the genshared script writes to it, so that
the messages are printed out immediately rather than randomly, later,
after output from subprocesses.
Differential Revision: https://phabricator.services.mozilla.com/D64294
--HG--
extra : moz-landing-system : lando
2020-02-27 04:42:57 +00:00
$( call WINEWRAP,$( AS) ) $( ASOUTOPTION) $@ $( ASFLAGS) $( $( notdir $<) _FLAGS) $( AS_DASH_C_FLAG) $( call relativize,$<)
2001-07-02 03:49:50 +00:00
e n d i f
1998-03-28 02:44:41 +00:00
2017-02-10 16:34:08 +00:00
d e f i n e s y m s _ t e m p l a t e
syms :: $( 2)
$(2) : $( 1)
2017-12-18 16:26:02 +00:00
i f d e f M O Z _ C R A S H R E P O R T E R
2020-05-05 20:04:30 +00:00
$$ ( call py_action,dumpsymbols,$$ ( abspath $$ <) $$ ( abspath $$ @) $$ ( DUMP_SYMBOLS_FLAGS) )
2020-03-27 10:41:06 +00:00
i f e q ( $( OS_ARCH ) , W I N N T )
2020-03-26 22:13:14 +00:00
i f d e f W I N C H E C K S E C
$$ ( PYTHON3) $$ ( topsrcdir) /build/win32/autowinchecksec.py $$ <
e n d i f # WINCHECKSEC
2020-03-20 01:54:00 +00:00
e n d i f # WINNT
2017-12-18 16:26:02 +00:00
e n d i f
2017-02-10 16:34:08 +00:00
e n d e f
i f n e q ( , $( filter $ ( DIST ) /bin %,$ ( FINAL_TARGET ) ) )
2021-10-14 21:09:29 +00:00
DUMP_SYMS_TARGETS := $( SHARED_LIBRARY) $( PROGRAM) $( SIMPLE_PROGRAMS)
2017-02-10 16:34:08 +00:00
e n d i f
i f d e f M O Z _ A U T O M A T I O N
i f e q ( , $( filter 1,$ ( MOZ_AUTOMATION_BUILD_SYMBOLS ) ) )
DUMP_SYMS_TARGETS :=
e n d i f
e n d i f
2018-10-17 14:38:52 +00:00
i f d e f M O Z _ C O P Y _ P D B S
2019-05-07 22:16:36 +00:00
MAIN_PDB_FILES = $( addsuffix .pdb,$( basename $( DUMP_SYMS_TARGETS) ) )
MAIN_PDB_DEST ?= $( FINAL_TARGET)
MAIN_PDB_TARGET = syms
INSTALL_TARGETS += MAIN_PDB
i f d e f C P P _ U N I T _ T E S T S
CPP_UNIT_TESTS_PDB_FILES = $( addsuffix .pdb,$( basename $( CPP_UNIT_TESTS) ) )
CPP_UNIT_TESTS_PDB_DEST = $( DIST) /cppunittests
CPP_UNIT_TESTS_PDB_TARGET = syms
INSTALL_TARGETS += CPP_UNIT_TESTS_PDB
e n d i f
2018-10-17 14:38:52 +00:00
e l s e i f d e f M O Z _ C R A S H R E P O R T E R
$( foreach file ,$ ( DUMP_SYMS_TARGETS ) ,$ ( eval $ ( call syms_template ,$ ( file ) ,$ ( notdir $ ( file ) ) _syms .track ) ) )
2017-12-18 16:26:02 +00:00
e n d i f
2017-02-10 16:34:08 +00:00
2019-02-05 21:38:42 +00:00
i f n e q ( , $( RUST_TESTS ) $( RUST_LIBRARY_FILE ) $( HOST_RUST_LIBRARY_FILE ) $( RUST_PROGRAMS ) $( HOST_RUST_PROGRAMS ) )
i n c l u d e $( MOZILLA_DIR ) / c o n f i g / m a k e f i l e s / r u s t . m k
2017-05-01 15:58:45 +00:00
e n d i f
2013-07-02 21:40:17 +00:00
$(SOBJS) :
2013-08-10 06:57:09 +00:00
$( REPORT_BUILD)
Bug 1617794 - Wrap Windows tools with Wine on cross builds. r=dmajor
Windows programs run via Wine don't like Unix absolute paths (they look
like command line arguments), so we need to use relative paths.
Mingw already run fxc2 via wine, but for some reason it doesn't care
about the Unix absolute paths. genshaders does need some adjustements to
run properly with the real fxc.
Now, on actual Windows, because the temporary directory where
tempfile.NamedTemporaryFile creates files by default is not necessarily
on the same drive as where the command runs from, a relative path can't
be constructed. So we also force the temporary file to be created in the
current (obj) directory.
There is no similar concern for other files because we only go from
objdir to srcdir, and the build system already doesn't support both
being on a separate drive.
While here, flush stdout when the genshared script writes to it, so that
the messages are printed out immediately rather than randomly, later,
after output from subprocesses.
Differential Revision: https://phabricator.services.mozilla.com/D64294
--HG--
extra : moz-landing-system : lando
2020-02-27 04:42:57 +00:00
$( call WINEWRAP,$( AS) ) $( ASOUTOPTION) $@ $( SFLAGS) $( $( notdir $<) _FLAGS) -c $( call relativize,$<)
1998-03-28 02:44:41 +00:00
2013-07-02 21:40:17 +00:00
$(CPPOBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2016-01-12 19:00:24 +00:00
$( call BUILDSTATUS,OBJECT_FILE $@ )
2020-06-03 19:09:52 +00:00
$( CCC) $( OUTOPTION) $@ -c $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $<
1998-03-28 02:44:41 +00:00
2019-11-27 20:11:59 +00:00
$(CPPWASMOBJS) :
$( REPORT_BUILD_VERBOSE)
$( call BUILDSTATUS,OBJECT_FILE $@ )
2021-08-25 07:39:01 +00:00
$( WASM_CXX) -o $@ -c $( WASM_CXXFLAGS) $( $( notdir $<) _FLAGS) $<
2019-11-27 20:11:59 +00:00
2013-07-02 21:40:17 +00:00
$(CMMOBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( CCC) -o $@ -c $( COMPILE_CXXFLAGS) $( COMPILE_CMMFLAGS) $( $( notdir $<) _FLAGS) $<
2001-10-31 01:20:39 +00:00
2013-07-02 21:40:17 +00:00
$(CMOBJS) :
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( CC) -o $@ -c $( COMPILE_CFLAGS) $( COMPILE_CMFLAGS) $( $( notdir $<) _FLAGS) $<
2004-06-18 00:56:48 +00:00
2013-08-20 06:21:35 +00:00
$(filter %.s,$(CPPSRCS : %.cpp =%.s )): %.s : %.cpp $( call mkdir_deps ,$ ( MDDEPDIR ) )
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( CCC) -S $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $<
2003-03-08 05:18:43 +00:00
2013-08-20 06:21:35 +00:00
$(filter %.s,$(CPPSRCS : %.cc =%.s )): %.s : %.cc $( call mkdir_deps ,$ ( MDDEPDIR ) )
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( CCC) -S $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $<
2007-07-11 17:26:11 +00:00
2014-06-17 02:36:24 +00:00
$(filter %.s,$(CPPSRCS : %.cxx =%.s )): %.s : %.cpp $( call mkdir_deps ,$ ( MDDEPDIR ) )
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( CCC) -S $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $<
2014-06-17 02:36:24 +00:00
2013-08-20 06:21:35 +00:00
$(filter %.s,$(CSRCS : %.c =%.s )): %.s : %.c $( call mkdir_deps ,$ ( MDDEPDIR ) )
2016-04-06 20:49:55 +00:00
$( REPORT_BUILD_VERBOSE)
2020-06-03 19:09:52 +00:00
$( CC) -S $( COMPILE_CFLAGS) $( $( notdir $<) _FLAGS) $<
2003-03-08 05:18:43 +00:00
2013-12-12 00:23:24 +00:00
i f n e q ( , $( filter %.i ,$ ( MAKECMDGOALS ) ) )
# Call as $(call _group_srcs,extension,$(SRCS)) - this will create a list
# of the full sources, as well as the $(notdir) version. So:
# foo.cpp sub/bar.cpp
# becomes:
# foo.cpp sub/bar.cpp bar.cpp
#
# This way we can match both 'make sub/bar.i' and 'make bar.i'
_group_srcs = $( sort $( patsubst %.$1 ,%.i,$( filter %.$1 ,$2 $( notdir $2 ) ) ) )
2017-04-05 07:31:40 +00:00
d e f i n e P R E P R O C E S S _ R U L E S
_PREPROCESSED_$1_FILES := $$ ( call _group_srcs,$1 ,$$ ( $2 ) )
2013-12-12 00:23:24 +00:00
# Make preprocessed files PHONY so they are always executed, since they are
# manual targets and we don't necessarily write to $@.
2017-04-05 07:31:40 +00:00
.PHONY : $$( _PREPROCESSED_ $ 1_FILES )
2017-04-05 07:36:24 +00:00
# Hack up VPATH so we can reach the sources. Eg: 'make Parser.i' may need to
# reach $(srcdir)/frontend/Parser.i
v p a t h % . $ 1 $$ ( a d d p r e f i x $$ ( s r c d i r ) / , $$ ( s o r t $$ ( d i r $$ ( $ 2 ) ) ) )
2017-04-05 07:39:51 +00:00
v p a t h % . $ 1 $$ ( a d d p r e f i x $$ ( C U R D I R ) / , $$ ( s o r t $$ ( d i r $$ ( $ 2 ) ) ) )
2017-04-05 07:36:24 +00:00
2017-04-05 07:33:37 +00:00
$$ (_PREPROCESSED_$1_FILES) : _DEPEND_CFLAGS =
$$ (_PREPROCESSED_$1_FILES) : %.i : %.$1
2017-04-05 07:31:40 +00:00
$$ ( REPORT_BUILD_VERBOSE)
$$ ( addprefix $$ ( MKDIR) -p ,$$ ( filter-out .,$$ ( @D) ) )
2019-09-09 17:44:47 +00:00
$$ ( $3 ) -C $$ ( PREPROCESS_OPTION) $$ @ $( foreach var,$4 ,$$ ( $( var) ) ) $$ ( $$ ( notdir $$ <) _FLAGS) $$ <
2013-12-12 00:23:24 +00:00
2017-04-05 07:31:40 +00:00
e n d e f
1998-03-28 02:44:41 +00:00
2017-04-05 07:31:40 +00:00
$( eval $ ( call PREPROCESS_RULES ,cpp ,CPPSRCS ,CCC ,COMPILE_CXXFLAGS ) )
$( eval $ ( call PREPROCESS_RULES ,cc ,CPPSRCS ,CCC ,COMPILE_CXXFLAGS ) )
$( eval $ ( call PREPROCESS_RULES ,cxx ,CPPSRCS ,CCC ,COMPILE_CXXFLAGS ) )
$( eval $ ( call PREPROCESS_RULES ,c ,CSRCS ,CC ,COMPILE_CFLAGS ) )
$( eval $ ( call PREPROCESS_RULES ,mm ,CMMSRCS ,CCC ,COMPILE_CXXFLAGS COMPILE_CMMFLAGS ) )
2008-03-13 11:12:10 +00:00
2013-12-12 00:23:24 +00:00
# Default to pre-processing the actual unified file. This can be overridden
# at the command-line to pre-process only the individual source file.
PP_UNIFIED ?= 1
# PP_REINVOKE gets set on the sub-make to prevent us from going in an
# infinite loop if the filename doesn't exist in the unified source files.
i f n d e f P P _ R E I N V O K E
2014-06-17 02:36:24 +00:00
MATCH_cpp = \( cpp\| cc| cxx\)
2013-12-12 00:23:24 +00:00
UPPER_c = C
UPPER_cpp = CPP
UPPER_mm = CMM
# When building with PP_UNIFIED=0, we also have to look in the Unified files to
# find a matching pathname.
_get_all_sources = $1 $( if $( filter Unified%,$1 ) ,$( shell sed -n 's/\#include "\(.*\)"$$/\1/p' $( filter Unified%,$1 ) ) )
all_cpp_sources := $( call _get_all_sources,$( CPPSRCS) )
all_mm_sources := $( call _get_all_sources,$( CMMSRCS) )
all_c_sources := $( call _get_all_sources,$( CSRCS) )
all_sources := $( all_cpp_sources) $( all_cmm_sources) $( all_c_sources)
# The catch-all %.i rule runs when we pass in a .i filename that doesn't match
# one of the *SRCS variables. The two code paths depend on whether or not
# we are requesting a unified file (PP_UNIFIED=1, the default) or not:
#
# PP_UNIFIED=1:
# - Look for it in any of the Unified files, and re-exec make with
# Unified_foo0.i as the target. This gets us the full unified preprocessed
# file.
#
# PP_UNIFIED=0:
# - If the .i filename is in *SRCS, or in a Unified filename, then we re-exec
# make with that filename as the target. The *SRCS variables are modified
# to have the Unified sources appended to them so that the static pattern
# rules will match.
%.i : FORCE
i f e q ( $( PP_UNIFIED ) , 1 )
@$( MAKE) PP_REINVOKE = 1 \
$( or $( addsuffix .i, \
$( foreach type,c cpp mm, \
$( if $( filter Unified%,$( $( UPPER_$( type ) ) SRCS) ) , \
$( shell grep -l '#include "\(.*/\)\?$(basename $@).$(or $(MATCH_$(type)),$(type))"' Unified*.$( type ) | sed 's/\.$(type)$$//' ) \
) ) ) ,$( error " File not found for preprocessing: $@ " ) )
e l s e
@$( MAKE) PP_REINVOKE = 1 $@ \
$( foreach type,c cpp mm,$( UPPER_$( type ) ) SRCS = " $( all_$( type ) _sources) " )
e n d i f
e n d i f
e n d i f
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
# EXTRA_DEPS contains manifests (manually added in Makefile.in ; bug 1498414)
Bug 1537703 - Use llvm-rc instead of rc.exe. r=mhentges,froydnj
This makes us use one less tool from MSVC, and removes one more use of wine
in cross builds.
We replace the call to either rc/llvm-rc or windres with a wrapper script.
While the script is not strictly needed for the latter, we use a wrapper
in that case anyway because it's one step towards fixing bug 1498414.
For llvm-rc, however, we need a wrapper because llvm-rc doesn't preprocess
on its own, so the wrapper does that too.
The wrapper script also allows to deal with the default flags passed to
llvm-rc or windres, rather than inherit them from old-configure.
We also need to explicitly pass the codepage to llvm-rc, which was not
necessary with rc (presumably, llvm-rc has a different default).
While here, remove the unused WINDRES subst from js/src/old-configure.in.
Also, while here, we remove --use-temp-file, because as described in the
linked bug and in the windres manual page, it was used to work around bugs
on Windows 98 and earlier.
Differential Revision: https://phabricator.services.mozilla.com/D86312
2020-08-08 21:02:04 +00:00
%.res : $( or $ ( RCFILE ) ,%.rc ) $( MOZILLA_DIR ) /config /create_res .py $( EXTRA_DEPS )
2013-08-10 06:57:09 +00:00
$( REPORT_BUILD)
Bug 1537703 - Use llvm-rc instead of rc.exe. r=mhentges,froydnj
This makes us use one less tool from MSVC, and removes one more use of wine
in cross builds.
We replace the call to either rc/llvm-rc or windres with a wrapper script.
While the script is not strictly needed for the latter, we use a wrapper
in that case anyway because it's one step towards fixing bug 1498414.
For llvm-rc, however, we need a wrapper because llvm-rc doesn't preprocess
on its own, so the wrapper does that too.
The wrapper script also allows to deal with the default flags passed to
llvm-rc or windres, rather than inherit them from old-configure.
We also need to explicitly pass the codepage to llvm-rc, which was not
necessary with rc (presumably, llvm-rc has a different default).
While here, remove the unused WINDRES subst from js/src/old-configure.in.
Also, while here, we remove --use-temp-file, because as described in the
linked bug and in the windres manual page, it was used to work around bugs
on Windows 98 and earlier.
Differential Revision: https://phabricator.services.mozilla.com/D86312
2020-08-08 21:02:04 +00:00
$( PYTHON3) $( MOZILLA_DIR) /config/create_res.py $( DEFINES) $( INCLUDES) -o $@ $<
2002-01-01 00:03:57 +00:00
Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart
We are currently relying on two different ways to insert side-by-side
manifests in binaries on Windows: through resource files, or through
the use of MT. The latter is not supported on mingw builds, which is
not great.
Link.exe has options to add a manifest at link time without relying on
either method above, but that's not supported on mingw either.
So the best we can do is to move everything to using resource files.
This also avoids using MT, which, on cross builds, requires using wine.
Ideally, the manifests would be declared in moz.build, but that
complicates things for cases like TestDllInterceptor, where there are
multiple binaries in the same directory, but only one of them needs the
manifest. This keeps the status quo of getting the manifest
automatically from the source directory.
Differential Revision: https://phabricator.services.mozilla.com/D85382
2020-08-07 00:55:16 +00:00
$(notdir $(addsuffix .rc,$(PROGRAM) $(SHARED_LIBRARY) $(SIMPLE_PROGRAMS) module)) : %.rc : $( RCINCLUDE ) $( MOZILLA_DIR ) /config /create_rc .py
2020-08-07 00:50:50 +00:00
$( PYTHON3) $( MOZILLA_DIR) /config/create_rc.py '$(if $(filter module,$*),,$*)' '$(RCINCLUDE)'
2013-08-20 06:21:45 +00:00
# Cancel GNU make built-in implicit rules
MAKEFLAGS += -r
1999-03-22 20:43:05 +00:00
2014-02-10 22:57:01 +00:00
i f n e q ( , $( filter WINNT ,$ ( OS_ARCH ) ) )
2006-09-27 15:23:31 +00:00
SEP := ;
e l s e
SEP := :
e n d i f
EMPTY :=
SPACE := $( EMPTY) $( EMPTY)
1999-01-29 20:00:50 +00:00
###############################################################################
1998-03-28 02:44:41 +00:00
# Bunch of things that extend the 'export' rule (in order):
1999-01-29 20:00:50 +00:00
###############################################################################
1998-03-28 02:44:41 +00:00
2005-02-18 22:17:37 +00:00
i f n e q ( $( XPI_NAME ) , )
2008-10-31 00:03:02 +00:00
$(FINAL_TARGET) :
$( NSINSTALL) -D $@
export :: $( FINAL_TARGET )
2005-02-18 22:17:37 +00:00
e n d i f
1999-06-03 00:41:11 +00:00
################################################################################
2015-11-28 01:21:19 +00:00
# The default location for prefs is the gre prefs directory.
# PREF_DIR is used for L10N_PREF_JS_EXPORTS in various locales/ directories.
2019-03-27 23:33:00 +00:00
PREF_DIR = defaults/pref
2012-12-05 22:36:15 +00:00
# If DIST_SUBDIR is defined it indicates that app and gre dirs are
# different and that we are building app related resources. Hence,
# PREF_DIR should point to the app prefs location.
2015-10-06 03:13:33 +00:00
i f n e q ( , $( DIST_SUBDIR ) $( XPI_NAME ) )
2019-03-27 23:33:00 +00:00
PREF_DIR = defaults/preferences
2005-03-28 19:36:24 +00:00
e n d i f
2004-01-16 19:22:43 +00:00
2012-05-10 17:10:11 +00:00
################################################################################
2000-09-20 19:35:24 +00:00
# CHROME PACKAGING
2000-09-09 05:54:35 +00:00
2003-10-15 20:30:59 +00:00
chrome ::
$( MAKE) realchrome
2009-02-27 21:03:53 +00:00
$( LOOP_OVER_DIRS)
2003-10-15 20:30:59 +00:00
2012-05-15 16:20:30 +00:00
$(FINAL_TARGET)/chrome : $( call mkdir_deps ,$ ( FINAL_TARGET ) /chrome )
2008-10-31 00:03:02 +00:00
2013-12-10 07:18:11 +00:00
i f n e q ( , $( JAR_MANIFEST ) )
2002-04-25 02:52:44 +00:00
i f n d e f N O _ D I S T _ I N S T A L L
2013-02-06 21:21:32 +00:00
i f d e f X P I _ N A M E
2013-02-07 16:22:11 +00:00
i f d e f X P I _ R O O T _ A P P I D
# For add-on packaging we may specify that an application
2013-02-06 21:21:32 +00:00
# sub-dir should be added to the root chrome manifest with
# a specific application id.
2013-12-02 21:34:21 +00:00
MAKE_JARS_FLAGS += --root-manifest-entry-appid= '$(XPI_ROOT_APPID)'
2013-02-07 16:22:11 +00:00
e n d i f
2013-02-06 21:21:32 +00:00
# if DIST_SUBDIR is defined but XPI_ROOT_APPID is not there's
# no way langpacks will get packaged right, so error out.
i f n e q ( , $( DIST_SUBDIR ) )
i f n d e f X P I _ R O O T _ A P P I D
$( error XPI_ROOT_APPID is not defined - langpacks will break .)
e n d i f
e n d i f
e n d i f
2020-06-30 21:34:32 +00:00
misc realchrome :: $( FINAL_TARGET ) /chrome
2020-05-05 20:04:30 +00:00
$( call py_action,jar_maker,\
2015-10-08 23:35:48 +00:00
$( QUIET) -d $( FINAL_TARGET) \
2015-12-29 07:00:21 +00:00
$( MAKE_JARS_FLAGS) $( DEFINES) $( ACDEFINES) \
2013-10-11 20:19:11 +00:00
$( JAR_MANIFEST) )
2013-02-06 21:21:32 +00:00
2020-06-30 21:34:32 +00:00
i f d e f A B _ C D
.PHONY : l 10n
l10n : misc ;
e n d i f
2008-11-26 19:43:59 +00:00
e n d i f
2013-12-10 07:18:11 +00:00
2002-04-25 02:52:44 +00:00
e n d i f
2014-07-28 23:55:55 +00:00
# When you move this out of the tools tier, please remove the corresponding
# hacks in recursivemake.py that check if Makefile.in sets the variable.
2005-06-01 11:59:09 +00:00
i f n e q ( $( XPI_PKGNAME ) , )
2013-11-08 02:42:22 +00:00
tools realchrome ::
2013-12-02 21:34:21 +00:00
@echo 'Packaging $(XPI_PKGNAME).xpi...'
2020-05-05 20:04:30 +00:00
$( call py_action,zip,-C $( FINAL_TARGET) ../$( XPI_PKGNAME) .xpi '*' )
2005-06-01 11:59:09 +00:00
e n d i f
1999-02-17 17:33:07 +00:00
#############################################################################
1999-08-24 21:45:06 +00:00
# MDDEPDIR is the subdirectory where all the dependency files are placed.
# This uses a make rule (instead of a macro) to support parallel
# builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
# processes could simultaneously try to create the same directory.
#
2008-11-10 20:55:46 +00:00
# We use $(CURDIR) in the rule's target to ensure that we don't find
# a dependency directory in the source tree via VPATH (perhaps from
# a previous build in the source tree) and thus neglect to create a
# dependency directory in the object directory, where we really need
# it.
2019-08-21 12:27:49 +00:00
_MDDEPEND_FILES :=
1999-09-09 09:24:58 +00:00
2019-08-21 12:27:49 +00:00
i f n e q ( , $( filter target -objects target all default ,$ ( MAKECMDGOALS ) ) )
_MDDEPEND_FILES += $( addsuffix .pp,$( notdir $( sort $( OBJS) $( PROGOBJS) ) ) )
1999-03-09 01:31:26 +00:00
e n d i f
2001-04-05 01:18:34 +00:00
2019-08-21 12:27:49 +00:00
i f n e q ( , $( filter host -objects host all default ,$ ( MAKECMDGOALS ) ) )
_MDDEPEND_FILES += $( addsuffix .pp,$( notdir $( sort $( HOST_OBJS) $( HOST_PROGOBJS) ) ) )
1999-03-10 00:03:12 +00:00
e n d i f
2013-05-09 17:05:33 +00:00
2019-11-04 23:15:19 +00:00
MDDEPEND_FILES := $( strip $( wildcard $( addprefix $( MDDEPDIR) /,$( _MDDEPEND_FILES) ) ) )
MDDEPEND_FILES += $( EXTRA_MDDEPEND_FILES)
2013-05-09 17:05:33 +00:00
i f n e q ( , $( MDDEPEND_FILES ) )
2015-12-03 23:20:58 +00:00
- i n c l u d e $( MDDEPEND_FILES )
2013-05-09 17:05:33 +00:00
e n d i f
2012-08-07 07:29:59 +00:00
################################################################################
# Install/copy rules
#
# The INSTALL_TARGETS variable contains a list of all install target
2012-08-29 06:55:57 +00:00
# categories. Each category defines a list of files and executables, and an
# install destination,
2012-08-07 07:29:59 +00:00
#
# FOO_FILES := foo bar
# FOO_EXECUTABLES := baz
# FOO_DEST := target_path
# INSTALL_TARGETS += FOO
2012-08-29 06:55:57 +00:00
#
# Additionally, a FOO_TARGET variable may be added to indicate the target for
# which the files and executables are installed. Default is "libs".
2013-11-09 01:32:53 +00:00
#
# Finally, a FOO_KEEP_PATH variable may be set to 1 to indicate the paths given
# in FOO_FILES/FOO_EXECUTABLES are to be kept at the destination. That is,
# if FOO_FILES is bar/baz/qux.h, and FOO_DEST is $(DIST)/include, the installed
# file would be $(DIST)/include/bar/baz/qux.h instead of $(DIST)/include/qux.h
2012-08-29 06:55:57 +00:00
# If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
2014-08-06 17:58:50 +00:00
i f n e q ( , $( filter $ ( DEPTH ) /config /nsinstall $ ( HOST_BIN_SUFFIX ) ,$ ( install_cmd ) ) )
i f e q ( , $( wildcard $ ( DEPTH ) /config /nsinstall $ ( HOST_BIN_SUFFIX ) ) )
nsinstall_is_usable = $( if $( wildcard $( DEPTH) /config/nsinstall$( HOST_BIN_SUFFIX) ) ,yes)
2012-08-29 06:55:57 +00:00
d e f i n e i n s t a l l _ c m d _ o v e r r i d e
2014-02-05 04:02:20 +00:00
$(1) : install_cmd = $$( if $ $ ( nsinstall_is_usable ) ,$ $ ( INSTALL ) ,$ $ ( NSINSTALL_PY ) -t ) $$( 1)
2012-08-29 06:55:57 +00:00
e n d e f
e n d i f
2013-01-23 09:13:04 +00:00
e n d i f
2012-08-29 06:55:57 +00:00
2013-11-09 01:32:53 +00:00
install_target_tier = $( or $( $( 1) _TARGET) ,libs)
INSTALL_TARGETS_TIERS := $( sort $( foreach category,$( INSTALL_TARGETS) ,$( call install_target_tier,$( category) ) ) )
install_target_result = $( $( 1) _DEST:%/= %) /$( if $( $( 1) _KEEP_PATH) ,$( 2) ,$( notdir $( 2) ) )
install_target_files = $( foreach file,$( $( 1) _FILES) ,$( call install_target_result,$( category) ,$( file) ) )
install_target_executables = $( foreach file,$( $( 1) _EXECUTABLES) ,$( call install_target_result,$( category) ,$( file) ) )
# Work around a GNU make 3.81 bug where it gives $< the wrong value.
# See details in bug 934864.
d e f i n e c r e a t e _ d e p e n d e n c y
$(1) : $( 2)
$(1) : $( 2)
e n d e f
d e f i n e i n s t a l l _ t a r g e t _ t e m p l a t e
$( call install_cmd_override ,$ ( 2) )
$( call create_dependency ,$ ( 2) ,$ ( 1) )
2012-08-07 07:29:59 +00:00
e n d e f
2013-11-09 01:32:53 +00:00
2012-08-07 07:29:59 +00:00
$( foreach category ,$ ( INSTALL_TARGETS ) ,\
2013-11-09 01:32:53 +00:00
$( if $( $( category) _DEST) ,,$( error Missing $( category) _DEST) ) \
$( foreach tier,$( call install_target_tier,$( category) ) ,\
$( eval INSTALL_TARGETS_FILES_$( tier) += $( call install_target_files,$( category) ) ) \
$( eval INSTALL_TARGETS_EXECUTABLES_$( tier) += $( call install_target_executables,$( category) ) ) \
) \
$( foreach file,$( $( category) _FILES) $( $( category) _EXECUTABLES) , \
$( eval $( call install_target_template,$( file) ,$( call install_target_result,$( category) ,$( file) ) ) ) \
) \
)
$( foreach tier ,$ ( INSTALL_TARGETS_TIERS ) , \
$( eval $( tier) :: $( INSTALL_TARGETS_FILES_$( tier) ) $( INSTALL_TARGETS_EXECUTABLES_$( tier) ) ) \
2012-08-07 07:29:59 +00:00
)
2013-11-09 01:32:53 +00:00
install_targets_sanity = $( if $( filter-out $( notdir $@ ) ,$( notdir $( <) ) ) ,$( error Looks like $@ has an unexpected dependency on $< which breaks INSTALL_TARGETS) )
$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_FILES_$(tier)))) :
$( install_targets_sanity)
2013-12-02 21:34:21 +00:00
$( call install_cmd,$( IFLAGS1) '$<' '$(@D)' )
2013-11-09 01:32:53 +00:00
$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_EXECUTABLES_$(tier)))) :
$( install_targets_sanity)
2013-12-02 21:34:21 +00:00
$( call install_cmd,$( IFLAGS2) '$<' '$(@D)' )
2013-11-09 01:32:53 +00:00
2012-07-23 05:42:22 +00:00
################################################################################
# Preprocessing rules
#
# The PP_TARGETS variable contains a list of all preprocessing target
2012-12-03 00:49:32 +00:00
# categories. Each category has associated variables listing input files, the
# output directory, extra preprocessor flags, and so on. For example:
2012-07-23 05:42:22 +00:00
#
2012-12-03 00:49:32 +00:00
# FOO := input-file
# FOO_PATH := target-directory
# FOO_FLAGS := -Dsome_flag
# PP_TARGETS += FOO
2012-08-29 06:55:57 +00:00
#
2012-12-03 00:49:32 +00:00
# If PP_TARGETS lists a category name <C> (like FOO, above), then we consult the
# following make variables to see what to do:
#
2013-11-09 01:35:44 +00:00
# - <C> lists input files to be preprocessed with mozbuild.action.preprocessor.
# We search VPATH for the names given here. If an input file name ends in
# '.in', that suffix is omitted from the output file name.
2012-12-03 00:49:32 +00:00
#
# - <C>_PATH names the directory in which to place the preprocessed output
# files. We create this directory if it does not already exist. Setting
# this variable is optional; if unset, we install the files in $(CURDIR).
#
2013-11-09 01:35:44 +00:00
# - <C>_FLAGS lists flags to pass to mozbuild.action.preprocessor, in addition
# to the usual bunch. Setting this variable is optional.
2012-12-03 00:49:32 +00:00
#
# - <C>_TARGET names the 'make' target that should depend on creating the output
# files. Setting this variable is optional; if unset, we preprocess the
# files for the 'libs' target.
2013-11-09 01:32:53 +00:00
#
# - <C>_KEEP_PATH may be set to 1 to indicate the paths given in <C> are to be
# kept under <C>_PATH. That is, if <C> is bar/baz/qux.h.in and <C>_PATH is
# $(DIST)/include, the preprocessed file would be $(DIST)/include/bar/baz/qux.h
# instead of $(DIST)/include/qux.h.
pp_target_tier = $( or $( $( 1) _TARGET) ,libs)
PP_TARGETS_TIERS := $( sort $( foreach category,$( PP_TARGETS) ,$( call pp_target_tier,$( category) ) ) )
pp_target_result = $( or $( $( 1) _PATH:%/= %) ,$( CURDIR) ) /$( if $( $( 1) _KEEP_PATH) ,$( 2:.in= ) ,$( notdir $( 2:.in= ) ) )
pp_target_results = $( foreach file,$( $( 1) ) ,$( call pp_target_result,$( category) ,$( file) ) )
$( foreach category ,$ ( PP_TARGETS ) , \
$( foreach tier,$( call pp_target_tier,$( category) ) , \
$( eval PP_TARGETS_RESULTS_$( tier) += $( call pp_target_results,$( category) ) ) \
) \
$( foreach file,$( $( category) ) , \
$( eval $( call create_dependency,$( call pp_target_result,$( category) ,$( file) ) , \
$( file) $( GLOBAL_DEPS) ) ) \
) \
$( eval $( call pp_target_results,$( category) ) : PP_TARGET_FLAGS = $( $( category) _FLAGS) ) \
)
2012-07-23 05:42:22 +00:00
2013-11-09 01:32:53 +00:00
$( foreach tier ,$ ( PP_TARGETS_TIERS ) , \
$( eval $( tier) :: $( PP_TARGETS_RESULTS_$( tier) ) ) \
)
2013-11-09 01:35:45 +00:00
PP_TARGETS_ALL_RESULTS := $( sort $( foreach tier,$( PP_TARGETS_TIERS) ,$( PP_TARGETS_RESULTS_$( tier) ) ) )
$(PP_TARGETS_ALL_RESULTS) :
2013-11-09 01:32:53 +00:00
$( if $( filter-out $( notdir $@ ) ,$( notdir $( <:.in= ) ) ) ,$( error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS) )
2013-12-02 21:34:21 +00:00
$( RM) '$@'
2020-05-05 20:04:30 +00:00
$( call py_action,preprocessor,--depend $( MDDEPDIR) /$( @F) .pp $( PP_TARGET_FLAGS) $( DEFINES) $( ACDEFINES) '$<' -o '$@' )
2013-11-09 01:35:45 +00:00
2015-12-24 07:36:50 +00:00
$(filter %.css,$(PP_TARGETS_ALL_RESULTS)) : PP_TARGET_FLAGS +=--marker %
2013-11-09 01:35:45 +00:00
# The depfile is based on the filename, and we don't want conflicts. So check
# there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
PP_TARGETS_ALL_RESULT_NAMES := $( notdir $( PP_TARGETS_ALL_RESULTS) )
$( foreach file ,$ ( sort $ ( PP_TARGETS_ALL_RESULT_NAMES ) ) , \
$( if $( filter-out 1,$( words $( filter $( file) ,$( PP_TARGETS_ALL_RESULT_NAMES) ) ) ) , \
$( error Multiple preprocessing rules are creating a $( file) file) \
) \
)
i f n e q ( , $( filter $ ( PP_TARGETS_TIERS ) $ ( PP_TARGETS_ALL_RESULTS ) ,$ ( MAKECMDGOALS ) ) )
# If the depfile for a preprocessed file doesn't exist, add a dep to force
# re-preprocessing.
$( foreach file ,$ ( PP_TARGETS_ALL_RESULTS ) , \
$( if $( wildcard $( MDDEPDIR) /$( notdir $( file) ) .pp) , \
, \
$( eval $( file) : FORCE) \
) \
)
MDDEPEND_FILES := $( strip $( wildcard $( addprefix $( MDDEPDIR) /,$( addsuffix .pp,$( notdir $( PP_TARGETS_ALL_RESULTS) ) ) ) ) )
2012-07-23 05:42:22 +00:00
2013-11-09 01:35:45 +00:00
i f n e q ( , $( MDDEPEND_FILES ) )
2015-12-03 23:20:58 +00:00
- i n c l u d e $( MDDEPEND_FILES )
2013-11-09 01:35:45 +00:00
e n d i f
e n d i f
2012-07-23 05:42:22 +00:00
2013-05-17 17:54:53 +00:00
# Pull in non-recursive targets if this is a partial tree build.
i f n d e f T O P L E V E L _ B U I L D
2014-11-30 01:45:31 +00:00
i n c l u d e $( MOZILLA_DIR ) / c o n f i g / m a k e f i l e s / n o n r e c u r s i v e . m k
2013-05-17 17:54:53 +00:00
e n d i f
1998-03-28 02:44:41 +00:00
################################################################################
# Special gmake rules.
################################################################################
2007-07-25 13:56:04 +00:00
1998-03-28 02:44:41 +00:00
#
# Re-define the list of default suffixes, so gmake won't have to churn through
# hundreds of built-in suffix rules for stuff we don't need.
#
.SUFFIXES :
#
# Fake targets. Always run these rules, even if a file/directory with that
# name already exists.
#
Bug 1670357 - Remove `make` targets for cleaning: `clean`, `realclean`, `clobber`, `distclean`, `clobber_all`, `everything` r=firefox-build-system-reviewers,mhentges
The `clobber` targets are superseded by `mach clobber`, so we don't need them for any reason. The `clean` target is meant to get you to a post-`configure` state, but it doesn't really work, and if it's necessary for you to be in that state for some reason you can just clobber and re-`configure`, so it doesn't seem worth it to get it working again. Instead, delete all of them. Also delete `everything` which is not useful when `clobber` doesn't exist.
Differential Revision: https://phabricator.services.mozilla.com/D93514
2020-10-15 20:37:18 +00:00
.PHONY : all alltags boot chrome realchrome export install libs makefiles run_apprunner tools $( DIRS ) FORCE
1999-03-09 21:56:44 +00:00
# Used as a dependency to force targets to rebuild
FORCE :
1998-03-28 02:44:41 +00:00
2000-09-28 04:02:15 +00:00
# Delete target if error occurs when building target
.DELETE_ON_ERROR :
1999-05-11 23:43:36 +00:00
tags : TAGS
2013-10-23 21:43:32 +00:00
TAGS : $( CSRCS ) $( CPPSRCS ) $( wildcard *.h )
1999-05-11 23:43:36 +00:00
-etags $( CSRCS) $( CPPSRCS) $( wildcard *.h)
2009-02-27 21:03:53 +00:00
$( LOOP_OVER_DIRS)
1999-05-11 23:43:36 +00:00
2012-05-16 18:46:28 +00:00
i f n d e f I N C L U D E D _ D E B U G M A K E _ M K #{
## Only parse when an echo* or show* target is requested
ifneq ( ,$( call isTargetStem,echo,show) )
2014-11-30 01:45:31 +00:00
include $( MOZILLA_DIR) /config/makefiles/debugmake.mk
2012-05-16 18:46:28 +00:00
endif #}
e n d i f #}
2000-04-21 01:14:45 +00:00
2009-05-18 18:15:05 +00:00
FREEZE_VARIABLES = \
CSRCS \
CPPSRCS \
EXPORTS \
DIRS \
LIBRARY \
MODULE \
$( NULL)
$(foreach var,$(FREEZE_VARIABLES),$(eval $(var)_FROZEN : = '$( $ ( var ) ) '))
CHECK_FROZEN_VARIABLES = $( foreach var,$( FREEZE_VARIABLES) , \
$( if $( subst $( $( var) _FROZEN) ,,'$($(var))' ) ,$( error Makefile variable '$(var)' changed value after including rules.mk. Was $( $( var) _FROZEN) , now $( $( var) ) .) ) )
2012-04-03 20:08:16 +00:00
libs export ::
2009-05-18 18:15:05 +00:00
$( CHECK_FROZEN_VARIABLES)
2010-07-02 23:59:17 +00:00
2013-05-05 08:16:25 +00:00
.DEFAULT_GOAL := $( or $( OVERRIDE_DEFAULT_GOAL) ,default)
2012-04-02 17:06:06 +00:00
#############################################################################
# Derived targets and dependencies
2014-11-30 01:45:31 +00:00
i n c l u d e $( MOZILLA_DIR ) / c o n f i g / m a k e f i l e s / a u t o t a r g e t s . m k
2012-04-02 17:06:06 +00:00
i f n e q ( $( NULL ) , $( AUTO_DEPS ) )
default all libs tools export:: $( AUTO_DEPS)
e n d i f