2011-07-07 19:29:41 +04:00
# -*- makefile -*-
2005-03-28 23:36:24 +04:00
# vim:set ts=8 sw=8 sts=8 noet:
1998-03-28 05:44:41 +03:00
#
2012-04-02 21:06:06 +04:00
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
1998-03-28 05:44:41 +03:00
#
2009-05-18 22:15:05 +04:00
1998-08-20 00:42:14 +04:00
i f n d e f t o p s r c d i r
2009-05-18 22:15:05 +04:00
$( error topsrcdir was not set ) )
1998-08-20 00:42:14 +04:00
e n d i f
1998-03-28 05:44:41 +03:00
2013-09-05 04:01:45 +04: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 06:00:52 +03: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-20 00:42:14 +04: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 05:44:41 +03:00
e n d i f
2002-03-22 18:01:17 +03:00
i f n d e f I N C L U D E D _ V E R S I O N _ M K
2014-11-30 04:45:31 +03:00
i n c l u d e $( MOZILLA_DIR ) / c o n f i g / v e r s i o n . m k
2002-03-22 18:01:17 +03:00
e n d i f
2012-05-15 20:20:30 +04:00
USE_AUTOTARGETS_MK = 1
2014-11-30 04:45:31 +03: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-04 00:08:16 +04:00
2013-08-10 10:57:09 +04:00
i f d e f R E B U I L D _ C H E C K
REPORT_BUILD = $( info $( shell $( PYTHON) $( MOZILLA_DIR) /config/rebuild_check.py $@ $^) )
e l s e
2013-11-12 03:37:08 +04:00
REPORT_BUILD = $( info $( notdir $@ ) )
2013-08-10 10:57:09 +04:00
e n d i f
2011-12-08 22:14:06 +04:00
2000-06-21 04:54:56 +04:00
EXEC = exec
2012-08-06 20:14:13 +04:00
# ELOG prints out failed command when building silently (gmake -s). Pymake
# prints out failed commands anyway, so ELOG just makes things worse by
# forcing shell invocations.
2011-01-06 01:17:10 +03:00
i f n e q ( , $( findstring s , $ ( filter -out --%, $ ( MAKEFLAGS ) ) ) )
2000-06-21 04:54:56 +04:00
ELOG := $( EXEC) sh $( BUILD_TOOLS) /print-failed-commands.sh
2000-02-26 07:21:53 +03:00
e l s e
2000-03-14 06:00:52 +03:00
ELOG :=
2012-08-06 20:14:13 +04:00
e n d i f # -s
2000-02-26 07:21:53 +03:00
2009-09-22 17:05:48 +04:00
_VPATH_SRCS = $( abspath $<)
2002-12-13 05:36:06 +03:00
2008-12-04 09:25:00 +03:00
################################################################################
# Testing frameworks support
################################################################################
2010-12-03 23:24:22 +03:00
testxpcobjdir = $( DEPTH) /_tests/xpcshell
2008-12-04 09:25:00 +03:00
i f d e f E N A B L E _ T E S T S
2011-11-12 00:25:22 +04:00
# Add test directories to the regular directories list. TEST_DIRS should
2014-07-29 03:55:55 +04:00
# arguably have the same status as other *_DIRS variables. It is coded this way
# until Makefiles stop using the "ifdef ENABLE_TESTS; DIRS +=" convention.
2011-11-12 00:25:22 +04:00
#
# The current developer workflow expects tests to be updated when processing
# the default target. If we ever change this implementation, the behavior
# should be preserved or the change should be widely communicated. A
# consequence of not processing test dir targets during the default target is
# that changes to tests may not be updated and code could assume to pass
# locally against non-current test code.
DIRS += $( TEST_DIRS)
2008-12-04 09:25:00 +03:00
i f d e f C P P _ U N I T _ T E S T S
2013-11-07 05:37:45 +04: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 09:25:00 +03: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 08:29:44 +04:00
SIMPLE_PROGRAMS += $( CPP_UNIT_TESTS)
2009-05-18 22:15:05 +04:00
INCLUDES += -I$( DIST) /include/testing
2008-12-04 09:25:00 +03:00
2013-06-24 21:45:32 +04: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-25 02:09:44 +04:00
CPP_UNIT_TESTS_FILES = $( CPP_UNIT_TESTS)
CPP_UNIT_TESTS_DEST = $( DIST) /cppunittests
2014-07-29 03:59:27 +04:00
CPP_UNIT_TESTS_TARGET = target
2014-07-25 02:09:44 +04:00
INSTALL_TARGETS += CPP_UNIT_TESTS
2013-06-24 21:45:32 +04:00
e n d i f
2014-02-10 23:42:19 +04:00
run-cppunittests ::
2014-11-30 04:45:31 +03:00
@$( PYTHON) $( MOZILLA_DIR) /testing/runcppunittests.py --xre-path= $( DIST) /bin --symbols-path= $( DIST) /crashreporter-symbols $( CPP_UNIT_TESTS)
2014-02-10 23:42:19 +04:00
2013-01-04 00:02:11 +04:00
cppunittests-remote : DM_TRANS ?=adb
cppunittests-remote :
2013-12-03 01:34:21 +04:00
@if [ '${TEST_DEVICE}' != '' -o '$(DM_TRANS)' = 'adb' ] ; then \
2014-11-30 04:45:31 +03:00
$( PYTHON) -u $( MOZILLA_DIR) /testing/remotecppunittests.py \
2013-01-04 00:02:11 +04:00
--xre-path= $( DEPTH) /dist/bin \
--localLib= $( DEPTH) /dist/$( MOZ_APP_NAME) \
--dm_trans= $( DM_TRANS) \
--deviceIP= ${ TEST_DEVICE } \
2014-07-23 08:29:44 +04:00
$( CPP_UNIT_TESTS) $( EXTRA_TEST_ARGS) ; \
2013-01-04 00:02:11 +04:00
else \
2013-12-03 01:34:21 +04:00
echo 'please prepare your host with environment variables for TEST_DEVICE' ; \
2013-01-04 00:02:11 +04:00
fi
2013-11-07 05:37:45 +04:00
e n d i f # COMPILE_ENVIRONMENT
2008-12-04 09:25:00 +03:00
e n d i f # CPP_UNIT_TESTS
2012-05-16 22:46:28 +04:00
.PHONY : check
2009-04-29 02:57:48 +04:00
2012-12-12 19:01:32 +04:00
i f d e f P Y T H O N _ U N I T _ T E S T S
2013-10-16 03:34:18 +04:00
RUN_PYTHON_UNIT_TESTS := $( addsuffix -run,$( PYTHON_UNIT_TESTS) )
2012-12-12 19:01:32 +04:00
.PHONY : $( RUN_PYTHON_UNIT_TESTS )
check :: $( RUN_PYTHON_UNIT_TESTS )
2013-10-16 03:34:18 +04:00
$(RUN_PYTHON_UNIT_TESTS) : %-run : %
2012-12-12 19:01:32 +04:00
@PYTHONDONTWRITEBYTECODE= 1 $( PYTHON) $<
e n d i f # PYTHON_UNIT_TESTS
2008-12-04 09:25:00 +03:00
e n d i f # ENABLE_TESTS
2003-03-08 08:18:43 +03:00
#
# Library rules
#
2011-05-23 20:54:47 +04:00
# If FORCE_STATIC_LIB is set, build a static library.
2005-10-17 18:57:32 +04:00
# Otherwise, build a shared library.
2003-03-08 08:18:43 +03:00
#
2000-03-31 05:24:48 +04:00
i f n d e f L I B R A R Y
2014-07-23 08:29:09 +04:00
i f d e f R E A L _ L I B R A R Y
2014-07-23 08:33:06 +04:00
# Don't build actual static library if a shared library is also built
i f d e f F O R C E _ S H A R E D _ L I B
2014-07-23 09:01:55 +04:00
# ... except when we really want one
i f d e f N O _ E X P A N D _ L I B S
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 05:33:00 +04:00
LIBRARY := $( REAL_LIBRARY)
2014-07-23 09:01:55 +04:00
e l s e
2014-07-23 08:33:06 +04:00
LIBRARY := $( REAL_LIBRARY) .$( LIBS_DESC_SUFFIX)
2014-07-23 09:01:55 +04:00
e n d i f
2014-07-23 08:33:06 +04:00
e l s e
2011-02-25 17:05:08 +03:00
# Only build actual library if it is installed in DIST/lib or SDK
i f e q ( , $( SDK_LIBRARY ) $( DIST_INSTALL ) $( NO_EXPAND_LIBS ) )
2011-09-03 10:19:06 +04:00
LIBRARY := $( REAL_LIBRARY) .$( LIBS_DESC_SUFFIX)
2011-02-25 17:05:08 +03:00
e l s e
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 05:33:00 +04:00
i f d e f N O _ E X P A N D _ L I B S
LIBRARY := $( REAL_LIBRARY)
e l s e
2011-09-03 10:19:06 +04:00
LIBRARY := $( REAL_LIBRARY) $( REAL_LIBRARY) .$( LIBS_DESC_SUFFIX)
2011-02-25 17:05:08 +03:00
e n d i f
2014-07-23 08:33:06 +04: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 05:33:00 +04:00
e n d i f
2014-07-23 08:29:09 +04:00
e n d i f # REAL_LIBRARY
2008-12-24 22:04:43 +03:00
e n d i f # LIBRARY
1999-02-19 06:06:32 +03:00
2000-03-31 11:18:52 +04:00
i f n d e f H O S T _ L I B R A R Y
i f d e f H O S T _ L I B R A R Y _ N A M E
2001-12-09 10:08:58 +03:00
HOST_LIBRARY := $( LIB_PREFIX) $( HOST_LIBRARY_NAME) .$( LIB_SUFFIX)
2000-03-31 11:18:52 +04:00
e n d i f
e n d i f
2000-03-31 05:24:48 +04:00
i f d e f L I B R A R Y
2011-05-23 20:54:47 +04:00
i f d e f F O R C E _ S H A R E D _ L I B
1998-03-28 05:44:41 +03:00
i f d e f M K S H L I B
1999-05-06 03:38:15 +04:00
2001-12-09 10:08:58 +03: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 04:16:19 +04:00
EMBED_MANIFEST_AT = 2
e n d i f # MKSHLIB
e n d i f # FORCE_SHARED_LIB
e n d i f # LIBRARY
2011-04-19 08:11:40 +04:00
i f e q ( $( OS_ARCH ) , W I N N T )
2003-03-08 08:18:43 +03:00
i f n d e f G N U _ C C
2001-12-09 10:08:58 +03:00
2005-06-03 03:27:48 +04:00
#
2008-11-26 22:38:09 +03:00
# Unless we're building SIMPLE_PROGRAMS, all C++ files share a PDB file per
# directory. For parallel builds, this PDB file is shared and locked by
# MSPDBSRV.EXE, starting with MSVC8 SP1. If you're using MSVC 7.1 or MSVC8
# without SP1, don't do parallel builds.
2008-11-04 22:38:40 +03:00
#
# The final PDB for libraries and programs is created by the linker and uses
# a different name from the single PDB file created by the compiler. See
# bug 462740.
#
2008-11-26 22:38:09 +03:00
i f d e f S I M P L E _ P R O G R A M S
2014-03-26 03:12:26 +04:00
COMPILE_PDB_FLAG ?= -Fd$( basename $( @F) ) .pdb
2008-11-26 22:38:09 +03:00
e l s e
2014-03-26 03:12:26 +04:00
COMPILE_PDB_FLAG ?= -Fdgenerated.pdb
2008-11-26 22:38:09 +03:00
e n d i f
2014-03-26 03:12:26 +04:00
COMPILE_CFLAGS += $( COMPILE_PDB_FLAG)
COMPILE_CXXFLAGS += $( COMPILE_PDB_FLAG)
2008-11-26 22:38:09 +03:00
2014-06-26 02:59:24 +04:00
LINK_PDBFILE ?= $( basename $( @F) ) .pdb
2001-12-09 10:08:58 +03:00
i f d e f M O Z _ D E B U G
2002-06-17 21:09:57 +04:00
CODFILE = $( basename $( @F) ) .cod
2002-01-01 03:03:57 +03:00
e n d i f
2001-12-09 10:08:58 +03:00
i f d e f D E F F I L E
2009-07-23 01:43:24 +04:00
OS_LDFLAGS += -DEF:$( call normalizepath,$( DEFFILE) )
2008-07-17 18:45:11 +04:00
EXTRA_DEPS += $( DEFFILE)
2001-12-09 10:08:58 +03:00
e n d i f
2011-12-27 13:51:53 +04:00
e l s e #!GNU_CC
i f d e f D E F F I L E
OS_LDFLAGS += $( call normalizepath,$( DEFFILE) )
EXTRA_DEPS += $( DEFFILE)
e n d i f
2003-03-08 08:18:43 +03:00
e n d i f # !GNU_CC
2004-11-23 22:34:02 +03:00
2001-12-09 10:08:58 +03:00
e n d i f # WINNT
2015-06-10 18:10:40 +03: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
2009-10-26 09:25:40 +03:00
i f e q ( $( SOLARIS_SUNPRO_CXX ) , 1 )
2009-11-20 09:15:39 +03:00
i f e q ( 8 6 , $( findstring 86,$ ( OS_TEST ) ) )
2014-11-30 04:45:31 +03:00
OS_LDFLAGS += -M $( MOZILLA_DIR) /config/solaris_ia32.map
2009-11-20 09:15:39 +03:00
e n d i f # x86
2009-10-26 09:25:40 +03:00
e n d i f # Solaris Sun Studio C++
2011-04-19 08:11:40 +04:00
i f e q ( $( HOST_OS_ARCH ) , W I N N T )
2005-07-06 05:49:32 +04:00
HOST_PDBFILE = $( basename $( @F) ) .pdb
2014-03-26 03:12:26 +04:00
HOST_PDB_FLAG ?= -Fd$( HOST_PDBFILE)
HOST_CFLAGS += $( HOST_PDB_FLAG)
HOST_CXXFLAGS += $( HOST_PDB_FLAG)
2005-07-06 05:49:32 +04:00
e n d i f
2011-04-14 13:23:13 +04:00
# Don't build SIMPLE_PROGRAMS during the MOZ_PROFILE_GENERATE pass
i f d e f M O Z _ P R O F I L E _ G E N E R A T E
SIMPLE_PROGRAMS :=
e n d i f
2013-11-07 05:37:45 +04: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 05:44:41 +03:00
i f n d e f T A R G E T S
2013-10-02 03:02:08 +04:00
TARGETS = $( LIBRARY) $( SHARED_LIBRARY) $( PROGRAM) $( SIMPLE_PROGRAMS) $( HOST_LIBRARY) $( HOST_PROGRAM) $( HOST_SIMPLE_PROGRAMS)
1998-03-28 05:44:41 +03:00
e n d i f
2013-07-03 01:40:17 +04:00
COBJS = $( notdir $( CSRCS:.c= .$( OBJ_SUFFIX) ) )
SOBJS = $( notdir $( SSRCS:.S= .$( OBJ_SUFFIX) ) )
# CPPSRCS can have different extensions (eg: .cpp, .cc)
CPPOBJS = $( notdir $( addsuffix .$( OBJ_SUFFIX) ,$( basename $( CPPSRCS) ) ) )
CMOBJS = $( notdir $( CMSRCS:.m= .$( OBJ_SUFFIX) ) )
CMMOBJS = $( notdir $( CMMSRCS:.mm= .$( OBJ_SUFFIX) ) )
ASOBJS = $( notdir $( ASFILES:.$( ASM_SUFFIX) = .$( OBJ_SUFFIX) ) )
2015-05-09 01:18:00 +03:00
RSOBJS = $( addprefix lib,$( notdir $( RSSRCS:.rs= .$( LIB_SUFFIX) ) ) )
1998-03-28 05:44:41 +03:00
i f n d e f O B J S
2015-05-09 01:18:00 +03:00
_OBJS = $( COBJS) $( SOBJS) $( CPPOBJS) $( CMOBJS) $( CMMOBJS) $( ASOBJS) $( RSOBJS)
2012-05-15 09:44:32 +04:00
OBJS = $( strip $( _OBJS) )
1998-03-28 05:44:41 +03:00
e n d i f
2013-10-25 02:58:14 +04:00
HOST_COBJS = $( addprefix host_,$( notdir $( HOST_CSRCS:.c= .$( OBJ_SUFFIX) ) ) )
2013-10-22 08:40:27 +04:00
# HOST_CPPOBJS can have different extensions (eg: .cpp, .cc)
2013-10-25 02:58:14 +04: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 11:18:52 +04:00
i f n d e f H O S T _ O B J S
2013-10-22 08:40:27 +04:00
_HOST_OBJS = $( HOST_COBJS) $( HOST_CPPOBJS) $( HOST_CMOBJS) $( HOST_CMMOBJS)
2007-04-27 15:47:10 +04:00
HOST_OBJS = $( strip $( _HOST_OBJS) )
2000-03-31 11:18:52 +04:00
e n d i f
2013-11-07 05:37:45 +04:00
e l s e
LIBRARY :=
SHARED_LIBRARY :=
IMPORT_LIBRARY :=
REAL_LIBRARY :=
PROGRAM :=
SIMPLE_PROGRAMS :=
HOST_LIBRARY :=
HOST_PROGRAM :=
HOST_SIMPLE_PROGRAMS :=
SDK_BINARY := $( filter %.py,$( SDK_BINARY) )
SDK_LIBRARY :=
e n d i f
2000-03-31 11:18:52 +04:00
2000-03-14 06:00:52 +03:00
ALL_TRASH = \
$( GARBAGE) $( TARGETS) $( OBJS) $( PROGOBJS) LOGS TAGS a.out \
2008-08-19 19:14:02 +04:00
$( filter-out $( ASFILES) ,$( OBJS:.$( OBJ_SUFFIX) = .s) ) $( OBJS:.$( OBJ_SUFFIX) = .ii) \
2011-08-29 09:34:12 +04:00
$( OBJS:.$( OBJ_SUFFIX) = .i) $( OBJS:.$( OBJ_SUFFIX) = .i_o) \
2014-07-23 08:29:09 +04:00
$( HOST_PROGOBJS) $( HOST_OBJS) $( IMPORT_LIBRARY) \
2003-09-18 21:24:54 +04:00
$( EXE_DEF_FILE) so_locations _gen _stubs $( wildcard *.res) $( wildcard *.RES) \
2013-08-12 16:10:41 +04:00
$( wildcard *.pdb) $( CODFILE) $( IMPORT_LIBRARY) \
2003-09-11 15:36:40 +04:00
$( SHARED_LIBRARY:$( DLL_SUFFIX) = .exp) $( wildcard *.ilk) \
2001-12-09 11:56:06 +03:00
$( PROGRAM:$( BIN_SUFFIX) = .exp) $( SIMPLE_PROGRAMS:$( BIN_SUFFIX) = .exp) \
$( PROGRAM:$( BIN_SUFFIX) = .lib) $( SIMPLE_PROGRAMS:$( BIN_SUFFIX) = .lib) \
2002-07-01 06:34:57 +04:00
$( SIMPLE_PROGRAMS:$( BIN_SUFFIX) = .$( OBJ_SUFFIX) ) \
2000-03-14 06:00:52 +03:00
$( wildcard gts_tmp_*) $( LIBRARY:%.a= .%.timestamp)
2000-08-30 05:15:32 +04:00
ALL_TRASH_DIRS = \
2002-01-08 12:29:10 +03:00
$( GARBAGE_DIRS) /no-such-file
1998-03-28 05:44:41 +03:00
2008-04-19 17:14:38 +04:00
i f d e f Q T D I R
GARBAGE += $( MOCSRCS)
e n d i f
2000-06-12 04:49:01 +04:00
i f d e f S I M P L E _ P R O G R A M S
2001-09-22 04:20:31 +04:00
GARBAGE += $( SIMPLE_PROGRAMS:%= %.$( OBJ_SUFFIX) )
2000-06-12 04:49:01 +04:00
e n d i f
i f d e f H O S T _ S I M P L E _ P R O G R A M S
2006-01-24 20:25:42 +03:00
GARBAGE += $( HOST_SIMPLE_PROGRAMS:%= %.$( OBJ_SUFFIX) )
2000-06-12 04:49:01 +04:00
e n d i f
2000-01-12 01:11:02 +03:00
#
# the Solaris WorkShop template repository cache. it occasionally can get
# out of sync, so targets like clobber should kill it.
#
2009-02-09 09:21:09 +03:00
i f e q ( $( SOLARIS_SUNPRO_CXX ) , 1 )
2000-09-13 11:36:37 +04:00
GARBAGE_DIRS += SunWS_cache
2000-01-12 01:11:02 +03:00
e n d i f
2000-03-02 06:39:19 +03:00
i f d e f M O Z _ U P D A T E _ X T E R M
2000-04-18 05:27:01 +04:00
# Its good not to have a newline at the end of the titlebar string because it
# makes the make -s output easier to read. Echo -n does not work on all
2012-08-07 12:42:45 +04:00
# platforms, but we can trick printf into doing it.
2014-07-16 11:36:30 +04:00
i f e q ( . , $( relativesrcdir ) )
UPDATE_TITLE = printf '\033]0;%s in %s\007' $( 1) $( 2) ;
e l s e
2013-12-03 01:34:21 +04:00
UPDATE_TITLE = printf '\033]0;%s in %s\007' $( 1) $( relativesrcdir) /$( 2) ;
1999-02-08 22:59:25 +03:00
e n d i f
2014-07-16 11:36:30 +04:00
e n d i f
1999-02-08 22:59:25 +03:00
2013-08-15 18:45:08 +04:00
i f d e f M A C H
2013-08-28 01:40:07 +04: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 04:17:59 +04:00
d e f i n e B U I L D S T A T U S
2013-12-03 01:34:21 +04:00
@ e c h o 'BUILDSTATUS $1'
2013-09-06 04:17:59 +04:00
e n d e f
2013-08-15 18:45:08 +04:00
e n d i f
2013-08-28 01:40:07 +04:00
e n d i f
2013-08-20 11:06:32 +04:00
2013-06-18 23:22:56 +04:00
d e f i n e S U B M A K E # $(call SUBMAKE,target,directory,static)
2010-07-27 15:44:21 +04:00
+ @ $( UPDATE_TITLE )
2014-07-16 11:36:30 +04:00
+ @ $( MAKE ) $( if $ ( 2) ,-C $ ( 2) ) $( 1)
2009-02-28 00:03:53 +03:00
e n d e f # The extra line is important here! don't delete it
2013-05-24 03:28:09 +04:00
d e f i n e T I E R _ D I R _ S U B M A K E
2013-08-20 11:06:32 +04:00
$( call SUBMAKE ,$ ( 4) ,$ ( 3) ,$ ( 5) )
2013-05-24 03:28:09 +04:00
e n d e f # Ths empty line is important.
2008-12-19 17:50:24 +03:00
i f n e q ( , $( strip $ ( DIRS ) ) )
2000-03-02 06:39:19 +03:00
LOOP_OVER_DIRS = \
2009-02-28 00:03:53 +03:00
$( foreach dir,$( DIRS) ,$( call SUBMAKE,$@ ,$( dir) ) )
2008-12-19 17:50:24 +03:00
e n d i f
2000-11-10 03:55:44 +03:00
1998-07-08 07:49:31 +04: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 11:18:52 +04: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
2012-09-11 11:43:32 +04:00
GARBAGE_DIRS += $( wildcard $( CURDIR) /$( MDDEPDIR) )
1999-09-09 13:24:58 +04:00
#
# Tags: emacs (etags), vi (ctags)
# TAG_PROGRAM := ctags -L -
#
TAG_PROGRAM = xargs etags -a
#
2007-04-25 18:26:42 +04:00
# Turn on C++ linking if we have any .cpp or .mm files
2011-08-26 03:37:25 +04:00
# (moved this from config.mk so that config.mk can be included
1999-09-09 13:24:58 +04:00
# before the CPPSRCS are defined)
#
2011-01-24 11:56:40 +03:00
i f n e q ( $( HOST_CPPSRCS ) $( HOST_CMMSRCS ) , )
HOST_CPP_PROG_LINK = 1
e n d i f
1999-09-09 13:24:58 +04:00
1999-09-22 13:54:00 +04:00
#
2011-08-26 03:37:25 +04:00
# This will strip out symbols that the component should not be
1999-09-22 13:54:00 +04:00
# exporting from the .dynsym section.
#
1999-09-16 17:43:15 +04:00
i f d e f I S _ C O M P O N E N T
1999-09-22 13:54:00 +04:00
EXTRA_DSO_LDOPTS += $( MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
1999-09-16 17:43:15 +04:00
e n d i f # IS_COMPONENT
2000-03-11 06:08:04 +03:00
#
# MacOS X specific stuff
#
2001-04-05 07:36:56 +04:00
i f e q ( $( OS_ARCH ) , D a r w i n )
2003-06-10 02:25:25 +04:00
i f d e f S H A R E D _ L I B R A R Y
2000-03-11 06:08:04 +03:00
i f d e f I S _ C O M P O N E N T
EXTRA_DSO_LDOPTS += -bundle
e l s e
2015-06-10 18:10:40 +03:00
i f d e f M O Z _ I O S
_LOADER_PATH := @rpath
e l s e
_LOADER_PATH := @executable_path
e n d i f
EXTRA_DSO_LDOPTS += -dynamiclib -install_name $( _LOADER_PATH) /$( SHARED_LIBRARY) -compatibility_version 1 -current_version 1 -single_module
2003-06-10 02:25:25 +04:00
e n d i f
2000-03-11 06:08:04 +03:00
e n d i f
e n d i f
2001-03-09 10:55:29 +03:00
#
# On NetBSD a.out systems, use -Bsymbolic. This fixes what would otherwise be
# fatal symbol name clashes between components.
#
i f e q ( $( OS_ARCH ) , N e t B S D )
i f e q ( $( DLL_SUFFIX ) , . s o . 1 . 0 )
i f d e f I S _ C O M P O N E N T
EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
e n d i f
e n d i f
e n d i f
2003-01-30 10:41:27 +03:00
i f e q ( $( OS_ARCH ) , F r e e B S D )
i f d e f I S _ C O M P O N E N T
EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
e n d i f
e n d i f
2001-03-09 10:55:29 +03:00
i f e q ( $( OS_ARCH ) , N e t B S D )
i f n e q ( , $( filter arc cobalt hpcmips mipsco newsmips pmax sgimips ,$ ( OS_TEST ) ) )
2013-11-19 06:47:30 +04:00
i f n e q ( , $( filter layout /%,$ ( relativesrcdir ) ) )
2001-03-09 10:55:29 +03:00
OS_CFLAGS += -Wa,-xgot
OS_CXXFLAGS += -Wa,-xgot
2001-08-16 09:18:04 +04:00
e n d i f
e n d i f
e n d i f
1999-11-18 05:49:30 +03:00
#
# HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
# which uses internal symbols first
#
i f e q ( $( OS_ARCH ) , H P - U X )
i f d e f I S _ C O M P O N E N T
i f e q ( $( GNU_CC ) $( GNU_CXX ) , )
EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
2001-11-02 17:24:34 +03:00
i f n e q ( $( HAS_EXTRAEXPORTS ) , 1 )
2002-10-02 14:10:06 +04:00
MKSHLIB += -Wl,+eNSGetModule -Wl,+eerrno
2004-02-26 10:34:27 +03:00
MKCSHLIB += +eNSGetModule +eerrno
2002-10-02 14:10:06 +04:00
i f n e q ( $( OS_TEST ) , i a 6 4 )
MKSHLIB += -Wl,+e_shlInit
2004-02-26 10:34:27 +03:00
MKCSHLIB += +e_shlInit
2002-10-02 14:10:06 +04:00
e n d i f # !ia64
2001-11-02 17:24:34 +03:00
e n d i f # !HAS_EXTRAEXPORTS
1999-11-18 05:49:30 +03:00
e n d i f # non-gnu compilers
e n d i f # IS_COMPONENT
e n d i f # HP-UX
2001-11-08 15:15:48 +03:00
i f e q ( $( OS_ARCH ) , A I X )
i f d e f I S _ C O M P O N E N T
i f n e q ( $( HAS_EXTRAEXPORTS ) , 1 )
MKSHLIB += -bE:$( MOZILLA_DIR) /build/unix/aix.exp -bnoexpall
MKCSHLIB += -bE:$( MOZILLA_DIR) /build/unix/aix.exp -bnoexpall
e n d i f # HAS_EXTRAEXPORTS
e n d i f # IS_COMPONENT
e n d i f # AIX
2002-02-14 07:32:11 +03:00
#
# Linux: add -Bsymbolic flag for components
2011-08-26 03:37:25 +04:00
#
2002-02-14 07:32:11 +03:00
i f e q ( $( OS_ARCH ) , L i n u x )
i f d e f I S _ C O M P O N E N T
EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
e n d i f
2014-05-30 22:12:20 +04:00
i f d e f L D _ V E R S I O N _ S C R I P T
EXTRA_DSO_LDOPTS += -Wl,--version-script,$( LD_VERSION_SCRIPT)
EXTRA_DEPS += $( LD_VERSION_SCRIPT)
e n d i f
2011-08-26 03:37:25 +04:00
e n d i f
2002-02-14 07:32:11 +03:00
2010-04-19 12:39:58 +04: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-19 01:04:00 +03:00
#
# MINGW32
#
i f e q ( $( OS_ARCH ) , W I N N T )
i f d e f G N U _ C C
i f n d e f I S _ C O M P O N E N T
2004-03-16 11:07:25 +03:00
DSO_LDOPTS += -Wl,--out-implib -Wl,$( IMPORT_LIBRARY)
2003-03-19 01:04:00 +03:00
e n d i f
e n d i f
e n d i f
2000-03-31 05:24:48 +04:00
i f e q ( $( USE_TVFS ) , 1 )
IFLAGS1 = -rb
IFLAGS2 = -rb
e l s e
2001-07-25 03:41:43 +04:00
IFLAGS1 = -m 644
IFLAGS2 = -m 755
2000-03-31 05:24:48 +04:00
e n d i f
1999-11-18 05:49:30 +03:00
2001-12-05 00:17:48 +03: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
2011-08-25 13:31:52 +04:00
i f n e q ( , $( filter ml %,$ ( AS ) ) )
ASOUTOPTION = -Fo# eol
e l s e
ASOUTOPTION = -o # eol
e n d i f
2007-03-26 22:17:02 +04:00
i f e q ( , $( CROSS_COMPILE ) )
HOST_OUTOPTION = $( OUTOPTION)
e l s e
HOST_OUTOPTION = -o # eol
2008-02-22 00:02:06 +03:00
e n d i f
1998-03-28 05:44:41 +03:00
################################################################################
2013-10-30 01:53:52 +04: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 21:54:56 +04: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-30 01:53:52 +04: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
2013-10-29 03:00:30 +04:00
$(DEPTH)/backend.RecursiveMakeBackend :
2013-10-30 01:53:52 +04:00
$( error Build configuration changed. Build with | mach build| or run | mach build-backend| to regenerate build config)
2013-05-21 10:26:20 +04:00
2013-10-29 03:00:30 +04:00
i n c l u d e $( DEPTH ) / b a c k e n d . R e c u r s i v e M a k e B a c k e n d . p p
2013-05-21 10:26:20 +04:00
2013-10-29 03:00:30 +04:00
default :: $( DEPTH ) /backend .RecursiveMakeBackend
2013-05-17 21:54:56 +04:00
export MOZBUILD_BACKEND_CHECKED = 1
e n d i f
2013-10-30 01:53:52 +04:00
e n d i f
e n d i f
2013-05-17 21:54:56 +04:00
2005-04-01 01:40:23 +04: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 14:45:39 +04:00
default all ::
2014-11-06 03:29:11 +03:00
$( foreach tier,$( TIERS) ,$( call SUBMAKE,$( tier) ) )
2005-04-01 01:40:23 +04:00
2013-08-20 11:21:34 +04:00
i f e q ( $( findstring s ,$ ( filter -out --%, $ ( MAKEFLAGS ) ) ) , )
2008-07-12 14:55:43 +04:00
ECHO := echo
QUIET :=
e l s e
ECHO := true
QUIET := -q
e n d i f
1999-01-21 10:42:44 +03:00
# Do everything from scratch
2001-12-01 01:53:10 +03:00
everything ::
$( MAKE) clean
2013-09-05 04:01:45 +04:00
$( MAKE) all
2001-04-05 05:18:34 +04:00
2014-08-07 09:21:03 +04:00
STATIC_LIB_DEP = $( if $( wildcard $( 1) .$( LIBS_DESC_SUFFIX) ) ,$( 1) .$( LIBS_DESC_SUFFIX) ,$( 1) )
STATIC_LIBS_DEPS := $( foreach l,$( STATIC_LIBS) ,$( call STATIC_LIB_DEP,$( l) ) )
2009-08-17 01:54:45 +04:00
2010-10-28 22:28:21 +04:00
# Dependencies which, if modified, should cause everything to rebuild
2014-11-30 04:45:31 +03:00
GLOBAL_DEPS += Makefile $( addprefix $( DEPTH) /config/,$( INCLUDED_AUTOCONF_MK) ) $( MOZILLA_DIR) /config/config.mk
2008-11-28 05:26:44 +03:00
2000-03-31 05:24:48 +04:00
##############################################
2013-11-07 05:37:45 +04:00
i f d e f C O M P I L E _ E N V I R O N M E N T
2013-10-02 03:53:23 +04:00
OBJ_TARGETS = $( OBJS) $( PROGOBJS) $( HOST_OBJS) $( HOST_PROGOBJS)
2014-07-25 02:14:40 +04:00
compile :: host target
host :: $( HOST_LIBRARY ) $( HOST_PROGRAM ) $( HOST_SIMPLE_PROGRAMS )
target :: $( LIBRARY ) $( SHARED_LIBRARY ) $( PROGRAM ) $( SIMPLE_PROGRAMS )
2013-09-06 04:19:32 +04:00
2014-11-30 04:45:31 +03: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 05:37:45 +04:00
e n d i f
1998-03-28 05:44:41 +03:00
2002-04-25 06:52:44 +04:00
##############################################
2013-12-09 08:39:26 +04:00
i f n e q ( 1 , $( NO_PROFILE_GUIDED_OPTIMIZE ) )
2009-09-25 20:50:53 +04:00
i f d e f M O Z _ P R O F I L E _ U S E
2010-07-26 23:21:55 +04:00
i f e q ( $( OS_ARCH ) _ $( GNU_CC ) , W I N N T _ )
2009-09-25 20:50:53 +04:00
# When building with PGO, we have to make sure to re-link
# in the MOZ_PROFILE_USE phase if we linked in the
# MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink
# file in the link rule in the GENERATE phase to indicate
# that we need a relink.
2008-02-21 02:29:11 +03:00
i f d e f S H A R E D _ L I B R A R Y
2009-09-25 20:50:53 +04:00
$(SHARED_LIBRARY) : pgo .relink
2008-02-21 02:29:11 +03:00
e n d i f
i f d e f P R O G R A M
2009-09-25 20:50:53 +04:00
$(PROGRAM) : pgo .relink
2008-02-21 02:29:11 +03:00
e n d i f
# In the second pass, we need to merge the pgc files into the pgd file.
# The compiler would do this for us automatically if they were in the right
# place, but they're in dist/bin.
2009-01-08 21:52:38 +03:00
i f n e q ( , $( SHARED_LIBRARY ) $( PROGRAM ) )
2008-02-21 02:29:11 +03:00
export ::
2009-01-08 21:52:38 +03:00
i f d e f P R O G R A M
2014-11-30 04:45:31 +03:00
$( PYTHON) $( MOZILLA_DIR) /build/win32/pgomerge.py \
2011-11-05 01:26:53 +04:00
$( PROGRAM:$( BIN_SUFFIX) = ) $( DIST) /bin
2009-01-08 21:52:38 +03:00
e n d i f
i f d e f S H A R E D _ L I B R A R Y
2014-11-30 04:45:31 +03:00
$( PYTHON) $( MOZILLA_DIR) /build/win32/pgomerge.py \
2014-07-23 08:29:09 +04:00
$( patsubst $( DLL_PREFIX) %$( DLL_SUFFIX) ,%,$( SHARED_LIBRARY) ) $( DIST) /bin
2009-01-08 21:52:38 +03:00
e n d i f
2009-09-25 20:50:53 +04:00
e n d i f # SHARED_LIBRARY || PROGRAM
2008-02-21 02:29:11 +03:00
e n d i f # WINNT_
2011-08-16 11:41:55 +04:00
e n d i f # MOZ_PROFILE_USE
2011-06-13 19:58:34 +04:00
i f d e f M O Z _ P R O F I L E _ G E N E R A T E
# Clean up profiling data during PROFILE_GENERATE phase
export ::
i f e q ( $( OS_ARCH ) _ $( GNU_CC ) , W I N N T _ )
2011-08-29 09:33:48 +04:00
$( foreach pgd,$( wildcard *.pgd) ,pgomgr -clear $( pgd) ; )
2011-06-13 19:58:34 +04:00
e l s e
i f d e f G N U _ C C
-$( RM) *.gcda
e n d i f
e n d i f
e n d i f
2011-08-29 09:34:12 +04:00
i f n e q ( , $( MOZ_PROFILE_GENERATE ) $( MOZ_PROFILE_USE ) )
i f d e f G N U _ C C
# Force rebuilding libraries and programs in both passes because each
# pass uses different object files.
$(PROGRAM) $(SHARED_LIBRARY) $(LIBRARY) : FORCE
e n d i f
e n d i f
2008-02-21 02:29:11 +03:00
e n d i f # NO_PROFILE_GUIDED_OPTIMIZE
##############################################
1999-02-17 20:33:07 +03:00
checkout :
2000-03-31 05:24:48 +04:00
$( MAKE) -C $( topsrcdir) -f client.mk checkout
1999-02-17 20:33:07 +03:00
2013-10-24 01:43:32 +04:00
clean clobber realclean clobber_all ::
2011-04-03 11:16:49 +04:00
-$( RM) $( ALL_TRASH)
-$( RM) -r $( ALL_TRASH_DIRS)
2013-08-30 06:10:19 +04:00
clean clobber realclean clobber_all distclean ::
2014-07-29 03:57:59 +04:00
$( foreach dir,$( DIRS) ,-$( call SUBMAKE,$@ ,$( dir) ) )
2013-08-30 06:10:19 +04:00
distclean ::
2011-08-26 03:37:25 +04:00
-$( RM) -r $( ALL_TRASH_DIRS)
2011-04-03 11:16:49 +04:00
-$( RM) $( ALL_TRASH) \
2000-12-13 00:28:24 +03:00
Makefile .HSancillary \
2005-06-29 20:28:02 +04:00
$( wildcard *.$( OBJ_SUFFIX) ) $( wildcard *.ho) $( wildcard host_*.o*) \
2003-04-23 04:54:38 +04:00
$( wildcard *.$( LIB_SUFFIX) ) $( wildcard *$( DLL_SUFFIX) ) \
$( wildcard *.$( IMPORT_LIB_SUFFIX) )
1999-06-04 02:23:06 +04:00
1998-03-28 05:44:41 +03:00
alltags :
2011-04-03 11:16:49 +04:00
$( RM) TAGS
1999-06-12 00:21:48 +04:00
find $( topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $( TAG_PROGRAM)
1998-03-28 05:44:41 +03:00
1999-01-23 14:41:15 +03:00
#
# PROGRAM = Foo
# creates OBJS, links with LIBS to create Foo
#
2014-07-29 03:59:56 +04:00
$(PROGRAM) : $( PROGOBJS ) $( STATIC_LIBS_DEPS ) $( EXTRA_DEPS ) $( EXE_DEF_FILE ) $( RESFILE ) $( GLOBAL_DEPS )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2011-04-03 11:16:49 +04:00
@$( RM) $@ .manifest
2001-12-09 10:08:58 +03:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( OS_ARCH ) )
2014-09-26 02:33:56 +04:00
$( EXPAND_LD) -NOLOGO -OUT:$@ -PDB:$( LINK_PDBFILE) $( WIN32_EXE_LDFLAGS) $( LDFLAGS) $( MOZ_PROGRAM_LDFLAGS) $( PROGOBJS) $( RESFILE) $( STATIC_LIBS) $( SHARED_LIBS) $( EXTRA_LIBS) $( OS_LIBS)
2006-01-23 20:16:17 +03:00
i f d e f M S M A N I F E S T _ T O O L
@if test -f $@ .manifest; then \
2013-12-03 01:34:21 +04:00
if test -f '$(srcdir)/$@.manifest' ; then \
echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest' ; \
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@ .manifest -OUTPUTRESOURCE:$@ \; 1; \
2006-03-21 17:49:45 +03:00
else \
2013-12-03 01:34:21 +04:00
echo 'Embedding manifest from $@.manifest' ; \
2006-03-21 17:49:45 +03:00
mt.exe -NOLOGO -MANIFEST $@ .manifest -OUTPUTRESOURCE:$@ \; 1; \
fi ; \
2013-12-03 01:34:21 +04:00
elif test -f '$(srcdir)/$@.manifest' ; then \
echo 'Embedding manifest from $(srcdir)/$@.manifest' ; \
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@ \; 1; \
2006-01-23 20:16:17 +03:00
fi
e n d i f # MSVC with manifest tool
2009-09-25 20:50:53 +04:00
i f d e f M O Z _ P R O F I L E _ G E N E R A T E
# touch it a few seconds into the future to work around FAT's
# 2-second granularity
2013-12-03 01:34:21 +04:00
touch -t ` date +%Y%m%d%H%M.%S -d 'now+5seconds' ` pgo.relink
2009-09-25 20:50:53 +04:00
e n d i f
e l s e # !WINNT || GNU_CC
2014-10-29 07:29:42 +03:00
$( EXPAND_CCC) -o $@ $( CXXFLAGS) $( PROGOBJS) $( RESFILE) $( WIN32_EXE_LDFLAGS) $( LDFLAGS) $( WRAP_LDFLAGS) $( STATIC_LIBS) $( MOZ_PROGRAM_LDFLAGS) $( SHARED_LIBS) $( EXTRA_LIBS) $( OS_LIBS) $( BIN_FLAGS) $( EXE_DEF_FILE)
2014-01-16 04:13:43 +04:00
$( call CHECK_BINARY,$@ )
2001-12-09 10:08:58 +03:00
e n d i f # WINNT && !GNU_CC
2005-04-22 23:06:27 +04:00
2001-10-26 12:36:28 +04:00
i f d e f E N A B L E _ S T R I P
2013-11-11 20:01:22 +04:00
$( STRIP) $( STRIP_FLAGS) $@
2001-10-26 12:36:28 +04:00
e n d i f
2001-10-26 16:39:30 +04: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 12:36:40 +03:00
2014-07-29 03:59:56 +04:00
$(HOST_PROGRAM) : $( HOST_PROGOBJS ) $( HOST_LIBS ) $( HOST_EXTRA_DEPS ) $( GLOBAL_DEPS )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2006-01-24 20:25:42 +03:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( HOST_OS_ARCH ) )
2013-10-24 03:06:43 +04:00
$( EXPAND_LIBS_EXEC) -- $( HOST_LD) -NOLOGO -OUT:$@ -PDB:$( HOST_PDBFILE) $( HOST_OBJS) $( WIN32_EXE_LDFLAGS) $( HOST_LDFLAGS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2006-01-23 20:16:17 +03:00
i f d e f M S M A N I F E S T _ T O O L
@if test -f $@ .manifest; then \
2013-12-03 01:34:21 +04:00
if test -f '$(srcdir)/$@.manifest' ; then \
echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest' ; \
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@ .manifest -OUTPUTRESOURCE:$@ \; 1; \
2009-08-04 02:01:55 +04:00
else \
2013-12-03 01:34:21 +04:00
echo 'Embedding manifest from $@.manifest' ; \
2009-08-04 02:01:55 +04:00
mt.exe -NOLOGO -MANIFEST $@ .manifest -OUTPUTRESOURCE:$@ \; 1; \
fi ; \
2013-12-03 01:34:21 +04:00
elif test -f '$(srcdir)/$@.manifest' ; then \
echo 'Embedding manifest from $(srcdir)/$@.manifest' ; \
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@ \; 1; \
2006-01-23 20:16:17 +03:00
fi
e n d i f # MSVC with manifest tool
2002-11-15 06:41:17 +03:00
e l s e
2011-01-24 11:56:40 +03:00
i f e q ( $( HOST_CPP_PROG_LINK ) , 1 )
2013-10-24 03:06:43 +04:00
$( EXPAND_LIBS_EXEC) -- $( HOST_CXX) -o $@ $( HOST_CXXFLAGS) $( HOST_LDFLAGS) $( HOST_PROGOBJS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2007-04-27 15:47:10 +04:00
e l s e
2013-10-24 03:06:43 +04:00
$( EXPAND_LIBS_EXEC) -- $( HOST_CC) -o $@ $( HOST_CFLAGS) $( HOST_LDFLAGS) $( HOST_PROGOBJS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2011-01-24 11:56:40 +03:00
e n d i f # HOST_CPP_PROG_LINK
2002-11-15 06:41:17 +03:00
e n d i f
2015-04-14 05:07:48 +03:00
i f n d e f C R O S S _ C O M P I L E
$( call CHECK_STDCXX,$@ )
e n d i f
2000-03-31 11:18:52 +04:00
1999-01-23 14:41:15 +03: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.
#
2014-07-29 03:59:56 +04:00
$(SIMPLE_PROGRAMS) : %$( BIN_SUFFIX ) : %.$( OBJ_SUFFIX ) $( STATIC_LIBS_DEPS ) $( EXTRA_DEPS ) $( GLOBAL_DEPS )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2001-12-09 10:08:58 +03:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( OS_ARCH ) )
2014-09-26 02:33:56 +04:00
$( EXPAND_LD) -nologo -out:$@ -pdb:$( LINK_PDBFILE) $< $( WIN32_EXE_LDFLAGS) $( LDFLAGS) $( MOZ_PROGRAM_LDFLAGS) $( STATIC_LIBS) $( SHARED_LIBS) $( EXTRA_LIBS) $( OS_LIBS)
2006-01-23 20:16:17 +03:00
i f d e f M S M A N I F E S T _ T O O L
@if test -f $@ .manifest; then \
mt.exe -NOLOGO -MANIFEST $@ .manifest -OUTPUTRESOURCE:$@ \; 1; \
rm -f $@ .manifest; \
fi
e n d i f # MSVC with manifest tool
2000-03-31 05:24:48 +04:00
e l s e
2014-10-29 07:29:42 +03:00
$( EXPAND_CCC) $( CXXFLAGS) -o $@ $< $( WIN32_EXE_LDFLAGS) $( LDFLAGS) $( WRAP_LDFLAGS) $( STATIC_LIBS) $( MOZ_PROGRAM_LDFLAGS) $( SHARED_LIBS) $( EXTRA_LIBS) $( OS_LIBS) $( BIN_FLAGS)
2014-01-16 04:13:43 +04:00
$( call CHECK_BINARY,$@ )
2001-12-09 10:08:58 +03:00
e n d i f # WINNT && !GNU_CC
2005-04-22 23:06:27 +04:00
2001-10-26 12:36:28 +04:00
i f d e f E N A B L E _ S T R I P
2013-11-11 20:01:22 +04:00
$( STRIP) $( STRIP_FLAGS) $@
1999-01-23 15:20:00 +03:00
e n d i f
2001-10-26 16:39:30 +04: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 14:41:15 +03:00
2014-07-29 03:59:56 +04:00
$(HOST_SIMPLE_PROGRAMS) : host_ %$( HOST_BIN_SUFFIX ) : host_ %.$( OBJ_SUFFIX ) $( HOST_LIBS ) $( HOST_EXTRA_DEPS ) $( GLOBAL_DEPS )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2006-01-24 20:25:42 +03:00
i f e q ( W I N N T _ , $( HOST_OS_ARCH ) _ $( GNU_CC ) )
2013-10-24 03:06:43 +04:00
$( EXPAND_LIBS_EXEC) -- $( HOST_LD) -NOLOGO -OUT:$@ -PDB:$( HOST_PDBFILE) $< $( WIN32_EXE_LDFLAGS) $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2007-03-26 22:29:16 +04:00
e l s e
2007-07-16 22:40:49 +04:00
i f n e q ( , $( HOST_CPPSRCS ) $( USE_HOST_CXX ) )
2013-10-24 03:06:43 +04:00
$( EXPAND_LIBS_EXEC) -- $( HOST_CXX) $( HOST_OUTOPTION) $@ $( HOST_CXXFLAGS) $( INCLUDES) $< $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2005-07-05 21:02:20 +04:00
e l s e
2013-10-24 03:06:43 +04:00
$( EXPAND_LIBS_EXEC) -- $( HOST_CC) $( HOST_OUTOPTION) $@ $( HOST_CFLAGS) $( INCLUDES) $< $( HOST_LIBS) $( HOST_EXTRA_LIBS)
2005-07-05 21:02:20 +04:00
e n d i f
2006-01-24 20:25:42 +03:00
e n d i f
2015-04-14 05:07:48 +03:00
i f n d e f C R O S S _ C O M P I L E
$( call CHECK_STDCXX,$@ )
e n d i f
2000-03-31 11:18:52 +04:00
2007-10-11 03:03:14 +04:00
i f d e f D T R A C E _ P R O B E _ O B J
EXTRA_DEPS += $( DTRACE_PROBE_OBJ)
2010-09-20 23:43:52 +04:00
OBJS += $( DTRACE_PROBE_OBJ)
2007-10-11 03:03:14 +04:00
e n d i f
2001-12-18 12:14:29 +03:00
2014-07-29 03:59:56 +04:00
$(filter %.$(LIB_SUFFIX),$(LIBRARY)) : $( OBJS ) $( STATIC_LIBS_DEPS ) $( filter %.$ ( LIB_SUFFIX ) ,$ ( EXTRA_LIBS ) ) $( EXTRA_DEPS ) $( GLOBAL_DEPS )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
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 05:33:00 +04:00
# Always remove both library and library descriptor
$( RM) $( REAL_LIBRARY) $( REAL_LIBRARY) .$( LIBS_DESC_SUFFIX)
2014-07-29 03:59:56 +04:00
$( EXPAND_AR) $( AR_FLAGS) $( OBJS) $( STATIC_LIBS) $( filter %.$( LIB_SUFFIX) ,$( EXTRA_LIBS) )
2011-02-25 17:05:08 +03:00
2014-07-29 03:59:56 +04:00
$(filter-out %.$(LIB_SUFFIX),$(LIBRARY)) : $( filter %.$ ( LIB_SUFFIX ) ,$ ( LIBRARY ) ) $( OBJS ) $( STATIC_LIBS_DEPS ) $( filter %.$ ( LIB_SUFFIX ) ,$ ( EXTRA_LIBS ) ) $( EXTRA_DEPS ) $( GLOBAL_DEPS )
2011-09-03 10:19:06 +04:00
# When we only build a library descriptor, blow out any existing library
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2014-07-11 14:06:55 +04:00
$( if $( filter %.$( LIB_SUFFIX) ,$( LIBRARY) ) ,,$( RM) $( REAL_LIBRARY) )
2014-07-29 03:59:56 +04:00
$( EXPAND_LIBS_GEN) -o $@ $( OBJS) $( STATIC_LIBS) $( filter %.$( LIB_SUFFIX) ,$( EXTRA_LIBS) )
1999-10-08 09:18:46 +04:00
2011-04-19 08:11:40 +04:00
i f e q ( $( OS_ARCH ) , W I N N T )
2012-10-09 12:17:26 +04: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 06:42:28 +04:00
e n d i f
2000-03-31 11:18:52 +04:00
$(HOST_LIBRARY) : $( HOST_OBJS ) Makefile
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2011-04-03 11:16:49 +04:00
$( RM) $@
2013-10-22 08:40:27 +04:00
$( EXPAND_LIBS_EXEC) --extract -- $( HOST_AR) $( HOST_AR_FLAGS) $( HOST_OBJS)
2000-03-31 11:18:52 +04:00
2007-10-20 02:24:32 +04:00
i f d e f H A V E _ D T R A C E
2007-11-02 09:36:49 +03:00
i f n d e f X P _ M A C O S X
2007-10-20 02:24:32 +04:00
i f d e f D T R A C E _ P R O B E _ O B J
i f n d e f D T R A C E _ L I B _ D E P E N D E N T
2011-08-18 02:14:52 +04:00
NON_DTRACE_OBJS := $( filter-out $( DTRACE_PROBE_OBJ) ,$( OBJS) )
$(DTRACE_PROBE_OBJ) : $( NON_DTRACE_OBJS )
2014-11-04 04:01:00 +03:00
dtrace -x nolibs -G -C -s $( MOZILLA_DTRACE_SRC) -o $( DTRACE_PROBE_OBJ) $( NON_DTRACE_OBJS)
2007-10-20 02:24:32 +04:00
e n d i f
e n d i f
e n d i f
2007-11-02 09:36:49 +03:00
e n d i f
2007-10-20 02:24:32 +04:00
2007-06-30 09:20:00 +04: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.
2014-07-29 03:59:56 +04:00
$(SHARED_LIBRARY) : $( OBJS ) $( RESFILE ) $( STATIC_LIBS_DEPS ) $( EXTRA_DEPS ) $( GLOBAL_DEPS )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2003-09-17 02:36:02 +04:00
i f n d e f I N C R E M E N T A L _ L I N K E R
2011-04-03 11:16:49 +04:00
$( RM) $@
2003-09-17 02:36:02 +04:00
e n d i f
2007-10-20 02:24:32 +04:00
i f d e f D T R A C E _ L I B _ D E P E N D E N T
2007-11-02 09:36:49 +03:00
i f n d e f X P _ M A C O S X
2014-11-04 04:01:00 +03:00
dtrace -x nolibs -G -C -s $( MOZILLA_DTRACE_SRC) -o $( DTRACE_PROBE_OBJ) $( shell $( EXPAND_LIBS) $( MOZILLA_PROBE_LIBS) )
2011-02-25 17:05:08 +03:00
e n d i f
2014-10-29 07:29:42 +03:00
$( EXPAND_MKSHLIB) $( SHLIB_LDSTARTFILE) $( OBJS) $( SUB_SHLOBJS) $( DTRACE_PROBE_OBJ) $( MOZILLA_PROBE_LIBS) $( RESFILE) $( LDFLAGS) $( WRAP_LDFLAGS) $( STATIC_LIBS) $( SHARED_LIBS) $( EXTRA_DSO_LDOPTS) $( MOZ_GLUE_LDFLAGS) $( EXTRA_LIBS) $( OS_LIBS) $( SHLIB_LDENDFILE)
2011-04-03 11:16:49 +04:00
@$( RM) $( DTRACE_PROBE_OBJ)
2008-08-27 01:34:36 +04:00
e l s e # ! DTRACE_LIB_DEPENDENT
2014-10-29 07:29:42 +03:00
$( EXPAND_MKSHLIB) $( SHLIB_LDSTARTFILE) $( OBJS) $( SUB_SHLOBJS) $( RESFILE) $( LDFLAGS) $( WRAP_LDFLAGS) $( STATIC_LIBS) $( SHARED_LIBS) $( EXTRA_DSO_LDOPTS) $( MOZ_GLUE_LDFLAGS) $( EXTRA_LIBS) $( OS_LIBS) $( SHLIB_LDENDFILE)
2007-10-20 02:24:32 +04:00
e n d i f # DTRACE_LIB_DEPENDENT
2014-01-16 04:13:43 +04:00
$( call CHECK_BINARY,$@ )
2007-10-11 03:03:14 +04:00
2006-01-23 20:16:17 +03:00
i f e q ( _ W I N N T , $( GNU_CC ) _ $( OS_ARCH ) )
i f d e f M S M A N I F E S T _ T O O L
2007-09-26 14:38:29 +04:00
i f d e f E M B E D _ M A N I F E S T _ A T
2006-01-23 20:16:17 +03:00
@if test -f $@ .manifest; then \
2007-09-26 14:38:29 +04:00
mt.exe -NOLOGO -MANIFEST $@ .manifest -OUTPUTRESOURCE:$@ \; $( EMBED_MANIFEST_AT) ; \
2006-01-23 20:16:17 +03:00
rm -f $@ .manifest; \
fi
2007-09-26 14:38:29 +04:00
e n d i f # EMBED_MANIFEST_AT
2006-01-23 20:16:17 +03:00
e n d i f # MSVC with manifest tool
2009-09-25 20:50:53 +04:00
i f d e f M O Z _ P R O F I L E _ G E N E R A T E
2013-12-03 01:34:21 +04:00
touch -t ` date +%Y%m%d%H%M.%S -d 'now+5seconds' ` pgo.relink
2009-09-25 20:50:53 +04:00
e n d i f
2006-01-23 20:16:17 +03:00
e n d i f # WINNT && !GCC
1998-03-28 05:44:41 +03:00
chmod +x $@
2001-10-26 12:36:28 +04:00
i f d e f E N A B L E _ S T R I P
2013-11-11 20:01:22 +04:00
$( STRIP) $( STRIP_FLAGS) $@
2001-10-26 12:36:28 +04:00
e n d i f
2001-10-26 16:39:30 +04:00
i f d e f M O Z _ P O S T _ D S O _ L I B _ C O M M A N D
$( MOZ_POST_DSO_LIB_COMMAND) $@
e n d i f
1998-03-28 05:44:41 +03:00
2009-02-09 09:21:09 +03:00
i f e q ( $( SOLARIS_SUNPRO_CC ) , 1 )
2007-08-18 03:07:39 +04:00
_MDDEPFILE = $( MDDEPDIR) /$( @F) .pp
d e f i n e M A K E _ D E P S _ A U T O _ C C
i f t e s t - d $( @D ) ; t h e n \
2013-12-03 01:34:21 +04:00
echo 'Building deps for $< using Sun Studio cc' ; \
2007-08-18 03:07:39 +04:00
$( CC) $( COMPILE_CFLAGS) -xM $< >$( _MDDEPFILE) ; \
2014-11-30 04:45:31 +03:00
$( PYTHON) $( MOZILLA_DIR) /build/unix/add_phony_targets.py $( _MDDEPFILE) ; \
2007-08-18 03:07:39 +04:00
f i
e n d e f
d e f i n e M A K E _ D E P S _ A U T O _ C X X
i f t e s t - d $( @D ) ; t h e n \
2013-12-03 01:34:21 +04:00
echo 'Building deps for $< using Sun Studio CC' ; \
2007-08-18 03:07:39 +04:00
$( CXX) $( COMPILE_CXXFLAGS) -xM $< >$( _MDDEPFILE) ; \
2014-11-30 04:45:31 +03:00
$( PYTHON) $( MOZILLA_DIR) /build/unix/add_phony_targets.py $( _MDDEPFILE) ; \
2007-08-18 03:07:39 +04:00
f i
e n d e f
e n d i f # Sun Studio on Solaris
2001-05-22 11:52:30 +04:00
2013-07-03 01:40:17 +04: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
2013-10-25 02:58:14 +04:00
$(basename $2$(notdir $1)).$(OBJ_SUFFIX) : $1 $$( call mkdir_deps ,$ $ ( MDDEPDIR ) )
2013-07-03 01:40:17 +04:00
e n d e f
$( foreach f ,$ ( CSRCS ) $ ( SSRCS ) $ ( CPPSRCS ) $ ( CMSRCS ) $ ( CMMSRCS ) $ ( ASFILES ) ,$ ( eval $ ( call src_objdep ,$ ( f ) ) ) )
2013-10-25 02:58:14 +04:00
$( foreach f ,$ ( HOST_CSRCS ) $ ( HOST_CPPSRCS ) $ ( HOST_CMSRCS ) $ ( HOST_CMMSRCS ) ,$ ( eval $ ( call src_objdep ,$ ( f ) ,host_ ) ) )
2015-07-21 16:21:40 +03:00
# The Rust compiler only outputs library objects, and so we need different
2015-05-09 01:18:00 +03:00
# mangling to generate dependency rules for it.
mk_libname = $( basename lib$( notdir $1 ) ) .$( LIB_SUFFIX)
src_libdep = $( call mk_libname,$1 ) : $1 $$ ( call mkdir_deps,$$ ( MDDEPDIR) )
$( foreach f ,$ ( RSSRCS ) ,$ ( eval $ ( call src_libdep ,$ ( f ) ) ) )
2013-07-03 01:40:17 +04:00
2013-04-10 02:10:25 +04:00
$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS) : $( GLOBAL_DEPS )
2012-03-31 11:24:39 +04:00
2002-11-15 10:24:44 +03:00
# Rules for building native targets must come first because of the host_ prefix
2013-10-22 08:40:27 +04:00
$(HOST_COBJS) :
2011-12-08 22:14:06 +04:00
$( REPORT_BUILD)
2007-03-26 22:17:02 +04:00
$( ELOG) $( HOST_CC) $( HOST_OUTOPTION) $@ -c $( HOST_CFLAGS) $( INCLUDES) $( NSPR_CFLAGS) $( _VPATH_SRCS)
2013-10-22 08:40:27 +04:00
$(HOST_CPPOBJS) :
2011-12-08 22:14:06 +04:00
$( REPORT_BUILD)
2007-03-26 22:17:02 +04:00
$( ELOG) $( HOST_CXX) $( HOST_OUTOPTION) $@ -c $( HOST_CXXFLAGS) $( INCLUDES) $( NSPR_CFLAGS) $( _VPATH_SRCS)
2002-11-15 10:24:44 +03:00
2013-10-22 08:40:27 +04:00
$(HOST_CMOBJS) :
2011-12-08 22:14:06 +04:00
$( REPORT_BUILD)
2008-02-23 00:08:36 +03:00
$( ELOG) $( HOST_CC) $( HOST_OUTOPTION) $@ -c $( HOST_CFLAGS) $( HOST_CMFLAGS) $( INCLUDES) $( NSPR_CFLAGS) $( _VPATH_SRCS)
2007-04-27 15:47:10 +04:00
2013-10-22 08:40:27 +04:00
$(HOST_CMMOBJS) :
2011-12-08 22:14:06 +04:00
$( REPORT_BUILD)
2008-02-23 00:08:36 +03:00
$( ELOG) $( HOST_CXX) $( HOST_OUTOPTION) $@ -c $( HOST_CXXFLAGS) $( HOST_CMMFLAGS) $( INCLUDES) $( NSPR_CFLAGS) $( _VPATH_SRCS)
2007-04-27 15:47:10 +04:00
2013-07-03 01:40:17 +04:00
$(COBJS) :
2011-12-08 22:14:06 +04:00
$( REPORT_BUILD)
2007-08-18 03:07:39 +04:00
@$( MAKE_DEPS_AUTO_CC)
2014-03-04 20:30:01 +04:00
$( ELOG) $( CC) $( OUTOPTION) $@ -c $( COMPILE_CFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
1998-03-28 05:44:41 +03:00
2010-07-23 21:56:19 +04:00
# DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
2011-08-26 03:37:25 +04:00
# 'moc' only knows about #defines it gets on the command line (-D...), not in
2010-07-23 21:56:19 +04:00
# included headers like mozilla-config.h
2013-08-20 10:21:35 +04:00
$(filter moc_%.cpp,$(CPPSRCS)) : moc_ %.cpp : %.h
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2011-11-17 10:28:33 +04:00
$( ELOG) $( MOC) $( DEFINES) $( ACDEFINES) $< $( OUTOPTION) $@
1999-08-09 18:55:56 +04:00
2013-08-20 10:21:35 +04:00
$(filter moc_%.cc,$(CPPSRCS)) : moc_ %.cc : %.cc
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2010-07-23 21:56:19 +04:00
$( ELOG) $( MOC) $( DEFINES) $( ACDEFINES) $( _VPATH_SRCS:.cc= .h) $( OUTOPTION) $@
2010-02-19 00:48:50 +03:00
2013-08-20 10:21:35 +04:00
$(filter qrc_%.cpp,$(CPPSRCS)) : qrc_ %.cpp : %.qrc
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2011-11-17 10:28:33 +04:00
$( ELOG) $( RCC) -name $* $< $( OUTOPTION) $@
2007-10-14 02:14:28 +04:00
i f d e f A S F I L E S
1999-03-08 18:01:13 +03:00
# The AS_DASH_C_FLAG is needed cause not all assemblers (Solaris) accept
# a '-c' flag.
2013-07-03 01:40:17 +04:00
$(ASOBJS) :
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2014-03-04 20:30:01 +04:00
$( AS) $( ASOUTOPTION) $@ $( ASFLAGS) $( $( notdir $<) _FLAGS) $( AS_DASH_C_FLAG) $( _VPATH_SRCS)
2001-07-02 07:49:50 +04:00
e n d i f
1998-03-28 05:44:41 +03:00
2015-05-09 01:18:00 +03:00
i f d e f M O Z _ R U S T
# Assume any system libraries rustc links against are already
# in the target's LIBS.
$(RSOBJS) :
$( REPORT_BUILD)
2015-07-21 16:21:40 +03:00
$( RUSTC) $( RUSTFLAGS) --crate-type staticlib -o $( call mk_libname,$<) $( _VPATH_SRCS)
2015-05-09 01:18:00 +03:00
e n d i f
2013-07-03 01:40:17 +04:00
$(SOBJS) :
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2014-03-04 20:30:01 +04:00
$( AS) -o $@ $( ASFLAGS) $( $( notdir $<) _FLAGS) $( LOCAL_INCLUDES) $( TARGET_LOCAL_INCLUDES) -c $<
1998-03-28 05:44:41 +03:00
2013-07-03 01:40:17 +04:00
$(CPPOBJS) :
2011-12-08 22:14:06 +04:00
$( REPORT_BUILD)
2007-08-18 03:07:39 +04:00
@$( MAKE_DEPS_AUTO_CXX)
2014-03-04 20:30:01 +04:00
$( ELOG) $( CCC) $( OUTOPTION) $@ -c $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
1998-03-28 05:44:41 +03:00
2013-07-03 01:40:17 +04:00
$(CMMOBJS) :
2011-12-08 22:14:06 +04:00
$( REPORT_BUILD)
2007-08-18 03:07:39 +04:00
@$( MAKE_DEPS_AUTO_CXX)
2014-03-04 20:30:01 +04:00
$( ELOG) $( CCC) -o $@ -c $( COMPILE_CXXFLAGS) $( COMPILE_CMMFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2001-10-31 04:20:39 +03:00
2013-07-03 01:40:17 +04:00
$(CMOBJS) :
2011-12-08 22:14:06 +04:00
$( REPORT_BUILD)
2007-08-18 03:07:39 +04:00
@$( MAKE_DEPS_AUTO_CC)
2014-03-04 20:30:01 +04:00
$( ELOG) $( CC) -o $@ -c $( COMPILE_CFLAGS) $( COMPILE_CMFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2004-06-18 04:56:48 +04:00
2013-08-20 10:21:35 +04:00
$(filter %.s,$(CPPSRCS : %.cpp =%.s )): %.s : %.cpp $( call mkdir_deps ,$ ( MDDEPDIR ) )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2014-03-04 20:30:01 +04:00
$( CCC) -S $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2003-03-08 08:18:43 +03:00
2013-08-20 10:21:35 +04:00
$(filter %.s,$(CPPSRCS : %.cc =%.s )): %.s : %.cc $( call mkdir_deps ,$ ( MDDEPDIR ) )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2014-03-04 20:30:01 +04:00
$( CCC) -S $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2007-07-11 21:26:11 +04:00
2014-06-17 06:36:24 +04:00
$(filter %.s,$(CPPSRCS : %.cxx =%.s )): %.s : %.cpp $( call mkdir_deps ,$ ( MDDEPDIR ) )
$( REPORT_BUILD)
$( CCC) -S $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2013-08-20 10:21:35 +04:00
$(filter %.s,$(CSRCS : %.c =%.s )): %.s : %.c $( call mkdir_deps ,$ ( MDDEPDIR ) )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2014-03-04 20:30:01 +04:00
$( CC) -S $( COMPILE_CFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2003-03-08 08:18:43 +03:00
2013-12-12 04:23:24 +04: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 ) ) ) )
_PREPROCESSED_CPP_FILES := $( call _group_srcs,cpp,$( CPPSRCS) )
_PREPROCESSED_CC_FILES := $( call _group_srcs,cc,$( CPPSRCS) )
2014-06-17 06:36:24 +04:00
_PREPROCESSED_CXX_FILES := $( call _group_srcs,cxx,$( CPPSRCS) )
2013-12-12 04:23:24 +04:00
_PREPROCESSED_C_FILES := $( call _group_srcs,c,$( CSRCS) )
_PREPROCESSED_CMM_FILES := $( call _group_srcs,mm,$( CMMSRCS) )
# Hack up VPATH so we can reach the sources. Eg: 'make Parser.i' may need to
# reach $(srcdir)/frontend/Parser.i
VPATH += $( addprefix $( srcdir) /,$( sort $( dir $( CPPSRCS) $( CSRCS) $( CMMSRCS) ) ) )
# Make preprocessed files PHONY so they are always executed, since they are
# manual targets and we don't necessarily write to $@.
2014-06-17 06:36:24 +04:00
.PHONY : $( _PREPROCESSED_CPP_FILES ) $( _PREPROCESSED_CC_FILES ) $( _PREPROCESSED_CXX_FILES ) $( _PREPROCESSED_C_FILES ) $( _PREPROCESSED_CMM_FILES )
2013-12-12 04:23:24 +04:00
$(_PREPROCESSED_CPP_FILES) : %.i : %.cpp $( call mkdir_deps ,$ ( MDDEPDIR ) )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2013-12-12 04:23:24 +04:00
$( addprefix $( MKDIR) -p ,$( filter-out .,$( @D) ) )
2014-03-04 20:30:01 +04:00
$( CCC) -C $( PREPROCESS_OPTION) $@ $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
1998-03-28 05:44:41 +03:00
2013-12-12 04:23:24 +04:00
$(_PREPROCESSED_CC_FILES) : %.i : %.cc $( call mkdir_deps ,$ ( MDDEPDIR ) )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2013-12-12 04:23:24 +04:00
$( addprefix $( MKDIR) -p ,$( filter-out .,$( @D) ) )
2014-03-04 20:30:01 +04:00
$( CCC) -C $( PREPROCESS_OPTION) $@ $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2007-07-11 21:26:11 +04:00
2014-06-17 06:36:24 +04:00
$(_PREPROCESSED_CXX_FILES) : %.i : %.cxx $( call mkdir_deps ,$ ( MDDEPDIR ) )
$( REPORT_BUILD)
$( addprefix $( MKDIR) -p ,$( filter-out .,$( @D) ) )
$( CCC) -C $( PREPROCESS_OPTION) $@ $( COMPILE_CXXFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2013-12-12 04:23:24 +04:00
$(_PREPROCESSED_C_FILES) : %.i : %.c $( call mkdir_deps ,$ ( MDDEPDIR ) )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2013-12-12 04:23:24 +04:00
$( addprefix $( MKDIR) -p ,$( filter-out .,$( @D) ) )
2014-03-04 20:30:01 +04:00
$( CC) -C $( PREPROCESS_OPTION) $@ $( COMPILE_CFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
1998-03-28 05:44:41 +03:00
2013-12-12 04:23:24 +04:00
$(_PREPROCESSED_CMM_FILES) : %.i : %.mm $( call mkdir_deps ,$ ( MDDEPDIR ) )
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2013-12-12 04:23:24 +04:00
$( addprefix $( MKDIR) -p ,$( filter-out .,$( @D) ) )
2014-03-04 20:30:01 +04:00
$( CCC) -C $( PREPROCESS_OPTION) $@ $( COMPILE_CXXFLAGS) $( COMPILE_CMMFLAGS) $( $( notdir $<) _FLAGS) $( TARGET_LOCAL_INCLUDES) $( _VPATH_SRCS)
2008-03-13 14:12:10 +03:00
2013-12-12 04:23:24 +04: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 06:36:24 +04:00
MATCH_cpp = \( cpp\| cc| cxx\)
2013-12-12 04:23:24 +04: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
2013-08-20 10:21:35 +04:00
$(RESFILE) : %.res : %.rc
2013-08-10 10:57:09 +04:00
$( REPORT_BUILD)
2002-01-01 03:03:57 +03:00
@echo Creating Resource file: $@
2003-03-08 08:18:43 +03:00
i f d e f G N U _ C C
2003-08-05 08:43:49 +04:00
$( RC) $( RCFLAGS) $( filter-out -U%,$( DEFINES) ) $( INCLUDES:-I%= --include-dir %) $( OUTOPTION) $@ $( _VPATH_SRCS)
2002-03-21 16:45:32 +03:00
e l s e
2003-08-05 08:43:49 +04:00
$( RC) $( RCFLAGS) -r $( DEFINES) $( INCLUDES) $( OUTOPTION) $@ $( _VPATH_SRCS)
2002-03-21 16:45:32 +03:00
e n d i f
2002-01-01 03:03:57 +03:00
2013-08-20 10:21:45 +04:00
# Cancel GNU make built-in implicit rules
MAKEFLAGS += -r
1999-03-22 23:43:05 +03:00
2014-02-11 02:57:01 +04:00
i f n e q ( , $( filter WINNT ,$ ( OS_ARCH ) ) )
2006-09-27 19:23:31 +04:00
SEP := ;
e l s e
SEP := :
e n d i f
EMPTY :=
SPACE := $( EMPTY) $( EMPTY)
2011-01-25 23:14:30 +03:00
# MSYS has its own special path form, but javac expects the source and class
# paths to be in the DOS form (i.e. e:/builds/...). This function does the
# appropriate conversion on Windows, but is a noop on other systems.
2011-04-19 08:11:40 +04:00
i f e q ( $( HOST_OS_ARCH ) , W I N N T )
2007-05-02 21:02:45 +04:00
# We use 'pwd -W' to get DOS form of the path. However, since the given path
2010-10-28 22:28:21 +04:00
# could be a file or a non-existent path, we cannot call 'pwd -W' directly
2007-05-02 21:02:45 +04:00
# on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
# on it, then merge with the rest of the path.
2013-12-03 01:34:21 +04:00
root-path = $( shell echo $( 1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\1|' )
non-root-path = $( shell echo $( 1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\2|' )
2009-08-03 20:16:05 +04:00
normalizepath = $( foreach p,$( 1) ,$( if $( filter /%,$( 1) ) ,$( patsubst %/,%,$( shell cd $( call root-path,$( 1) ) && pwd -W) ) /$( call non-root-path,$( 1) ) ,$( 1) ) )
2007-03-08 01:44:16 +03:00
e l s e
normalizepath = $( 1)
e n d i f
2013-08-20 10:22:33 +04:00
###############################################################################
# Java rules
###############################################################################
2013-10-10 04:05:36 +04:00
i f n e q ( , $( JAVAFILES ) $( ANDROID_RESFILES ) $( ANDROID_APKNAME ) $( JAVA_JAR_TARGETS ) )
2014-11-30 04:45:31 +03:00
include $( MOZILLA_DIR) /config/makefiles/java-build.mk
2013-01-26 00:22:13 +04:00
e n d i f
1999-01-29 23:00:50 +03:00
###############################################################################
1998-03-28 05:44:41 +03:00
# Bunch of things that extend the 'export' rule (in order):
1999-01-29 23:00:50 +03:00
###############################################################################
1998-03-28 05:44:41 +03:00
2005-02-19 01:17:37 +03:00
i f n e q ( $( XPI_NAME ) , )
2008-10-31 03:03:02 +03:00
$(FINAL_TARGET) :
$( NSINSTALL) -D $@
export :: $( FINAL_TARGET )
2005-02-19 01:17:37 +03:00
e n d i f
1999-06-03 04:41:11 +04:00
################################################################################
2015-11-28 04:21:19 +03:00
# The default location for prefs is the gre prefs directory.
# PREF_DIR is used for L10N_PREF_JS_EXPORTS in various locales/ directories.
2004-01-16 22:22:43 +03:00
PREF_DIR = defaults/pref
2012-12-06 02:36:15 +04: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 06:13:33 +03:00
i f n e q ( , $( DIST_SUBDIR ) $( XPI_NAME ) )
2012-12-06 02:36:15 +04:00
PREF_DIR = defaults/preferences
2005-03-28 23:36:24 +04:00
e n d i f
2004-01-16 22:22:43 +03:00
2001-12-22 01:29:31 +03:00
################################################################################
2005-02-19 01:17:37 +03:00
# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
2001-12-22 01:29:31 +03:00
i f n e q ( $( AUTOCFG_JS_EXPORTS ) , )
2001-12-31 12:04:25 +03:00
i f n d e f N O _ D I S T _ I N S T A L L
2012-08-29 10:55:57 +04:00
AUTOCFG_JS_EXPORTS_FILES := $( AUTOCFG_JS_EXPORTS)
AUTOCFG_JS_EXPORTS_DEST := $( FINAL_TARGET) /defaults/autoconfig
AUTOCFG_JS_EXPORTS_TARGET := export
INSTALL_TARGETS += AUTOCFG_JS_EXPORTS
2001-12-31 12:04:25 +03:00
e n d i f
2011-08-26 03:37:25 +04:00
e n d i f
2012-05-16 22:46:28 +04:00
2012-05-10 21:10:11 +04:00
################################################################################
2009-05-21 22:12:46 +04:00
# SDK
i f n e q ( , $( SDK_LIBRARY ) )
i f n d e f N O _ D I S T _ I N S T A L L
2012-08-29 10:55:57 +04:00
SDK_LIBRARY_FILES := $( SDK_LIBRARY)
SDK_LIBRARY_DEST := $( SDK_LIB_DIR)
2014-07-29 03:59:27 +04:00
SDK_LIBRARY_TARGET := target
2012-08-29 10:55:57 +04:00
INSTALL_TARGETS += SDK_LIBRARY
2009-05-21 22:12:46 +04:00
e n d i f
e n d i f # SDK_LIBRARY
2014-07-29 03:59:27 +04:00
# SDK_BINARY is still used in various makefiles for non-products of the
# compilation, so we need to keep that running on the libs tier.
2011-04-14 13:23:13 +04:00
i f n e q ( , $( strip $ ( SDK_BINARY ) ) )
2009-05-21 22:12:46 +04:00
i f n d e f N O _ D I S T _ I N S T A L L
2012-08-29 10:55:57 +04:00
SDK_BINARY_FILES := $( SDK_BINARY)
SDK_BINARY_DEST := $( SDK_BIN_DIR)
2014-07-25 02:14:40 +04:00
# SDK_BINARY_TARGET is set in xpcom/idl-parser/Makefile.in
2014-07-29 03:58:28 +04:00
SDK_BINARY_TARGET ?= libs target
2012-08-29 10:55:57 +04:00
INSTALL_TARGETS += SDK_BINARY
2009-05-21 22:12:46 +04:00
e n d i f
e n d i f # SDK_BINARY
1999-07-27 18:30:34 +04:00
################################################################################
2000-09-20 23:35:24 +04:00
# CHROME PACKAGING
2000-09-09 09:54:35 +04:00
2003-10-16 00:30:59 +04:00
chrome ::
$( MAKE) realchrome
2009-02-28 00:03:53 +03:00
$( LOOP_OVER_DIRS)
2003-10-16 00:30:59 +04:00
2012-05-15 20:20:30 +04:00
$(FINAL_TARGET)/chrome : $( call mkdir_deps ,$ ( FINAL_TARGET ) /chrome )
2008-10-31 03:03:02 +03:00
2013-12-10 11:18:11 +04:00
i f n e q ( , $( JAR_MANIFEST ) )
2002-04-25 06:52:44 +04:00
i f n d e f N O _ D I S T _ I N S T A L L
2013-02-07 01:21:32 +04:00
i f d e f X P I _ N A M E
2013-02-07 20:22:11 +04: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-07 01:21:32 +04:00
# sub-dir should be added to the root chrome manifest with
# a specific application id.
2013-12-03 01:34:21 +04:00
MAKE_JARS_FLAGS += --root-manifest-entry-appid= '$(XPI_ROOT_APPID)'
2013-02-07 20:22:11 +04:00
e n d i f
2013-02-07 01:21:32 +04: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
2013-11-05 02:39:28 +04:00
libs realchrome :: $( FINAL_TARGET ) /chrome
2013-10-12 00:19:11 +04:00
$( call py_action,jar_maker,\
2015-10-09 02:35:48 +03:00
$( QUIET) -d $( FINAL_TARGET) \
2015-09-30 10:33:04 +03:00
$( MAKE_JARS_FLAGS) $( DEFINES) $( ACDEFINES) $( MOZ_DEBUG_DEFINES) \
2013-10-12 00:19:11 +04:00
$( JAR_MANIFEST) )
2013-02-07 01:21:32 +04:00
2008-11-26 22:43:59 +03:00
e n d i f
2013-12-10 11:18:11 +04:00
# This is a temporary check to ensure patches relying on the old behavior
# of silently picking up jar.mn files continue to work.
e l s e # No JAR_MANIFEST
i f n e q ( , $( wildcard $ ( srcdir ) /jar .mn ) )
$( error $ ( srcdir ) contains a jar .mn file but this file is not declared in a JAR_MANIFESTS variable in a moz .build file )
e n d i f
2002-04-25 06:52:44 +04:00
e n d i f
2014-07-29 03:55:55 +04: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 15:59:09 +04:00
i f n e q ( $( XPI_PKGNAME ) , )
2013-11-08 06:42:22 +04:00
tools realchrome ::
2006-02-06 22:07:40 +03:00
i f d e f S T R I P _ X P I
2006-03-29 01:44:14 +04:00
i f n d e f M O Z _ D E B U G
2013-12-03 01:34:21 +04:00
@echo 'Stripping $(XPI_PKGNAME) package directory...'
2006-01-03 22:08:27 +03:00
@echo $( FINAL_TARGET)
@cd $( FINAL_TARGET) && find . ! -type d \
2013-12-03 01:34:21 +04:00
! -name '*.js' \
! -name '*.xpt' \
! -name '*.gif' \
! -name '*.jpg' \
! -name '*.png' \
! -name '*.xpm' \
! -name '*.txt' \
! -name '*.rdf' \
! -name '*.sh' \
! -name '*.properties' \
! -name '*.dtd' \
! -name '*.html' \
! -name '*.xul' \
! -name '*.css' \
! -name '*.xml' \
! -name '*.jar' \
! -name '*.dat' \
! -name '*.tbl' \
! -name '*.src' \
! -name '*.reg' \
2006-01-03 22:08:27 +03:00
$( PLATFORM_EXCLUDE_LIST) \
-exec $( STRIP) $( STRIP_FLAGS) { } >/dev/null 2>& 1 \;
2006-03-29 01:44:14 +04:00
e n d i f
2006-01-03 22:08:27 +03:00
e n d i f
2013-12-03 01:34:21 +04:00
@echo 'Packaging $(XPI_PKGNAME).xpi...'
2015-05-20 01:52:55 +03:00
$( call py_action,zip,-C $( FINAL_TARGET) ../$( XPI_PKGNAME) .xpi '*' )
2005-06-01 15:59:09 +04:00
e n d i f
2014-07-29 03:55:55 +04:00
# See comment above about moving this out of the tools tier.
2005-06-01 15:59:09 +04:00
i f d e f I N S T A L L _ E X T E N S I O N _ I D
i f n d e f X P I _ N A M E
$( error XPI_NAME must be set for INSTALL_EXTENSION_ID )
e n d i f
2013-11-08 06:42:22 +04:00
tools ::
2014-08-06 20:58:31 +04:00
$( RM) -r '$(DIST)/bin/distribution$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
$( NSINSTALL) -D '$(DIST)/bin/distribution$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
$( call copy_dir,$( FINAL_TARGET) ,$( DIST) /bin/distribution$( DIST_SUBDIR:%= /%) /extensions/$( INSTALL_EXTENSION_ID) )
2005-06-01 15:59:09 +04:00
e n d i f
1999-02-17 20:33:07 +03:00
#############################################################################
1999-08-25 01:45:06 +04: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 23:55:46 +03: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.
2013-10-24 02:59:03 +04:00
i f n e q ( , $( filter -out all chrome default export realchrome clean clobber clobber_all distclean realclean ,$ ( MAKECMDGOALS ) ) )
2015-11-03 21:23:04 +03:00
MDDEPEND_FILES := $( strip $( wildcard $( addprefix $( MDDEPDIR) /,$( addsuffix .pp,$( notdir $( sort $( OBJS) $( PROGOBJS) $( HOST_OBJS) $( HOST_PROGOBJS) ) ) ) ) ) )
1999-09-09 13:24:58 +04:00
2001-04-05 05:18:34 +04:00
i f n e q ( , $( MDDEPEND_FILES ) )
2013-08-20 04:15:43 +04:00
$( call include_deps ,$ ( MDDEPEND_FILES ) )
1999-03-09 04:31:26 +03:00
e n d i f
2001-04-05 05:18:34 +04:00
1999-03-10 03:03:12 +03:00
e n d i f
2013-05-09 21:05:33 +04:00
2015-11-03 21:23:04 +03:00
MDDEPEND_FILES := $( strip $( wildcard $( addprefix $( MDDEPDIR) /,$( EXTRA_MDDEPEND_FILES) ) ) )
2013-05-09 21:05:33 +04:00
i f n e q ( , $( MDDEPEND_FILES ) )
2013-08-20 04:15:43 +04:00
$( call include_deps ,$ ( MDDEPEND_FILES ) )
2013-05-09 21:05:33 +04:00
e n d i f
1998-03-28 05:44:41 +03:00
#############################################################################
2008-06-06 23:43:26 +04:00
- i n c l u d e $( topsrcdir ) / $( MOZ_BUILD_APP ) / a p p - r u l e s . m k
1998-03-28 05:44:41 +03:00
- i n c l u d e $( MY_RULES )
#
# Generate Emacs tags in a file named TAGS if ETAGS was set in $(MY_CONFIG)
# or in $(MY_RULES)
#
i f d e f E T A G S
1998-04-16 03:56:45 +04:00
i f n e q ( $( CSRCS ) $( CPPSRCS ) $( HEADERS ) , )
1998-03-28 05:44:41 +03:00
all :: TAGS
TAGS :: $( CSRCS ) $( CPPSRCS ) $( HEADERS )
$( ETAGS) $( CSRCS) $( CPPSRCS) $( HEADERS)
e n d i f
e n d i f
2012-08-07 11:29:59 +04:00
################################################################################
# Install/copy rules
#
# The INSTALL_TARGETS variable contains a list of all install target
2012-08-29 10:55:57 +04:00
# categories. Each category defines a list of files and executables, and an
# install destination,
2012-08-07 11:29:59 +04:00
#
# FOO_FILES := foo bar
# FOO_EXECUTABLES := baz
# FOO_DEST := target_path
# INSTALL_TARGETS += FOO
2012-08-29 10:55:57 +04: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 05:32:53 +04: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 10:55:57 +04:00
# If we're using binary nsinstall and it's not built yet, fallback to python nsinstall.
2014-08-06 21:58:50 +04: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 10:55:57 +04: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 08:02:20 +04:00
$(1) : install_cmd = $$( if $ $ ( nsinstall_is_usable ) ,$ $ ( INSTALL ) ,$ $ ( NSINSTALL_PY ) -t ) $$( 1)
2012-08-29 10:55:57 +04:00
e n d e f
e n d i f
2013-01-23 13:13:04 +04:00
e n d i f
2012-08-29 10:55:57 +04:00
2013-11-09 05:32:53 +04: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 11:29:59 +04:00
e n d e f
2013-11-09 05:32:53 +04:00
2012-08-07 11:29:59 +04:00
$( foreach category ,$ ( INSTALL_TARGETS ) ,\
2013-11-09 05:32:53 +04: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 11:29:59 +04:00
)
2013-11-09 05:32:53 +04: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-03 01:34:21 +04:00
$( call install_cmd,$( IFLAGS1) '$<' '$(@D)' )
2013-11-09 05:32:53 +04:00
$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_EXECUTABLES_$(tier)))) :
$( install_targets_sanity)
2013-12-03 01:34:21 +04:00
$( call install_cmd,$( IFLAGS2) '$<' '$(@D)' )
2013-11-09 05:32:53 +04:00
2012-07-23 09:42:22 +04:00
################################################################################
# Preprocessing rules
#
# The PP_TARGETS variable contains a list of all preprocessing target
2012-12-03 04:49:32 +04:00
# categories. Each category has associated variables listing input files, the
# output directory, extra preprocessor flags, and so on. For example:
2012-07-23 09:42:22 +04:00
#
2012-12-03 04:49:32 +04:00
# FOO := input-file
# FOO_PATH := target-directory
# FOO_FLAGS := -Dsome_flag
# PP_TARGETS += FOO
2012-08-29 10:55:57 +04:00
#
2012-12-03 04:49:32 +04: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 05:35:44 +04: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 04:49:32 +04: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 05:35:44 +04: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 04:49:32 +04: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 05:32:53 +04: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 09:42:22 +04:00
2013-11-09 05:32:53 +04:00
$( foreach tier ,$ ( PP_TARGETS_TIERS ) , \
$( eval $( tier) :: $( PP_TARGETS_RESULTS_$( tier) ) ) \
)
2013-11-09 05:35:45 +04:00
PP_TARGETS_ALL_RESULTS := $( sort $( foreach tier,$( PP_TARGETS_TIERS) ,$( PP_TARGETS_RESULTS_$( tier) ) ) )
$(PP_TARGETS_ALL_RESULTS) :
2013-11-09 05:32:53 +04:00
$( if $( filter-out $( notdir $@ ) ,$( notdir $( <:.in= ) ) ) ,$( error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS) )
2013-12-03 01:34:21 +04:00
$( RM) '$@'
2015-09-30 10:33:04 +03:00
$( call py_action,preprocessor,--depend $( MDDEPDIR) /$( @F) .pp $( PP_TARGET_FLAGS) $( DEFINES) $( ACDEFINES) $( MOZ_DEBUG_DEFINES) '$<' -o '$@' )
2013-11-09 05:35:45 +04: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 09:42:22 +04:00
2013-11-09 05:35:45 +04:00
i f n e q ( , $( MDDEPEND_FILES ) )
$( call include_deps ,$ ( MDDEPEND_FILES ) )
e n d i f
e n d i f
2012-07-23 09:42:22 +04:00
2013-05-17 21:54:53 +04: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 04:45:31 +03: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 21:54:53 +04:00
e n d i f
1998-03-28 05:44:41 +03:00
################################################################################
# Special gmake rules.
################################################################################
2007-07-25 17:56:04 +04:00
1998-03-28 05:44:41 +03: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.
#
2014-07-29 03:55:55 +04:00
.PHONY : all alltags boot checkout chrome realchrome clean clobber clobber_all export install libs makefiles realclean run_apprunner tools $( DIRS ) FORCE
1999-03-10 00:56:44 +03:00
# Used as a dependency to force targets to rebuild
FORCE :
1998-03-28 05:44:41 +03:00
2000-09-28 08:02:15 +04:00
# Delete target if error occurs when building target
.DELETE_ON_ERROR :
1999-05-12 03:43:36 +04:00
tags : TAGS
2013-10-24 01:43:32 +04:00
TAGS : $( CSRCS ) $( CPPSRCS ) $( wildcard *.h )
1999-05-12 03:43:36 +04:00
-etags $( CSRCS) $( CPPSRCS) $( wildcard *.h)
2009-02-28 00:03:53 +03:00
$( LOOP_OVER_DIRS)
1999-05-12 03:43:36 +04:00
2012-05-16 22:46:28 +04: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 04:45:31 +03:00
include $( MOZILLA_DIR) /config/makefiles/debugmake.mk
2012-05-16 22:46:28 +04:00
endif #}
e n d i f #}
2000-04-21 05:14:45 +04:00
2002-02-22 14:11:24 +03:00
documentation :
@cd $( DEPTH)
2002-11-11 07:04:49 +03:00
$( DOXYGEN) $( DEPTH) /config/doxygen.cfg
2005-08-11 20:41:54 +04:00
2009-04-27 01:32:41 +04:00
i f d e f E N A B L E _ T E S T S
2013-10-24 01:43:32 +04:00
check ::
2009-02-28 00:03:53 +03:00
$( LOOP_OVER_DIRS)
2009-04-27 01:32:41 +04:00
e n d i f
2009-05-18 22:15:05 +04: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-04 00:08:16 +04:00
libs export ::
2009-05-18 22:15:05 +04:00
$( CHECK_FROZEN_VARIABLES)
2010-07-03 03:59:17 +04:00
2013-02-11 17:10:10 +04:00
PURGECACHES_DIRS ?= $( DIST) /bin
i f d e f M O Z _ W E B A P P _ R U N T I M E
PURGECACHES_DIRS += $( DIST) /bin/webapprt
e n d i f
PURGECACHES_FILES = $( addsuffix /.purgecaches,$( PURGECACHES_DIRS) )
default all :: $( PURGECACHES_FILES )
$(PURGECACHES_FILES) :
if test -d $( @D) ; then touch $@ ; fi
2012-04-02 21:06:06 +04:00
2013-05-05 12:16:25 +04:00
.DEFAULT_GOAL := $( or $( OVERRIDE_DEFAULT_GOAL) ,default)
2012-04-02 21:06:06 +04:00
#############################################################################
# Derived targets and dependencies
2014-11-30 04:45:31 +03: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 21:06:06 +04:00
i f n e q ( $( NULL ) , $( AUTO_DEPS ) )
default all libs tools export:: $( AUTO_DEPS)
e n d i f
2013-11-22 03:16:18 +04:00
export :: $( GENERATED_FILES )
GARBAGE += $( GENERATED_FILES)