2
# This Source Code Form is subject to the terms of the Mozilla Public
3
# License, v. 2.0. If a copy of the MPL was not distributed with this
4
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
# Determines the platform and builds the macros needed to load the
10
# appropriate platform-specific .mk file, then defines all (most?)
11
# of the generic macros.
14
# Define an include-at-most-once flag
15
ifdef INCLUDED_CONFIG_MK
16
$(error Do not include config.mk twice!)
18
INCLUDED_CONFIG_MK = 1
20
EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
26
ifndef INCLUDED_AUTOCONF_MK
27
include $(DEPTH)/config/autoconf.mk
32
# Sanity check some variables
40
INSTALL_EXTENSION_ID \
45
# checks for internal spaces or trailing spaces in the variable
47
check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x)))
49
$(foreach x,$(CHECK_VARS),$(check-variable))
51
core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
52
core_realpath = $(if $(realpath $(1)),$(realpath $(1)),$(call core_abspath,$(1)))
55
space :=$(nullstr) # EOL
57
core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1)))))))
61
# LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
62
LIBXUL_DIST ?= $(DIST)
64
# FINAL_TARGET specifies the location into which we copy end-user-shipped
65
# build products (typelibs, components, chrome).
67
# If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
68
# If DIST_SUBDIR is set, the files will be shipped to $(DIST)/$(DIST_SUBDIR)
69
# Otherwise, the default $(DIST)/bin will be used.
70
FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(if $(DIST_SUBDIR),$(DIST)/bin/$(DIST_SUBDIR),$(DIST)/bin))
73
DEFINES += -DXPI_NAME=$(XPI_NAME)
76
# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
79
ifeq ($(HOST_OS_ARCH),WINNT)
80
win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
81
BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix
83
win_srcdir := $(srcdir)
84
BUILD_TOOLS = $(topsrcdir)/build/unix
87
CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
88
AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
91
# Strip off the excessively long version numbers on these platforms,
92
# but save the version to allow multiple versions of the same base
93
# platform to be built in the same tree.
95
ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD SunOS,$(OS_ARCH)))
96
OS_RELEASE := $(basename $(OS_RELEASE))
98
# Allow the user to ignore the OS_VERSION, which is usually irrelevant.
99
ifdef WANT_MOZILLA_CONFIG_OS_VERSION
100
OS_VERS := $(suffix $(OS_RELEASE))
101
OS_VERSION := $(shell echo $(OS_VERS) | sed 's/-.*//')
106
OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
108
FINAL_LINK_LIBS = $(DEPTH)/config/final-link-libs
109
FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps
110
FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names
112
MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX)
113
MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX)
117
PYCOMMANDPATH += $(topsrcdir)/build
118
CC_WRAPPER ?= %cl InvokeClWithDependencyGeneration
119
CXX_WRAPPER ?= %cl InvokeClWithDependencyGeneration
121
CC_WRAPPER ?= $(PYTHON) -O $(topsrcdir)/build/cl.py
122
CXX_WRAPPER ?= $(PYTHON) -O $(topsrcdir)/build/cl.py
126
CC := $(CC_WRAPPER) $(CC)
127
CXX := $(CXX_WRAPPER) $(CXX)
133
PYCOMMANDPATH += $(topsrcdir)/config
136
PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
138
# determine debug-related options
144
_DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
145
XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
147
_DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
148
XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
151
ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS))
153
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
154
_DEBUG_ASFLAGS += -g cv8
156
ifneq ($(OS_ARCH),Darwin)
157
_DEBUG_ASFLAGS += -g dwarf2
161
_DEBUG_ASFLAGS += $(MOZ_DEBUG_FLAGS)
163
_DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
164
_DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
167
MOZALLOC_LIB = $(call EXPAND_LIBNAME_PATH,mozalloc,$(DIST)/lib)
169
ASFLAGS += $(_DEBUG_ASFLAGS)
170
OS_CFLAGS += $(_DEBUG_CFLAGS)
171
OS_CXXFLAGS += $(_DEBUG_CFLAGS)
172
OS_LDFLAGS += $(_DEBUG_LDFLAGS)
174
# XXX: What does this? Bug 482434 filed for better explanation.
175
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
177
ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
183
# MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
184
# Used for generating an optimized build with debugging symbols.
185
# Used in the Windows nightlies to generate symbols for crash reporting.
186
ifdef MOZ_DEBUG_SYMBOLS
187
OS_CXXFLAGS += -UDEBUG -DNDEBUG
188
OS_CFLAGS += -UDEBUG -DNDEBUG
190
OS_LDFLAGS += -DEBUG -OPT:REF,ICF
192
OS_LDFLAGS += -DEBUG -OPT:REF
197
# Handle trace-malloc in optimized builds.
198
# No opt to give sane callstacks.
200
ifdef NS_TRACE_MALLOC
201
MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG
203
OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF,ICF
205
OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF
207
endif # NS_TRACE_MALLOC
211
# We don't build a static CRT when building a custom CRT,
212
# it appears to be broken. So don't link to jemalloc if
213
# the Makefile wants static CRT linking.
214
ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_1)
215
# Disable default CRT libs and add the right lib path for the linker
219
endif # WINNT && !GNU_CC
221
ifdef MOZ_GLUE_PROGRAM_LDFLAGS
222
DEFINES += -DMOZ_GLUE_IN_PROGRAM
224
MOZ_GLUE_PROGRAM_LDFLAGS=$(MOZ_GLUE_LDFLAGS)
228
# Build using PIC by default
232
# Determine if module being compiled is destined
233
# to be merged into libxul
238
DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
240
$(error Component makefile does not specify MODULE_NAME.)
247
# If we are building this component into an extension/xulapp, it cannot be
248
# statically linked. In the future we may want to add a xulapp meta-component
259
ifndef SHARED_LIBRARY_NAME
261
SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
265
ifndef STATIC_LIBRARY_NAME
267
STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
271
# No sense in profiling tools
273
NO_PROFILE_GUIDED_OPTIMIZE = 1
276
# Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
277
# and we don't have the same build logic to re-link them in the second pass.
278
ifdef SIMPLE_PROGRAMS
279
NO_PROFILE_GUIDED_OPTIMIZE = 1
282
# No sense in profiling unit tests
284
NO_PROFILE_GUIDED_OPTIMIZE = 1
287
# Enable profile-based feedback
288
ifndef NO_PROFILE_GUIDED_OPTIMIZE
289
ifdef MOZ_PROFILE_GENERATE
290
OS_CFLAGS += $(PROFILE_GEN_CFLAGS)
291
OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS)
292
OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
293
ifeq (WINNT,$(OS_ARCH))
296
endif # MOZ_PROFILE_GENERATE
298
ifdef MOZ_PROFILE_USE
299
OS_CFLAGS += $(PROFILE_USE_CFLAGS)
300
OS_CXXFLAGS += $(PROFILE_USE_CFLAGS)
301
OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
302
ifeq (WINNT,$(OS_ARCH))
305
endif # MOZ_PROFILE_USE
306
endif # NO_PROFILE_GUIDED_OPTIMIZE
309
# Does the makefile specifies the internal XPCOM API linkage?
310
ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY))
311
DEFINES += -DMOZILLA_INTERNAL_API
314
# Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
315
# building libxul libraries
328
ifndef JS_SHARED_LIBRARY
329
DEFINES += -DSTATIC_EXPORTABLE_JS_API
333
# Flags passed to JarMaker.py
336
-f $(MOZ_CHROME_FILE_FORMAT) \
339
ifdef USE_EXTENSION_MANIFEST
340
MAKE_JARS_FLAGS += -e
344
MAKE_JARS_FLAGS += --both-manifests
347
TAR_CREATE_FLAGS = -cvhf
348
TAR_CREATE_FLAGS_QUIET = -chf
350
ifeq ($(OS_ARCH),BSD_OS)
351
TAR_CREATE_FLAGS = -cvLf
352
TAR_CREATE_FLAGS_QUIET = -cLf
355
ifeq ($(OS_ARCH),OS2)
356
TAR_CREATE_FLAGS = -cvf
357
TAR_CREATE_FLAGS_QUIET = -cf
361
# Personal makefile customizations go in these optional make include files.
363
MY_CONFIG := $(DEPTH)/config/myconfig.mk
364
MY_RULES := $(DEPTH)/config/myrules.mk
367
# Default command macros; can be overridden in <arch>.mk.
370
XPIDL_LINK = $(PYTHON) $(LIBXUL_DIST)/sdk/bin/xpt.py link
373
JAVA_GEN_DIR = _javagen
374
JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
375
JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
377
OS_INCLUDES += $(NSPR_CFLAGS) $(NSS_CFLAGS) $(MOZ_JPEG_CFLAGS) $(MOZ_PNG_CFLAGS) $(MOZ_ZLIB_CFLAGS)
384
$(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include) \
388
include $(topsrcdir)/config/static-checking-config.mk
390
CFLAGS = $(OS_CPPFLAGS) $(OS_CFLAGS)
391
CXXFLAGS = $(OS_CPPFLAGS) $(OS_CXXFLAGS)
392
LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
394
# Allow each module to override the *default* optimization settings
395
# by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
396
# arguments to --enable-optimize
398
ifeq (1,$(MOZ_OPTIMIZE))
399
ifdef MODULE_OPTIMIZE_FLAGS
400
CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
401
CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
403
ifneq (,$(if $(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE),$(MOZ_PGO_OPTIMIZE_FLAGS)))
404
CFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
405
CXXFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
407
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
408
CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
409
endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
410
endif # MODULE_OPTIMIZE_FLAGS
412
CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
413
CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
414
endif # MOZ_OPTIMIZE == 1
415
LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
419
HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS)
422
ifeq (1,$(MOZ_OPTIMIZE))
423
ifdef MODULE_OPTIMIZE_FLAGS
424
HOST_CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
426
HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
427
endif # MODULE_OPTIMIZE_FLAGS
429
HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
430
endif # MOZ_OPTIMIZE == 1
432
endif # CROSS_COMPILE
434
CFLAGS += $(MOZ_FRAMEPTR_FLAGS)
435
CXXFLAGS += $(MOZ_FRAMEPTR_FLAGS)
437
# Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
438
# to request that we use the 'warnings as errors' compile flags)
440
# NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
441
# build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
442
# situation. (See bug 437002.)
443
ifeq (WINNT_1,$(OS_ARCH)_$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
444
FAIL_ON_WARNINGS_DEBUG=
446
endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
448
# Now, check for debug version of flag; it turns on normal flag in debug builds.
449
ifdef FAIL_ON_WARNINGS_DEBUG
453
endif # FAIL_ON_WARNINGS_DEBUG
455
# Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
456
ifdef FAIL_ON_WARNINGS
457
CXXFLAGS += $(WARNINGS_AS_ERRORS)
458
CFLAGS += $(WARNINGS_AS_ERRORS)
459
endif # FAIL_ON_WARNINGS
461
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
462
#// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
463
#// DLL version of the RTL is used...
465
#//------------------------------------------------------------------------
466
ifdef USE_STATIC_LIBS
467
RTL_FLAGS=-MT # Statically linked multithreaded RTL
468
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
469
ifndef MOZ_NO_DEBUG_RTL
470
RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
472
endif # MOZ_DEBUG || NS_TRACE_MALLOC
474
else # !USE_STATIC_LIBS
476
RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
477
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
478
ifndef MOZ_NO_DEBUG_RTL
479
RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
481
endif # MOZ_DEBUG || NS_TRACE_MALLOC
482
endif # USE_STATIC_LIBS
483
endif # WINNT && !GNU_CC
485
ifeq ($(OS_ARCH),Darwin)
486
# Compiling ObjC requires an Apple compiler anyway, so it's ok to set
488
HOST_CMFLAGS += -fobjc-exceptions
489
HOST_CMMFLAGS += -fobjc-exceptions
490
OS_COMPILE_CMFLAGS += -fobjc-exceptions
491
OS_COMPILE_CMMFLAGS += -fobjc-exceptions
492
ifeq ($(MOZ_WIDGET_TOOLKIT),uikit)
493
OS_COMPILE_CMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
494
OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
498
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS)
499
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS)
500
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
501
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
504
HOST_CFLAGS += $(RTL_FLAGS)
508
# Name of the binary code directories
512
# We need to know where to find the libraries we
513
# put on the link line for binaries, and should
514
# we link statically or dynamic? Assuming dynamic for now.
516
ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
517
LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
519
LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
523
# Default location of include files
524
IDL_DIR = $(DIST)/idl
526
XPIDL_FLAGS = -I$(srcdir) -I$(IDL_DIR)
528
XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
531
SDK_LIB_DIR = $(DIST)/sdk/lib
532
SDK_BIN_DIR = $(DIST)/sdk/bin
536
MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
538
ifeq ($(OS_ARCH),OS2)
545
ifdef USE_ELF_DYNSTR_GC
546
ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
547
ELF_DYNSTR_GC = $(DEPTH)/config/elf-dynstr-gc
552
ifeq ($(OS_ARCH),Darwin)
555
PBBUILD = NEXT_ROOT= $(PBBUILD_BIN)
557
PBBUILD = $(PBBUILD_BIN)
559
PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
561
PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
562
endif # MACOS_SDK_DIR
563
ifdef MACOSX_DEPLOYMENT_TARGET
564
export MACOSX_DEPLOYMENT_TARGET
565
PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)"
566
endif # MACOSX_DEPLOYMENT_TARGET
569
ifeq (2,$(MOZ_OPTIMIZE))
570
# Only override project defaults if the config specified explicit settings
571
PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)"
572
endif # MOZ_OPTIMIZE=2
574
endif # OS_ARCH=Darwin
576
ifdef MOZ_USING_CCACHE
582
ifdef MOZ_NATIVE_MAKEDEPEND
584
MKDEPEND = $(MOZ_NATIVE_MAKEDEPEND)
586
MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend
587
MKDEPEND = $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
590
# Set link flags according to whether we want a console.
592
ifeq ($(MOZ_WINCONSOLE),1)
593
ifeq ($(OS_ARCH),OS2)
594
BIN_FLAGS += -Zlinker -PM:VIO
596
ifeq ($(OS_ARCH),WINNT)
598
WIN32_EXE_LDFLAGS += -mconsole
600
WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE
603
else # MOZ_WINCONSOLE
604
ifeq ($(OS_ARCH),OS2)
605
BIN_FLAGS += -Zlinker -PM:PM
607
ifeq ($(OS_ARCH),WINNT)
609
WIN32_EXE_LDFLAGS += -mwindows
611
WIN32_EXE_LDFLAGS += -SUBSYSTEM:WINDOWS
617
# If we're building a component on MSVC, we don't want to generate an
618
# import lib, because that import lib will collide with the name of a
619
# static version of the same library.
620
ifeq ($(GNU_LD)$(OS_ARCH),WINNT)
622
LDFLAGS += -IMPLIB:fake.lib
623
DELETE_AFTER_LINK = fake.lib fake.exp
628
# Include any personal overrides the user might think are needed.
630
-include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
631
-include $(MY_CONFIG)
633
######################################################################
635
GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
637
ifeq ($(OS_ARCH),Darwin)
639
NSDISTMODE=absolute_symlink
644
NSINSTALL_PY := $(PYTHON) $(call core_abspath,$(topsrcdir)/config/nsinstall.py)
645
# For Pymake, wherever we use nsinstall.py we're also going to try to make it
646
# a native command where possible. Since native commands can't be used outside
647
# of single-line commands, we continue to provide INSTALL for general use.
648
# Single-line commands should be switched over to install_cmd.
649
NSINSTALL_NATIVECMD := %nsinstall nsinstall
652
NSINSTALL = $(NSINSTALL_BIN)
654
ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
655
NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
657
ifeq ($(HOST_OS_ARCH),WINNT)
658
NSINSTALL = $(NSINSTALL_PY)
660
NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
663
endif # NSINSTALL_BIN
666
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
667
INSTALL = $(NSINSTALL) -t
669
install_cmd = $(NSINSTALL_NATIVECMD) -t $(1)
674
# This isn't laid out as conditional directives so that NSDISTMODE can be
676
INSTALL = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(filter absolute_symlink, $(NSDISTMODE)), $(NSINSTALL) -L $(PWD), $(NSINSTALL) -R))
680
# The default for install_cmd is simply INSTALL
681
install_cmd ?= $(INSTALL) $(1)
683
# Use nsinstall in copy mode to install files on the system
684
SYSINSTALL = $(NSINSTALL) -t
685
# This isn't necessarily true, just here
686
sysinstall_cmd = install_cmd
689
# Localization build automation
692
# Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
693
# MOZ_UI_LOCALE directly, but use an intermediate variable that can be
694
# overridden by the command line. (Besides, AB_CD is prettier).
695
AB_CD = $(MOZ_UI_LOCALE)
698
L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
700
IS_LANGUAGE_REPACK = 1
703
EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(call core_realpath,$(L10NBASEDIR))/$(AB_CD)/$(subst /locales,,$(1)))
706
LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
710
# if LOCALE_MERGEDIR is set, use mergedir first, then the localization,
712
ifdef LOCALE_MERGEDIR
713
MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
715
MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
716
ifdef LOCALE_MERGEDIR
717
MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
721
ifdef LOCALE_MERGEDIR
722
MERGE_FILE = $(firstword \
723
$(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
724
$(wildcard $(LOCALE_SRCDIR)/$(1)) \
725
$(srcdir)/en-US/$(1) )
727
MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
729
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
731
ifeq (OS2,$(OS_ARCH))
732
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(LIBXUL_DIST)"
734
ifneq (WINNT,$(OS_ARCH))
735
RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
743
# Make sure any compiled classes work with at least JVM 1.4
744
JAVAC_FLAGS += -source 1.4
751
DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
752
STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
755
OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizejars.py)
757
CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py)
759
EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py $(if $@,--depend $(MDDEPDIR)/$(@F).pp --target $@)
760
EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py $(if $@,--depend $(MDDEPDIR)/$(@F).pp)
761
EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
762
EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
763
EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
764
EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
765
EXPAND_MKSHLIB_ARGS = --uselist
767
EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER)
769
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB)
772
ifneq ($(OS_ARCH),Darwin)
773
CHECK_STDCXX = objdump -p $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev/null && echo "TEST-UNEXPECTED-FAIL | | We don't want these libstdc++ symbols to be used:" && objdump -T $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && exit 1 || exit 0
776
EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,stdc++compat,$(DEPTH)/build/unix/stdc++compat)
777
HOST_EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,host_stdc++compat,$(DEPTH)/build/unix/stdc++compat)
780
# autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
782
OBJ_SUFFIX := $(_OBJ_SUFFIX)
784
# PGO builds with GCC build objects with instrumentation in a first pass,
785
# then objects optimized, without instrumentation, in a second pass. If
786
# we overwrite the ojects from the first pass with those from the second,
787
# we end up not getting instrumentation data for better optimization on
788
# incremental builds. As a consequence, we use a different object suffix
789
# for the first pass.
790
ifndef NO_PROFILE_GUIDED_OPTIMIZE
791
ifdef MOZ_PROFILE_GENERATE
798
# EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
799
# expands to $(LIB_PREFIX)foo.$(LIB_SUFFIX) or -lfoo, depending on linker
800
# arguments syntax. Should only be used for system libraries
802
# EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
803
# expands to dir/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
805
# EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
806
# expands to $(DIST)/lib/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
809
EXPAND_LIBNAME = $(addprefix -l,$(1))
811
EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
813
EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
814
EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
816
# Include internal ply only if needed
817
ifndef MOZ_SYSTEM_PLY
818
PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
821
export CL_INCLUDES_PREFIX
823
ifeq ($(MOZ_WIDGET_GTK),2)
824
MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS)