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
30 -include $(DEPTH
)/.mozconfig.mk
32 ifndef EXTERNALLY_MANAGED_MAKE_FILE
33 # Using $(firstword) may not be perfect. But it should be good enough for most
35 _current_makefile
= $(CURDIR
)/$(firstword $(MAKEFILE_LIST
))
37 CHECK_MOZBUILD_VARIABLES
= $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
), \
38 $(if
$(subst $($(var
)_FROZEN
),,'$($(var))'), \
39 $(error Variable
$(var
) is defined in
$(_current_makefile
). It should only be defined in moz.build files
),\
40 )) $(foreach var
,$(_DEPRECATED_VARIABLES
), \
41 $(if
$(subst $($(var
)_FROZEN
),,'$($(var))'), \
42 $(error Variable
$(var
) is defined in
$(_current_makefile
). This variable has been deprecated. It does nothing. It must be removed in order to build
),\
45 # Check variables set after autoconf.mk (included at the top of Makefiles) is
46 # included and before config.mk is included.
47 _eval_for_side_effects
:= $(CHECK_MOZBUILD_VARIABLES
)
49 # Import the automatically generated backend file. If this file doesn't exist,
50 # the backend hasn't been properly configured. We want this to be a fatal
51 # error, hence not using "-include".
52 ifndef STANDALONE_MAKEFILE
53 GLOBAL_DEPS
+= backend.mk
57 # Freeze the values specified by moz.build to catch them if they fail.
58 $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
) $(_DEPRECATED_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
61 space
= $(NULL
) $(NULL
)
63 # Include defs.mk files that can be found in $(srcdir)/$(DEPTH),
64 # $(srcdir)/$(DEPTH-1), $(srcdir)/$(DEPTH-2), etc., and $(srcdir)
65 # where $(DEPTH-1) is one level less of depth, $(DEPTH-2), two, etc.
66 # i.e. for DEPTH=../../.., DEPTH-1 is ../.. and DEPTH-2 is ..
67 # These defs.mk files are used to define variables in a directory
68 # and all its subdirectories, recursively.
69 __depth
:= $(subst /, ,$(DEPTH
))
73 $(foreach __d
,$(__depth
) .
,$(eval __depth
= $(wordlist
2,$(words $(__depth
)),$(__depth
))$(eval
-include $(subst $(space
),/,$(strip $(srcdir) $(__depth
) defs.mk
)))))
77 # Sanity check some variables
84 INSTALL_EXTENSION_ID \
90 # checks for internal spaces or trailing spaces in the variable
92 check-variable
= $(if
$(filter-out 0 1,$(words $($(x
))z
)),$(error Spaces are not allowed in
$(x
)))
94 $(foreach x
,$(CHECK_VARS
),$(check-variable
))
96 ifndef INCLUDED_FUNCTIONS_MK
97 include $(MOZILLA_DIR
)/config
/makefiles
/functions.mk
102 # LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
103 LIBXUL_DIST ?
= $(DIST
)
105 # FINAL_TARGET specifies the location into which we copy end-user-shipped
106 # build products (typelibs, components, chrome). It may already be specified by
109 # If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
110 # instead of $(DIST)/bin. In both cases, if DIST_SUBDIR is set, the files will be
111 # shipped to a $(DIST_SUBDIR) subdirectory.
112 FINAL_TARGET ?
= $(if
$(XPI_NAME
),$(DIST
)/xpi-stage
/$(XPI_NAME
),$(DIST
)/bin
)$(DIST_SUBDIR
:%=/%)
113 # Override the stored value for the check to make sure that the variable is not
114 # redefined in the Makefile.in value.
115 FINAL_TARGET_FROZEN
:= '$(FINAL_TARGET)'
118 DEFINES
+= -DXPI_NAME
=$(XPI_NAME
)
121 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
124 ifeq ($(HOST_OS_ARCH
),WINNT
)
125 ifeq ($(MOZILLA_DIR
),$(topsrcdir
))
126 win_srcdir
:= $(subst $(topsrcdir
),$(WIN_TOP_SRC
),$(srcdir))
128 # This means we're in comm-central's topsrcdir, so we need to adjust
129 # WIN_TOP_SRC (which points to mozilla's topsrcdir) for the substitution
131 cc_WIN_TOP_SRC
:= $(WIN_TOP_SRC
:%/mozilla
=%)
132 win_srcdir
:= $(subst $(topsrcdir
),$(cc_WIN_TOP_SRC
),$(srcdir))
134 BUILD_TOOLS
= $(WIN_TOP_SRC
)/build
/unix
136 win_srcdir
:= $(srcdir)
137 BUILD_TOOLS
= $(MOZILLA_DIR
)/build
/unix
140 CONFIG_TOOLS
= $(MOZ_BUILD_ROOT
)/config
141 AUTOCONF_TOOLS
= $(MOZILLA_DIR
)/build
/autoconf
144 # Strip off the excessively long version numbers on these platforms,
145 # but save the version to allow multiple versions of the same base
146 # platform to be built in the same tree.
148 ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD SunOS
,$(OS_ARCH
)))
149 OS_RELEASE
:= $(basename $(OS_RELEASE
))
151 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
152 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
153 OS_VERS
:= $(suffix $(OS_RELEASE
))
154 OS_VERSION
:= $(shell echo
$(OS_VERS
) | sed
's/-.*//')
159 OS_CONFIG
:= $(OS_ARCH
)$(OS_RELEASE
)
162 CC_WRAPPER ?
= $(call py_action
,cl
)
163 CXX_WRAPPER ?
= $(call py_action
,cl
)
166 CC
:= $(CC_WRAPPER
) $(CC
)
167 CXX
:= $(CXX_WRAPPER
) $(CXX
)
172 PYTHON_PATH
= $(PYTHON
) $(topsrcdir
)/config
/pythonpath.py
174 # determine debug-related options
180 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
181 XULPPFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
183 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
184 XULPPFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
187 ifneq (,$(MOZ_DEBUG
)$(MOZ_DEBUG_SYMBOLS
))
189 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
190 _DEBUG_ASFLAGS
+= -g cv8
192 ifneq ($(OS_ARCH
),Darwin
)
193 _DEBUG_ASFLAGS
+= -g dwarf2
197 _DEBUG_ASFLAGS
+= $(MOZ_DEBUG_FLAGS
)
199 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
200 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
203 ASFLAGS
+= $(_DEBUG_ASFLAGS
)
204 OS_CFLAGS
+= $(_DEBUG_CFLAGS
)
205 OS_CXXFLAGS
+= $(_DEBUG_CFLAGS
)
206 OS_LDFLAGS
+= $(_DEBUG_LDFLAGS
)
208 # XXX: What does this? Bug 482434 filed for better explanation.
209 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
211 ifneq (,$(MOZ_BROWSE_INFO
)$(MOZ_BSCFILE
))
217 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
218 # Used for generating an optimized build with debugging symbols.
219 # Used in the Windows nightlies to generate symbols for crash reporting.
220 ifdef MOZ_DEBUG_SYMBOLS
221 OS_CXXFLAGS
+= -UDEBUG
-DNDEBUG
222 OS_CFLAGS
+= -UDEBUG
-DNDEBUG
223 ifdef HAVE_64BIT_BUILD
224 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
,ICF
226 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
231 # Handle DMD in optimized builds.
232 # No opt to give sane callstacks.
235 MOZ_OPTIMIZE_FLAGS
=-Zi
-Od
-UDEBUG
-DNDEBUG
236 ifdef HAVE_64BIT_BUILD
237 OS_LDFLAGS
= -DEBUG
-OPT
:REF
,ICF
239 OS_LDFLAGS
= -DEBUG
-OPT
:REF
245 endif # WINNT && !GNU_CC
247 ifdef MOZ_GLUE_IN_PROGRAM
248 DEFINES
+= -DMOZ_GLUE_IN_PROGRAM
252 # Build using PIC by default
256 # No sense in profiling tools
258 NO_PROFILE_GUIDED_OPTIMIZE
= 1
261 # Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
262 # and we don't have the same build logic to re-link them in the second pass.
263 ifdef SIMPLE_PROGRAMS
264 NO_PROFILE_GUIDED_OPTIMIZE
= 1
267 # No sense in profiling unit tests
269 NO_PROFILE_GUIDED_OPTIMIZE
= 1
272 # Enable profile-based feedback
273 ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE
))
274 ifdef MOZ_PROFILE_GENERATE
275 OS_CFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_GEN_CFLAGS
))
276 OS_CXXFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_GEN_CFLAGS
))
277 OS_LDFLAGS
+= $(PROFILE_GEN_LDFLAGS
)
278 ifeq (WINNT
,$(OS_ARCH
))
281 endif # MOZ_PROFILE_GENERATE
283 ifdef MOZ_PROFILE_USE
284 OS_CFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_USE_CFLAGS
))
285 OS_CXXFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_USE_CFLAGS
))
286 OS_LDFLAGS
+= $(PROFILE_USE_LDFLAGS
)
287 ifeq (WINNT
,$(OS_ARCH
))
290 endif # MOZ_PROFILE_USE
291 endif # NO_PROFILE_GUIDED_OPTIMIZE
295 -f
$(MOZ_CHROME_FILE_FORMAT
) \
298 ifdef USE_EXTENSION_MANIFEST
299 MAKE_JARS_FLAGS
+= -e
302 TAR_CREATE_FLAGS
= -chf
305 # Personal makefile customizations go in these optional make include files.
307 MY_CONFIG
:= $(DEPTH
)/config
/myconfig.mk
308 MY_RULES
:= $(DEPTH
)/config
/myrules.mk
311 # Default command macros; can be overridden in <arch>.mk.
316 JAVA_GEN_DIR
= _javagen
317 JAVA_DIST_DIR
= $(DEPTH
)/$(JAVA_GEN_DIR
)
318 JAVA_IFACES_PKG_NAME
= org
/mozilla
/interfaces
328 # NSPR_CFLAGS and NSS_CFLAGS must appear ahead of the other flags to avoid Linux
329 # builds wrongly picking up system NSPR/NSS header files.
331 $(if
$(LIBXUL_SDK
),-I
$(LIBXUL_SDK
)/include) \
332 $(NSPR_CFLAGS
) $(NSS_CFLAGS
) \
336 $(MOZ_PIXMAN_CFLAGS
) \
340 include $(MOZILLA_DIR
)/config
/static-checking-config.mk
342 CFLAGS
= $(OS_CPPFLAGS
) $(OS_CFLAGS
)
343 CXXFLAGS
= $(OS_CPPFLAGS
) $(OS_CXXFLAGS
)
344 LDFLAGS
= $(OS_LDFLAGS
) $(MOZBUILD_LDFLAGS
) $(MOZ_FIX_LINK_PATHS
)
346 # Allow each module to override the *default* optimization settings
347 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
348 # arguments to --enable-optimize
350 ifeq (1,$(MOZ_OPTIMIZE
))
351 ifdef MODULE_OPTIMIZE_FLAGS
352 CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
353 CXXFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
355 ifneq (,$(if
$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
),$(MOZ_PGO_OPTIMIZE_FLAGS
)))
356 CFLAGS
+= $(MOZ_PGO_OPTIMIZE_FLAGS
)
357 CXXFLAGS
+= $(MOZ_PGO_OPTIMIZE_FLAGS
)
359 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
360 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
361 endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
362 endif # MODULE_OPTIMIZE_FLAGS
364 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
365 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
366 endif # MOZ_OPTIMIZE == 1
367 LDFLAGS
+= $(MOZ_OPTIMIZE_LDFLAGS
)
371 HOST_CFLAGS
+= $(HOST_OPTIMIZE_FLAGS
)
374 ifeq (1,$(MOZ_OPTIMIZE
))
375 ifdef MODULE_OPTIMIZE_FLAGS
376 HOST_CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
378 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
379 endif # MODULE_OPTIMIZE_FLAGS
381 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
382 endif # MOZ_OPTIMIZE == 1
384 endif # CROSS_COMPILE
386 CFLAGS
+= $(MOZ_FRAMEPTR_FLAGS
)
387 CXXFLAGS
+= $(MOZ_FRAMEPTR_FLAGS
)
389 # Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
390 # to request that we use the 'warnings as errors' compile flags)
392 # NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
393 # build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
394 # situation. (See bug 437002.)
395 ifeq (WINNT_1
,$(OS_ARCH
)_
$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
396 FAIL_ON_WARNINGS_DEBUG
=
398 endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
400 # Now, check for debug version of flag; it turns on normal flag in debug builds.
401 ifdef FAIL_ON_WARNINGS_DEBUG
405 endif # FAIL_ON_WARNINGS_DEBUG
407 # Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
408 ifdef FAIL_ON_WARNINGS
409 # Never treat warnings as errors in clang-cl, because it warns about many more
410 # things than MSVC does.
412 CXXFLAGS
+= $(WARNINGS_AS_ERRORS
)
413 CFLAGS
+= $(WARNINGS_AS_ERRORS
)
415 endif # FAIL_ON_WARNINGS
417 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
418 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
419 #// DLL version of the RTL is used...
421 #//------------------------------------------------------------------------
422 ifdef USE_STATIC_LIBS
423 RTL_FLAGS
=-MT
# Statically linked multithreaded RTL
425 ifndef MOZ_NO_DEBUG_RTL
426 RTL_FLAGS
=-MTd
# Statically linked multithreaded MSVC4.0 debug RTL
430 else # !USE_STATIC_LIBS
432 RTL_FLAGS
=-MD
# Dynamically linked, multithreaded RTL
434 ifndef MOZ_NO_DEBUG_RTL
435 RTL_FLAGS
=-MDd
# Dynamically linked, multithreaded MSVC4.0 debug RTL
438 endif # USE_STATIC_LIBS
439 endif # WINNT && !GNU_CC
441 ifeq ($(OS_ARCH
),Darwin
)
442 # Compiling ObjC requires an Apple compiler anyway, so it's ok to set
444 HOST_CMFLAGS
+= -fobjc-exceptions
445 HOST_CMMFLAGS
+= -fobjc-exceptions
446 OS_COMPILE_CMFLAGS
+= -fobjc-exceptions
447 OS_COMPILE_CMMFLAGS
+= -fobjc-exceptions
448 ifeq ($(MOZ_WIDGET_TOOLKIT
),uikit
)
449 OS_COMPILE_CMFLAGS
+= -fobjc-abi-version
=2 -fobjc-legacy-dispatch
450 OS_COMPILE_CMMFLAGS
+= -fobjc-abi-version
=2 -fobjc-legacy-dispatch
454 COMPILE_CFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(OS_INCLUDES
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(RTL_FLAGS
) $(OS_CPPFLAGS
) $(OS_COMPILE_CFLAGS
) $(CFLAGS
) $(MOZBUILD_CFLAGS
) $(EXTRA_COMPILE_FLAGS
)
455 COMPILE_CXXFLAGS
= $(if
$(DISABLE_STL_WRAPPING
),,$(STL_FLAGS
)) $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(OS_INCLUDES
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(RTL_FLAGS
) $(OS_CPPFLAGS
) $(OS_COMPILE_CXXFLAGS
) $(CXXFLAGS
) $(MOZBUILD_CXXFLAGS
) $(EXTRA_COMPILE_FLAGS
)
456 COMPILE_CMFLAGS
= $(OS_COMPILE_CMFLAGS
) $(MOZBUILD_CMFLAGS
) $(EXTRA_COMPILE_FLAGS
)
457 COMPILE_CMMFLAGS
= $(OS_COMPILE_CMMFLAGS
) $(MOZBUILD_CMMFLAGS
) $(EXTRA_COMPILE_FLAGS
)
458 ASFLAGS
+= $(EXTRA_ASSEMBLER_FLAGS
)
461 HOST_CFLAGS
+= $(RTL_FLAGS
)
465 # Name of the binary code directories
469 # Default location of include files
471 IDL_PARSER_DIR
= $(topsrcdir
)/xpcom
/idl-parser
472 IDL_PARSER_CACHE_DIR
= $(DEPTH
)/xpcom
/idl-parser
474 IDL_PARSER_DIR
= $(LIBXUL_SDK
)/sdk
/bin
475 IDL_PARSER_CACHE_DIR
= $(LIBXUL_SDK
)/sdk
/bin
478 SDK_LIB_DIR
= $(DIST
)/sdk
/lib
479 SDK_BIN_DIR
= $(DIST
)/sdk
/bin
483 ifdef MACOSX_DEPLOYMENT_TARGET
484 export MACOSX_DEPLOYMENT_TARGET
485 endif # MACOSX_DEPLOYMENT_TARGET
487 ifdef MOZ_USING_CCACHE
493 # Set link flags according to whether we want a console.
494 ifeq ($(OS_ARCH
),WINNT
)
496 ifeq ($(MOZ_WINCONSOLE
),1)
497 WIN32_EXE_LDFLAGS
+= $(WIN32_CONSOLE_EXE_LDFLAGS
)
498 else # MOZ_WINCONSOLE
499 WIN32_EXE_LDFLAGS
+= $(WIN32_GUI_EXE_LDFLAGS
)
502 # For setting subsystem version
503 WIN32_EXE_LDFLAGS
+= $(WIN32_CONSOLE_EXE_LDFLAGS
)
508 ifeq ($(CPU_ARCH
),x86_64
)
509 # set stack to 2MB on x64 build. See bug 582910
510 WIN32_EXE_LDFLAGS
+= -STACK
:2097152
515 # Include any personal overrides the user might think are needed.
517 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-config.mk
518 -include $(MY_CONFIG
)
520 ######################################################################
522 GARBAGE
+= $(DEPENDENCIES
) core
$(wildcard core.
[0-9]*) $(wildcard *.err
) $(wildcard *.pure
) $(wildcard *_pure_
*.o
) Templates.DB
524 ifeq ($(OS_ARCH
),Darwin
)
526 NSDISTMODE
=absolute_symlink
531 NSINSTALL_PY
:= $(PYTHON
) $(abspath
$(MOZILLA_DIR
)/config
/nsinstall.py
)
532 # For Pymake, wherever we use nsinstall.py we're also going to try to make it
533 # a native command where possible. Since native commands can't be used outside
534 # of single-line commands, we continue to provide INSTALL for general use.
535 # Single-line commands should be switched over to install_cmd.
536 NSINSTALL_NATIVECMD
:= %nsinstall nsinstall
539 NSINSTALL
= $(NSINSTALL_BIN
)
541 ifeq ($(HOST_OS_ARCH
),WINNT
)
542 NSINSTALL
= $(NSINSTALL_PY
)
544 NSINSTALL
= $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
)
546 endif # NSINSTALL_BIN
549 ifeq (,$(CROSS_COMPILE
)$(filter-out WINNT
, $(OS_ARCH
)))
550 INSTALL
= $(NSINSTALL
) -t
554 # This isn't laid out as conditional directives so that NSDISTMODE can be
556 INSTALL
= $(if
$(filter copy
, $(NSDISTMODE
)), $(NSINSTALL
) -t
, $(if
$(filter absolute_symlink
, $(NSDISTMODE
)), $(NSINSTALL
) -L
$(PWD
), $(NSINSTALL
) -R
))
560 # The default for install_cmd is simply INSTALL
561 install_cmd ?
= $(INSTALL
) $(1)
563 # Use nsinstall in copy mode to install files on the system
564 SYSINSTALL
= $(NSINSTALL
) -t
565 # This isn't necessarily true, just here
566 sysinstall_cmd
= install_cmd
569 # Localization build automation
572 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
573 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
574 # overridden by the command line. (Besides, AB_CD is prettier).
575 AB_CD
= $(MOZ_UI_LOCALE
)
576 # Many locales directories want this definition.
577 DEFINES
+= -DAB_CD
=$(AB_CD
)
580 L10NBASEDIR
= $(error L10NBASEDIR not defined by configure
)
582 IS_LANGUAGE_REPACK
= 1
585 EXPAND_LOCALE_SRCDIR
= $(if
$(filter en-US
,$(AB_CD
)),$(topsrcdir
)/$(1)/en-US
,$(or
$(realpath
$(L10NBASEDIR
)),$(abspath
$(L10NBASEDIR
)))/$(AB_CD
)/$(subst /locales
,,$(1)))
588 LOCALE_SRCDIR ?
= $(call EXPAND_LOCALE_SRCDIR
,$(relativesrcdir
))
592 MAKE_JARS_FLAGS
+= --relativesrcdir
=$(relativesrcdir
)
593 ifneq (en-US
,$(AB_CD
))
594 ifdef LOCALE_MERGEDIR
595 MAKE_JARS_FLAGS
+= --locale-mergedir
=$(LOCALE_MERGEDIR
)
597 ifdef IS_LANGUAGE_REPACK
598 MAKE_JARS_FLAGS
+= --l10n-base
=$(L10NBASEDIR
)/$(AB_CD
)
601 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
604 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
605 endif # ! relativesrcdir
607 ifdef LOCALE_MERGEDIR
608 MERGE_FILE
= $(firstword \
609 $(wildcard $(LOCALE_MERGEDIR
)/$(subst /locales
,,$(relativesrcdir
))/$(1)) \
610 $(wildcard $(LOCALE_SRCDIR
)/$(1)) \
611 $(srcdir)/en-US
/$(1) )
613 MERGE_FILE
= $(LOCALE_SRCDIR
)/$(1)
615 MERGE_FILES
= $(foreach f
,$(1),$(call MERGE_FILE
,$(f
)))
617 # These marcros are similar to MERGE_FILE, but no merging, and en-US first.
618 # They're used for searchplugins, for example.
619 EN_US_OR_L10N_FILE
= $(firstword \
620 $(wildcard $(srcdir)/en-US
/$(1)) \
621 $(LOCALE_SRCDIR
)/$(1) )
622 EN_US_OR_L10N_FILES
= $(foreach f
,$(1),$(call EN_US_OR_L10N_FILE
,$(f
)))
624 ifneq (WINNT
,$(OS_ARCH
))
625 RUN_TEST_PROGRAM
= $(LIBXUL_DIST
)/bin
/run-mozilla.sh
632 # Make sure any compiled classes work with at least JVM 1.4
633 JAVAC_FLAGS
+= -source
1.4
639 CREATE_PRECOMPLETE_CMD
= $(PYTHON
) $(abspath
$(MOZILLA_DIR
)/config
/createprecomplete.py
)
641 # MDDEPDIR is the subdirectory where dependency files are stored
644 EXPAND_LIBS_EXEC
= $(PYTHON
) $(MOZILLA_DIR
)/config
/expandlibs_exec.py
645 EXPAND_LIBS_GEN
= $(PYTHON
) $(MOZILLA_DIR
)/config
/expandlibs_gen.py
646 EXPAND_AR
= $(EXPAND_LIBS_EXEC
) --extract
-- $(AR
)
647 EXPAND_CC
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(CC
)
648 EXPAND_CCC
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(CCC
)
649 EXPAND_LD
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(LD
)
650 EXPAND_MKSHLIB_ARGS
= --uselist
652 EXPAND_MKSHLIB_ARGS
+= --symbol-order
$(SYMBOL_ORDER
)
654 EXPAND_MKSHLIB
= $(EXPAND_LIBS_EXEC
) $(EXPAND_MKSHLIB_ARGS
) -- $(MKSHLIB
)
656 ifneq (,$(MOZ_LIBSTDCXX_TARGET_VERSION
)$(MOZ_LIBSTDCXX_HOST_VERSION
))
657 ifneq ($(OS_ARCH
),Darwin
)
658 CHECK_STDCXX
= @
$(TOOLCHAIN_PREFIX
)objdump
-p
$(1) | grep
-v
-e
'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev
/null ||
( echo
'TEST-UNEXPECTED-FAIL | check_stdcxx | We do not want these libstdc++ symbols to be used:' && $(TOOLCHAIN_PREFIX
)objdump
-T
$(1) | grep
-e
'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && false
)
662 ifeq (,$(filter $(OS_TARGET
),WINNT Darwin
))
663 CHECK_TEXTREL
= @
$(TOOLCHAIN_PREFIX
)readelf
-d
$(1) | grep TEXTREL
> /dev
/null
&& echo
'TEST-UNEXPECTED-FAIL | check_textrel | We do not want text relocations in libraries and programs' || true
666 ifeq ($(MOZ_WIDGET_TOOLKIT
),android
)
667 # While this is very unlikely (libc being added by the compiler at the end
668 # of the linker command line), if libmozglue.so ends up after libc.so, all
669 # hell breaks loose, so better safe than sorry, and check it's actually the
671 CHECK_MOZGLUE_ORDER
= @
$(TOOLCHAIN_PREFIX
)readelf
-d
$(1) | grep NEEDED | awk
'{ libs[$$NF] = ++n } END { if (libs["[libmozglue.so]"] && libs["[libc.so]"] < libs["[libmozglue.so]"]) { print "libmozglue.so must be linked before libc.so"; exit 1 } }'
675 $(call CHECK_STDCXX
,$(1))
676 $(call CHECK_TEXTREL
,$(1))
677 $(call LOCAL_CHECKS
,$(1))
678 $(call CHECK_MOZGLUE_ORDER
,$(1))
681 # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
683 OBJ_SUFFIX
:= $(_OBJ_SUFFIX
)
685 # PGO builds with GCC build objects with instrumentation in a first pass,
686 # then objects optimized, without instrumentation, in a second pass. If
687 # we overwrite the objects from the first pass with those from the second,
688 # we end up not getting instrumentation data for better optimization on
689 # incremental builds. As a consequence, we use a different object suffix
690 # for the first pass.
691 ifndef NO_PROFILE_GUIDED_OPTIMIZE
692 ifdef MOZ_PROFILE_GENERATE
699 PLY_INCLUDE
= -I
$(MOZILLA_DIR
)/other-licenses
/ply
701 export CL_INCLUDES_PREFIX
702 # Make sure that the build system can handle non-ASCII characters
703 # in environment variables to prevent it from breking silently on
704 # non-English systems.
707 DEFINES
+= -DNO_NSPR_10_SUPPORT
709 # Freeze the values specified by moz.build to catch them if they fail.
710 $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
) $(_DEPRECATED_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))