2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
15 # The Original Code is mozilla.org code.
17 # The Initial Developer of the Original Code is
18 # Netscape Communications Corporation.
19 # Portions created by the Initial Developer are Copyright (C) 1998
20 # the Initial Developer. All Rights Reserved.
23 # Benjamin Smedberg <benjamin@smedbergs.us>
25 # Alternatively, the contents of this file may be used under the terms of
26 # either of the GNU General Public License Version 2 or later (the "GPL"),
27 # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
42 # Determines the platform and builds the macros needed to load the
43 # appropriate platform-specific .mk file, then defines all (most?)
44 # of the generic macros.
47 # Define an include-at-most-once flag
48 INCLUDED_CONFIG_MK
= 1
50 EXIT_ON_ERROR
= set
-e
; # Shell loops continue past errors without this.
56 ifndef INCLUDED_AUTOCONF_MK
57 include $(DEPTH
)/config
/autoconf.mk
59 ifndef INCLUDED_INSURE_MK
61 include $(topsrcdir
)/config
/insure.mk
65 # Sanity check some variables
73 INSTALL_EXTENSION_ID \
76 # checks for internal spaces or trailing spaces in the variable
78 check-variable
= $(if
$(filter-out 0 1,$(words $($(x
))z
)),$(error Spaces are not allowed in
$(x
)))
80 $(foreach x
,$(CHECK_VARS
),$(check-variable
))
82 # FINAL_TARGET specifies the location into which we copy end-user-shipped
83 # build products (typelibs, components, chrome).
85 # It will usually be the well-loved $(DIST)/bin, today, but can also be an
86 # XPI-contents staging directory for ambitious and right-thinking extensions.
87 FINAL_TARGET
= $(if
$(XPI_NAME
),$(DIST
)/xpi-stage
/$(XPI_NAME
),$(DIST
)/bin
)
89 # MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in
90 # the jar format, make-jars leaves behind a directory structure that's not
91 # needed in $(FINAL_TARGET). For both, flat, and symlink, the directory
92 # structure contains the chrome, so leave it in $(FINAL_TARGET).
93 ifeq (jar
,$(MOZ_CHROME_FILE_FORMAT
))
94 MAKE_JARS_TARGET
= $(if
$(XPI_NAME
),$(FINAL_TARGET
).stage
,$(DIST
)/chrome-stage
)
96 MAKE_JARS_TARGET
= $(FINAL_TARGET
)
100 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
101 # Since the longest of these is 5 characters without the suffix,
102 # be sure to not set VERSION_NUMBER to anything longer than 3
103 # characters for Win16's sake.
107 ifeq ($(HOST_OS_ARCH
),WINNT
)
108 win_srcdir
:= $(subst $(topsrcdir
),$(WIN_TOP_SRC
),$(srcdir))
109 BUILD_TOOLS
= $(WIN_TOP_SRC
)/build
/unix
111 win_srcdir
:= $(srcdir)
112 BUILD_TOOLS
= $(topsrcdir
)/build
/unix
115 CONFIG_TOOLS
= $(MOZ_BUILD_ROOT
)/config
116 AUTOCONF_TOOLS
= $(topsrcdir
)/build
/autoconf
118 ifeq ($(OS_ARCH
),QNX
)
119 ifeq ($(OS_TARGET
),NTO
)
120 LD
:= qcc
-Vgcc_ntox86
-nostdlib
125 ifeq ($(OS_ARCH
),BeOS
)
126 BEOS_ADDON_WORKAROUND
= 1
130 # Strip off the excessively long version numbers on these platforms,
131 # but save the version to allow multiple versions of the same base
132 # platform to be built in the same tree.
134 ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS
,$(OS_ARCH
)))
135 OS_RELEASE
:= $(basename $(OS_RELEASE
))
137 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
138 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
139 OS_VERS
:= $(suffix $(OS_RELEASE
))
140 OS_VERSION
:= $(shell echo
$(OS_VERS
) | sed
's/-.*//')
145 OS_CONFIG
:= $(OS_ARCH
)$(OS_RELEASE
)
147 FINAL_LINK_LIBS
= $(DEPTH
)/config
/final-link-libs
148 FINAL_LINK_COMPS
= $(DEPTH
)/config
/final-link-comps
149 FINAL_LINK_COMP_NAMES
= $(DEPTH
)/config
/final-link-comp-names
151 MOZ_UNICHARUTIL_LIBS
= $(LIBXUL_DIST
)/lib
/$(LIB_PREFIX
)unicharutil_s.
$(LIB_SUFFIX
)
152 MOZ_WIDGET_SUPPORT_LIBS
= $(DIST
)/lib
/$(LIB_PREFIX
)widgetsupport_s.
$(LIB_SUFFIX
)
154 # determine debug-related options
159 # global debugging is disabled
160 # check if it was explicitly enabled for this module
161 ifneq (, $(findstring $(MODULE
), $(MOZ_DEBUG_MODULES
)))
165 # global debugging is enabled
166 # check if it was explicitly disabled for this module
167 ifneq (, $(findstring ^
$(MODULE
), $(MOZ_DEBUG_MODULES
)))
173 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
174 XULPPFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
176 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
177 XULPPFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
180 # determine if -g should be passed to the compiler, based on
181 # the current module, and the value of MOZ_DBGRINFO_MODULES
184 MOZ_DBGRINFO_MODULES
+= ALL_MODULES
185 pattern
:= ALL_MODULES ^ALL_MODULES
187 MOZ_DBGRINFO_MODULES
+= ^ALL_MODULES
188 pattern
:= ALL_MODULES ^ALL_MODULES
192 # our current Makefile specifies a module name - add it to our pattern
193 pattern
+= $(MODULE
) ^
$(MODULE
)
196 # start by finding the first relevant module name
197 # (remember that the order of the module names in MOZ_DBGRINFO_MODULES
198 # is reversed from the order the user specified to configure -
199 # this allows the user to put general names at the beginning
200 # of the list, and to override them with explicit module names later
203 first_match
:=$(firstword $(filter $(pattern
), $(MOZ_DBGRINFO_MODULES
)))
205 ifeq ($(first_match
), $(MODULE
))
206 # the user specified explicitly that
207 # this module should be compiled with -g
208 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
209 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
211 ifeq ($(first_match
), ^
$(MODULE
))
212 # the user specified explicitly that this module
213 # should not be compiled with -g (nothing to do)
215 ifeq ($(first_match
), ALL_MODULES
)
216 # the user didn't mention this module explicitly,
217 # but wanted all modules to be compiled with -g
218 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
219 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
221 ifeq ($(first_match
), ^ALL_MODULES
)
222 # the user didn't mention this module explicitly,
223 # but wanted all modules to be compiled without -g (nothing to do)
231 # (these might have been above when processing MOZ_DBGRINFO_MODULES)
232 OS_CFLAGS
+= $(_DEBUG_CFLAGS
)
233 OS_CXXFLAGS
+= $(_DEBUG_CFLAGS
)
234 OS_LDFLAGS
+= $(_DEBUG_LDFLAGS
)
236 # MOZ_PROFILE equivs for win32
237 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
239 ifneq (,$(MOZ_BROWSE_INFO
)$(MOZ_BSCFILE
))
245 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
246 # Used for generating an optimized build with debugging symbols.
247 # Used in the Windows nightlies to generate symbols for crash reporting.
248 ifdef MOZ_DEBUG_SYMBOLS
249 OS_CXXFLAGS
+= -Zi
-UDEBUG
-DNDEBUG
250 OS_CFLAGS
+= -Zi
-UDEBUG
-DNDEBUG
251 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
-OPT
:nowin98
255 # -FIXED:NO is needed for Quantify to work, but it increases the size
256 # of executables, so only use it if building for Quantify.
257 WIN32_EXE_LDFLAGS
+= -FIXED
:NO
259 # We need -OPT:NOICF to prevent identical methods from being merged together.
260 # Otherwise, Quantify doesn't know which method was actually called when it's
261 # showing you the profile.
262 OS_LDFLAGS
+= -OPT
:NOICF
266 # Handle trace-malloc in optimized builds.
267 # No opt to give sane callstacks.
269 ifdef NS_TRACE_MALLOC
270 MOZ_OPTIMIZE_FLAGS
=-Zi
-Od
-UDEBUG
-DNDEBUG
271 OS_LDFLAGS
= -DEBUG
-PDB
:NONE
-OPT
:REF
-OPT
:nowin98
272 endif # NS_TRACE_MALLOC
275 endif # WINNT && !GNU_CC
278 # Build using PIC by default
279 # Do not use PIC if not building a shared lib (see exceptions below)
282 ifndef BUILD_STATIC_LIBS
285 ifneq (,$(FORCE_SHARED_LIB
)$(FORCE_USE_PIC
))
289 # In Firefox, all components are linked into either libxul or the static
290 # meta-component, and should be compiled with PIC.
291 ifdef MOZ_META_COMPONENT
295 # If module is going to be merged into the nsStaticModule,
296 # make sure that the entry points are translated and
297 # the module is built static.
301 ifneq (,$(BUILD_STATIC_LIBS
))
303 DEFINES
+= -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT
=1
310 # Determine if module being compiled is destined
311 # to be merged into libxul
313 ifdef MOZ_ENABLE_LIBXUL
317 DEFINES
+= -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT
=1
319 $(error Component makefile does not specify MODULE_NAME.
)
328 # If we are building this component into an extension/xulapp, it cannot be
329 # statically linked. In the future we may want to add a xulapp meta-component
342 # Disable PIC if necessary
347 ifeq ($(OS_ARCH
)_
$(HAVE_GCC3_ABI
),Darwin_1
)
348 DSO_PIC_CFLAGS
=-mdynamic-no-pic
354 # This comes from configure
355 ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
356 NO_PROFILE_GUIDED_OPTIMIZE
= 1
359 # Enable profile-based feedback
360 ifndef NO_PROFILE_GUIDED_OPTIMIZE
361 ifdef MOZ_PROFILE_GENERATE
362 # No sense in profiling tools
363 ifndef INTERNAL_TOOLS
364 OS_CFLAGS
+= $(PROFILE_GEN_CFLAGS
)
365 OS_CXXFLAGS
+= $(PROFILE_GEN_CFLAGS
)
366 OS_LDFLAGS
+= $(PROFILE_GEN_LDFLAGS
)
367 ifeq (WINNT
,$(OS_ARCH
))
370 endif # INTERNAL_TOOLS
371 endif # MOZ_PROFILE_GENERATE
373 ifdef MOZ_PROFILE_USE
374 ifndef INTERNAL_TOOLS
375 OS_CFLAGS
+= $(PROFILE_USE_CFLAGS
)
376 OS_CXXFLAGS
+= $(PROFILE_USE_CFLAGS
)
377 OS_LDFLAGS
+= $(PROFILE_USE_LDFLAGS
)
378 ifeq (WINNT
,$(OS_ARCH
))
381 endif # INTERNAL_TOOLS
382 endif # MOZ_PROFILE_USE
383 endif # NO_PROFILE_GUIDED_OPTIMIZE
386 # Does the makefile specifies the internal XPCOM API linkage?
387 ifneq (,$(MOZILLA_INTERNAL_API
)$(LIBXUL_LIBRARY
))
388 DEFINES
+= -DMOZILLA_INTERNAL_API
391 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
392 # building libxul libraries
393 ifdef MOZ_ENABLE_LIBXUL
399 -D_IMPL_NS_COM_OBSOLETE \
407 ifndef MOZ_NATIVE_ZLIB
408 DEFINES
+= -DZLIB_INTERNAL
420 -D_IMPL_NS_COM_OBSOLETE \
430 DEFINES
+= -D_NSPR_BUILD_
435 # Force _all_ exported methods to be |_declspec(dllexport)| when we're
436 # building them into the executable.
438 ifeq (,$(filter-out WINNT WINCE OS2
, $(OS_ARCH
)))
439 ifdef BUILD_STATIC_LIBS
442 -D_IMPL_NS_MSG_BASE \
448 # Flags passed to make-jars.pl
451 -s
$(srcdir) -t
$(topsrcdir
) -z
$(ZIP
) -p
$(MOZILLA_DIR
)/config
/preprocessor.pl \
452 -f
$(MOZ_CHROME_FILE_FORMAT
) \
455 ifdef NO_JAR_AUTO_REG
456 MAKE_JARS_FLAGS
+= -a
459 ifdef USE_EXTENSION_MANIFEST
460 MAKE_JARS_FLAGS
+= -e
463 ifeq ($(OS_TARGET
),WIN95
)
464 MAKE_JARS_FLAGS
+= -l
467 ifneq (,$(filter gtk2
,$(MOZ_WIDGET_TOOLKIT
)))
468 MAKE_JARS_FLAGS
+= -x
472 MAKE_JARS_FLAGS
+= -o
$(OS_ARCH
)
475 TAR_CREATE_FLAGS
= -cvhf
477 ifeq ($(OS_ARCH
),BSD_OS
)
478 TAR_CREATE_FLAGS
= -cvLf
481 ifeq ($(OS_ARCH
),OS2
)
482 TAR_CREATE_FLAGS
= -cvf
486 # Personal makefile customizations go in these optional make include files.
488 MY_CONFIG
:= $(DEPTH
)/config
/myconfig.mk
489 MY_RULES
:= $(DEPTH
)/config
/myrules.mk
492 # Default command macros; can be overridden in <arch>.mk.
495 NFSPWD
= $(CONFIG_TOOLS
)/nfspwd
496 PURIFY
= purify
$(PURIFYOPTIONS
)
497 QUANTIFY
= quantify
$(QUANTIFYOPTIONS
)
499 XPIDL_COMPILE
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/host
/bin
/host_xpidl
$(HOST_BIN_SUFFIX
)
500 XPIDL_LINK
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/host
/bin
/host_xpt_link
$(HOST_BIN_SUFFIX
)
502 XPIDL_COMPILE
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/bin
/xpidl
$(BIN_SUFFIX
)
503 XPIDL_LINK
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/bin
/xpt_link
$(BIN_SUFFIX
)
507 JAVA_GEN_DIR
= _javagen
508 JAVA_DIST_DIR
= $(DEPTH
)/$(JAVA_GEN_DIR
)
509 JAVA_IFACES_PKG_NAME
= org
/mozilla
/interfaces
511 REQ_INCLUDES
= -I
$(srcdir) -I.
$(foreach d
,$(REQUIRES
),-I
$(DIST
)/include/$d) -I
$(DIST
)/include
513 REQ_INCLUDES_SDK
= $(foreach d
,$(REQUIRES
),-I
$(LIBXUL_SDK
)/include/$d) -I
$(LIBXUL_SDK
)/include
516 INCLUDES
= $(LOCAL_INCLUDES
) $(REQ_INCLUDES
) $(REQ_INCLUDES_SDK
) -I
$(PUBLIC
) $(OS_INCLUDES
)
518 ifndef MOZILLA_INTERNAL_API
519 INCLUDES
+= -I
$(LIBXUL_DIST
)/sdk
/include
522 CFLAGS
= $(OS_CFLAGS
)
523 CXXFLAGS
= $(OS_CXXFLAGS
)
524 LDFLAGS
= $(OS_LDFLAGS
) $(MOZ_FIX_LINK_PATHS
)
526 # Allow each module to override the *default* optimization settings
527 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
528 # arguments to --enable-optimize
530 ifeq (1,$(MOZ_OPTIMIZE
))
531 ifdef MODULE_OPTIMIZE_FLAGS
532 CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
533 CXXFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
535 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
536 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
537 endif # MODULE_OPTIMIZE_FLAGS
539 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
540 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
541 endif # MOZ_OPTIMIZE == 1
542 LDFLAGS
+= $(MOZ_OPTIMIZE_LDFLAGS
)
546 HOST_CFLAGS
+= $(HOST_OPTIMIZE_FLAGS
)
549 ifeq (1,$(MOZ_OPTIMIZE
))
550 ifdef MODULE_OPTIMIZE_FLAGS
551 HOST_CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
553 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
554 endif # MODULE_OPTIMIZE_FLAGS
556 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
557 endif # MOZ_OPTIMIZE == 1
559 endif # CROSS_COMPILE
561 ifeq ($(MOZ_OS2_TOOLS
),VACPP
)
562 ifdef USE_STATIC_LIBS
564 else # !USE_STATIC_LIBS
570 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
571 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
572 #// DLL version of the RTL is used...
574 #//------------------------------------------------------------------------
575 ifdef USE_STATIC_LIBS
576 RTL_FLAGS
=-MT
# Statically linked multithreaded RTL
577 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
))
578 ifndef MOZ_NO_DEBUG_RTL
579 RTL_FLAGS
=-MTd
# Statically linked multithreaded MSVC4.0 debug RTL
581 endif # MOZ_DEBUG || NS_TRACE_MALLOC
583 else # !USE_STATIC_LIBS
585 RTL_FLAGS
=-MD
# Dynamically linked, multithreaded RTL
586 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
))
587 ifndef MOZ_NO_DEBUG_RTL
588 RTL_FLAGS
=-MDd
# Dynamically linked, multithreaded MSVC4.0 debug RTL
590 endif # MOZ_DEBUG || NS_TRACE_MALLOC
591 endif # USE_STATIC_LIBS
592 endif # WINNT && !GNU_CC
594 ifeq ($(OS_ARCH
),Darwin
)
595 # Darwin doesn't cross-compile, so just set both types of flags here.
596 HOST_CMFLAGS
+= -fobjc-exceptions
597 HOST_CMMFLAGS
+= -fobjc-exceptions
598 OS_COMPILE_CMFLAGS
+= -fobjc-exceptions
599 OS_COMPILE_CMMFLAGS
+= -fobjc-exceptions
602 COMPILE_CFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(XCFLAGS
) $(PROFILER_CFLAGS
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(CFLAGS
) $(RTL_FLAGS
) $(OS_COMPILE_CFLAGS
)
603 COMPILE_CXXFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(XCFLAGS
) $(PROFILER_CFLAGS
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(CXXFLAGS
) $(RTL_FLAGS
) $(OS_COMPILE_CXXFLAGS
)
604 COMPILE_CMFLAGS
= $(OS_COMPILE_CMFLAGS
)
605 COMPILE_CMMFLAGS
= $(OS_COMPILE_CMMFLAGS
)
608 HOST_CFLAGS
+= $(RTL_FLAGS
)
612 # Name of the binary code directories
616 # We need to know where to find the libraries we
617 # put on the link line for binaries, and should
618 # we link statically or dynamic? Assuming dynamic for now.
620 ifneq ($(MOZ_OS2_TOOLS
),VACPP
)
621 ifneq (WINNT_
,$(OS_ARCH
)_
$(GNU_CC
))
622 ifneq (,$(filter-out WINCE
,$(OS_ARCH
)))
623 LIBS_DIR
= -L
$(DIST
)/bin
-L
$(DIST
)/lib
625 LIBS_DIR
+= -L
$(LIBXUL_SDK
)/bin
-L
$(LIBXUL_SDK
)/lib
631 # Default location of include files
632 IDL_DIR
= $(DIST
)/idl
634 PUBLIC
= $(DIST
)/include/$(MODULE
)
636 PUBLIC
= $(DIST
)/include
639 XPIDL_FLAGS
= -I
$(srcdir) -I
$(IDL_DIR
)
641 XPIDL_FLAGS
+= -I
$(LIBXUL_SDK
)/idl
644 SDK_PUBLIC
= $(DIST
)/sdk
/include
645 SDK_IDL_DIR
= $(DIST
)/sdk
/idl
646 SDK_LIB_DIR
= $(DIST
)/sdk
/lib
647 SDK_BIN_DIR
= $(DIST
)/sdk
/bin
651 MOZ_COMPONENT_LIBS
=$(XPCOM_LIBS
) $(MOZ_COMPONENT_NSPR_LIBS
)
653 ifdef GC_LEAK_DETECTOR
654 XPCOM_LIBS
+= -lboehm
657 ifeq (xpconnect
, $(findstring xpconnect
, $(BUILD_MODULES
)))
658 DEFINES
+= -DXPCONNECT_STANDALONE
661 ifeq ($(OS_ARCH
),OS2
)
668 ifdef USE_ELF_DYNSTR_GC
669 ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
670 ELF_DYNSTR_GC
= $(DEPTH
)/config
/elf-dynstr-gc
675 ifeq ($(OS_ARCH
),Darwin
)
678 export LD_SEG_ADDR_TABLE
=$(shell cd
$(topsrcdir
); pwd
)/config
/prebind-address-table
679 endif # USE_PREBINDING
682 PBBUILD
= NEXT_ROOT
= $(PBBUILD_BIN
)
684 PBBUILD
= $(PBBUILD_BIN
)
686 PBBUILD_SETTINGS
= GCC_VERSION
="$(GCC_VERSION)" SYMROOT
=build ARCHS
="$(OS_TEST)"
688 PBBUILD_SETTINGS
+= SDKROOT
="$(MACOS_SDK_DIR)"
689 endif # MACOS_SDK_DIR
690 ifdef MACOSX_DEPLOYMENT_TARGET
691 export MACOSX_DEPLOYMENT_TARGET
692 PBBUILD_SETTINGS
+= MACOSX_DEPLOYMENT_TARGET
="$(MACOSX_DEPLOYMENT_TARGET)"
693 endif # MACOSX_DEPLOYMENT_TARGET
695 ifeq (2,$(MOZ_OPTIMIZE
))
696 # Only override project defaults if the config specified explicit settings
697 PBBUILD_SETTINGS
+= GCC_MODEL_TUNING
= OPTIMIZATION_CFLAGS
="$(MOZ_OPTIMIZE_FLAGS)"
698 endif # MOZ_OPTIMIZE=2
700 ifeq (1,$(HAS_XCODE_2_1
))
701 # Xcode 2.1 puts its build products in a directory corresponding to the
702 # selected build style/configuration.
703 XCODE_PRODUCT_DIR
= build
/$(BUILDSTYLE
)
705 XCODE_PRODUCT_DIR
= build
706 endif # HAS_XCODE_2_1=1
707 endif # OS_ARCH=Darwin
710 ifdef MOZ_NATIVE_MAKEDEPEND
712 MKDEPEND
= $(CYGWIN_WRAPPER
) $(MOZ_NATIVE_MAKEDEPEND
)
714 MKDEPEND_DIR
= $(CONFIG_TOOLS
)/mkdepend
715 MKDEPEND
= $(CYGWIN_WRAPPER
) $(MKDEPEND_DIR
)/mkdepend
$(BIN_SUFFIX
)
718 # Set link flags according to whether we want a console.
720 ifeq ($(MOZ_WINCONSOLE
),1)
721 ifeq ($(MOZ_OS2_TOOLS
),EMX
)
722 BIN_FLAGS
+= -Zlinker
-PM
:VIO
724 ifeq ($(OS_ARCH
),WINNT
)
726 WIN32_EXE_LDFLAGS
+= -mconsole
728 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:CONSOLE
731 else # MOZ_WINCONSOLE
732 ifeq ($(MOZ_OS2_TOOLS
),VACPP
)
735 ifeq ($(MOZ_OS2_TOOLS
),EMX
)
736 BIN_FLAGS
+= -Zlinker
-PM
:PM
738 ifeq ($(OS_ARCH
),WINNT
)
740 WIN32_EXE_LDFLAGS
+= -mwindows
742 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:WINDOWS
748 # Flags needed to link against the component library
749 ifdef MOZ_COMPONENTLIB
750 MOZ_COMPONENTLIB_EXTRA_DSO_LIBS
= mozcomps xpcom_compat
752 # Tell the linker where NSS is, if we're building crypto
753 ifeq ($(OS_ARCH
),Darwin
)
754 ifeq (,$(findstring crypto
,$(MOZ_META_COMPONENTS
)))
755 MOZ_COMPONENTLIB_EXTRA_LIBS
= $(foreach library
, $(patsubst -l
%, $(LIB_PREFIX
)%$(DLL_SUFFIX
), $(filter -l
%, $(NSS_LIBS
))), -dylib_file @executable_path
/$(library
):$(DIST
)/bin
/$(library
))
760 # If we're building a component on MSVC, we don't want to generate an
761 # import lib, because that import lib will collide with the name of a
762 # static version of the same library.
763 ifeq ($(GNU_LD
)$(OS_ARCH
),WINNT
)
765 LDFLAGS
+= -IMPLIB
:fake.lib
766 DELETE_AFTER_LINK
= fake.lib fake.exp
771 # Include any personal overrides the user might think are needed.
773 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-config.mk
774 -include $(MY_CONFIG
)
776 ######################################################################
777 # Now test variables that might have been set or overridden by $(MY_CONFIG).
779 DEFINES
+= -DOSTYPE
=\"$(OS_CONFIG
)\"
780 DEFINES
+= -DOSARCH
=$(OS_ARCH
)
783 ifdef ENABLE_EAZEL_PROFILER
784 ifndef INTERNAL_TOOLS
785 ifneq ($(LIBRARY_NAME
), xpt
)
786 ifneq (, $(findstring $(shell $(topsrcdir
)/build
/unix
/print-depth-path.sh | awk
-F
/ '{ print $$2; }'), $(MOZ_PROFILE_MODULES
)))
787 PROFILER_CFLAGS
= $(EAZEL_PROFILER_CFLAGS
) -DENABLE_EAZEL_PROFILER
788 PROFILER_LIBS
= $(EAZEL_PROFILER_LIBS
)
794 ######################################################################
796 GARBAGE
+= $(DEPENDENCIES
) $(MKDEPENDENCIES
) $(MKDEPENDENCIES
).bak core
$(wildcard core.
[0-9]*) $(wildcard *.err
) $(wildcard *.pure
) $(wildcard *_pure_
*.o
) Templates.DB
798 ifeq ($(OS_ARCH
),Darwin
)
800 NSDISTMODE
=absolute_symlink
806 NSINSTALL
= $(CYGWIN_WRAPPER
) $(NSINSTALL_BIN
)
808 ifeq (WINNT
,$(CROSS_COMPILE
)$(OS_ARCH
))
809 NSINSTALL
= $(CYGWIN_WRAPPER
) $(MOZ_TOOLS_DIR
)/bin
/nsinstall
811 ifeq (OS2
,$(CROSS_COMPILE
)$(OS_ARCH
))
812 NSINSTALL
= $(MOZ_TOOLS_DIR
)/nsinstall
814 NSINSTALL
= $(CONFIG_TOOLS
)/nsinstall
817 endif # NSINSTALL_BIN
820 ifeq (,$(CROSS_COMPILE
)$(filter-out WINNT OS2
, $(OS_ARCH
)))
821 INSTALL
= $(NSINSTALL
)
823 ifeq ($(NSDISTMODE
),copy
)
824 # copy files, but preserve source mtime
825 INSTALL
= $(NSINSTALL
) -t
827 ifeq ($(NSDISTMODE
),absolute_symlink
)
828 # install using absolute symbolic links
829 ifeq ($(OS_ARCH
),Darwin
)
830 INSTALL
= $(NSINSTALL
) -L
$(PWD
)
832 INSTALL
= $(NSINSTALL
) -L
`$(NFSPWD)`
835 # install using relative symbolic links
836 INSTALL
= $(NSINSTALL
) -R
837 endif # absolute_symlink
841 ifeq (,$(filter-out WINCE
,$(OS_ARCH
)))
842 NSINSTALL
= $(CYGWIN_WRAPPER
) nsinstall
843 INSTALL
= $(CYGWIN_WRAPPER
) nsinstall
846 # Use nsinstall in copy mode to install files on the system
847 SYSINSTALL
= $(NSINSTALL
) -t
849 ifeq ($(OS_ARCH
),WINNT
)
850 ifneq (,$(CYGDRIVE_MOUNT
))
851 export CYGDRIVE_MOUNT
856 # Localization build automation
859 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
860 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
861 # overridden by the command line. (Besides, AB_CD is prettier).
862 AB_CD
= $(MOZ_UI_LOCALE
)
864 EXPAND_LOCALE_SRCDIR
= $(if
$(filter en-US
,$(AB_CD
)),$(topsrcdir
)/$(1)/en-US
,$(L10NBASEDIR
)/$(AB_CD
)/$(subst /locales
,,$(1)))
867 LOCALE_SRCDIR
= $(call EXPAND_LOCALE_SRCDIR
,$(relativesrcdir
))
871 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
874 ifeq (,$(filter WINCE WINNT OS2
,$(OS_ARCH
)))
875 RUN_TEST_PROGRAM
= $(DIST
)/bin
/run-mozilla.sh
882 # Make sure any compiled classes work with at least JVM 1.4
883 JAVAC_FLAGS
+= -source
1.4