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 $(topsrcdir
)/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 win_srcdir
:= $(subst $(topsrcdir
),$(WIN_TOP_SRC
),$(srcdir))
126 BUILD_TOOLS
= $(WIN_TOP_SRC
)/build
/unix
128 win_srcdir
:= $(srcdir)
129 BUILD_TOOLS
= $(topsrcdir
)/build
/unix
132 CONFIG_TOOLS
= $(MOZ_BUILD_ROOT
)/config
133 AUTOCONF_TOOLS
= $(topsrcdir
)/build
/autoconf
136 # Strip off the excessively long version numbers on these platforms,
137 # but save the version to allow multiple versions of the same base
138 # platform to be built in the same tree.
140 ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD SunOS
,$(OS_ARCH
)))
141 OS_RELEASE
:= $(basename $(OS_RELEASE
))
143 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
144 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
145 OS_VERS
:= $(suffix $(OS_RELEASE
))
146 OS_VERSION
:= $(shell echo
$(OS_VERS
) | sed
's/-.*//')
151 OS_CONFIG
:= $(OS_ARCH
)$(OS_RELEASE
)
154 CC_WRAPPER ?
= $(call py_action
,cl
)
155 CXX_WRAPPER ?
= $(call py_action
,cl
)
158 CC
:= $(CC_WRAPPER
) $(CC
)
159 CXX
:= $(CXX_WRAPPER
) $(CXX
)
164 PYTHON_PATH
= $(PYTHON
) $(topsrcdir
)/config
/pythonpath.py
166 # determine debug-related options
172 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
173 XULPPFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
175 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
176 XULPPFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
179 ifneq (,$(MOZ_DEBUG
)$(MOZ_DEBUG_SYMBOLS
))
181 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
182 _DEBUG_ASFLAGS
+= -g cv8
184 ifneq ($(OS_ARCH
),Darwin
)
185 _DEBUG_ASFLAGS
+= -g dwarf2
189 _DEBUG_ASFLAGS
+= $(MOZ_DEBUG_FLAGS
)
191 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
192 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
195 ASFLAGS
+= $(_DEBUG_ASFLAGS
)
196 OS_CFLAGS
+= $(_DEBUG_CFLAGS
)
197 OS_CXXFLAGS
+= $(_DEBUG_CFLAGS
)
198 OS_LDFLAGS
+= $(_DEBUG_LDFLAGS
)
200 # XXX: What does this? Bug 482434 filed for better explanation.
201 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
203 ifneq (,$(MOZ_BROWSE_INFO
)$(MOZ_BSCFILE
))
209 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
210 # Used for generating an optimized build with debugging symbols.
211 # Used in the Windows nightlies to generate symbols for crash reporting.
212 ifdef MOZ_DEBUG_SYMBOLS
213 OS_CXXFLAGS
+= -UDEBUG
-DNDEBUG
214 OS_CFLAGS
+= -UDEBUG
-DNDEBUG
215 ifdef HAVE_64BIT_BUILD
216 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
,ICF
218 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
223 # Handle trace-malloc and DMD in optimized builds.
224 # No opt to give sane callstacks.
226 ifneq (,$(NS_TRACE_MALLOC
)$(MOZ_DMD
))
227 MOZ_OPTIMIZE_FLAGS
=-Zi
-Od
-UDEBUG
-DNDEBUG
228 ifdef HAVE_64BIT_BUILD
229 OS_LDFLAGS
= -DEBUG
-OPT
:REF
,ICF
231 OS_LDFLAGS
= -DEBUG
-OPT
:REF
233 endif # NS_TRACE_MALLOC || MOZ_DMD
237 # We don't build a static CRT when building a custom CRT,
238 # it appears to be broken. So don't link to jemalloc if
239 # the Makefile wants static CRT linking.
240 ifeq ($(MOZ_MEMORY
)_
$(USE_STATIC_LIBS
),1_1
)
241 # Disable default CRT libs and add the right lib path for the linker
245 endif # WINNT && !GNU_CC
247 ifdef MOZ_GLUE_PROGRAM_LDFLAGS
248 DEFINES
+= -DMOZ_GLUE_IN_PROGRAM
250 MOZ_GLUE_PROGRAM_LDFLAGS
=$(MOZ_GLUE_LDFLAGS
)
254 # Build using PIC by default
258 # Determine if module being compiled is destined
259 # to be merged into libxul
261 ifneq (,$(filter xul xul-
%,$(FINAL_LIBRARY
) $(LIBRARY_NAME
)))
267 $(error IS_COMPONENT is set
, but is not compatible with LIBXUL_LIBRARY
)
271 # PGO on MSVC is opt-in
273 ifndef MSVC_ENABLE_PGO
274 NO_PROFILE_GUIDED_OPTIMIZE
= 1
278 # No sense in profiling tools
280 NO_PROFILE_GUIDED_OPTIMIZE
= 1
283 # Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
284 # and we don't have the same build logic to re-link them in the second pass.
285 ifdef SIMPLE_PROGRAMS
286 NO_PROFILE_GUIDED_OPTIMIZE
= 1
289 # No sense in profiling unit tests
291 NO_PROFILE_GUIDED_OPTIMIZE
= 1
294 # Enable profile-based feedback
295 ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE
))
296 ifdef MOZ_PROFILE_GENERATE
297 OS_CFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_GEN_CFLAGS
))
298 OS_CXXFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_GEN_CFLAGS
))
299 OS_LDFLAGS
+= $(PROFILE_GEN_LDFLAGS
)
300 ifeq (WINNT
,$(OS_ARCH
))
303 endif # MOZ_PROFILE_GENERATE
305 ifdef MOZ_PROFILE_USE
306 OS_CFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_USE_CFLAGS
))
307 OS_CXXFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_USE_CFLAGS
))
308 OS_LDFLAGS
+= $(PROFILE_USE_LDFLAGS
)
309 ifeq (WINNT
,$(OS_ARCH
))
312 endif # MOZ_PROFILE_USE
313 endif # NO_PROFILE_GUIDED_OPTIMIZE
316 OS_LDFLAGS
+= $(DELAYLOAD_LDFLAGS
)
319 ifneq (,$(LIBXUL_LIBRARY
))
320 DEFINES
+= -DMOZILLA_INTERNAL_API
323 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
324 # building libxul libraries
330 ifndef JS_SHARED_LIBRARY
331 DEFINES
+= -DSTATIC_EXPORTABLE_JS_API
337 -f
$(MOZ_CHROME_FILE_FORMAT
) \
340 ifdef USE_EXTENSION_MANIFEST
341 MAKE_JARS_FLAGS
+= -e
344 TAR_CREATE_FLAGS
= -chf
347 # Personal makefile customizations go in these optional make include files.
349 MY_CONFIG
:= $(DEPTH
)/config
/myconfig.mk
350 MY_RULES
:= $(DEPTH
)/config
/myrules.mk
353 # Default command macros; can be overridden in <arch>.mk.
358 JAVA_GEN_DIR
= _javagen
359 JAVA_DIST_DIR
= $(DEPTH
)/$(JAVA_GEN_DIR
)
360 JAVA_IFACES_PKG_NAME
= org
/mozilla
/interfaces
362 OS_INCLUDES
+= $(MOZ_JPEG_CFLAGS
) $(MOZ_PNG_CFLAGS
) $(MOZ_ZLIB_CFLAGS
) $(MOZ_PIXMAN_CFLAGS
)
364 # NSPR_CFLAGS and NSS_CFLAGS must appear ahead of OS_INCLUDES to avoid Linux
365 # builds wrongly picking up system NSPR/NSS header files.
371 $(if
$(LIBXUL_SDK
),-I
$(LIBXUL_SDK
)/include) \
372 $(NSPR_CFLAGS
) $(NSS_CFLAGS
) \
376 include $(topsrcdir
)/config
/static-checking-config.mk
378 CFLAGS
= $(OS_CPPFLAGS
) $(OS_CFLAGS
)
379 CXXFLAGS
= $(OS_CPPFLAGS
) $(OS_CXXFLAGS
)
380 LDFLAGS
= $(OS_LDFLAGS
) $(MOZBUILD_LDFLAGS
) $(MOZ_FIX_LINK_PATHS
)
382 # Allow each module to override the *default* optimization settings
383 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
384 # arguments to --enable-optimize
386 ifeq (1,$(MOZ_OPTIMIZE
))
387 ifdef MODULE_OPTIMIZE_FLAGS
388 CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
389 CXXFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
391 ifneq (,$(if
$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
),$(MOZ_PGO_OPTIMIZE_FLAGS
)))
392 CFLAGS
+= $(MOZ_PGO_OPTIMIZE_FLAGS
)
393 CXXFLAGS
+= $(MOZ_PGO_OPTIMIZE_FLAGS
)
395 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
396 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
397 endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
398 endif # MODULE_OPTIMIZE_FLAGS
400 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
401 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
402 endif # MOZ_OPTIMIZE == 1
403 LDFLAGS
+= $(MOZ_OPTIMIZE_LDFLAGS
)
407 HOST_CFLAGS
+= $(HOST_OPTIMIZE_FLAGS
)
410 ifeq (1,$(MOZ_OPTIMIZE
))
411 ifdef MODULE_OPTIMIZE_FLAGS
412 HOST_CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
414 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
415 endif # MODULE_OPTIMIZE_FLAGS
417 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
418 endif # MOZ_OPTIMIZE == 1
420 endif # CROSS_COMPILE
422 CFLAGS
+= $(MOZ_FRAMEPTR_FLAGS
)
423 CXXFLAGS
+= $(MOZ_FRAMEPTR_FLAGS
)
425 # Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
426 # to request that we use the 'warnings as errors' compile flags)
428 # NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
429 # build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
430 # situation. (See bug 437002.)
431 ifeq (WINNT_1
,$(OS_ARCH
)_
$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
432 FAIL_ON_WARNINGS_DEBUG
=
434 endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
436 # Now, check for debug version of flag; it turns on normal flag in debug builds.
437 ifdef FAIL_ON_WARNINGS_DEBUG
441 endif # FAIL_ON_WARNINGS_DEBUG
443 # Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
444 ifdef FAIL_ON_WARNINGS
445 CXXFLAGS
+= $(WARNINGS_AS_ERRORS
)
446 CFLAGS
+= $(WARNINGS_AS_ERRORS
)
447 endif # FAIL_ON_WARNINGS
449 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
450 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
451 #// DLL version of the RTL is used...
453 #//------------------------------------------------------------------------
454 ifdef USE_STATIC_LIBS
455 RTL_FLAGS
=-MT
# Statically linked multithreaded RTL
456 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
))
457 ifndef MOZ_NO_DEBUG_RTL
458 RTL_FLAGS
=-MTd
# Statically linked multithreaded MSVC4.0 debug RTL
460 endif # MOZ_DEBUG || NS_TRACE_MALLOC
462 else # !USE_STATIC_LIBS
464 RTL_FLAGS
=-MD
# Dynamically linked, multithreaded RTL
465 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
))
466 ifndef MOZ_NO_DEBUG_RTL
467 RTL_FLAGS
=-MDd
# Dynamically linked, multithreaded MSVC4.0 debug RTL
469 endif # MOZ_DEBUG || NS_TRACE_MALLOC
470 endif # USE_STATIC_LIBS
471 endif # WINNT && !GNU_CC
473 ifeq ($(OS_ARCH
),Darwin
)
474 # Compiling ObjC requires an Apple compiler anyway, so it's ok to set
476 HOST_CMFLAGS
+= -fobjc-exceptions
477 HOST_CMMFLAGS
+= -fobjc-exceptions
478 OS_COMPILE_CMFLAGS
+= -fobjc-exceptions
479 OS_COMPILE_CMMFLAGS
+= -fobjc-exceptions
480 ifeq ($(MOZ_WIDGET_TOOLKIT
),uikit
)
481 OS_COMPILE_CMFLAGS
+= -fobjc-abi-version
=2 -fobjc-legacy-dispatch
482 OS_COMPILE_CMMFLAGS
+= -fobjc-abi-version
=2 -fobjc-legacy-dispatch
486 COMPILE_CFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(RTL_FLAGS
) $(OS_CPPFLAGS
) $(OS_COMPILE_CFLAGS
) $(CFLAGS
) $(MOZBUILD_CFLAGS
) $(EXTRA_COMPILE_FLAGS
)
487 COMPILE_CXXFLAGS
= $(if
$(DISABLE_STL_WRAPPING
),,$(STL_FLAGS
)) $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(RTL_FLAGS
) $(OS_CPPFLAGS
) $(OS_COMPILE_CXXFLAGS
) $(CXXFLAGS
) $(MOZBUILD_CXXFLAGS
) $(EXTRA_COMPILE_FLAGS
)
488 COMPILE_CMFLAGS
= $(OS_COMPILE_CMFLAGS
) $(MOZBUILD_CMFLAGS
) $(EXTRA_COMPILE_FLAGS
)
489 COMPILE_CMMFLAGS
= $(OS_COMPILE_CMMFLAGS
) $(MOZBUILD_CMMFLAGS
) $(EXTRA_COMPILE_FLAGS
)
490 ASFLAGS
+= $(EXTRA_ASSEMBLER_FLAGS
)
493 HOST_CFLAGS
+= $(RTL_FLAGS
)
497 # Name of the binary code directories
501 # Default location of include files
503 IDL_PARSER_DIR
= $(topsrcdir
)/xpcom
/idl-parser
504 IDL_PARSER_CACHE_DIR
= $(DEPTH
)/xpcom
/idl-parser
506 IDL_PARSER_DIR
= $(LIBXUL_SDK
)/sdk
/bin
507 IDL_PARSER_CACHE_DIR
= $(LIBXUL_SDK
)/sdk
/bin
510 SDK_LIB_DIR
= $(DIST
)/sdk
/lib
511 SDK_BIN_DIR
= $(DIST
)/sdk
/bin
515 ifdef MACOSX_DEPLOYMENT_TARGET
516 export MACOSX_DEPLOYMENT_TARGET
517 endif # MACOSX_DEPLOYMENT_TARGET
519 ifdef MOZ_USING_CCACHE
525 # Set link flags according to whether we want a console.
526 ifeq ($(OS_ARCH
),WINNT
)
528 ifeq ($(MOZ_WINCONSOLE
),1)
529 WIN32_EXE_LDFLAGS
+= $(WIN32_CONSOLE_EXE_LDFLAGS
)
530 else # MOZ_WINCONSOLE
531 WIN32_EXE_LDFLAGS
+= $(WIN32_GUI_EXE_LDFLAGS
)
534 # For setting subsystem version
535 WIN32_EXE_LDFLAGS
+= $(WIN32_CONSOLE_EXE_LDFLAGS
)
540 ifeq ($(CPU_ARCH
),x86_64
)
541 # set stack to 2MB on x64 build. See bug 582910
542 WIN32_EXE_LDFLAGS
+= -STACK
:2097152
546 # If we're building a component on MSVC, we don't want to generate an
547 # import lib, because that import lib will collide with the name of a
548 # static version of the same library.
549 ifeq ($(GNU_LD
)$(OS_ARCH
),WINNT
)
551 LDFLAGS
+= -IMPLIB
:fake.lib
552 DELETE_AFTER_LINK
= fake.lib fake.exp
557 # Include any personal overrides the user might think are needed.
559 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-config.mk
560 -include $(MY_CONFIG
)
562 ######################################################################
564 GARBAGE
+= $(DEPENDENCIES
) core
$(wildcard core.
[0-9]*) $(wildcard *.err
) $(wildcard *.pure
) $(wildcard *_pure_
*.o
) Templates.DB
566 ifeq ($(OS_ARCH
),Darwin
)
568 NSDISTMODE
=absolute_symlink
573 NSINSTALL_PY
:= $(PYTHON
) $(abspath
$(topsrcdir
)/config
/nsinstall.py
)
574 # For Pymake, wherever we use nsinstall.py we're also going to try to make it
575 # a native command where possible. Since native commands can't be used outside
576 # of single-line commands, we continue to provide INSTALL for general use.
577 # Single-line commands should be switched over to install_cmd.
578 NSINSTALL_NATIVECMD
:= %nsinstall nsinstall
581 NSINSTALL
= $(NSINSTALL_BIN
)
583 ifeq ($(HOST_OS_ARCH
),WINNT
)
584 NSINSTALL
= $(NSINSTALL_PY
)
586 NSINSTALL
= $(DEPTH
)/config
/nsinstall
$(HOST_BIN_SUFFIX
)
588 endif # NSINSTALL_BIN
591 ifeq (,$(CROSS_COMPILE
)$(filter-out WINNT
, $(OS_ARCH
)))
592 INSTALL
= $(NSINSTALL
) -t
596 # This isn't laid out as conditional directives so that NSDISTMODE can be
598 INSTALL
= $(if
$(filter copy
, $(NSDISTMODE
)), $(NSINSTALL
) -t
, $(if
$(filter absolute_symlink
, $(NSDISTMODE
)), $(NSINSTALL
) -L
$(PWD
), $(NSINSTALL
) -R
))
602 # The default for install_cmd is simply INSTALL
603 install_cmd ?
= $(INSTALL
) $(1)
605 # Use nsinstall in copy mode to install files on the system
606 SYSINSTALL
= $(NSINSTALL
) -t
607 # This isn't necessarily true, just here
608 sysinstall_cmd
= install_cmd
611 # Localization build automation
614 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
615 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
616 # overridden by the command line. (Besides, AB_CD is prettier).
617 AB_CD
= $(MOZ_UI_LOCALE
)
618 # Many locales directories want this definition.
619 DEFINES
+= -DAB_CD
=$(AB_CD
)
622 L10NBASEDIR
= $(error L10NBASEDIR not defined by configure
)
624 IS_LANGUAGE_REPACK
= 1
627 EXPAND_LOCALE_SRCDIR
= $(if
$(filter en-US
,$(AB_CD
)),$(topsrcdir
)/$(1)/en-US
,$(or
$(realpath
$(L10NBASEDIR
)),$(abspath
$(L10NBASEDIR
)))/$(AB_CD
)/$(subst /locales
,,$(1)))
630 LOCALE_SRCDIR ?
= $(call EXPAND_LOCALE_SRCDIR
,$(relativesrcdir
))
634 MAKE_JARS_FLAGS
+= --relativesrcdir
=$(relativesrcdir
)
635 ifneq (en-US
,$(AB_CD
))
636 ifdef LOCALE_MERGEDIR
637 MAKE_JARS_FLAGS
+= --locale-mergedir
=$(LOCALE_MERGEDIR
)
639 ifdef IS_LANGUAGE_REPACK
640 MAKE_JARS_FLAGS
+= --l10n-base
=$(L10NBASEDIR
)/$(AB_CD
)
643 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
646 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
647 endif # ! relativesrcdir
649 ifdef LOCALE_MERGEDIR
650 MERGE_FILE
= $(firstword \
651 $(wildcard $(LOCALE_MERGEDIR
)/$(subst /locales
,,$(relativesrcdir
))/$(1)) \
652 $(wildcard $(LOCALE_SRCDIR
)/$(1)) \
653 $(srcdir)/en-US
/$(1) )
655 MERGE_FILE
= $(LOCALE_SRCDIR
)/$(1)
657 MERGE_FILES
= $(foreach f
,$(1),$(call MERGE_FILE
,$(f
)))
659 ifneq (WINNT
,$(OS_ARCH
))
660 RUN_TEST_PROGRAM
= $(LIBXUL_DIST
)/bin
/run-mozilla.sh
667 # Make sure any compiled classes work with at least JVM 1.4
668 JAVAC_FLAGS
+= -source
1.4
674 CREATE_PRECOMPLETE_CMD
= $(PYTHON
) $(abspath
$(topsrcdir
)/config
/createprecomplete.py
)
676 # MDDEPDIR is the subdirectory where dependency files are stored
679 EXPAND_LIBS_EXEC
= $(PYTHON
) $(topsrcdir
)/config
/expandlibs_exec.py
680 EXPAND_LIBS_GEN
= $(PYTHON
) $(topsrcdir
)/config
/expandlibs_gen.py
681 EXPAND_AR
= $(EXPAND_LIBS_EXEC
) --extract
-- $(AR
)
682 EXPAND_CC
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(CC
)
683 EXPAND_CCC
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(CCC
)
684 EXPAND_LD
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(LD
)
685 EXPAND_MKSHLIB_ARGS
= --uselist
687 EXPAND_MKSHLIB_ARGS
+= --symbol-order
$(SYMBOL_ORDER
)
689 EXPAND_MKSHLIB
= $(EXPAND_LIBS_EXEC
) $(EXPAND_MKSHLIB_ARGS
) -- $(MKSHLIB
)
691 ifneq (,$(MOZ_LIBSTDCXX_TARGET_VERSION
)$(MOZ_LIBSTDCXX_HOST_VERSION
))
692 ifneq ($(OS_ARCH
),Darwin
)
693 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
)
697 ifeq (,$(filter $(OS_TARGET
),WINNT Darwin
))
698 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
702 $(call CHECK_STDCXX
,$(1))
703 $(call CHECK_TEXTREL
,$(1))
704 $(call LOCAL_CHECKS
,$(1))
707 # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
709 OBJ_SUFFIX
:= $(_OBJ_SUFFIX
)
711 # PGO builds with GCC build objects with instrumentation in a first pass,
712 # then objects optimized, without instrumentation, in a second pass. If
713 # we overwrite the objects from the first pass with those from the second,
714 # we end up not getting instrumentation data for better optimization on
715 # incremental builds. As a consequence, we use a different object suffix
716 # for the first pass.
717 ifndef NO_PROFILE_GUIDED_OPTIMIZE
718 ifdef MOZ_PROFILE_GENERATE
725 # EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
726 # expands to $(LIB_PREFIX)foo.$(LIB_SUFFIX) or -lfoo, depending on linker
727 # arguments syntax. Should only be used for system libraries
729 # EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
730 # expands to dir/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
732 # EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
733 # expands to $(DIST)/lib/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
736 EXPAND_LIBNAME
= $(addprefix -l
,$(1))
738 EXPAND_LIBNAME
= $(foreach lib
,$(1),$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
740 EXPAND_LIBNAME_PATH
= $(foreach lib
,$(1),$(2)/$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
741 EXPAND_MOZLIBNAME
= $(foreach lib
,$(1),$(DIST
)/lib
/$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
743 PLY_INCLUDE
= -I
$(topsrcdir
)/other-licenses
/ply
745 export CL_INCLUDES_PREFIX
746 # Make sure that the build system can handle non-ASCII characters
747 # in environment variables to prevent it from breking silently on
748 # non-English systems.
751 DEFINES
+= -DNO_NSPR_10_SUPPORT
755 -I
$(topsrcdir
)/ipc
/chromium
/src \
756 -I
$(topsrcdir
)/ipc
/glue \
757 -I
$(DEPTH
)/ipc
/ipdl
/_ipdlheaders \
760 ifeq (WINNT
,$(OS_TARGET
))
761 # These get set via VC project file settings for normal GYP builds.
762 DEFINES
+= -DUNICODE
-D_UNICODE
765 DISABLE_STL_WRAPPING
:= 1
766 # Skip most Mozilla-specific include locations.
767 INCLUDES
= -I.
$(LOCAL_INCLUDES
) -I
$(DEPTH
)/dist/include
770 # Freeze the values specified by moz.build to catch them if they fail.
771 $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
) $(_DEPRECATED_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))