Bug 459878, fix up errors for 3.0.5 -> 3.1b2 MU test
[mozilla-1.9.git] / config / config.mk
blob881255742ba18d0fcba7fec4d37808de1b95d804
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
13 # License.
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.
22 # Contributor(s):
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 *****
40 # config.mk
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.
52 ifndef topsrcdir
53 topsrcdir = $(DEPTH)
54 endif
56 ifndef INCLUDED_AUTOCONF_MK
57 include $(DEPTH)/config/autoconf.mk
58 endif
59 ifndef INCLUDED_INSURE_MK
60 ifdef MOZ_INSURIFYING
61 include $(topsrcdir)/config/insure.mk
62 endif
63 endif
65 # Sanity check some variables
66 CHECK_VARS := \
67 XPI_NAME \
68 LIBRARY_NAME \
69 MODULE \
70 DEPTH \
71 SHORT_LIBNAME \
72 XPI_PKGNAME \
73 INSTALL_EXTENSION_ID \
74 $(NULL)
76 # checks for internal spaces or trailing spaces in the variable
77 # named by $x
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)
95 else
96 MAKE_JARS_TARGET = $(FINAL_TARGET)
97 endif
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.
105 VERSION_NUMBER = 50
107 ifeq ($(HOST_OS_ARCH),WINNT)
108 win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
109 BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix
110 else
111 win_srcdir := $(srcdir)
112 BUILD_TOOLS = $(topsrcdir)/build/unix
113 endif
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
121 else
122 LD := $(CC)
123 endif
124 endif
125 ifeq ($(OS_ARCH),BeOS)
126 BEOS_ADDON_WORKAROUND = 1
127 endif
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/-.*//')
141 endif
143 endif
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
155 _DEBUG_CFLAGS :=
156 _DEBUG_LDFLAGS :=
158 ifndef MOZ_DEBUG
159 # global debugging is disabled
160 # check if it was explicitly enabled for this module
161 ifneq (, $(findstring $(MODULE), $(MOZ_DEBUG_MODULES)))
162 MOZ_DEBUG:=1
163 endif
164 else
165 # global debugging is enabled
166 # check if it was explicitly disabled for this module
167 ifneq (, $(findstring ^$(MODULE), $(MOZ_DEBUG_MODULES)))
168 MOZ_DEBUG:=
169 endif
170 endif
172 ifdef MOZ_DEBUG
173 _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
174 XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
175 else
176 _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
177 XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
178 endif
180 # determine if -g should be passed to the compiler, based on
181 # the current module, and the value of MOZ_DBGRINFO_MODULES
183 ifdef MOZ_DEBUG
184 MOZ_DBGRINFO_MODULES += ALL_MODULES
185 pattern := ALL_MODULES ^ALL_MODULES
186 else
187 MOZ_DBGRINFO_MODULES += ^ALL_MODULES
188 pattern := ALL_MODULES ^ALL_MODULES
189 endif
191 ifdef MODULE
192 # our current Makefile specifies a module name - add it to our pattern
193 pattern += $(MODULE) ^$(MODULE)
194 endif
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
201 # in the list)
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)
210 else
211 ifeq ($(first_match), ^$(MODULE))
212 # the user specified explicitly that this module
213 # should not be compiled with -g (nothing to do)
214 else
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)
220 else
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)
224 endif
225 endif
226 endif
227 endif
230 # append debug flags
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_)
238 ifdef MOZ_DEBUG
239 ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
240 OS_CFLAGS += -FR
241 OS_CXXFLAGS += -FR
242 endif
243 else # ! MOZ_DEBUG
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
252 endif
254 ifdef MOZ_QUANTIFY
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
263 endif
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
274 endif # MOZ_DEBUG
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
283 _ENABLE_PIC=1
284 endif
285 ifneq (,$(FORCE_SHARED_LIB)$(FORCE_USE_PIC))
286 _ENABLE_PIC=1
287 endif
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
292 _ENABLE_PIC=1
293 endif
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.
299 ifdef IS_COMPONENT
300 ifdef EXPORT_LIBRARY
301 ifneq (,$(BUILD_STATIC_LIBS))
302 ifdef MODULE_NAME
303 DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
304 FORCE_STATIC_LIB=1
305 endif
306 endif
307 endif
308 endif
310 # Determine if module being compiled is destined
311 # to be merged into libxul
313 ifdef MOZ_ENABLE_LIBXUL
314 ifdef LIBXUL_LIBRARY
315 ifdef IS_COMPONENT
316 ifdef MODULE_NAME
317 DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
318 else
319 $(error Component makefile does not specify MODULE_NAME.)
320 endif
321 endif
322 FORCE_STATIC_LIB=1
323 _ENABLE_PIC=1
324 SHORT_LIBNAME=
325 endif
326 endif
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
330 # build option.
332 ifdef XPI_NAME
333 _ENABLE_PIC=1
334 ifdef IS_COMPONENT
335 EXPORT_LIBRARY=
336 FORCE_STATIC_LIB=
337 FORCE_SHARED_LIB=1
338 endif
339 endif
342 # Disable PIC if necessary
345 ifndef _ENABLE_PIC
346 DSO_CFLAGS=
347 ifeq ($(OS_ARCH)_$(HAVE_GCC3_ABI),Darwin_1)
348 DSO_PIC_CFLAGS=-mdynamic-no-pic
349 else
350 DSO_PIC_CFLAGS=
351 endif
352 endif
354 # This comes from configure
355 ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
356 NO_PROFILE_GUIDED_OPTIMIZE = 1
357 endif
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))
368 AR_FLAGS += -LTCG
369 endif
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))
379 AR_FLAGS += -LTCG
380 endif
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
389 endif
391 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
392 # building libxul libraries
393 ifdef MOZ_ENABLE_LIBXUL
394 ifdef LIBXUL_LIBRARY
395 DEFINES += \
396 -D_IMPL_NS_COM \
397 -DEXPORT_XPT_API \
398 -DEXPORT_XPTC_API \
399 -D_IMPL_NS_COM_OBSOLETE \
400 -D_IMPL_NS_GFX \
401 -D_IMPL_NS_WIDGET \
402 -DIMPL_XREAPI \
403 -DIMPL_NS_NET \
404 -DIMPL_THEBES \
405 $(NULL)
407 ifndef MOZ_NATIVE_ZLIB
408 DEFINES += -DZLIB_INTERNAL
409 endif
410 endif
411 endif
413 ifdef MINIMO
414 ifdef LIBXUL_LIBRARY
415 DEFINES += \
416 -D_IMPL_NS_COM \
417 -DEXPORT_XPT_API \
418 -DEXPORT_XPTC_API \
419 -DEXPORT_XPTI_API \
420 -D_IMPL_NS_COM_OBSOLETE \
421 -D_IMPL_NS_GFX \
422 -D_IMPL_NS_WIDGET \
423 -DIMPL_XREAPI \
424 -DIMPL_NS_NET \
425 -DIMPL_THEBES \
426 $(NULL)
427 endif
429 ifdef WINCE
430 DEFINES += -D_NSPR_BUILD_
431 endif
433 endif
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
440 DEFINES += \
441 -D_IMPL_NS_GFX \
442 -D_IMPL_NS_MSG_BASE \
443 -D_IMPL_NS_WIDGET \
444 $(NULL)
445 endif
446 endif
448 # Flags passed to make-jars.pl
450 MAKE_JARS_FLAGS = \
451 -s $(srcdir) -t $(topsrcdir) -z $(ZIP) -p $(MOZILLA_DIR)/config/preprocessor.pl \
452 -f $(MOZ_CHROME_FILE_FORMAT) \
453 $(NULL)
455 ifdef NO_JAR_AUTO_REG
456 MAKE_JARS_FLAGS += -a
457 endif
459 ifdef USE_EXTENSION_MANIFEST
460 MAKE_JARS_FLAGS += -e
461 endif
463 ifeq ($(OS_TARGET),WIN95)
464 MAKE_JARS_FLAGS += -l
465 endif
467 ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
468 MAKE_JARS_FLAGS += -x
469 endif
471 ifdef CROSS_COMPILE
472 MAKE_JARS_FLAGS += -o $(OS_ARCH)
473 endif
475 TAR_CREATE_FLAGS = -cvhf
477 ifeq ($(OS_ARCH),BSD_OS)
478 TAR_CREATE_FLAGS = -cvLf
479 endif
481 ifeq ($(OS_ARCH),OS2)
482 TAR_CREATE_FLAGS = -cvf
483 endif
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.
494 CCC = $(CXX)
495 NFSPWD = $(CONFIG_TOOLS)/nfspwd
496 PURIFY = purify $(PURIFYOPTIONS)
497 QUANTIFY = quantify $(QUANTIFYOPTIONS)
498 ifdef CROSS_COMPILE
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)
501 else
502 XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
503 XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
504 endif
506 # Java macros
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
512 ifdef LIBXUL_SDK
513 REQ_INCLUDES_SDK = $(foreach d,$(REQUIRES),-I$(LIBXUL_SDK)/include/$d) -I$(LIBXUL_SDK)/include
514 endif
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
520 endif
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
529 ifdef MOZ_OPTIMIZE
530 ifeq (1,$(MOZ_OPTIMIZE))
531 ifdef MODULE_OPTIMIZE_FLAGS
532 CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
533 CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
534 else
535 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
536 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
537 endif # MODULE_OPTIMIZE_FLAGS
538 else
539 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
540 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
541 endif # MOZ_OPTIMIZE == 1
542 LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
543 endif # MOZ_OPTIMIZE
545 ifdef CROSS_COMPILE
546 HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS)
547 else
548 ifdef MOZ_OPTIMIZE
549 ifeq (1,$(MOZ_OPTIMIZE))
550 ifdef MODULE_OPTIMIZE_FLAGS
551 HOST_CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
552 else
553 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
554 endif # MODULE_OPTIMIZE_FLAGS
555 else
556 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
557 endif # MOZ_OPTIMIZE == 1
558 endif # MOZ_OPTIMIZE
559 endif # CROSS_COMPILE
561 ifeq ($(MOZ_OS2_TOOLS),VACPP)
562 ifdef USE_STATIC_LIBS
563 RTL_FLAGS += -Gd-
564 else # !USE_STATIC_LIBS
565 RTL_FLAGS += -Gd+
566 endif
567 endif
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
580 endif
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
589 endif
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
600 endif
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)
607 ifndef CROSS_COMPILE
608 HOST_CFLAGS += $(RTL_FLAGS)
609 endif
612 # Name of the binary code directories
614 # Override defaults
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
624 ifdef LIBXUL_SDK
625 LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
626 endif
627 endif
628 endif
629 endif
631 # Default location of include files
632 IDL_DIR = $(DIST)/idl
633 ifdef MODULE
634 PUBLIC = $(DIST)/include/$(MODULE)
635 else
636 PUBLIC = $(DIST)/include
637 endif
639 XPIDL_FLAGS = -I$(srcdir) -I$(IDL_DIR)
640 ifdef LIBXUL_SDK
641 XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
642 endif
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
649 DEPENDENCIES = .md
651 MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
653 ifdef GC_LEAK_DETECTOR
654 XPCOM_LIBS += -lboehm
655 endif
657 ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES)))
658 DEFINES += -DXPCONNECT_STANDALONE
659 endif
661 ifeq ($(OS_ARCH),OS2)
662 ELF_DYNSTR_GC = echo
663 else
664 ELF_DYNSTR_GC = :
665 endif
667 ifndef CROSS_COMPILE
668 ifdef USE_ELF_DYNSTR_GC
669 ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
670 ELF_DYNSTR_GC = $(DEPTH)/config/elf-dynstr-gc
671 endif
672 endif
673 endif
675 ifeq ($(OS_ARCH),Darwin)
676 ifdef USE_PREBINDING
677 export LD_PREBIND=1
678 export LD_SEG_ADDR_TABLE=$(shell cd $(topsrcdir); pwd)/config/prebind-address-table
679 endif # USE_PREBINDING
680 ifdef NEXT_ROOT
681 export NEXT_ROOT
682 PBBUILD = NEXT_ROOT= $(PBBUILD_BIN)
683 else # NEXT_ROOT
684 PBBUILD = $(PBBUILD_BIN)
685 endif # NEXT_ROOT
686 PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
687 ifdef MACOS_SDK_DIR
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
694 ifdef MOZ_OPTIMIZE
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
699 endif # MOZ_OPTIMIZE
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)
704 else
705 XCODE_PRODUCT_DIR = build
706 endif # HAS_XCODE_2_1=1
707 endif # OS_ARCH=Darwin
710 ifdef MOZ_NATIVE_MAKEDEPEND
711 MKDEPEND_DIR =
712 MKDEPEND = $(CYGWIN_WRAPPER) $(MOZ_NATIVE_MAKEDEPEND)
713 else
714 MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend
715 MKDEPEND = $(CYGWIN_WRAPPER) $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
716 endif
718 # Set link flags according to whether we want a console.
719 ifdef MOZ_WINCONSOLE
720 ifeq ($(MOZ_WINCONSOLE),1)
721 ifeq ($(MOZ_OS2_TOOLS),EMX)
722 BIN_FLAGS += -Zlinker -PM:VIO
723 endif
724 ifeq ($(OS_ARCH),WINNT)
725 ifdef GNU_CC
726 WIN32_EXE_LDFLAGS += -mconsole
727 else
728 WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE
729 endif
730 endif
731 else # MOZ_WINCONSOLE
732 ifeq ($(MOZ_OS2_TOOLS),VACPP)
733 LDFLAGS += -PM:PM
734 endif
735 ifeq ($(MOZ_OS2_TOOLS),EMX)
736 BIN_FLAGS += -Zlinker -PM:PM
737 endif
738 ifeq ($(OS_ARCH),WINNT)
739 ifdef GNU_CC
740 WIN32_EXE_LDFLAGS += -mwindows
741 else
742 WIN32_EXE_LDFLAGS += -SUBSYSTEM:WINDOWS
743 endif
744 endif
745 endif
746 endif
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))
756 endif
757 endif
758 endif
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)
764 ifdef IS_COMPONENT
765 LDFLAGS += -IMPLIB:fake.lib
766 DELETE_AFTER_LINK = fake.lib fake.exp
767 endif
768 endif
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)
782 # For profiling
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)
789 endif
790 endif
791 endif
792 endif
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)
799 ifndef NSDISTMODE
800 NSDISTMODE=absolute_symlink
801 endif
802 PWD := $(shell pwd)
803 endif
805 ifdef NSINSTALL_BIN
806 NSINSTALL = $(CYGWIN_WRAPPER) $(NSINSTALL_BIN)
807 else
808 ifeq (WINNT,$(CROSS_COMPILE)$(OS_ARCH))
809 NSINSTALL = $(CYGWIN_WRAPPER) $(MOZ_TOOLS_DIR)/bin/nsinstall
810 else
811 ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
812 NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
813 else
814 NSINSTALL = $(CONFIG_TOOLS)/nsinstall
815 endif # OS2
816 endif # WINNT
817 endif # NSINSTALL_BIN
820 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
821 INSTALL = $(NSINSTALL)
822 else
823 ifeq ($(NSDISTMODE),copy)
824 # copy files, but preserve source mtime
825 INSTALL = $(NSINSTALL) -t
826 else
827 ifeq ($(NSDISTMODE),absolute_symlink)
828 # install using absolute symbolic links
829 ifeq ($(OS_ARCH),Darwin)
830 INSTALL = $(NSINSTALL) -L $(PWD)
831 else
832 INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
833 endif # Darwin
834 else
835 # install using relative symbolic links
836 INSTALL = $(NSINSTALL) -R
837 endif # absolute_symlink
838 endif # copy
839 endif # WINNT/OS2
841 ifeq (,$(filter-out WINCE,$(OS_ARCH)))
842 NSINSTALL = $(CYGWIN_WRAPPER) nsinstall
843 INSTALL = $(CYGWIN_WRAPPER) nsinstall
844 endif
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
852 endif
853 endif
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)))
866 ifdef relativesrcdir
867 LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
868 endif
870 ifdef LOCALE_SRCDIR
871 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
872 endif
874 ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
875 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
876 endif
879 # Java macros
882 # Make sure any compiled classes work with at least JVM 1.4
883 JAVAC_FLAGS += -source 1.4
885 ifdef MOZ_DEBUG
886 JAVAC_FLAGS += -g
887 endif