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
67 # Sanity check some variables
75 INSTALL_EXTENSION_ID \
78 # checks for internal spaces or trailing spaces in the variable
80 check-variable
= $(if
$(filter-out 0 1,$(words $($(x
))z
)),$(error Spaces are not allowed in
$(x
)))
82 $(foreach x
,$(CHECK_VARS
),$(check-variable
))
84 # FINAL_TARGET specifies the location into which we copy end-user-shipped
85 # build products (typelibs, components, chrome).
87 # It will usually be the well-loved $(DIST)/bin, today, but can also be an
88 # XPI-contents staging directory for ambitious and right-thinking extensions.
89 FINAL_TARGET
= $(if
$(XPI_NAME
),$(DIST
)/xpi-stage
/$(XPI_NAME
),$(DIST
)/bin
)
91 # MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in
92 # the jar format, make-jars leaves behind a directory structure that's not
93 # needed in $(FINAL_TARGET). For both, flat, and symlink, the directory
94 # structure contains the chrome, so leave it in $(FINAL_TARGET).
95 ifeq (jar
,$(MOZ_CHROME_FILE_FORMAT
))
96 MAKE_JARS_TARGET
= $(if
$(XPI_NAME
),$(FINAL_TARGET
).stage
,$(DIST
)/chrome-stage
)
98 MAKE_JARS_TARGET
= $(FINAL_TARGET
)
102 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
103 # Since the longest of these is 5 characters without the suffix,
104 # be sure to not set VERSION_NUMBER to anything longer than 3
105 # characters for Win16's sake.
109 ifeq ($(HOST_OS_ARCH
),WINNT
)
110 win_srcdir
:= $(subst $(topsrcdir
),$(WIN_TOP_SRC
),$(srcdir))
111 BUILD_TOOLS
= $(WIN_TOP_SRC
)/build
/unix
113 win_srcdir
:= $(srcdir)
114 BUILD_TOOLS
= $(topsrcdir
)/build
/unix
117 CONFIG_TOOLS
= $(MOZ_BUILD_ROOT
)/config
118 AUTOCONF_TOOLS
= $(topsrcdir
)/build
/autoconf
120 ifeq ($(OS_ARCH
),QNX
)
121 ifeq ($(OS_TARGET
),NTO
)
122 LD
:= qcc
-Vgcc_ntox86
-nostdlib
127 ifeq ($(OS_ARCH
),BeOS
)
128 BEOS_ADDON_WORKAROUND
= 1
132 # Strip off the excessively long version numbers on these platforms,
133 # but save the version to allow multiple versions of the same base
134 # platform to be built in the same tree.
136 ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS
,$(OS_ARCH
)))
137 OS_RELEASE
:= $(basename $(OS_RELEASE
))
139 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
140 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
141 OS_VERS
:= $(suffix $(OS_RELEASE
))
142 OS_VERSION
:= $(shell echo
$(OS_VERS
) | sed
's/-.*//')
147 OS_CONFIG
:= $(OS_ARCH
)$(OS_RELEASE
)
149 FINAL_LINK_LIBS
= $(DEPTH
)/config
/final-link-libs
150 FINAL_LINK_COMPS
= $(DEPTH
)/config
/final-link-comps
151 FINAL_LINK_COMP_NAMES
= $(DEPTH
)/config
/final-link-comp-names
153 MOZ_UNICHARUTIL_LIBS
= $(LIBXUL_DIST
)/lib
/$(LIB_PREFIX
)unicharutil_s.
$(LIB_SUFFIX
)
154 MOZ_WIDGET_SUPPORT_LIBS
= $(DIST
)/lib
/$(LIB_PREFIX
)widgetsupport_s.
$(LIB_SUFFIX
)
157 ifneq ($(OS_ARCH
),WINNT
)
158 JEMALLOC_LIBS
= $(MKSHLIB_FORCE_ALL
) $(call EXPAND_LIBNAME
,jemalloc
) $(MKSHLIB_UNFORCE_ALL
)
162 # determine debug-related options
167 # global debugging is disabled
168 # check if it was explicitly enabled for this module
169 ifneq (, $(findstring $(MODULE
), $(MOZ_DEBUG_MODULES
)))
173 # global debugging is enabled
174 # check if it was explicitly disabled for this module
175 ifneq (, $(findstring ^
$(MODULE
), $(MOZ_DEBUG_MODULES
)))
181 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
182 XULPPFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
184 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
185 XULPPFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
188 # determine if -g should be passed to the compiler, based on
189 # the current module, and the value of MOZ_DBGRINFO_MODULES
192 MOZ_DBGRINFO_MODULES
+= ALL_MODULES
193 pattern
:= ALL_MODULES ^ALL_MODULES
195 MOZ_DBGRINFO_MODULES
+= ^ALL_MODULES
196 pattern
:= ALL_MODULES ^ALL_MODULES
200 # our current Makefile specifies a module name - add it to our pattern
201 pattern
+= $(MODULE
) ^
$(MODULE
)
204 # start by finding the first relevant module name
205 # (remember that the order of the module names in MOZ_DBGRINFO_MODULES
206 # is reversed from the order the user specified to configure -
207 # this allows the user to put general names at the beginning
208 # of the list, and to override them with explicit module names later
211 first_match
:=$(firstword $(filter $(pattern
), $(MOZ_DBGRINFO_MODULES
)))
213 ifeq ($(first_match
), $(MODULE
))
214 # the user specified explicitly that
215 # this module should be compiled with -g
216 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
217 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
219 ifeq ($(first_match
), ^
$(MODULE
))
220 # the user specified explicitly that this module
221 # should not be compiled with -g (nothing to do)
223 ifeq ($(first_match
), ALL_MODULES
)
224 # the user didn't mention this module explicitly,
225 # but wanted all modules to be compiled with -g
226 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
227 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
229 ifeq ($(first_match
), ^ALL_MODULES
)
230 # the user didn't mention this module explicitly,
231 # but wanted all modules to be compiled without -g (nothing to do)
239 # (these might have been above when processing MOZ_DBGRINFO_MODULES)
240 OS_CFLAGS
+= $(_DEBUG_CFLAGS
)
241 OS_CXXFLAGS
+= $(_DEBUG_CFLAGS
)
242 OS_LDFLAGS
+= $(_DEBUG_LDFLAGS
)
244 # MOZ_PROFILE equivs for win32
245 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
247 ifneq (,$(MOZ_BROWSE_INFO
)$(MOZ_BSCFILE
))
253 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
254 # Used for generating an optimized build with debugging symbols.
255 # Used in the Windows nightlies to generate symbols for crash reporting.
256 ifdef MOZ_DEBUG_SYMBOLS
257 OS_CXXFLAGS
+= -Zi
-UDEBUG
-DNDEBUG
258 OS_CFLAGS
+= -Zi
-UDEBUG
-DNDEBUG
259 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
-OPT
:nowin98
263 # -FIXED:NO is needed for Quantify to work, but it increases the size
264 # of executables, so only use it if building for Quantify.
265 WIN32_EXE_LDFLAGS
+= -FIXED
:NO
267 # We need -OPT:NOICF to prevent identical methods from being merged together.
268 # Otherwise, Quantify doesn't know which method was actually called when it's
269 # showing you the profile.
270 OS_LDFLAGS
+= -OPT
:NOICF
274 # Handle trace-malloc in optimized builds.
275 # No opt to give sane callstacks.
277 ifdef NS_TRACE_MALLOC
278 MOZ_OPTIMIZE_FLAGS
=-Zi
-Od
-UDEBUG
-DNDEBUG
279 OS_LDFLAGS
= -DEBUG
-PDB
:NONE
-OPT
:REF
-OPT
:nowin98
280 endif # NS_TRACE_MALLOC
283 endif # WINNT && !GNU_CC
286 # Build using PIC by default
287 # Do not use PIC if not building a shared lib (see exceptions below)
290 ifndef BUILD_STATIC_LIBS
293 ifneq (,$(FORCE_SHARED_LIB
)$(FORCE_USE_PIC
))
297 # In Firefox, all components are linked into either libxul or the static
298 # meta-component, and should be compiled with PIC.
299 ifdef MOZ_META_COMPONENT
303 # If module is going to be merged into the nsStaticModule,
304 # make sure that the entry points are translated and
305 # the module is built static.
309 ifneq (,$(BUILD_STATIC_LIBS
))
311 DEFINES
+= -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT
=1
318 # Determine if module being compiled is destined
319 # to be merged into libxul
321 ifdef MOZ_ENABLE_LIBXUL
325 DEFINES
+= -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT
=1
327 $(error Component makefile does not specify MODULE_NAME.
)
336 # If we are building this component into an extension/xulapp, it cannot be
337 # statically linked. In the future we may want to add a xulapp meta-component
350 # Disable PIC if necessary
355 ifeq ($(OS_ARCH
)_
$(HAVE_GCC3_ABI
),Darwin_1
)
356 DSO_PIC_CFLAGS
=-mdynamic-no-pic
362 # This comes from configure
363 ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
364 NO_PROFILE_GUIDED_OPTIMIZE
= 1
367 # Enable profile-based feedback
368 ifndef NO_PROFILE_GUIDED_OPTIMIZE
369 ifdef MOZ_PROFILE_GENERATE
370 # No sense in profiling tools
371 ifndef INTERNAL_TOOLS
372 OS_CFLAGS
+= $(PROFILE_GEN_CFLAGS
)
373 OS_CXXFLAGS
+= $(PROFILE_GEN_CFLAGS
)
374 OS_LDFLAGS
+= $(PROFILE_GEN_LDFLAGS
)
375 ifeq (WINNT
,$(OS_ARCH
))
378 endif # INTERNAL_TOOLS
379 endif # MOZ_PROFILE_GENERATE
381 ifdef MOZ_PROFILE_USE
382 ifndef INTERNAL_TOOLS
383 OS_CFLAGS
+= $(PROFILE_USE_CFLAGS
)
384 OS_CXXFLAGS
+= $(PROFILE_USE_CFLAGS
)
385 OS_LDFLAGS
+= $(PROFILE_USE_LDFLAGS
)
386 ifeq (WINNT
,$(OS_ARCH
))
389 endif # INTERNAL_TOOLS
390 endif # MOZ_PROFILE_USE
391 endif # NO_PROFILE_GUIDED_OPTIMIZE
394 # Does the makefile specifies the internal XPCOM API linkage?
395 ifneq (,$(MOZILLA_INTERNAL_API
)$(LIBXUL_LIBRARY
))
396 DEFINES
+= -DMOZILLA_INTERNAL_API
399 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
400 # building libxul libraries
401 ifdef MOZ_ENABLE_LIBXUL
407 -D_IMPL_NS_COM_OBSOLETE \
415 ifndef MOZ_NATIVE_ZLIB
416 DEFINES
+= -DZLIB_INTERNAL
421 # Force _all_ exported methods to be |_declspec(dllexport)| when we're
422 # building them into the executable.
424 ifeq (,$(filter-out WINNT WINCE OS2
, $(OS_ARCH
)))
425 ifdef BUILD_STATIC_LIBS
428 -D_IMPL_NS_MSG_BASE \
434 # Flags passed to make-jars.pl
438 -f
$(MOZ_CHROME_FILE_FORMAT
) \
441 ifdef USE_EXTENSION_MANIFEST
442 MAKE_JARS_FLAGS
+= -e
446 MAKE_JARS_FLAGS
+= --both-manifests
449 TAR_CREATE_FLAGS
= -cvhf
451 ifeq ($(OS_ARCH
),BSD_OS
)
452 TAR_CREATE_FLAGS
= -cvLf
455 ifeq ($(OS_ARCH
),OS2
)
456 TAR_CREATE_FLAGS
= -cvf
460 # Personal makefile customizations go in these optional make include files.
462 MY_CONFIG
:= $(DEPTH
)/config
/myconfig.mk
463 MY_RULES
:= $(DEPTH
)/config
/myrules.mk
466 # Default command macros; can be overridden in <arch>.mk.
469 NFSPWD
= $(CONFIG_TOOLS
)/nfspwd
470 PURIFY
= purify
$(PURIFYOPTIONS
)
471 QUANTIFY
= quantify
$(QUANTIFYOPTIONS
)
473 XPIDL_COMPILE
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/host
/bin
/host_xpidl
$(HOST_BIN_SUFFIX
)
474 XPIDL_LINK
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/host
/bin
/host_xpt_link
$(HOST_BIN_SUFFIX
)
476 XPIDL_COMPILE
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/bin
/xpidl
$(BIN_SUFFIX
)
477 XPIDL_LINK
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/bin
/xpt_link
$(BIN_SUFFIX
)
481 JAVA_GEN_DIR
= _javagen
482 JAVA_DIST_DIR
= $(DEPTH
)/$(JAVA_GEN_DIR
)
483 JAVA_IFACES_PKG_NAME
= org
/mozilla
/interfaces
485 REQ_INCLUDES
= -I
$(srcdir) -I.
$(foreach d
,$(REQUIRES
),-I
$(DIST
)/include/$d) -I
$(DIST
)/include
487 REQ_INCLUDES_SDK
= $(foreach d
,$(REQUIRES
),-I
$(LIBXUL_SDK
)/include/$d) -I
$(LIBXUL_SDK
)/include
490 INCLUDES
= $(LOCAL_INCLUDES
) $(REQ_INCLUDES
) $(REQ_INCLUDES_SDK
) -I
$(PUBLIC
) $(OS_INCLUDES
)
492 ifndef MOZILLA_INTERNAL_API
493 INCLUDES
+= -I
$(LIBXUL_DIST
)/sdk
/include
496 include $(topsrcdir
)/config
/static-checking-config.mk
498 CFLAGS
= $(OS_CFLAGS
)
499 CXXFLAGS
= $(OS_CXXFLAGS
)
500 LDFLAGS
= $(OS_LDFLAGS
) $(MOZ_FIX_LINK_PATHS
)
502 # Allow each module to override the *default* optimization settings
503 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
504 # arguments to --enable-optimize
506 ifeq (1,$(MOZ_OPTIMIZE
))
507 ifdef MODULE_OPTIMIZE_FLAGS
508 CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
509 CXXFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
511 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
512 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
513 endif # MODULE_OPTIMIZE_FLAGS
515 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
516 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
517 endif # MOZ_OPTIMIZE == 1
518 LDFLAGS
+= $(MOZ_OPTIMIZE_LDFLAGS
)
522 HOST_CFLAGS
+= $(HOST_OPTIMIZE_FLAGS
)
525 ifeq (1,$(MOZ_OPTIMIZE
))
526 ifdef MODULE_OPTIMIZE_FLAGS
527 HOST_CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
529 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
530 endif # MODULE_OPTIMIZE_FLAGS
532 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
533 endif # MOZ_OPTIMIZE == 1
535 endif # CROSS_COMPILE
538 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
539 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
540 #// DLL version of the RTL is used...
542 #//------------------------------------------------------------------------
543 ifdef USE_STATIC_LIBS
544 RTL_FLAGS
=-MT
# Statically linked multithreaded RTL
545 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
))
546 ifndef MOZ_NO_DEBUG_RTL
547 RTL_FLAGS
=-MTd
# Statically linked multithreaded MSVC4.0 debug RTL
549 endif # MOZ_DEBUG || NS_TRACE_MALLOC
551 else # !USE_STATIC_LIBS
553 RTL_FLAGS
=-MD
# Dynamically linked, multithreaded RTL
554 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
))
555 ifndef MOZ_NO_DEBUG_RTL
556 RTL_FLAGS
=-MDd
# Dynamically linked, multithreaded MSVC4.0 debug RTL
558 endif # MOZ_DEBUG || NS_TRACE_MALLOC
559 endif # USE_STATIC_LIBS
560 endif # WINNT && !GNU_CC
562 ifeq ($(OS_ARCH
),Darwin
)
563 # Darwin doesn't cross-compile, so just set both types of flags here.
564 HOST_CMFLAGS
+= -fobjc-exceptions
565 HOST_CMMFLAGS
+= -fobjc-exceptions
566 OS_COMPILE_CMFLAGS
+= -fobjc-exceptions
567 OS_COMPILE_CMMFLAGS
+= -fobjc-exceptions
570 COMPILE_CFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(XCFLAGS
) $(PROFILER_CFLAGS
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(CFLAGS
) $(RTL_FLAGS
) $(OS_COMPILE_CFLAGS
)
571 COMPILE_CXXFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(XCFLAGS
) $(PROFILER_CFLAGS
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(CXXFLAGS
) $(RTL_FLAGS
) $(OS_COMPILE_CXXFLAGS
)
572 COMPILE_CMFLAGS
= $(OS_COMPILE_CMFLAGS
)
573 COMPILE_CMMFLAGS
= $(OS_COMPILE_CMMFLAGS
)
576 HOST_CFLAGS
+= $(RTL_FLAGS
)
580 # Name of the binary code directories
584 # We need to know where to find the libraries we
585 # put on the link line for binaries, and should
586 # we link statically or dynamic? Assuming dynamic for now.
588 ifneq (WINNT_
,$(OS_ARCH
)_
$(GNU_CC
))
589 ifneq (,$(filter-out WINCE
,$(OS_ARCH
)))
590 LIBS_DIR
= -L
$(DIST
)/bin
-L
$(DIST
)/lib
592 LIBS_DIR
+= -L
$(LIBXUL_SDK
)/bin
-L
$(LIBXUL_SDK
)/lib
597 # Default location of include files
598 IDL_DIR
= $(DIST
)/idl
600 PUBLIC
= $(DIST
)/include/$(MODULE
)
602 PUBLIC
= $(DIST
)/include
605 XPIDL_FLAGS
= -I
$(srcdir) -I
$(IDL_DIR
)
607 XPIDL_FLAGS
+= -I
$(LIBXUL_SDK
)/idl
610 SDK_PUBLIC
= $(DIST
)/sdk
/include
611 SDK_IDL_DIR
= $(DIST
)/sdk
/idl
612 SDK_LIB_DIR
= $(DIST
)/sdk
/lib
613 SDK_BIN_DIR
= $(DIST
)/sdk
/bin
617 MOZ_COMPONENT_LIBS
=$(XPCOM_LIBS
) $(MOZ_COMPONENT_NSPR_LIBS
)
619 ifdef GC_LEAK_DETECTOR
620 XPCOM_LIBS
+= -lboehm
623 ifeq (xpconnect
, $(findstring xpconnect
, $(BUILD_MODULES
)))
624 DEFINES
+= -DXPCONNECT_STANDALONE
627 ifeq ($(OS_ARCH
),OS2
)
634 ifdef USE_ELF_DYNSTR_GC
635 ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
636 ELF_DYNSTR_GC
= $(DEPTH
)/config
/elf-dynstr-gc
641 ifeq ($(OS_ARCH
),Darwin
)
644 PBBUILD
= NEXT_ROOT
= $(PBBUILD_BIN
)
646 PBBUILD
= $(PBBUILD_BIN
)
648 PBBUILD_SETTINGS
= GCC_VERSION
="$(GCC_VERSION)" SYMROOT
=build ARCHS
="$(OS_TEST)"
650 PBBUILD_SETTINGS
+= SDKROOT
="$(MACOS_SDK_DIR)"
651 endif # MACOS_SDK_DIR
652 ifdef MACOSX_DEPLOYMENT_TARGET
653 export MACOSX_DEPLOYMENT_TARGET
654 PBBUILD_SETTINGS
+= MACOSX_DEPLOYMENT_TARGET
="$(MACOSX_DEPLOYMENT_TARGET)"
655 endif # MACOSX_DEPLOYMENT_TARGET
657 ifeq (2,$(MOZ_OPTIMIZE
))
658 # Only override project defaults if the config specified explicit settings
659 PBBUILD_SETTINGS
+= GCC_MODEL_TUNING
= OPTIMIZATION_CFLAGS
="$(MOZ_OPTIMIZE_FLAGS)"
660 endif # MOZ_OPTIMIZE=2
662 ifeq (1,$(HAS_XCODE_2_1
))
663 # Xcode 2.1 puts its build products in a directory corresponding to the
664 # selected build style/configuration.
665 XCODE_PRODUCT_DIR
= build
/$(BUILDSTYLE
)
667 XCODE_PRODUCT_DIR
= build
668 endif # HAS_XCODE_2_1=1
669 endif # OS_ARCH=Darwin
672 ifdef MOZ_NATIVE_MAKEDEPEND
674 MKDEPEND
= $(CYGWIN_WRAPPER
) $(MOZ_NATIVE_MAKEDEPEND
)
676 MKDEPEND_DIR
= $(CONFIG_TOOLS
)/mkdepend
677 MKDEPEND
= $(CYGWIN_WRAPPER
) $(MKDEPEND_DIR
)/mkdepend
$(BIN_SUFFIX
)
680 # Set link flags according to whether we want a console.
682 ifeq ($(MOZ_WINCONSOLE
),1)
683 ifeq ($(OS_ARCH
),OS2
)
684 BIN_FLAGS
+= -Zlinker
-PM
:VIO
686 ifeq ($(OS_ARCH
),WINNT
)
688 WIN32_EXE_LDFLAGS
+= -mconsole
690 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:CONSOLE
693 else # MOZ_WINCONSOLE
694 ifeq ($(OS_ARCH
),OS2
)
695 BIN_FLAGS
+= -Zlinker
-PM
:PM
697 ifeq ($(OS_ARCH
),WINNT
)
699 WIN32_EXE_LDFLAGS
+= -mwindows
701 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:WINDOWS
707 # Flags needed to link against the component library
708 ifdef MOZ_COMPONENTLIB
709 MOZ_COMPONENTLIB_EXTRA_DSO_LIBS
= mozcomps xpcom_compat
711 # Tell the linker where NSS is, if we're building crypto
712 ifeq ($(OS_ARCH
),Darwin
)
713 ifeq (,$(findstring crypto
,$(MOZ_META_COMPONENTS
)))
714 MOZ_COMPONENTLIB_EXTRA_LIBS
= $(foreach library
, $(patsubst -l
%, $(LIB_PREFIX
)%$(DLL_SUFFIX
), $(filter -l
%, $(NSS_LIBS
))), -dylib_file @executable_path
/$(library
):$(DIST
)/bin
/$(library
))
719 # If we're building a component on MSVC, we don't want to generate an
720 # import lib, because that import lib will collide with the name of a
721 # static version of the same library.
722 ifeq ($(GNU_LD
)$(OS_ARCH
),WINNT
)
724 LDFLAGS
+= -IMPLIB
:fake.lib
725 DELETE_AFTER_LINK
= fake.lib fake.exp
730 # Include any personal overrides the user might think are needed.
732 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-config.mk
733 -include $(MY_CONFIG
)
735 ######################################################################
736 # Now test variables that might have been set or overridden by $(MY_CONFIG).
738 DEFINES
+= -DOSTYPE
=\"$(OS_CONFIG
)\"
739 DEFINES
+= -DOSARCH
=$(OS_ARCH
)
742 ifdef ENABLE_EAZEL_PROFILER
743 ifndef INTERNAL_TOOLS
744 ifneq ($(LIBRARY_NAME
), xpt
)
745 ifneq (, $(findstring $(shell $(topsrcdir
)/build
/unix
/print-depth-path.sh | awk
-F
/ '{ print $$2; }'), $(MOZ_PROFILE_MODULES
)))
746 PROFILER_CFLAGS
= $(EAZEL_PROFILER_CFLAGS
) -DENABLE_EAZEL_PROFILER
747 PROFILER_LIBS
= $(EAZEL_PROFILER_LIBS
)
753 ######################################################################
755 GARBAGE
+= $(DEPENDENCIES
) $(MKDEPENDENCIES
) $(MKDEPENDENCIES
).bak core
$(wildcard core.
[0-9]*) $(wildcard *.err
) $(wildcard *.pure
) $(wildcard *_pure_
*.o
) Templates.DB
757 ifeq ($(OS_ARCH
),Darwin
)
759 NSDISTMODE
=absolute_symlink
765 NSINSTALL
= $(CYGWIN_WRAPPER
) $(NSINSTALL_BIN
)
767 ifeq (WINNT
,$(CROSS_COMPILE
)$(OS_ARCH
))
768 NSINSTALL
= $(CYGWIN_WRAPPER
) $(MOZ_TOOLS_DIR
)/bin
/nsinstall
770 ifeq (OS2
,$(CROSS_COMPILE
)$(OS_ARCH
))
771 NSINSTALL
= $(MOZ_TOOLS_DIR
)/nsinstall
773 NSINSTALL
= $(CONFIG_TOOLS
)/nsinstall
776 endif # NSINSTALL_BIN
779 ifeq (,$(CROSS_COMPILE
)$(filter-out WINNT OS2
, $(OS_ARCH
)))
780 INSTALL
= $(NSINSTALL
)
782 ifeq ($(NSDISTMODE
),copy
)
783 # copy files, but preserve source mtime
784 INSTALL
= $(NSINSTALL
) -t
786 ifeq ($(NSDISTMODE
),absolute_symlink
)
787 # install using absolute symbolic links
788 ifeq ($(OS_ARCH
),Darwin
)
789 INSTALL
= $(NSINSTALL
) -L
$(PWD
)
791 INSTALL
= $(NSINSTALL
) -L
`$(NFSPWD)`
794 # install using relative symbolic links
795 INSTALL
= $(NSINSTALL
) -R
796 endif # absolute_symlink
800 ifeq (,$(filter-out WINCE
,$(OS_ARCH
)))
801 NSINSTALL
= $(CYGWIN_WRAPPER
) nsinstall
802 INSTALL
= $(CYGWIN_WRAPPER
) nsinstall
805 # Use nsinstall in copy mode to install files on the system
806 SYSINSTALL
= $(NSINSTALL
) -t
808 ifeq ($(OS_ARCH
),WINNT
)
809 ifneq (,$(CYGDRIVE_MOUNT
))
810 export CYGDRIVE_MOUNT
815 # Localization build automation
818 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
819 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
820 # overridden by the command line. (Besides, AB_CD is prettier).
821 AB_CD
= $(MOZ_UI_LOCALE
)
824 L10NBASEDIR
= $(error L10NBASEDIR not defined by configure
)
827 EXPAND_LOCALE_SRCDIR
= $(if
$(filter en-US
,$(AB_CD
)),$(topsrcdir
)/$(1)/en-US
,$(L10NBASEDIR
)/$(AB_CD
)/$(subst /locales
,,$(1)))
830 LOCALE_SRCDIR
= $(call EXPAND_LOCALE_SRCDIR
,$(relativesrcdir
))
834 # if LOCALE_MERGEDIR is set, use mergedir first, then the localization,
836 ifdef LOCALE_MERGEDIR
837 MAKE_JARS_FLAGS
+= -c
$(LOCALE_MERGEDIR
)/$(subst /locales
,,$(relativesrcdir
))
839 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
840 ifdef LOCALE_MERGEDIR
841 MAKE_JARS_FLAGS
+= -c
$(topsrcdir
)/$(relativesrcdir
)/en-US
845 ifeq (,$(filter WINCE WINNT OS2
,$(OS_ARCH
)))
846 RUN_TEST_PROGRAM
= $(DIST
)/bin
/run-mozilla.sh
853 # Make sure any compiled classes work with at least JVM 1.4
854 JAVAC_FLAGS
+= -source
1.4
861 DIRS
+= $(foreach tier
,$(TIERS
),$(tier_
$(tier
)_dirs
))
862 STATIC_DIRS
+= $(foreach tier
,$(TIERS
),$(tier_
$(tier
)_staticdirs
))