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 # Integrate with mozbuild-generated make files. We first verify that no
33 # variables provided by the automatically generated .mk files are
34 # present. If they are, this is a violation of the separation of
35 # responsibility between Makefile.in and mozbuild files.
36 _MOZBUILD_EXTERNAL_VARIABLES
:= \
37 ANDROID_GENERATED_RESFILES \
52 HOST_SIMPLE_PROGRAMS \
72 _DEPRECATED_VARIABLES
:= \
74 MOCHITEST_FILES_PARTS \
75 MOCHITEST_BROWSER_FILES_PARTS \
79 ifndef EXTERNALLY_MANAGED_MAKE_FILE
80 # Using $(firstword) may not be perfect. But it should be good enough for most
82 _current_makefile
= $(CURDIR
)/$(firstword $(MAKEFILE_LIST
))
84 $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
),$(if
$(filter file
override,$(subst $(NULL
) ,_
,$(origin $(var
)))),\
85 $(error Variable
$(var
) is defined in
$(_current_makefile
). It should only be defined in moz.build files
),\
88 $(foreach var
,$(_DEPRECATED_VARIABLES
),$(if
$(filter file
override,$(subst $(NULL
) ,_
,$(origin $(var
)))),\
89 $(error Variable
$(var
) is defined in
$(_current_makefile
). This variable has been deprecated. It does nothing. It must be removed in order to build
)\
92 # Import the automatically generated backend file. If this file doesn't exist,
93 # the backend hasn't been properly configured. We want this to be a fatal
94 # error, hence not using "-include".
95 ifndef STANDALONE_MAKEFILE
96 GLOBAL_DEPS
+= backend.mk
100 # Freeze the values specified by moz.build to catch them if they fail.
102 $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
103 $(foreach var
,$(_DEPRECATED_VARIABLES
),$(eval
$(var
)_FROZEN
:= '$($(var))'))
105 CHECK_MOZBUILD_VARIABLES
= $(foreach var
,$(_MOZBUILD_EXTERNAL_VARIABLES
), \
106 $(if
$(subst $($(var
)_FROZEN
),,'$($(var))'), \
107 $(error Variable
$(var
) is defined in
$(_current_makefile
). It should only be defined in moz.build files
),\
108 )) $(foreach var
,$(_DEPRECATED_VARIABLES
), \
109 $(if
$(subst $($(var
)_FROZEN
),,'$($(var))'), \
110 $(error Variable
$(var
) is defined in
$(_current_makefile
). This variable has been deprecated. It does nothing. It must be removed in order to build
),\
115 space
= $(NULL
) $(NULL
)
117 # Include defs.mk files that can be found in $(srcdir)/$(DEPTH),
118 # $(srcdir)/$(DEPTH-1), $(srcdir)/$(DEPTH-2), etc., and $(srcdir)
119 # where $(DEPTH-1) is one level less of depth, $(DEPTH-2), two, etc.
120 # i.e. for DEPTH=../../.., DEPTH-1 is ../.. and DEPTH-2 is ..
121 # These defs.mk files are used to define variables in a directory
122 # and all its subdirectories, recursively.
123 __depth
:= $(subst /, ,$(DEPTH
))
127 $(foreach __d
,$(__depth
) .
,$(eval __depth
= $(wordlist
2,$(words $(__depth
)),$(__depth
))$(eval
-include $(subst $(space
),/,$(strip $(srcdir) $(__depth
) defs.mk
)))))
131 # Sanity check some variables
138 INSTALL_EXTENSION_ID \
139 SHARED_LIBRARY_NAME \
140 STATIC_LIBRARY_NAME \
143 # checks for internal spaces or trailing spaces in the variable
145 check-variable
= $(if
$(filter-out 0 1,$(words $($(x
))z
)),$(error Spaces are not allowed in
$(x
)))
147 $(foreach x
,$(CHECK_VARS
),$(check-variable
))
149 ifndef INCLUDED_FUNCTIONS_MK
150 include $(topsrcdir
)/config
/makefiles
/functions.mk
155 # LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
156 LIBXUL_DIST ?
= $(DIST
)
158 # FINAL_TARGET specifies the location into which we copy end-user-shipped
159 # build products (typelibs, components, chrome). It may already be specified by
162 # If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
163 # instead of $(DIST)/bin. In both cases, if DIST_SUBDIR is set, the files will be
164 # shipped to a $(DIST_SUBDIR) subdirectory.
165 FINAL_TARGET ?
= $(if
$(XPI_NAME
),$(DIST
)/xpi-stage
/$(XPI_NAME
),$(DIST
)/bin
)$(DIST_SUBDIR
:%=/%)
166 # Override the stored value for the check to make sure that the variable is not
167 # redefined in the Makefile.in value.
168 FINAL_TARGET_FROZEN
:= '$(FINAL_TARGET)'
171 DEFINES
+= -DXPI_NAME
=$(XPI_NAME
)
174 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
177 ifeq ($(HOST_OS_ARCH
),WINNT
)
178 win_srcdir
:= $(subst $(topsrcdir
),$(WIN_TOP_SRC
),$(srcdir))
179 BUILD_TOOLS
= $(WIN_TOP_SRC
)/build
/unix
181 win_srcdir
:= $(srcdir)
182 BUILD_TOOLS
= $(topsrcdir
)/build
/unix
185 CONFIG_TOOLS
= $(MOZ_BUILD_ROOT
)/config
186 AUTOCONF_TOOLS
= $(topsrcdir
)/build
/autoconf
188 # Disable MOZ_PSEUDO_DERECURSE when it contains no-pymake and we're running
189 # pymake. This can be removed when no-pymake is removed from the default in
190 # build/autoconf/compiler-opts.m4.
193 ifneq (,$(filter no-pymake
,$(subst $(comma
), ,$(MOZ_PSEUDO_DERECURSE
))))
194 MOZ_PSEUDO_DERECURSE
:=
198 # Disable MOZ_PSEUDO_DERECURSE on PGO builds until it's fixed.
199 ifneq (,$(MOZ_PROFILE_USE
)$(MOZ_PROFILE_GENERATE
))
200 MOZ_PSEUDO_DERECURSE
:=
204 # Strip off the excessively long version numbers on these platforms,
205 # but save the version to allow multiple versions of the same base
206 # platform to be built in the same tree.
208 ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD SunOS
,$(OS_ARCH
)))
209 OS_RELEASE
:= $(basename $(OS_RELEASE
))
211 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
212 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
213 OS_VERS
:= $(suffix $(OS_RELEASE
))
214 OS_VERSION
:= $(shell echo
$(OS_VERS
) | sed
's/-.*//')
219 OS_CONFIG
:= $(OS_ARCH
)$(OS_RELEASE
)
222 CC_WRAPPER ?
= $(call py_action
,cl
)
223 CXX_WRAPPER ?
= $(call py_action
,cl
)
226 CC
:= $(CC_WRAPPER
) $(CC
)
227 CXX
:= $(CXX_WRAPPER
) $(CXX
)
233 PYCOMMANDPATH
+= $(PYTHON_SITE_PACKAGES
)
236 PYTHON_PATH
= $(PYTHON
) $(topsrcdir
)/config
/pythonpath.py
238 # determine debug-related options
244 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
245 XULPPFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
247 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
248 XULPPFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
251 ifneq (,$(MOZ_DEBUG
)$(MOZ_DEBUG_SYMBOLS
))
253 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
254 _DEBUG_ASFLAGS
+= -g cv8
256 ifneq ($(OS_ARCH
),Darwin
)
257 _DEBUG_ASFLAGS
+= -g dwarf2
261 _DEBUG_ASFLAGS
+= $(MOZ_DEBUG_FLAGS
)
263 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
264 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
267 MOZALLOC_LIB
= $(call EXPAND_LIBNAME_PATH
,mozalloc
,$(DIST
)/lib
)
269 ASFLAGS
+= $(_DEBUG_ASFLAGS
)
270 OS_CFLAGS
+= $(_DEBUG_CFLAGS
)
271 OS_CXXFLAGS
+= $(_DEBUG_CFLAGS
)
272 OS_LDFLAGS
+= $(_DEBUG_LDFLAGS
)
274 # XXX: What does this? Bug 482434 filed for better explanation.
275 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
277 ifneq (,$(MOZ_BROWSE_INFO
)$(MOZ_BSCFILE
))
283 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
284 # Used for generating an optimized build with debugging symbols.
285 # Used in the Windows nightlies to generate symbols for crash reporting.
286 ifdef MOZ_DEBUG_SYMBOLS
287 OS_CXXFLAGS
+= -UDEBUG
-DNDEBUG
288 OS_CFLAGS
+= -UDEBUG
-DNDEBUG
290 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
,ICF
292 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
297 # Handle trace-malloc and DMD in optimized builds.
298 # No opt to give sane callstacks.
300 ifneq (,$(NS_TRACE_MALLOC
)$(MOZ_DMD
))
301 MOZ_OPTIMIZE_FLAGS
=-Zi
-Od
-UDEBUG
-DNDEBUG
303 OS_LDFLAGS
= -DEBUG
-OPT
:REF
,ICF
305 OS_LDFLAGS
= -DEBUG
-OPT
:REF
307 endif # NS_TRACE_MALLOC || MOZ_DMD
311 # We don't build a static CRT when building a custom CRT,
312 # it appears to be broken. So don't link to jemalloc if
313 # the Makefile wants static CRT linking.
314 ifeq ($(MOZ_MEMORY
)_
$(USE_STATIC_LIBS
),1_1
)
315 # Disable default CRT libs and add the right lib path for the linker
319 endif # WINNT && !GNU_CC
321 ifdef MOZ_GLUE_PROGRAM_LDFLAGS
322 DEFINES
+= -DMOZ_GLUE_IN_PROGRAM
324 MOZ_GLUE_PROGRAM_LDFLAGS
=$(MOZ_GLUE_LDFLAGS
)
328 # Build using PIC by default
332 # Determine if module being compiled is destined
333 # to be merged into libxul
335 ifeq ($(FINAL_LIBRARY
),xul
)
337 $(error FINAL_LIBRARY is
"xul", LIBXUL_LIBRARY is implied
)
344 $(error IS_COMPONENT is set
, but is not compatible with LIBXUL_LIBRARY
)
349 # If we are building this component into an extension/xulapp, it cannot be
350 # statically linked. In the future we may want to add a xulapp meta-component
361 ifndef SHARED_LIBRARY_NAME
363 SHARED_LIBRARY_NAME
=$(LIBRARY_NAME
)
367 ifndef STATIC_LIBRARY_NAME
369 STATIC_LIBRARY_NAME
=$(LIBRARY_NAME
)
373 # PGO on MSVC is opt-in
375 ifndef MSVC_ENABLE_PGO
376 NO_PROFILE_GUIDED_OPTIMIZE
= 1
380 # No sense in profiling tools
382 NO_PROFILE_GUIDED_OPTIMIZE
= 1
385 # Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
386 # and we don't have the same build logic to re-link them in the second pass.
387 ifdef SIMPLE_PROGRAMS
388 NO_PROFILE_GUIDED_OPTIMIZE
= 1
391 # No sense in profiling unit tests
393 NO_PROFILE_GUIDED_OPTIMIZE
= 1
396 # Enable profile-based feedback
397 ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE
))
398 ifdef MOZ_PROFILE_GENERATE
399 OS_CFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_GEN_CFLAGS
))
400 OS_CXXFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_GEN_CFLAGS
))
401 OS_LDFLAGS
+= $(PROFILE_GEN_LDFLAGS
)
402 ifeq (WINNT
,$(OS_ARCH
))
405 endif # MOZ_PROFILE_GENERATE
407 ifdef MOZ_PROFILE_USE
408 OS_CFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_USE_CFLAGS
))
409 OS_CXXFLAGS
+= $(if
$(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE
))),,$(PROFILE_USE_CFLAGS
))
410 OS_LDFLAGS
+= $(PROFILE_USE_LDFLAGS
)
411 ifeq (WINNT
,$(OS_ARCH
))
414 endif # MOZ_PROFILE_USE
415 endif # NO_PROFILE_GUIDED_OPTIMIZE
418 # Does the makefile specifies the internal XPCOM API linkage?
419 ifneq (,$(MOZILLA_INTERNAL_API
)$(LIBXUL_LIBRARY
))
420 DEFINES
+= -DMOZILLA_INTERNAL_API
423 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
424 # building libxul libraries
430 ifndef JS_SHARED_LIBRARY
431 DEFINES
+= -DSTATIC_EXPORTABLE_JS_API
437 -f
$(MOZ_CHROME_FILE_FORMAT
) \
440 ifdef USE_EXTENSION_MANIFEST
441 MAKE_JARS_FLAGS
+= -e
445 MAKE_JARS_FLAGS
+= --both-manifests
448 TAR_CREATE_FLAGS
= -chf
450 ifeq ($(OS_ARCH
),OS2
)
451 TAR_CREATE_FLAGS
= -cf
455 # Personal makefile customizations go in these optional make include files.
457 MY_CONFIG
:= $(DEPTH
)/config
/myconfig.mk
458 MY_RULES
:= $(DEPTH
)/config
/myrules.mk
461 # Default command macros; can be overridden in <arch>.mk.
466 JAVA_GEN_DIR
= _javagen
467 JAVA_DIST_DIR
= $(DEPTH
)/$(JAVA_GEN_DIR
)
468 JAVA_IFACES_PKG_NAME
= org
/mozilla
/interfaces
470 OS_INCLUDES
+= $(MOZ_JPEG_CFLAGS
) $(MOZ_PNG_CFLAGS
) $(MOZ_ZLIB_CFLAGS
)
472 # NSPR_CFLAGS and NSS_CFLAGS must appear ahead of OS_INCLUDES to avoid Linux
473 # builds wrongly picking up system NSPR/NSS header files.
479 $(if
$(LIBXUL_SDK
),-I
$(LIBXUL_SDK
)/include) \
480 $(NSPR_CFLAGS
) $(NSS_CFLAGS
) \
484 include $(topsrcdir
)/config
/static-checking-config.mk
486 CFLAGS
= $(OS_CPPFLAGS
) $(OS_CFLAGS
)
487 CXXFLAGS
= $(OS_CPPFLAGS
) $(OS_CXXFLAGS
)
488 LDFLAGS
= $(OS_LDFLAGS
) $(MOZ_FIX_LINK_PATHS
)
490 # Allow each module to override the *default* optimization settings
491 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
492 # arguments to --enable-optimize
494 ifeq (1,$(MOZ_OPTIMIZE
))
495 ifdef MODULE_OPTIMIZE_FLAGS
496 CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
497 CXXFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
499 ifneq (,$(if
$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
),$(MOZ_PGO_OPTIMIZE_FLAGS
)))
500 CFLAGS
+= $(MOZ_PGO_OPTIMIZE_FLAGS
)
501 CXXFLAGS
+= $(MOZ_PGO_OPTIMIZE_FLAGS
)
503 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
504 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
505 endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
506 endif # MODULE_OPTIMIZE_FLAGS
508 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
509 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
510 endif # MOZ_OPTIMIZE == 1
511 LDFLAGS
+= $(MOZ_OPTIMIZE_LDFLAGS
)
515 HOST_CFLAGS
+= $(HOST_OPTIMIZE_FLAGS
)
518 ifeq (1,$(MOZ_OPTIMIZE
))
519 ifdef MODULE_OPTIMIZE_FLAGS
520 HOST_CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
522 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
523 endif # MODULE_OPTIMIZE_FLAGS
525 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
526 endif # MOZ_OPTIMIZE == 1
528 endif # CROSS_COMPILE
530 CFLAGS
+= $(MOZ_FRAMEPTR_FLAGS
)
531 CXXFLAGS
+= $(MOZ_FRAMEPTR_FLAGS
)
533 # Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
534 # to request that we use the 'warnings as errors' compile flags)
536 # NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
537 # build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
538 # situation. (See bug 437002.)
539 ifeq (WINNT_1
,$(OS_ARCH
)_
$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
540 FAIL_ON_WARNINGS_DEBUG
=
542 endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
544 # Now, check for debug version of flag; it turns on normal flag in debug builds.
545 ifdef FAIL_ON_WARNINGS_DEBUG
549 endif # FAIL_ON_WARNINGS_DEBUG
551 # Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
552 ifdef FAIL_ON_WARNINGS
553 CXXFLAGS
+= $(WARNINGS_AS_ERRORS
)
554 CFLAGS
+= $(WARNINGS_AS_ERRORS
)
555 endif # FAIL_ON_WARNINGS
557 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
558 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
559 #// DLL version of the RTL is used...
561 #//------------------------------------------------------------------------
562 ifdef USE_STATIC_LIBS
563 RTL_FLAGS
=-MT
# Statically linked multithreaded RTL
564 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
)$(MOZ_DMD
))
565 ifndef MOZ_NO_DEBUG_RTL
566 RTL_FLAGS
=-MTd
# Statically linked multithreaded MSVC4.0 debug RTL
568 endif # MOZ_DEBUG || NS_TRACE_MALLOC || MOZ_DMD
570 else # !USE_STATIC_LIBS
572 RTL_FLAGS
=-MD
# Dynamically linked, multithreaded RTL
573 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
)$(MOZ_DMD
))
574 ifndef MOZ_NO_DEBUG_RTL
575 RTL_FLAGS
=-MDd
# Dynamically linked, multithreaded MSVC4.0 debug RTL
577 endif # MOZ_DEBUG || NS_TRACE_MALLOC || MOZ_DMD
578 endif # USE_STATIC_LIBS
579 endif # WINNT && !GNU_CC
581 ifeq ($(OS_ARCH
),Darwin
)
582 # Compiling ObjC requires an Apple compiler anyway, so it's ok to set
584 HOST_CMFLAGS
+= -fobjc-exceptions
585 HOST_CMMFLAGS
+= -fobjc-exceptions
586 OS_COMPILE_CMFLAGS
+= -fobjc-exceptions
587 OS_COMPILE_CMMFLAGS
+= -fobjc-exceptions
588 ifeq ($(MOZ_WIDGET_TOOLKIT
),uikit
)
589 OS_COMPILE_CMFLAGS
+= -fobjc-abi-version
=2 -fobjc-legacy-dispatch
590 OS_COMPILE_CMMFLAGS
+= -fobjc-abi-version
=2 -fobjc-legacy-dispatch
594 COMPILE_CFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(RTL_FLAGS
) $(OS_CPPFLAGS
) $(OS_COMPILE_CFLAGS
) $(CFLAGS
)
595 COMPILE_CXXFLAGS
= $(STL_FLAGS
) $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(RTL_FLAGS
) $(OS_CPPFLAGS
) $(OS_COMPILE_CXXFLAGS
) $(CXXFLAGS
)
596 COMPILE_CMFLAGS
= $(OS_COMPILE_CMFLAGS
)
597 COMPILE_CMMFLAGS
= $(OS_COMPILE_CMMFLAGS
)
600 HOST_CFLAGS
+= $(RTL_FLAGS
)
604 # Name of the binary code directories
608 # We need to know where to find the libraries we
609 # put on the link line for binaries, and should
610 # we link statically or dynamic? Assuming dynamic for now.
612 ifneq (WINNT_
,$(OS_ARCH
)_
$(GNU_CC
))
613 LIBS_DIR
= -L
$(DIST
)/bin
-L
$(DIST
)/lib
615 LIBS_DIR
+= -L
$(LIBXUL_SDK
)/bin
-L
$(LIBXUL_SDK
)/lib
619 # Default location of include files
621 IDL_PARSER_DIR
= $(topsrcdir
)/xpcom
/idl-parser
622 IDL_PARSER_CACHE_DIR
= $(DEPTH
)/xpcom
/idl-parser
624 IDL_PARSER_DIR
= $(LIBXUL_SDK
)/sdk
/bin
625 IDL_PARSER_CACHE_DIR
= $(LIBXUL_SDK
)/sdk
/bin
628 SDK_LIB_DIR
= $(DIST
)/sdk
/lib
629 SDK_BIN_DIR
= $(DIST
)/sdk
/bin
633 MOZ_COMPONENT_LIBS
=$(XPCOM_LIBS
) $(MOZ_COMPONENT_NSPR_LIBS
)
635 ifdef MACOSX_DEPLOYMENT_TARGET
636 export MACOSX_DEPLOYMENT_TARGET
637 endif # MACOSX_DEPLOYMENT_TARGET
639 ifdef MOZ_USING_CCACHE
645 # Set link flags according to whether we want a console.
647 ifeq ($(MOZ_WINCONSOLE
),1)
648 ifeq ($(OS_ARCH
),OS2
)
649 BIN_FLAGS
+= -Zlinker
-PM
:VIO
651 ifeq ($(OS_ARCH
),WINNT
)
653 WIN32_EXE_LDFLAGS
+= -mconsole
655 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:CONSOLE
658 else # MOZ_WINCONSOLE
659 ifeq ($(OS_ARCH
),OS2
)
660 BIN_FLAGS
+= -Zlinker
-PM
:PM
662 ifeq ($(OS_ARCH
),WINNT
)
664 WIN32_EXE_LDFLAGS
+= -mwindows
666 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:WINDOWS
673 ifeq ($(CPU_ARCH
),x86_64
)
674 # set stack to 2MB on x64 build. See bug 582910
675 WIN32_EXE_LDFLAGS
+= -STACK
:2097152
679 # If we're building a component on MSVC, we don't want to generate an
680 # import lib, because that import lib will collide with the name of a
681 # static version of the same library.
682 ifeq ($(GNU_LD
)$(OS_ARCH
),WINNT
)
684 LDFLAGS
+= -IMPLIB
:fake.lib
685 DELETE_AFTER_LINK
= fake.lib fake.exp
690 # Include any personal overrides the user might think are needed.
692 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-config.mk
693 -include $(MY_CONFIG
)
695 ######################################################################
697 GARBAGE
+= $(DEPENDENCIES
) core
$(wildcard core.
[0-9]*) $(wildcard *.err
) $(wildcard *.pure
) $(wildcard *_pure_
*.o
) Templates.DB
699 ifeq ($(OS_ARCH
),Darwin
)
701 NSDISTMODE
=absolute_symlink
706 NSINSTALL_PY
:= $(PYTHON
) $(abspath
$(topsrcdir
)/config
/nsinstall.py
)
707 # For Pymake, wherever we use nsinstall.py we're also going to try to make it
708 # a native command where possible. Since native commands can't be used outside
709 # of single-line commands, we continue to provide INSTALL for general use.
710 # Single-line commands should be switched over to install_cmd.
711 NSINSTALL_NATIVECMD
:= %nsinstall nsinstall
714 NSINSTALL
= $(NSINSTALL_BIN
)
716 ifeq (OS2
,$(CROSS_COMPILE
)$(OS_ARCH
))
717 NSINSTALL
= $(MOZ_TOOLS_DIR
)/nsinstall
719 ifeq ($(HOST_OS_ARCH
),WINNT
)
720 NSINSTALL
= $(NSINSTALL_PY
)
722 NSINSTALL
= $(CONFIG_TOOLS
)/nsinstall
$(HOST_BIN_SUFFIX
)
725 endif # NSINSTALL_BIN
728 ifeq (,$(CROSS_COMPILE
)$(filter-out WINNT OS2
, $(OS_ARCH
)))
729 INSTALL
= $(NSINSTALL
) -t
731 install_cmd
= $(NSINSTALL_NATIVECMD
) -t
$(1)
736 # This isn't laid out as conditional directives so that NSDISTMODE can be
738 INSTALL
= $(if
$(filter copy
, $(NSDISTMODE
)), $(NSINSTALL
) -t
, $(if
$(filter absolute_symlink
, $(NSDISTMODE
)), $(NSINSTALL
) -L
$(PWD
), $(NSINSTALL
) -R
))
742 # The default for install_cmd is simply INSTALL
743 install_cmd ?
= $(INSTALL
) $(1)
745 # Use nsinstall in copy mode to install files on the system
746 SYSINSTALL
= $(NSINSTALL
) -t
747 # This isn't necessarily true, just here
748 sysinstall_cmd
= install_cmd
751 # Localization build automation
754 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
755 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
756 # overridden by the command line. (Besides, AB_CD is prettier).
757 AB_CD
= $(MOZ_UI_LOCALE
)
760 L10NBASEDIR
= $(error L10NBASEDIR not defined by configure
)
762 IS_LANGUAGE_REPACK
= 1
765 EXPAND_LOCALE_SRCDIR
= $(if
$(filter en-US
,$(AB_CD
)),$(topsrcdir
)/$(1)/en-US
,$(or
$(realpath
$(L10NBASEDIR
)),$(abspath
$(L10NBASEDIR
)))/$(AB_CD
)/$(subst /locales
,,$(1)))
768 LOCALE_SRCDIR ?
= $(call EXPAND_LOCALE_SRCDIR
,$(relativesrcdir
))
772 MAKE_JARS_FLAGS
+= --relativesrcdir
=$(relativesrcdir
)
773 ifneq (en-US
,$(AB_CD
))
774 ifdef LOCALE_MERGEDIR
775 MAKE_JARS_FLAGS
+= --locale-mergedir
=$(LOCALE_MERGEDIR
)
777 ifdef IS_LANGUAGE_REPACK
778 MAKE_JARS_FLAGS
+= --l10n-base
=$(L10NBASEDIR
)/$(AB_CD
)
781 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
784 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
785 endif # ! relativesrcdir
787 ifdef LOCALE_MERGEDIR
788 MERGE_FILE
= $(firstword \
789 $(wildcard $(LOCALE_MERGEDIR
)/$(subst /locales
,,$(relativesrcdir
))/$(1)) \
790 $(wildcard $(LOCALE_SRCDIR
)/$(1)) \
791 $(srcdir)/en-US
/$(1) )
793 MERGE_FILE
= $(LOCALE_SRCDIR
)/$(1)
795 MERGE_FILES
= $(foreach f
,$(1),$(call MERGE_FILE
,$(f
)))
797 ifeq (OS2
,$(OS_ARCH
))
798 RUN_TEST_PROGRAM
= $(topsrcdir
)/build
/os2
/test_os2.cmd
'$(LIBXUL_DIST)'
800 ifneq (WINNT
,$(OS_ARCH
))
801 RUN_TEST_PROGRAM
= $(LIBXUL_DIST
)/bin
/run-mozilla.sh
809 # Make sure any compiled classes work with at least JVM 1.4
810 JAVAC_FLAGS
+= -source
1.4
816 CREATE_PRECOMPLETE_CMD
= $(PYTHON
) $(abspath
$(topsrcdir
)/config
/createprecomplete.py
)
818 # MDDEPDIR is the subdirectory where dependency files are stored
821 EXPAND_LIBS_EXEC
= $(PYTHON
) $(topsrcdir
)/config
/expandlibs_exec.py
$(if
$@
,--depend
$(MDDEPDIR
)/$@.pp
--target
$@
)
822 EXPAND_LIBS_GEN
= $(PYTHON
) $(topsrcdir
)/config
/expandlibs_gen.py
$(if
$@
,--depend
$(MDDEPDIR
)/$@.pp
)
823 EXPAND_AR
= $(EXPAND_LIBS_EXEC
) --extract
-- $(AR
)
824 EXPAND_CC
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(CC
)
825 EXPAND_CCC
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(CCC
)
826 EXPAND_LD
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(LD
)
827 EXPAND_MKSHLIB_ARGS
= --uselist
829 EXPAND_MKSHLIB_ARGS
+= --symbol-order
$(SYMBOL_ORDER
)
831 EXPAND_MKSHLIB
= $(EXPAND_LIBS_EXEC
) $(EXPAND_MKSHLIB_ARGS
) -- $(MKSHLIB
)
833 ifneq (,$(MOZ_LIBSTDCXX_TARGET_VERSION
)$(MOZ_LIBSTDCXX_HOST_VERSION
))
834 ifneq ($(OS_ARCH
),Darwin
)
835 CHECK_STDCXX
= @
$(TOOLCHAIN_PREFIX
)objdump
-p
$(1) | grep
-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 || true
838 ifdef MOZ_LIBSTDCXX_TARGET_VERSION
839 EXTRA_LIBS
+= $(call EXPAND_LIBNAME_PATH
,stdc
++compat
,$(DEPTH
)/build
/unix
/stdc
++compat
)
841 ifdef MOZ_LIBSTDCXX_HOST_VERSION
842 HOST_EXTRA_LIBS
+= $(call EXPAND_LIBNAME_PATH
,host_stdc
++compat
,$(DEPTH
)/build
/unix
/stdc
++compat
)
846 ifeq (,$(filter $(OS_TARGET
),WINNT Darwin OS2
))
847 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
851 $(call CHECK_STDCXX
,$(1))
852 $(call CHECK_TEXTREL
,$(1))
855 # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
857 OBJ_SUFFIX
:= $(_OBJ_SUFFIX
)
859 # PGO builds with GCC build objects with instrumentation in a first pass,
860 # then objects optimized, without instrumentation, in a second pass. If
861 # we overwrite the ojects from the first pass with those from the second,
862 # we end up not getting instrumentation data for better optimization on
863 # incremental builds. As a consequence, we use a different object suffix
864 # for the first pass.
865 ifndef NO_PROFILE_GUIDED_OPTIMIZE
866 ifdef MOZ_PROFILE_GENERATE
873 # EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
874 # expands to $(LIB_PREFIX)foo.$(LIB_SUFFIX) or -lfoo, depending on linker
875 # arguments syntax. Should only be used for system libraries
877 # EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
878 # expands to dir/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
880 # EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
881 # expands to $(DIST)/lib/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
884 EXPAND_LIBNAME
= $(addprefix -l
,$(1))
886 EXPAND_LIBNAME
= $(foreach lib
,$(1),$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
888 EXPAND_LIBNAME_PATH
= $(foreach lib
,$(1),$(2)/$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
889 EXPAND_MOZLIBNAME
= $(foreach lib
,$(1),$(DIST
)/lib
/$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
891 PLY_INCLUDE
= -I
$(topsrcdir
)/other-licenses
/ply
893 export CL_INCLUDES_PREFIX
895 ifdef MOZ_GTK2_CFLAGS
896 MOZ_GTK2_CFLAGS
:= -I
$(topsrcdir
)/widget
/gtk
/compat
$(MOZ_GTK2_CFLAGS
)
899 DEFINES
+= -DNO_NSPR_10_SUPPORT