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 space
= $(NULL
) $(NULL
)
32 # Include defs.mk files that can be found in $(srcdir)/$(DEPTH),
33 # $(srcdir)/$(DEPTH-1), $(srcdir)/$(DEPTH-2), etc., and $(srcdir)
34 # where $(DEPTH-1) is one level less of depth, $(DEPTH-2), two, etc.
35 # i.e. for DEPTH=../../.., DEPTH-1 is ../.. and DEPTH-2 is ..
36 # These defs.mk files are used to define variables in a directory
37 # and all its subdirectories, recursively.
38 __depth
:= $(subst /, ,$(DEPTH
))
42 $(foreach __d
,$(__depth
) .
,$(eval __depth
= $(wordlist
2,$(words $(__depth
)),$(__depth
))$(eval
-include $(subst $(space
),/,$(strip $(srcdir) $(__depth
) defs.mk
)))))
46 # Sanity check some variables
54 INSTALL_EXTENSION_ID \
59 # checks for internal spaces or trailing spaces in the variable
61 check-variable
= $(if
$(filter-out 0 1,$(words $($(x
))z
)),$(error Spaces are not allowed in
$(x
)))
63 $(foreach x
,$(CHECK_VARS
),$(check-variable
))
65 core_abspath
= $(if
$(findstring :,$(1)),$(1),$(if
$(filter /%,$(1)),$(1),$(CURDIR
)/$(1)))
66 core_realpath
= $(if
$(realpath
$(1)),$(realpath
$(1)),$(call core_abspath
,$(1)))
68 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)))))))
72 # LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
73 LIBXUL_DIST ?
= $(DIST
)
75 # FINAL_TARGET specifies the location into which we copy end-user-shipped
76 # build products (typelibs, components, chrome).
78 # If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
79 # instead of $(DIST)/bin. In both cases, if DIST_SUBDIR is set, the files will be
80 # shipped to a $(DIST_SUBDIR) subdirectory.
81 FINAL_TARGET
= $(if
$(XPI_NAME
),$(DIST
)/xpi-stage
/$(XPI_NAME
),$(DIST
)/bin
)$(DIST_SUBDIR
:%=/%)
84 DEFINES
+= -DXPI_NAME
=$(XPI_NAME
)
87 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
90 ifeq ($(HOST_OS_ARCH
),WINNT
)
91 win_srcdir
:= $(subst $(topsrcdir
),$(WIN_TOP_SRC
),$(srcdir))
92 BUILD_TOOLS
= $(WIN_TOP_SRC
)/build
/unix
94 win_srcdir
:= $(srcdir)
95 BUILD_TOOLS
= $(topsrcdir
)/build
/unix
98 CONFIG_TOOLS
= $(MOZ_BUILD_ROOT
)/config
99 AUTOCONF_TOOLS
= $(topsrcdir
)/build
/autoconf
102 # Strip off the excessively long version numbers on these platforms,
103 # but save the version to allow multiple versions of the same base
104 # platform to be built in the same tree.
106 ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD SunOS
,$(OS_ARCH
)))
107 OS_RELEASE
:= $(basename $(OS_RELEASE
))
109 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
110 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
111 OS_VERS
:= $(suffix $(OS_RELEASE
))
112 OS_VERSION
:= $(shell echo
$(OS_VERS
) | sed
's/-.*//')
117 OS_CONFIG
:= $(OS_ARCH
)$(OS_RELEASE
)
119 FINAL_LINK_LIBS
= $(DEPTH
)/config
/final-link-libs
120 FINAL_LINK_COMPS
= $(DEPTH
)/config
/final-link-comps
121 FINAL_LINK_COMP_NAMES
= $(DEPTH
)/config
/final-link-comp-names
123 MOZ_UNICHARUTIL_LIBS
= $(LIBXUL_DIST
)/lib
/$(LIB_PREFIX
)unicharutil_s.
$(LIB_SUFFIX
)
124 MOZ_WIDGET_SUPPORT_LIBS
= $(DIST
)/lib
/$(LIB_PREFIX
)widgetsupport_s.
$(LIB_SUFFIX
)
127 CC_WRAPPER ?
= $(PYTHON
) -O
$(topsrcdir
)/build
/cl.py
128 CXX_WRAPPER ?
= $(PYTHON
) -O
$(topsrcdir
)/build
/cl.py
131 CC
:= $(CC_WRAPPER
) $(CC
)
132 CXX
:= $(CXX_WRAPPER
) $(CXX
)
138 PYCOMMANDPATH
+= $(topsrcdir
)/config
141 PYTHON_PATH
= $(PYTHON
) $(topsrcdir
)/config
/pythonpath.py
143 # determine debug-related options
149 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
150 XULPPFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
152 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
153 XULPPFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
156 ifneq (,$(MOZ_DEBUG
)$(MOZ_DEBUG_SYMBOLS
))
158 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
159 _DEBUG_ASFLAGS
+= -g cv8
161 ifneq ($(OS_ARCH
),Darwin
)
162 _DEBUG_ASFLAGS
+= -g dwarf2
166 _DEBUG_ASFLAGS
+= $(MOZ_DEBUG_FLAGS
)
168 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
169 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
172 MOZALLOC_LIB
= $(call EXPAND_LIBNAME_PATH
,mozalloc
,$(DIST
)/lib
)
174 ASFLAGS
+= $(_DEBUG_ASFLAGS
)
175 OS_CFLAGS
+= $(_DEBUG_CFLAGS
)
176 OS_CXXFLAGS
+= $(_DEBUG_CFLAGS
)
177 OS_LDFLAGS
+= $(_DEBUG_LDFLAGS
)
179 # XXX: What does this? Bug 482434 filed for better explanation.
180 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
182 ifneq (,$(MOZ_BROWSE_INFO
)$(MOZ_BSCFILE
))
188 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
189 # Used for generating an optimized build with debugging symbols.
190 # Used in the Windows nightlies to generate symbols for crash reporting.
191 ifdef MOZ_DEBUG_SYMBOLS
192 OS_CXXFLAGS
+= -UDEBUG
-DNDEBUG
193 OS_CFLAGS
+= -UDEBUG
-DNDEBUG
195 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
,ICF
197 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
202 # Handle trace-malloc and DMD in optimized builds.
203 # No opt to give sane callstacks.
205 ifneq (,$(NS_TRACE_MALLOC
)$(MOZ_DMD
))
206 MOZ_OPTIMIZE_FLAGS
=-Zi
-Od
-UDEBUG
-DNDEBUG
208 OS_LDFLAGS
= -DEBUG
-OPT
:REF
,ICF
210 OS_LDFLAGS
= -DEBUG
-OPT
:REF
212 endif # NS_TRACE_MALLOC || MOZ_DMD
216 # We don't build a static CRT when building a custom CRT,
217 # it appears to be broken. So don't link to jemalloc if
218 # the Makefile wants static CRT linking.
219 ifeq ($(MOZ_MEMORY
)_
$(USE_STATIC_LIBS
),1_1
)
220 # Disable default CRT libs and add the right lib path for the linker
224 endif # WINNT && !GNU_CC
226 ifdef MOZ_GLUE_PROGRAM_LDFLAGS
227 DEFINES
+= -DMOZ_GLUE_IN_PROGRAM
229 MOZ_GLUE_PROGRAM_LDFLAGS
=$(MOZ_GLUE_LDFLAGS
)
233 # Build using PIC by default
237 # Determine if module being compiled is destined
238 # to be merged into libxul
243 DEFINES
+= -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT
=1
245 $(error Component makefile does not specify MODULE_NAME.
)
252 # If we are building this component into an extension/xulapp, it cannot be
253 # statically linked. In the future we may want to add a xulapp meta-component
264 ifndef SHARED_LIBRARY_NAME
266 SHARED_LIBRARY_NAME
=$(LIBRARY_NAME
)
270 ifndef STATIC_LIBRARY_NAME
272 STATIC_LIBRARY_NAME
=$(LIBRARY_NAME
)
276 # No sense in profiling tools
278 NO_PROFILE_GUIDED_OPTIMIZE
= 1
281 # Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
282 # and we don't have the same build logic to re-link them in the second pass.
283 ifdef SIMPLE_PROGRAMS
284 NO_PROFILE_GUIDED_OPTIMIZE
= 1
287 # No sense in profiling unit tests
289 NO_PROFILE_GUIDED_OPTIMIZE
= 1
292 # Enable profile-based feedback
293 ifndef NO_PROFILE_GUIDED_OPTIMIZE
294 ifdef MOZ_PROFILE_GENERATE
295 OS_CFLAGS
+= $(PROFILE_GEN_CFLAGS
)
296 OS_CXXFLAGS
+= $(PROFILE_GEN_CFLAGS
)
297 OS_LDFLAGS
+= $(PROFILE_GEN_LDFLAGS
)
298 ifeq (WINNT
,$(OS_ARCH
))
301 endif # MOZ_PROFILE_GENERATE
303 ifdef MOZ_PROFILE_USE
304 OS_CFLAGS
+= $(PROFILE_USE_CFLAGS
)
305 OS_CXXFLAGS
+= $(PROFILE_USE_CFLAGS
)
306 OS_LDFLAGS
+= $(PROFILE_USE_LDFLAGS
)
307 ifeq (WINNT
,$(OS_ARCH
))
310 endif # MOZ_PROFILE_USE
311 endif # NO_PROFILE_GUIDED_OPTIMIZE
314 # Does the makefile specifies the internal XPCOM API linkage?
315 ifneq (,$(MOZILLA_INTERNAL_API
)$(LIBXUL_LIBRARY
))
316 DEFINES
+= -DMOZILLA_INTERNAL_API
319 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
320 # building libxul libraries
333 ifndef JS_SHARED_LIBRARY
334 DEFINES
+= -DSTATIC_EXPORTABLE_JS_API
338 # Flags passed to JarMaker.py
341 -f
$(MOZ_CHROME_FILE_FORMAT
) \
344 ifdef USE_EXTENSION_MANIFEST
345 MAKE_JARS_FLAGS
+= -e
349 MAKE_JARS_FLAGS
+= --both-manifests
352 TAR_CREATE_FLAGS
= -cvhf
353 TAR_CREATE_FLAGS_QUIET
= -chf
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
+= $(MOZ_JPEG_CFLAGS
) $(MOZ_PNG_CFLAGS
) $(MOZ_ZLIB_CFLAGS
)
379 # NSPR_CFLAGS and NSS_CFLAGS must appear ahead of OS_INCLUDES to avoid Linux
380 # builds wrongly picking up system NSPR/NSS header files.
386 $(if
$(LIBXUL_SDK
),-I
$(LIBXUL_SDK
)/include) \
387 $(NSPR_CFLAGS
) $(NSS_CFLAGS
) \
391 include $(topsrcdir
)/config
/static-checking-config.mk
393 CFLAGS
= $(OS_CPPFLAGS
) $(OS_CFLAGS
)
394 CXXFLAGS
= $(OS_CPPFLAGS
) $(OS_CXXFLAGS
)
395 LDFLAGS
= $(OS_LDFLAGS
) $(MOZ_FIX_LINK_PATHS
)
397 # Allow each module to override the *default* optimization settings
398 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
399 # arguments to --enable-optimize
401 ifeq (1,$(MOZ_OPTIMIZE
))
402 ifdef MODULE_OPTIMIZE_FLAGS
403 CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
404 CXXFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
406 ifneq (,$(if
$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
),$(MOZ_PGO_OPTIMIZE_FLAGS
)))
407 CFLAGS
+= $(MOZ_PGO_OPTIMIZE_FLAGS
)
408 CXXFLAGS
+= $(MOZ_PGO_OPTIMIZE_FLAGS
)
410 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
411 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
412 endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
413 endif # MODULE_OPTIMIZE_FLAGS
415 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
416 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
417 endif # MOZ_OPTIMIZE == 1
418 LDFLAGS
+= $(MOZ_OPTIMIZE_LDFLAGS
)
422 HOST_CFLAGS
+= $(HOST_OPTIMIZE_FLAGS
)
425 ifeq (1,$(MOZ_OPTIMIZE
))
426 ifdef MODULE_OPTIMIZE_FLAGS
427 HOST_CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
429 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
430 endif # MODULE_OPTIMIZE_FLAGS
432 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
433 endif # MOZ_OPTIMIZE == 1
435 endif # CROSS_COMPILE
437 CFLAGS
+= $(MOZ_FRAMEPTR_FLAGS
)
438 CXXFLAGS
+= $(MOZ_FRAMEPTR_FLAGS
)
440 # Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
441 # to request that we use the 'warnings as errors' compile flags)
443 # NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
444 # build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
445 # situation. (See bug 437002.)
446 ifeq (WINNT_1
,$(OS_ARCH
)_
$(MOZ_PROFILE_GENERATE
)$(MOZ_PROFILE_USE
))
447 FAIL_ON_WARNINGS_DEBUG
=
449 endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
451 # Now, check for debug version of flag; it turns on normal flag in debug builds.
452 ifdef FAIL_ON_WARNINGS_DEBUG
456 endif # FAIL_ON_WARNINGS_DEBUG
458 # Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
459 ifdef FAIL_ON_WARNINGS
460 CXXFLAGS
+= $(WARNINGS_AS_ERRORS
)
461 CFLAGS
+= $(WARNINGS_AS_ERRORS
)
462 endif # FAIL_ON_WARNINGS
464 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
465 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
466 #// DLL version of the RTL is used...
468 #//------------------------------------------------------------------------
469 ifdef USE_STATIC_LIBS
470 RTL_FLAGS
=-MT
# Statically linked multithreaded RTL
471 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
)$(MOZ_DMD
))
472 ifndef MOZ_NO_DEBUG_RTL
473 RTL_FLAGS
=-MTd
# Statically linked multithreaded MSVC4.0 debug RTL
475 endif # MOZ_DEBUG || NS_TRACE_MALLOC || MOZ_DMD
477 else # !USE_STATIC_LIBS
479 RTL_FLAGS
=-MD
# Dynamically linked, multithreaded RTL
480 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
)$(MOZ_DMD
))
481 ifndef MOZ_NO_DEBUG_RTL
482 RTL_FLAGS
=-MDd
# Dynamically linked, multithreaded MSVC4.0 debug RTL
484 endif # MOZ_DEBUG || NS_TRACE_MALLOC || MOZ_DMD
485 endif # USE_STATIC_LIBS
486 endif # WINNT && !GNU_CC
488 ifeq ($(OS_ARCH
),Darwin
)
489 # Compiling ObjC requires an Apple compiler anyway, so it's ok to set
491 HOST_CMFLAGS
+= -fobjc-exceptions
492 HOST_CMMFLAGS
+= -fobjc-exceptions
493 OS_COMPILE_CMFLAGS
+= -fobjc-exceptions
494 OS_COMPILE_CMMFLAGS
+= -fobjc-exceptions
495 ifeq ($(MOZ_WIDGET_TOOLKIT
),uikit
)
496 OS_COMPILE_CMFLAGS
+= -fobjc-abi-version
=2 -fobjc-legacy-dispatch
497 OS_COMPILE_CMMFLAGS
+= -fobjc-abi-version
=2 -fobjc-legacy-dispatch
501 COMPILE_CFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(CFLAGS
) $(RTL_FLAGS
) $(OS_CPPFLAGS
) $(OS_COMPILE_CFLAGS
)
502 COMPILE_CXXFLAGS
= $(STL_FLAGS
) $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(CXXFLAGS
) $(RTL_FLAGS
) $(OS_CPPFLAGS
) $(OS_COMPILE_CXXFLAGS
)
503 COMPILE_CMFLAGS
= $(OS_COMPILE_CMFLAGS
)
504 COMPILE_CMMFLAGS
= $(OS_COMPILE_CMMFLAGS
)
507 HOST_CFLAGS
+= $(RTL_FLAGS
)
511 # Name of the binary code directories
515 # We need to know where to find the libraries we
516 # put on the link line for binaries, and should
517 # we link statically or dynamic? Assuming dynamic for now.
519 ifneq (WINNT_
,$(OS_ARCH
)_
$(GNU_CC
))
520 LIBS_DIR
= -L
$(DIST
)/bin
-L
$(DIST
)/lib
522 LIBS_DIR
+= -L
$(LIBXUL_SDK
)/bin
-L
$(LIBXUL_SDK
)/lib
526 # Default location of include files
527 IDL_DIR
= $(DIST
)/idl
529 XPIDL_FLAGS
+= -I
$(srcdir) -I
$(IDL_DIR
)
531 XPIDL_FLAGS
+= -I
$(LIBXUL_SDK
)/idl
534 SDK_LIB_DIR
= $(DIST
)/sdk
/lib
535 SDK_BIN_DIR
= $(DIST
)/sdk
/bin
539 MOZ_COMPONENT_LIBS
=$(XPCOM_LIBS
) $(MOZ_COMPONENT_NSPR_LIBS
)
541 ifeq ($(OS_ARCH
),OS2
)
548 ifdef USE_ELF_DYNSTR_GC
549 ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
550 ELF_DYNSTR_GC
= $(DEPTH
)/config
/elf-dynstr-gc
555 ifdef MACOSX_DEPLOYMENT_TARGET
556 export MACOSX_DEPLOYMENT_TARGET
557 endif # MACOSX_DEPLOYMENT_TARGET
559 ifdef MOZ_USING_CCACHE
565 # Set link flags according to whether we want a console.
567 ifeq ($(MOZ_WINCONSOLE
),1)
568 ifeq ($(OS_ARCH
),OS2
)
569 BIN_FLAGS
+= -Zlinker
-PM
:VIO
571 ifeq ($(OS_ARCH
),WINNT
)
573 WIN32_EXE_LDFLAGS
+= -mconsole
575 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:CONSOLE
578 else # MOZ_WINCONSOLE
579 ifeq ($(OS_ARCH
),OS2
)
580 BIN_FLAGS
+= -Zlinker
-PM
:PM
582 ifeq ($(OS_ARCH
),WINNT
)
584 WIN32_EXE_LDFLAGS
+= -mwindows
586 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:WINDOWS
593 ifeq ($(CPU_ARCH
),x86_64
)
594 # set stack to 2MB on x64 build. See bug 582910
595 WIN32_EXE_LDFLAGS
+= -STACK
:2097152
599 # If we're building a component on MSVC, we don't want to generate an
600 # import lib, because that import lib will collide with the name of a
601 # static version of the same library.
602 ifeq ($(GNU_LD
)$(OS_ARCH
),WINNT
)
604 LDFLAGS
+= -IMPLIB
:fake.lib
605 DELETE_AFTER_LINK
= fake.lib fake.exp
610 # Include any personal overrides the user might think are needed.
612 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-config.mk
613 -include $(MY_CONFIG
)
615 ######################################################################
617 GARBAGE
+= $(DEPENDENCIES
) core
$(wildcard core.
[0-9]*) $(wildcard *.err
) $(wildcard *.pure
) $(wildcard *_pure_
*.o
) Templates.DB
619 ifeq ($(OS_ARCH
),Darwin
)
621 NSDISTMODE
=absolute_symlink
626 NSINSTALL_PY
:= $(PYTHON
) $(call core_abspath
,$(topsrcdir
)/config
/nsinstall.py
)
627 # For Pymake, wherever we use nsinstall.py we're also going to try to make it
628 # a native command where possible. Since native commands can't be used outside
629 # of single-line commands, we continue to provide INSTALL for general use.
630 # Single-line commands should be switched over to install_cmd.
631 NSINSTALL_NATIVECMD
:= %nsinstall nsinstall
634 NSINSTALL
= $(NSINSTALL_BIN
)
636 ifeq (OS2
,$(CROSS_COMPILE
)$(OS_ARCH
))
637 NSINSTALL
= $(MOZ_TOOLS_DIR
)/nsinstall
639 ifeq ($(HOST_OS_ARCH
),WINNT
)
640 NSINSTALL
= $(NSINSTALL_PY
)
642 NSINSTALL
= $(CONFIG_TOOLS
)/nsinstall
$(HOST_BIN_SUFFIX
)
645 endif # NSINSTALL_BIN
648 ifeq (,$(CROSS_COMPILE
)$(filter-out WINNT OS2
, $(OS_ARCH
)))
649 INSTALL
= $(NSINSTALL
) -t
651 install_cmd
= $(NSINSTALL_NATIVECMD
) -t
$(1)
656 # This isn't laid out as conditional directives so that NSDISTMODE can be
658 INSTALL
= $(if
$(filter copy
, $(NSDISTMODE
)), $(NSINSTALL
) -t
, $(if
$(filter absolute_symlink
, $(NSDISTMODE
)), $(NSINSTALL
) -L
$(PWD
), $(NSINSTALL
) -R
))
662 # The default for install_cmd is simply INSTALL
663 install_cmd ?
= $(INSTALL
) $(1)
665 # Use nsinstall in copy mode to install files on the system
666 SYSINSTALL
= $(NSINSTALL
) -t
667 # This isn't necessarily true, just here
668 sysinstall_cmd
= install_cmd
671 # Localization build automation
674 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
675 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
676 # overridden by the command line. (Besides, AB_CD is prettier).
677 AB_CD
= $(MOZ_UI_LOCALE
)
680 L10NBASEDIR
= $(error L10NBASEDIR not defined by configure
)
682 IS_LANGUAGE_REPACK
= 1
685 EXPAND_LOCALE_SRCDIR
= $(if
$(filter en-US
,$(AB_CD
)),$(topsrcdir
)/$(1)/en-US
,$(call core_realpath
,$(L10NBASEDIR
))/$(AB_CD
)/$(subst /locales
,,$(1)))
688 LOCALE_SRCDIR
= $(call EXPAND_LOCALE_SRCDIR
,$(relativesrcdir
))
692 MAKE_JARS_FLAGS
+= --relativesrcdir
=$(relativesrcdir
)
693 ifneq (en-US
,$(AB_CD
))
694 ifdef LOCALE_MERGEDIR
695 MAKE_JARS_FLAGS
+= --locale-mergedir
=$(LOCALE_MERGEDIR
)
697 ifdef IS_LANGUAGE_REPACK
698 MAKE_JARS_FLAGS
+= --l10n-base
=$(L10NBASEDIR
)/$(AB_CD
)
701 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
704 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
705 endif # ! relativesrcdir
707 ifdef LOCALE_MERGEDIR
708 MERGE_FILE
= $(firstword \
709 $(wildcard $(LOCALE_MERGEDIR
)/$(subst /locales
,,$(relativesrcdir
))/$(1)) \
710 $(wildcard $(LOCALE_SRCDIR
)/$(1)) \
711 $(srcdir)/en-US
/$(1) )
713 MERGE_FILE
= $(LOCALE_SRCDIR
)/$(1)
715 MERGE_FILES
= $(foreach f
,$(1),$(call MERGE_FILE
,$(f
)))
717 ifeq (OS2
,$(OS_ARCH
))
718 RUN_TEST_PROGRAM
= $(topsrcdir
)/build
/os2
/test_os2.cmd
"$(LIBXUL_DIST)"
720 ifneq (WINNT
,$(OS_ARCH
))
721 RUN_TEST_PROGRAM
= $(LIBXUL_DIST
)/bin
/run-mozilla.sh
729 # Make sure any compiled classes work with at least JVM 1.4
730 JAVAC_FLAGS
+= -source
1.4
736 CREATE_PRECOMPLETE_CMD
= $(PYTHON
) $(call core_abspath
,$(topsrcdir
)/config
/createprecomplete.py
)
738 # MDDEPDIR is the subdirectory where dependency files are stored
741 EXPAND_LIBS_EXEC
= $(PYTHON
) $(topsrcdir
)/config
/expandlibs_exec.py
$(if
$@
,--depend
$(MDDEPDIR
)/$(@F
).pp
--target
$@
)
742 EXPAND_LIBS_GEN
= $(PYTHON
) $(topsrcdir
)/config
/expandlibs_gen.py
$(if
$@
,--depend
$(MDDEPDIR
)/$(@F
).pp
)
743 EXPAND_AR
= $(EXPAND_LIBS_EXEC
) --extract
-- $(AR
)
744 EXPAND_CC
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(CC
)
745 EXPAND_CCC
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(CCC
)
746 EXPAND_LD
= $(EXPAND_LIBS_EXEC
) --uselist
-- $(LD
)
747 EXPAND_MKSHLIB_ARGS
= --uselist
749 EXPAND_MKSHLIB_ARGS
+= --symbol-order
$(SYMBOL_ORDER
)
751 EXPAND_MKSHLIB
= $(EXPAND_LIBS_EXEC
) $(EXPAND_MKSHLIB_ARGS
) -- $(MKSHLIB
)
754 ifneq ($(OS_ARCH
),Darwin
)
755 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
758 EXTRA_LIBS
+= $(call EXPAND_LIBNAME_PATH
,stdc
++compat
,$(DEPTH
)/build
/unix
/stdc
++compat
)
759 HOST_EXTRA_LIBS
+= $(call EXPAND_LIBNAME_PATH
,host_stdc
++compat
,$(DEPTH
)/build
/unix
/stdc
++compat
)
762 # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
764 OBJ_SUFFIX
:= $(_OBJ_SUFFIX
)
766 # PGO builds with GCC build objects with instrumentation in a first pass,
767 # then objects optimized, without instrumentation, in a second pass. If
768 # we overwrite the ojects from the first pass with those from the second,
769 # we end up not getting instrumentation data for better optimization on
770 # incremental builds. As a consequence, we use a different object suffix
771 # for the first pass.
772 ifndef NO_PROFILE_GUIDED_OPTIMIZE
773 ifdef MOZ_PROFILE_GENERATE
780 # EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
781 # expands to $(LIB_PREFIX)foo.$(LIB_SUFFIX) or -lfoo, depending on linker
782 # arguments syntax. Should only be used for system libraries
784 # EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
785 # expands to dir/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
787 # EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
788 # expands to $(DIST)/lib/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
791 EXPAND_LIBNAME
= $(addprefix -l
,$(1))
793 EXPAND_LIBNAME
= $(foreach lib
,$(1),$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
795 EXPAND_LIBNAME_PATH
= $(foreach lib
,$(1),$(2)/$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
796 EXPAND_MOZLIBNAME
= $(foreach lib
,$(1),$(DIST
)/lib
/$(LIB_PREFIX
)$(lib
).
$(LIB_SUFFIX
))
798 # Include internal ply only if needed
799 ifndef MOZ_SYSTEM_PLY
800 PLY_INCLUDE
= -I
$(topsrcdir
)/other-licenses
/ply
803 export CL_INCLUDES_PREFIX
805 ifeq ($(MOZ_WIDGET_GTK
),2)
806 MOZ_GTK2_CFLAGS
:= -I
$(topsrcdir
)/widget
/gtk2
/compat
$(MOZ_GTK2_CFLAGS
)
809 DEFINES
+= -DNO_NSPR_10_SUPPORT