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 \
80 # checks for internal spaces or trailing spaces in the variable
82 check-variable
= $(if
$(filter-out 0 1,$(words $($(x
))z
)),$(error Spaces are not allowed in
$(x
)))
84 $(foreach x
,$(CHECK_VARS
),$(check-variable
))
86 # FINAL_TARGET specifies the location into which we copy end-user-shipped
87 # build products (typelibs, components, chrome).
89 # It will usually be the well-loved $(DIST)/bin, today, but can also be an
90 # XPI-contents staging directory for ambitious and right-thinking extensions.
91 FINAL_TARGET
= $(if
$(XPI_NAME
),$(DIST
)/xpi-stage
/$(XPI_NAME
),$(DIST
)/bin
)
93 # MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in
94 # the jar format, make-jars leaves behind a directory structure that's not
95 # needed in $(FINAL_TARGET). For both, flat, and symlink, the directory
96 # structure contains the chrome, so leave it in $(FINAL_TARGET).
97 ifeq (jar
,$(MOZ_CHROME_FILE_FORMAT
))
98 MAKE_JARS_TARGET
= $(if
$(XPI_NAME
),$(FINAL_TARGET
).stage
,$(DIST
)/chrome-stage
)
100 MAKE_JARS_TARGET
= $(FINAL_TARGET
)
104 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
105 # Since the longest of these is 5 characters without the suffix,
106 # be sure to not set VERSION_NUMBER to anything longer than 3
107 # characters for Win16's sake.
111 ifeq ($(HOST_OS_ARCH
),WINNT
)
112 win_srcdir
:= $(subst $(topsrcdir
),$(WIN_TOP_SRC
),$(srcdir))
113 BUILD_TOOLS
= $(WIN_TOP_SRC
)/build
/unix
115 win_srcdir
:= $(srcdir)
116 BUILD_TOOLS
= $(topsrcdir
)/build
/unix
119 CONFIG_TOOLS
= $(MOZ_BUILD_ROOT
)/config
120 AUTOCONF_TOOLS
= $(topsrcdir
)/build
/autoconf
122 ifeq ($(OS_ARCH
),QNX
)
123 ifeq ($(OS_TARGET
),NTO
)
124 LD
:= qcc
-Vgcc_ntox86
-nostdlib
129 ifeq ($(OS_ARCH
),BeOS
)
130 BEOS_ADDON_WORKAROUND
= 1
134 # Strip off the excessively long version numbers on these platforms,
135 # but save the version to allow multiple versions of the same base
136 # platform to be built in the same tree.
138 ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS
,$(OS_ARCH
)))
139 OS_RELEASE
:= $(basename $(OS_RELEASE
))
141 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
142 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
143 OS_VERS
:= $(suffix $(OS_RELEASE
))
144 OS_VERSION
:= $(shell echo
$(OS_VERS
) | sed
's/-.*//')
149 OS_CONFIG
:= $(OS_ARCH
)$(OS_RELEASE
)
151 FINAL_LINK_LIBS
= $(DEPTH
)/config
/final-link-libs
152 FINAL_LINK_COMPS
= $(DEPTH
)/config
/final-link-comps
153 FINAL_LINK_COMP_NAMES
= $(DEPTH
)/config
/final-link-comp-names
155 MOZ_UNICHARUTIL_LIBS
= $(LIBXUL_DIST
)/lib
/$(LIB_PREFIX
)unicharutil_s.
$(LIB_SUFFIX
)
156 MOZ_WIDGET_SUPPORT_LIBS
= $(DIST
)/lib
/$(LIB_PREFIX
)widgetsupport_s.
$(LIB_SUFFIX
)
159 ifneq ($(OS_ARCH
),WINNT
)
160 JEMALLOC_LIBS
= $(MKSHLIB_FORCE_ALL
) $(call EXPAND_LIBNAME
,jemalloc
) $(MKSHLIB_UNFORCE_ALL
)
164 # determine debug-related options
169 # global debugging is disabled
170 # check if it was explicitly enabled for this module
171 ifneq (, $(findstring $(MODULE
), $(MOZ_DEBUG_MODULES
)))
175 # global debugging is enabled
176 # check if it was explicitly disabled for this module
177 ifneq (, $(findstring ^
$(MODULE
), $(MOZ_DEBUG_MODULES
)))
183 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
184 XULPPFLAGS
+= $(MOZ_DEBUG_ENABLE_DEFS
)
186 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
187 XULPPFLAGS
+= $(MOZ_DEBUG_DISABLE_DEFS
)
190 # determine if -g should be passed to the compiler, based on
191 # the current module, and the value of MOZ_DBGRINFO_MODULES
194 MOZ_DBGRINFO_MODULES
+= ALL_MODULES
195 pattern
:= ALL_MODULES ^ALL_MODULES
197 MOZ_DBGRINFO_MODULES
+= ^ALL_MODULES
198 pattern
:= ALL_MODULES ^ALL_MODULES
202 # our current Makefile specifies a module name - add it to our pattern
203 pattern
+= $(MODULE
) ^
$(MODULE
)
206 # start by finding the first relevant module name
207 # (remember that the order of the module names in MOZ_DBGRINFO_MODULES
208 # is reversed from the order the user specified to configure -
209 # this allows the user to put general names at the beginning
210 # of the list, and to override them with explicit module names later
213 first_match
:=$(firstword $(filter $(pattern
), $(MOZ_DBGRINFO_MODULES
)))
215 ifeq ($(first_match
), $(MODULE
))
216 # the user specified explicitly that
217 # this module should be compiled with -g
218 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
219 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
221 ifeq ($(first_match
), ^
$(MODULE
))
222 # the user specified explicitly that this module
223 # should not be compiled with -g (nothing to do)
225 ifeq ($(first_match
), ALL_MODULES
)
226 # the user didn't mention this module explicitly,
227 # but wanted all modules to be compiled with -g
228 _DEBUG_CFLAGS
+= $(MOZ_DEBUG_FLAGS
)
229 _DEBUG_LDFLAGS
+= $(MOZ_DEBUG_LDFLAGS
)
231 ifeq ($(first_match
), ^ALL_MODULES
)
232 # the user didn't mention this module explicitly,
233 # but wanted all modules to be compiled without -g (nothing to do)
241 # (these might have been above when processing MOZ_DBGRINFO_MODULES)
242 OS_CFLAGS
+= $(_DEBUG_CFLAGS
)
243 OS_CXXFLAGS
+= $(_DEBUG_CFLAGS
)
244 OS_LDFLAGS
+= $(_DEBUG_LDFLAGS
)
246 # MOZ_PROFILE equivs for win32
247 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
249 ifneq (,$(MOZ_BROWSE_INFO
)$(MOZ_BSCFILE
))
255 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
256 # Used for generating an optimized build with debugging symbols.
257 # Used in the Windows nightlies to generate symbols for crash reporting.
258 ifdef MOZ_DEBUG_SYMBOLS
259 OS_CXXFLAGS
+= -Zi
-UDEBUG
-DNDEBUG
260 OS_CFLAGS
+= -Zi
-UDEBUG
-DNDEBUG
261 OS_LDFLAGS
+= -DEBUG
-OPT
:REF
-OPT
:nowin98
265 # -FIXED:NO is needed for Quantify to work, but it increases the size
266 # of executables, so only use it if building for Quantify.
267 WIN32_EXE_LDFLAGS
+= -FIXED
:NO
269 # We need -OPT:NOICF to prevent identical methods from being merged together.
270 # Otherwise, Quantify doesn't know which method was actually called when it's
271 # showing you the profile.
272 OS_LDFLAGS
+= -OPT
:NOICF
276 # Handle trace-malloc in optimized builds.
277 # No opt to give sane callstacks.
279 ifdef NS_TRACE_MALLOC
280 MOZ_OPTIMIZE_FLAGS
=-Zi
-Od
-UDEBUG
-DNDEBUG
281 OS_LDFLAGS
= -DEBUG
-PDB
:NONE
-OPT
:REF
-OPT
:nowin98
282 endif # NS_TRACE_MALLOC
285 endif # WINNT && !GNU_CC
288 # Build using PIC by default
289 # Do not use PIC if not building a shared lib (see exceptions below)
292 ifndef BUILD_STATIC_LIBS
295 ifneq (,$(FORCE_SHARED_LIB
)$(FORCE_USE_PIC
))
299 # In Firefox, all components are linked into either libxul or the static
300 # meta-component, and should be compiled with PIC.
301 ifdef MOZ_META_COMPONENT
305 # If module is going to be merged into the nsStaticModule,
306 # make sure that the entry points are translated and
307 # the module is built static.
311 ifneq (,$(BUILD_STATIC_LIBS
))
313 DEFINES
+= -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT
=1
320 # Determine if module being compiled is destined
321 # to be merged into libxul
323 ifdef MOZ_ENABLE_LIBXUL
327 DEFINES
+= -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT
=1
329 $(error Component makefile does not specify MODULE_NAME.
)
338 # If we are building this component into an extension/xulapp, it cannot be
339 # statically linked. In the future we may want to add a xulapp meta-component
352 # Disable PIC if necessary
357 ifeq ($(OS_ARCH
)_
$(HAVE_GCC3_ABI
),Darwin_1
)
358 DSO_PIC_CFLAGS
=-mdynamic-no-pic
364 ifndef SHARED_LIBRARY_NAME
366 SHARED_LIBRARY_NAME
=$(LIBRARY_NAME
)
370 ifndef STATIC_LIBRARY_NAME
372 STATIC_LIBRARY_NAME
=$(LIBRARY_NAME
)
376 # This comes from configure
377 ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
378 NO_PROFILE_GUIDED_OPTIMIZE
= 1
381 # Enable profile-based feedback
382 ifndef NO_PROFILE_GUIDED_OPTIMIZE
383 ifdef MOZ_PROFILE_GENERATE
384 # No sense in profiling tools
385 ifndef INTERNAL_TOOLS
386 OS_CFLAGS
+= $(PROFILE_GEN_CFLAGS
)
387 OS_CXXFLAGS
+= $(PROFILE_GEN_CFLAGS
)
388 OS_LDFLAGS
+= $(PROFILE_GEN_LDFLAGS
)
389 ifeq (WINNT
,$(OS_ARCH
))
392 endif # INTERNAL_TOOLS
393 endif # MOZ_PROFILE_GENERATE
395 ifdef MOZ_PROFILE_USE
396 ifndef INTERNAL_TOOLS
397 OS_CFLAGS
+= $(PROFILE_USE_CFLAGS
)
398 OS_CXXFLAGS
+= $(PROFILE_USE_CFLAGS
)
399 OS_LDFLAGS
+= $(PROFILE_USE_LDFLAGS
)
400 ifeq (WINNT
,$(OS_ARCH
))
403 endif # INTERNAL_TOOLS
404 endif # MOZ_PROFILE_USE
405 endif # NO_PROFILE_GUIDED_OPTIMIZE
408 # Does the makefile specifies the internal XPCOM API linkage?
409 ifneq (,$(MOZILLA_INTERNAL_API
)$(LIBXUL_LIBRARY
))
410 DEFINES
+= -DMOZILLA_INTERNAL_API
413 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
414 # building libxul libraries
415 ifdef MOZ_ENABLE_LIBXUL
421 -D_IMPL_NS_COM_OBSOLETE \
429 ifndef MOZ_NATIVE_ZLIB
430 DEFINES
+= -DZLIB_INTERNAL
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
452 -f
$(MOZ_CHROME_FILE_FORMAT
) \
455 ifdef USE_EXTENSION_MANIFEST
456 MAKE_JARS_FLAGS
+= -e
460 MAKE_JARS_FLAGS
+= --both-manifests
463 TAR_CREATE_FLAGS
= -cvhf
465 ifeq ($(OS_ARCH
),BSD_OS
)
466 TAR_CREATE_FLAGS
= -cvLf
469 ifeq ($(OS_ARCH
),OS2
)
470 TAR_CREATE_FLAGS
= -cvf
474 # Personal makefile customizations go in these optional make include files.
476 MY_CONFIG
:= $(DEPTH
)/config
/myconfig.mk
477 MY_RULES
:= $(DEPTH
)/config
/myrules.mk
480 # Default command macros; can be overridden in <arch>.mk.
483 NFSPWD
= $(CONFIG_TOOLS
)/nfspwd
484 PURIFY
= purify
$(PURIFYOPTIONS
)
485 QUANTIFY
= quantify
$(QUANTIFYOPTIONS
)
487 XPIDL_COMPILE
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/host
/bin
/host_xpidl
$(HOST_BIN_SUFFIX
)
488 XPIDL_LINK
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/host
/bin
/host_xpt_link
$(HOST_BIN_SUFFIX
)
490 XPIDL_COMPILE
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/bin
/xpidl
$(BIN_SUFFIX
)
491 XPIDL_LINK
= $(CYGWIN_WRAPPER
) $(LIBXUL_DIST
)/bin
/xpt_link
$(BIN_SUFFIX
)
495 JAVA_GEN_DIR
= _javagen
496 JAVA_DIST_DIR
= $(DEPTH
)/$(JAVA_GEN_DIR
)
497 JAVA_IFACES_PKG_NAME
= org
/mozilla
/interfaces
499 REQ_INCLUDES
= -I
$(srcdir) -I.
$(foreach d
,$(REQUIRES
),-I
$(DIST
)/include/$d) -I
$(DIST
)/include
501 REQ_INCLUDES_SDK
= $(foreach d
,$(REQUIRES
),-I
$(LIBXUL_SDK
)/include/$d) -I
$(LIBXUL_SDK
)/include
504 INCLUDES
= $(LOCAL_INCLUDES
) $(REQ_INCLUDES
) $(REQ_INCLUDES_SDK
) -I
$(PUBLIC
) $(OS_INCLUDES
)
506 ifndef MOZILLA_INTERNAL_API
507 INCLUDES
+= -I
$(LIBXUL_DIST
)/sdk
/include
510 include $(topsrcdir
)/config
/static-checking-config.mk
512 CFLAGS
= $(OS_CFLAGS
)
513 CXXFLAGS
= $(OS_CXXFLAGS
)
514 LDFLAGS
= $(OS_LDFLAGS
) $(MOZ_FIX_LINK_PATHS
)
516 # Allow each module to override the *default* optimization settings
517 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
518 # arguments to --enable-optimize
520 ifeq (1,$(MOZ_OPTIMIZE
))
521 ifdef MODULE_OPTIMIZE_FLAGS
522 CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
523 CXXFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
525 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
526 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
527 endif # MODULE_OPTIMIZE_FLAGS
529 CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
530 CXXFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
531 endif # MOZ_OPTIMIZE == 1
532 LDFLAGS
+= $(MOZ_OPTIMIZE_LDFLAGS
)
536 HOST_CFLAGS
+= $(HOST_OPTIMIZE_FLAGS
)
539 ifeq (1,$(MOZ_OPTIMIZE
))
540 ifdef MODULE_OPTIMIZE_FLAGS
541 HOST_CFLAGS
+= $(MODULE_OPTIMIZE_FLAGS
)
543 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
544 endif # MODULE_OPTIMIZE_FLAGS
546 HOST_CFLAGS
+= $(MOZ_OPTIMIZE_FLAGS
)
547 endif # MOZ_OPTIMIZE == 1
549 endif # CROSS_COMPILE
552 ifeq ($(OS_ARCH
)_
$(GNU_CC
),WINNT_
)
553 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
554 #// DLL version of the RTL is used...
556 #//------------------------------------------------------------------------
557 ifdef USE_STATIC_LIBS
558 RTL_FLAGS
=-MT
# Statically linked multithreaded RTL
559 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
))
560 ifndef MOZ_NO_DEBUG_RTL
561 RTL_FLAGS
=-MTd
# Statically linked multithreaded MSVC4.0 debug RTL
563 endif # MOZ_DEBUG || NS_TRACE_MALLOC
565 else # !USE_STATIC_LIBS
567 RTL_FLAGS
=-MD
# Dynamically linked, multithreaded RTL
568 ifneq (,$(MOZ_DEBUG
)$(NS_TRACE_MALLOC
))
569 ifndef MOZ_NO_DEBUG_RTL
570 RTL_FLAGS
=-MDd
# Dynamically linked, multithreaded MSVC4.0 debug RTL
572 endif # MOZ_DEBUG || NS_TRACE_MALLOC
573 endif # USE_STATIC_LIBS
574 endif # WINNT && !GNU_CC
576 ifeq ($(OS_ARCH
),Darwin
)
577 # Darwin doesn't cross-compile, so just set both types of flags here.
578 HOST_CMFLAGS
+= -fobjc-exceptions
579 HOST_CMMFLAGS
+= -fobjc-exceptions
580 OS_COMPILE_CMFLAGS
+= -fobjc-exceptions
581 OS_COMPILE_CMMFLAGS
+= -fobjc-exceptions
584 COMPILE_CFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(XCFLAGS
) $(PROFILER_CFLAGS
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(CFLAGS
) $(RTL_FLAGS
) $(OS_COMPILE_CFLAGS
)
585 COMPILE_CXXFLAGS
= $(VISIBILITY_FLAGS
) $(DEFINES
) $(INCLUDES
) $(XCFLAGS
) $(PROFILER_CFLAGS
) $(DSO_CFLAGS
) $(DSO_PIC_CFLAGS
) $(CXXFLAGS
) $(RTL_FLAGS
) $(OS_COMPILE_CXXFLAGS
)
586 COMPILE_CMFLAGS
= $(OS_COMPILE_CMFLAGS
)
587 COMPILE_CMMFLAGS
= $(OS_COMPILE_CMMFLAGS
)
590 HOST_CFLAGS
+= $(RTL_FLAGS
)
594 # Name of the binary code directories
598 # We need to know where to find the libraries we
599 # put on the link line for binaries, and should
600 # we link statically or dynamic? Assuming dynamic for now.
602 ifneq (WINNT_
,$(OS_ARCH
)_
$(GNU_CC
))
603 ifneq (,$(filter-out WINCE
,$(OS_ARCH
)))
604 LIBS_DIR
= -L
$(DIST
)/bin
-L
$(DIST
)/lib
606 LIBS_DIR
+= -L
$(LIBXUL_SDK
)/bin
-L
$(LIBXUL_SDK
)/lib
611 # Default location of include files
612 IDL_DIR
= $(DIST
)/idl
614 PUBLIC
= $(DIST
)/include/$(MODULE
)
616 PUBLIC
= $(DIST
)/include
619 XPIDL_FLAGS
= -I
$(srcdir) -I
$(IDL_DIR
)
621 XPIDL_FLAGS
+= -I
$(LIBXUL_SDK
)/idl
624 SDK_PUBLIC
= $(DIST
)/sdk
/include
625 SDK_IDL_DIR
= $(DIST
)/sdk
/idl
626 SDK_LIB_DIR
= $(DIST
)/sdk
/lib
627 SDK_BIN_DIR
= $(DIST
)/sdk
/bin
631 MOZ_COMPONENT_LIBS
=$(XPCOM_LIBS
) $(MOZ_COMPONENT_NSPR_LIBS
)
633 ifdef GC_LEAK_DETECTOR
634 XPCOM_LIBS
+= -lboehm
637 ifeq (xpconnect
, $(findstring xpconnect
, $(BUILD_MODULES
)))
638 DEFINES
+= -DXPCONNECT_STANDALONE
641 ifeq ($(OS_ARCH
),OS2
)
648 ifdef USE_ELF_DYNSTR_GC
649 ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
650 ELF_DYNSTR_GC
= $(DEPTH
)/config
/elf-dynstr-gc
655 ifeq ($(OS_ARCH
),Darwin
)
658 PBBUILD
= NEXT_ROOT
= $(PBBUILD_BIN
)
660 PBBUILD
= $(PBBUILD_BIN
)
662 PBBUILD_SETTINGS
= GCC_VERSION
="$(GCC_VERSION)" SYMROOT
=build ARCHS
="$(OS_TEST)"
664 PBBUILD_SETTINGS
+= SDKROOT
="$(MACOS_SDK_DIR)"
665 endif # MACOS_SDK_DIR
666 ifdef MACOSX_DEPLOYMENT_TARGET
667 export MACOSX_DEPLOYMENT_TARGET
668 PBBUILD_SETTINGS
+= MACOSX_DEPLOYMENT_TARGET
="$(MACOSX_DEPLOYMENT_TARGET)"
669 endif # MACOSX_DEPLOYMENT_TARGET
671 ifeq (2,$(MOZ_OPTIMIZE
))
672 # Only override project defaults if the config specified explicit settings
673 PBBUILD_SETTINGS
+= GCC_MODEL_TUNING
= OPTIMIZATION_CFLAGS
="$(MOZ_OPTIMIZE_FLAGS)"
674 endif # MOZ_OPTIMIZE=2
676 ifeq (1,$(HAS_XCODE_2_1
))
677 # Xcode 2.1 puts its build products in a directory corresponding to the
678 # selected build style/configuration.
679 XCODE_PRODUCT_DIR
= build
/$(BUILDSTYLE
)
681 XCODE_PRODUCT_DIR
= build
682 endif # HAS_XCODE_2_1=1
683 endif # OS_ARCH=Darwin
686 ifdef MOZ_NATIVE_MAKEDEPEND
688 MKDEPEND
= $(CYGWIN_WRAPPER
) $(MOZ_NATIVE_MAKEDEPEND
)
690 MKDEPEND_DIR
= $(CONFIG_TOOLS
)/mkdepend
691 MKDEPEND
= $(CYGWIN_WRAPPER
) $(MKDEPEND_DIR
)/mkdepend
$(BIN_SUFFIX
)
694 # Set link flags according to whether we want a console.
696 ifeq ($(MOZ_WINCONSOLE
),1)
697 ifeq ($(OS_ARCH
),OS2
)
698 BIN_FLAGS
+= -Zlinker
-PM
:VIO
700 ifeq ($(OS_ARCH
),WINNT
)
702 WIN32_EXE_LDFLAGS
+= -mconsole
704 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:CONSOLE
707 else # MOZ_WINCONSOLE
708 ifeq ($(OS_ARCH
),OS2
)
709 BIN_FLAGS
+= -Zlinker
-PM
:PM
711 ifeq ($(OS_ARCH
),WINNT
)
713 WIN32_EXE_LDFLAGS
+= -mwindows
715 WIN32_EXE_LDFLAGS
+= -SUBSYSTEM
:WINDOWS
721 # Flags needed to link against the component library
722 ifdef MOZ_COMPONENTLIB
723 MOZ_COMPONENTLIB_EXTRA_DSO_LIBS
= mozcomps xpcom_compat
725 # Tell the linker where NSS is, if we're building crypto
726 ifeq ($(OS_ARCH
),Darwin
)
727 ifeq (,$(findstring crypto
,$(MOZ_META_COMPONENTS
)))
728 MOZ_COMPONENTLIB_EXTRA_LIBS
= $(foreach library
, $(patsubst -l
%, $(LIB_PREFIX
)%$(DLL_SUFFIX
), $(filter -l
%, $(NSS_LIBS
))), -dylib_file @executable_path
/$(library
):$(DIST
)/bin
/$(library
))
733 # If we're building a component on MSVC, we don't want to generate an
734 # import lib, because that import lib will collide with the name of a
735 # static version of the same library.
736 ifeq ($(GNU_LD
)$(OS_ARCH
),WINNT
)
738 LDFLAGS
+= -IMPLIB
:fake.lib
739 DELETE_AFTER_LINK
= fake.lib fake.exp
744 # Include any personal overrides the user might think are needed.
746 -include $(topsrcdir
)/$(MOZ_BUILD_APP
)/app-config.mk
747 -include $(MY_CONFIG
)
749 ######################################################################
750 # Now test variables that might have been set or overridden by $(MY_CONFIG).
752 DEFINES
+= -DOSTYPE
=\"$(OS_CONFIG
)\"
753 DEFINES
+= -DOSARCH
=$(OS_ARCH
)
756 ifdef ENABLE_EAZEL_PROFILER
757 ifndef INTERNAL_TOOLS
758 ifneq ($(LIBRARY_NAME
), xpt
)
759 ifneq (, $(findstring $(shell $(topsrcdir
)/build
/unix
/print-depth-path.sh | awk
-F
/ '{ print $$2; }'), $(MOZ_PROFILE_MODULES
)))
760 PROFILER_CFLAGS
= $(EAZEL_PROFILER_CFLAGS
) -DENABLE_EAZEL_PROFILER
761 PROFILER_LIBS
= $(EAZEL_PROFILER_LIBS
)
767 ######################################################################
769 GARBAGE
+= $(DEPENDENCIES
) $(MKDEPENDENCIES
) $(MKDEPENDENCIES
).bak core
$(wildcard core.
[0-9]*) $(wildcard *.err
) $(wildcard *.pure
) $(wildcard *_pure_
*.o
) Templates.DB
771 ifeq ($(OS_ARCH
),Darwin
)
773 NSDISTMODE
=absolute_symlink
779 NSINSTALL
= $(CYGWIN_WRAPPER
) $(NSINSTALL_BIN
)
781 ifeq (WINNT
,$(CROSS_COMPILE
)$(OS_ARCH
))
782 NSINSTALL
= $(CYGWIN_WRAPPER
) $(MOZ_TOOLS_DIR
)/bin
/nsinstall
784 ifeq (OS2
,$(CROSS_COMPILE
)$(OS_ARCH
))
785 NSINSTALL
= $(MOZ_TOOLS_DIR
)/nsinstall
787 NSINSTALL
= $(CONFIG_TOOLS
)/nsinstall
790 endif # NSINSTALL_BIN
793 ifeq (,$(CROSS_COMPILE
)$(filter-out WINNT OS2
, $(OS_ARCH
)))
794 INSTALL
= $(NSINSTALL
)
796 ifeq ($(NSDISTMODE
),copy
)
797 # copy files, but preserve source mtime
798 INSTALL
= $(NSINSTALL
) -t
800 ifeq ($(NSDISTMODE
),absolute_symlink
)
801 # install using absolute symbolic links
802 ifeq ($(OS_ARCH
),Darwin
)
803 INSTALL
= $(NSINSTALL
) -L
$(PWD
)
805 INSTALL
= $(NSINSTALL
) -L
`$(NFSPWD)`
808 # install using relative symbolic links
809 INSTALL
= $(NSINSTALL
) -R
810 endif # absolute_symlink
814 ifeq (,$(filter-out WINCE
,$(OS_ARCH
)))
815 NSINSTALL
= $(CYGWIN_WRAPPER
) nsinstall
816 INSTALL
= $(CYGWIN_WRAPPER
) nsinstall
819 # Use nsinstall in copy mode to install files on the system
820 SYSINSTALL
= $(NSINSTALL
) -t
822 ifeq ($(OS_ARCH
),WINNT
)
823 ifneq (,$(CYGDRIVE_MOUNT
))
824 export CYGDRIVE_MOUNT
829 # Localization build automation
832 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
833 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
834 # overridden by the command line. (Besides, AB_CD is prettier).
835 AB_CD
= $(MOZ_UI_LOCALE
)
838 L10NBASEDIR
= $(error L10NBASEDIR not defined by configure
)
841 EXPAND_LOCALE_SRCDIR
= $(if
$(filter en-US
,$(AB_CD
)),$(topsrcdir
)/$(1)/en-US
,$(L10NBASEDIR
)/$(AB_CD
)/$(subst /locales
,,$(1)))
844 LOCALE_SRCDIR
= $(call EXPAND_LOCALE_SRCDIR
,$(relativesrcdir
))
848 # if LOCALE_MERGEDIR is set, use mergedir first, then the localization,
850 ifdef LOCALE_MERGEDIR
851 MAKE_JARS_FLAGS
+= -c
$(LOCALE_MERGEDIR
)/$(subst /locales
,,$(relativesrcdir
))
853 MAKE_JARS_FLAGS
+= -c
$(LOCALE_SRCDIR
)
854 ifdef LOCALE_MERGEDIR
855 MAKE_JARS_FLAGS
+= -c
$(topsrcdir
)/$(relativesrcdir
)/en-US
859 ifeq (,$(filter WINCE WINNT OS2
,$(OS_ARCH
)))
860 RUN_TEST_PROGRAM
= $(DIST
)/bin
/run-mozilla.sh
863 ifeq ($(OS_ARCH
),OS2
)
864 RUN_TEST_PROGRAM
= $(topsrcdir
)/testing
/xpcshell
/test_os2.cmd
"$(DIST)"
871 # Make sure any compiled classes work with at least JVM 1.4
872 JAVAC_FLAGS
+= -source
1.4
879 DIRS
+= $(foreach tier
,$(TIERS
),$(tier_
$(tier
)_dirs
))
880 STATIC_DIRS
+= $(foreach tier
,$(TIERS
),$(tier_
$(tier
)_staticdirs
))