Bug 588735 - Mirror glass caption buttons for rtl windows. r=roc, a=blocking-betaN.
[mozilla-central.git] / config / config.mk
blobc73303a4885fc35c1f4e0b8cd579fe716be05b5a
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 #ifdef INCLUDED_CONFIG_MK
49 #$(error Don't include config.mk twice!)
50 #endif
51 INCLUDED_CONFIG_MK = 1
53 EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
55 ifndef topsrcdir
56 topsrcdir = $(DEPTH)
57 endif
59 ifndef INCLUDED_AUTOCONF_MK
60 include $(DEPTH)/config/autoconf.mk
61 endif
63 COMMA = ,
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 SHARED_LIBRARY_NAME \
75 STATIC_LIBRARY_NAME \
76 $(NULL)
78 # checks for internal spaces or trailing spaces in the variable
79 # named by $x
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 core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
86 nullstr :=
87 space :=$(nullstr) # EOL
89 core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1)))))))
91 # FINAL_TARGET specifies the location into which we copy end-user-shipped
92 # build products (typelibs, components, chrome).
94 # It will usually be the well-loved $(DIST)/bin, today, but can also be an
95 # XPI-contents staging directory for ambitious and right-thinking extensions.
96 FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)
98 ifdef XPI_NAME
99 DEFINES += -DXPI_NAME=$(XPI_NAME)
100 endif
102 # MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in
103 # the jar format, make-jars leaves behind a directory structure that's not
104 # needed in $(FINAL_TARGET). For both, flat, and symlink, the directory
105 # structure contains the chrome, so leave it in $(FINAL_TARGET).
106 ifeq (jar,$(MOZ_CHROME_FILE_FORMAT))
107 MAKE_JARS_TARGET = $(if $(XPI_NAME),$(FINAL_TARGET).stage,$(DIST)/chrome-stage)
108 else
109 MAKE_JARS_TARGET = $(FINAL_TARGET)
110 endif
112 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
113 VERSION_NUMBER = 50
115 ifeq ($(HOST_OS_ARCH),WINNT)
116 win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
117 BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix
118 else
119 win_srcdir := $(srcdir)
120 BUILD_TOOLS = $(topsrcdir)/build/unix
121 endif
123 CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
124 AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
126 ifeq ($(OS_ARCH),QNX)
127 ifeq ($(OS_TARGET),NTO)
128 LD := qcc -Vgcc_ntox86 -nostdlib
129 else
130 LD := $(CC)
131 endif
132 endif
133 ifeq ($(OS_ARCH),BeOS)
134 BEOS_ADDON_WORKAROUND = 1
135 endif
138 # Strip off the excessively long version numbers on these platforms,
139 # but save the version to allow multiple versions of the same base
140 # platform to be built in the same tree.
142 ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
143 OS_RELEASE := $(basename $(OS_RELEASE))
145 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
146 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
147 OS_VERS := $(suffix $(OS_RELEASE))
148 OS_VERSION := $(shell echo $(OS_VERS) | sed 's/-.*//')
149 endif
151 endif
153 OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
155 FINAL_LINK_LIBS = $(DEPTH)/config/final-link-libs
156 FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps
157 FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names
159 MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX)
160 MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX)
162 ifdef MOZ_MEMORY
163 ifneq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
164 JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_MOZLIBNAME,jemalloc) $(MKSHLIB_UNFORCE_ALL)
165 endif
166 endif
168 CC := $(CC_WRAPPER) $(CC)
169 CXX := $(CXX_WRAPPER) $(CXX)
171 # determine debug-related options
172 _DEBUG_CFLAGS :=
173 _DEBUG_LDFLAGS :=
175 ifdef MOZ_DEBUG
176 _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) $(MOZ_DEBUG_FLAGS)
177 _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
178 XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
179 else
180 _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
181 XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
182 ifdef MOZ_DEBUG_SYMBOLS
183 _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
184 _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
185 endif
186 endif
188 MOZALLOC_LIB = $(call EXPAND_LIBNAME_PATH,mozalloc,$(DIST)/lib)
190 OS_CFLAGS += $(_DEBUG_CFLAGS)
191 OS_CXXFLAGS += $(_DEBUG_CFLAGS)
192 OS_LDFLAGS += $(_DEBUG_LDFLAGS)
194 # XXX: What does this? Bug 482434 filed for better explanation.
195 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
196 ifdef MOZ_DEBUG
197 ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
198 OS_CFLAGS += -FR
199 OS_CXXFLAGS += -FR
200 endif
201 else # ! MOZ_DEBUG
203 # We don't build a static CRT when building a custom CRT,
204 # it appears to be broken. So don't link to jemalloc if
205 # the Makefile wants static CRT linking.
206 ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_)
207 # Disable default CRT libs and add the right lib path for the linker
208 OS_LDFLAGS += $(MOZ_MEMORY_LDFLAGS)
209 endif
211 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
212 # Used for generating an optimized build with debugging symbols.
213 # Used in the Windows nightlies to generate symbols for crash reporting.
214 ifdef MOZ_DEBUG_SYMBOLS
215 OS_CXXFLAGS += -Zi -UDEBUG -DNDEBUG
216 OS_CFLAGS += -Zi -UDEBUG -DNDEBUG
217 OS_LDFLAGS += -DEBUG -OPT:REF
218 endif
220 ifdef MOZ_QUANTIFY
221 # -FIXED:NO is needed for Quantify to work, but it increases the size
222 # of executables, so only use it if building for Quantify.
223 WIN32_EXE_LDFLAGS += -FIXED:NO
225 # We need -OPT:NOICF to prevent identical methods from being merged together.
226 # Otherwise, Quantify doesn't know which method was actually called when it's
227 # showing you the profile.
228 OS_LDFLAGS += -OPT:NOICF
229 endif
232 # Handle trace-malloc in optimized builds.
233 # No opt to give sane callstacks.
235 ifdef NS_TRACE_MALLOC
236 MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG
237 OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF -OPT:nowin98
238 endif # NS_TRACE_MALLOC
240 endif # MOZ_DEBUG
241 endif # WINNT && !GNU_CC
244 # Build using PIC by default
245 # Do not use PIC if not building a shared lib (see exceptions below)
248 ifndef BUILD_STATIC_LIBS
249 _ENABLE_PIC=1
250 endif
251 ifneq (,$(FORCE_SHARED_LIB)$(FORCE_USE_PIC))
252 _ENABLE_PIC=1
253 endif
255 # In Firefox, all components are linked into either libxul or the static
256 # meta-component, and should be compiled with PIC.
257 ifdef MOZ_META_COMPONENT
258 _ENABLE_PIC=1
259 endif
261 # If module is going to be merged into the nsStaticModule,
262 # make sure that the entry points are translated and
263 # the module is built static.
265 ifdef IS_COMPONENT
266 ifdef EXPORT_LIBRARY
267 ifneq (,$(BUILD_STATIC_LIBS))
268 ifdef MODULE_NAME
269 DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
270 FORCE_STATIC_LIB=1
271 endif
272 endif
273 endif
274 endif
276 # Determine if module being compiled is destined
277 # to be merged into libxul
279 ifdef MOZ_ENABLE_LIBXUL
280 ifdef LIBXUL_LIBRARY
281 ifdef IS_COMPONENT
282 ifdef MODULE_NAME
283 DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
284 else
285 $(error Component makefile does not specify MODULE_NAME.)
286 endif
287 endif
288 FORCE_STATIC_LIB=1
289 _ENABLE_PIC=1
290 SHORT_LIBNAME=
291 endif
292 endif
294 # If we are building this component into an extension/xulapp, it cannot be
295 # statically linked. In the future we may want to add a xulapp meta-component
296 # build option.
298 ifdef XPI_NAME
299 _ENABLE_PIC=1
300 ifdef IS_COMPONENT
301 EXPORT_LIBRARY=
302 FORCE_STATIC_LIB=
303 FORCE_SHARED_LIB=1
304 endif
305 endif
308 # Disable PIC if necessary
311 ifndef _ENABLE_PIC
312 DSO_CFLAGS=
313 ifeq ($(OS_ARCH)_$(HAVE_GCC3_ABI),Darwin_1)
314 DSO_PIC_CFLAGS=-mdynamic-no-pic
315 else
316 DSO_PIC_CFLAGS=
317 endif
318 endif
320 ifndef SHARED_LIBRARY_NAME
321 ifdef LIBRARY_NAME
322 SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
323 endif
324 endif
326 ifndef STATIC_LIBRARY_NAME
327 ifdef LIBRARY_NAME
328 STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
329 endif
330 endif
332 ifeq (WINNT,$(OS_ARCH))
333 MOZ_FAKELIBS = 1
334 endif
336 # This comes from configure
337 ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
338 NO_PROFILE_GUIDED_OPTIMIZE = 1
339 endif
341 # No sense in profiling tools
342 ifdef INTERNAL_TOOLS
343 NO_PROFILE_GUIDED_OPTIMIZE = 1
344 endif
346 # Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
347 # and we don't have the same build logic to re-link them in the second pass.
348 ifdef SIMPLE_PROGRAMS
349 NO_PROFILE_GUIDED_OPTIMIZE = 1
350 endif
352 # Enable profile-based feedback
353 ifndef NO_PROFILE_GUIDED_OPTIMIZE
354 ifdef MOZ_PROFILE_GENERATE
355 OS_CFLAGS += $(PROFILE_GEN_CFLAGS)
356 OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS)
357 OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
358 ifeq (WINNT,$(OS_ARCH))
359 AR_FLAGS += -LTCG
360 endif
361 endif # MOZ_PROFILE_GENERATE
363 ifdef MOZ_PROFILE_USE
364 OS_CFLAGS += $(PROFILE_USE_CFLAGS)
365 OS_CXXFLAGS += $(PROFILE_USE_CFLAGS)
366 OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
367 ifeq (WINNT,$(OS_ARCH))
368 AR_FLAGS += -LTCG
369 endif
370 endif # MOZ_PROFILE_USE
371 endif # NO_PROFILE_GUIDED_OPTIMIZE
374 # Does the makefile specifies the internal XPCOM API linkage?
375 ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY))
376 DEFINES += -DMOZILLA_INTERNAL_API
377 endif
379 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
380 # building libxul libraries
381 ifdef MOZ_ENABLE_LIBXUL
382 ifdef LIBXUL_LIBRARY
383 DEFINES += \
384 -D_IMPL_NS_COM \
385 -DEXPORT_XPT_API \
386 -DEXPORT_XPTC_API \
387 -D_IMPL_NS_GFX \
388 -D_IMPL_NS_WIDGET \
389 -DIMPL_XREAPI \
390 -DIMPL_NS_NET \
391 -DIMPL_THEBES \
392 $(NULL)
394 ifndef JS_SHARED_LIBRARY
395 DEFINES += -DSTATIC_EXPORTABLE_JS_API
396 endif
397 endif
398 endif
400 # Force _all_ exported methods to be |_declspec(dllexport)| when we're
401 # building them into the executable.
403 ifeq (,$(filter-out WINNT WINCE OS2, $(OS_ARCH)))
404 ifdef BUILD_STATIC_LIBS
405 DEFINES += \
406 -D_IMPL_NS_GFX \
407 -D_IMPL_NS_MSG_BASE \
408 -D_IMPL_NS_WIDGET \
409 $(NULL)
410 endif
411 endif
413 # Flags passed to make-jars.pl
415 MAKE_JARS_FLAGS = \
416 -t $(topsrcdir) \
417 -f $(MOZ_CHROME_FILE_FORMAT) \
418 $(NULL)
420 ifdef USE_EXTENSION_MANIFEST
421 MAKE_JARS_FLAGS += -e
422 endif
424 ifdef BOTH_MANIFESTS
425 MAKE_JARS_FLAGS += --both-manifests
426 endif
428 TAR_CREATE_FLAGS = -cvhf
430 ifeq ($(OS_ARCH),BSD_OS)
431 TAR_CREATE_FLAGS = -cvLf
432 endif
434 ifeq ($(OS_ARCH),OS2)
435 TAR_CREATE_FLAGS = -cvf
436 endif
439 # Personal makefile customizations go in these optional make include files.
441 MY_CONFIG := $(DEPTH)/config/myconfig.mk
442 MY_RULES := $(DEPTH)/config/myrules.mk
445 # Default command macros; can be overridden in <arch>.mk.
447 CCC = $(CXX)
448 NFSPWD = $(CONFIG_TOOLS)/nfspwd
449 PURIFY = purify $(PURIFYOPTIONS)
450 QUANTIFY = quantify $(QUANTIFYOPTIONS)
451 ifdef CROSS_COMPILE
452 XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX)
453 XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpt_link$(HOST_BIN_SUFFIX)
454 else
455 XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
456 XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
457 endif
459 # Java macros
460 JAVA_GEN_DIR = _javagen
461 JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
462 JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
464 INCLUDES = \
465 $(LOCAL_INCLUDES) \
466 -I$(srcdir) \
467 -I. \
468 -I$(DIST)/include -I$(DIST)/include/nsprpub \
469 $(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include -I$(LIBXUL_SDK)/include/nsprpub) \
470 $(OS_INCLUDES) \
471 $(NULL)
473 include $(topsrcdir)/config/static-checking-config.mk
475 ifdef MOZ_SHARK
476 OS_CFLAGS += -F/System/Library/PrivateFrameworks
477 OS_CXXFLAGS += -F/System/Library/PrivateFrameworks
478 OS_LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD
479 endif # ifdef MOZ_SHARK
481 CFLAGS = $(OS_CFLAGS)
482 CXXFLAGS = $(OS_CXXFLAGS)
483 LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
485 # Allow each module to override the *default* optimization settings
486 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
487 # arguments to --enable-optimize
488 ifdef MOZ_OPTIMIZE
489 ifeq (1,$(MOZ_OPTIMIZE))
490 ifdef MODULE_OPTIMIZE_FLAGS
491 CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
492 CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
493 else
494 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
495 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
496 endif # MODULE_OPTIMIZE_FLAGS
497 else
498 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
499 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
500 endif # MOZ_OPTIMIZE == 1
501 LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
502 endif # MOZ_OPTIMIZE
504 ifdef CROSS_COMPILE
505 HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS)
506 else
507 ifdef MOZ_OPTIMIZE
508 ifeq (1,$(MOZ_OPTIMIZE))
509 ifdef MODULE_OPTIMIZE_FLAGS
510 HOST_CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
511 else
512 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
513 endif # MODULE_OPTIMIZE_FLAGS
514 else
515 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
516 endif # MOZ_OPTIMIZE == 1
517 endif # MOZ_OPTIMIZE
518 endif # CROSS_COMPILE
520 # Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
521 # to request that we use the 'warnings as errors' compile flags)
523 # NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
524 # build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
525 # situation. (See bug 437002.)
526 ifeq (WINNT_1,$(OS_ARCH)_$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
527 FAIL_ON_WARNINGS_DEBUG=
528 FAIL_ON_WARNINGS=
529 endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
531 # Also clear FAIL_ON_WARNINGS[_DEBUG] for Android builds, since
532 # they have some platform-specific warnings we haven't fixed yet.
533 ifeq ($(OS_TARGET),Android)
534 FAIL_ON_WARNINGS_DEBUG=
535 FAIL_ON_WARNINGS=
536 endif # Android
538 # Now, check for debug version of flag; it turns on normal flag in debug builds.
539 ifdef FAIL_ON_WARNINGS_DEBUG
540 ifdef MOZ_DEBUG
541 FAIL_ON_WARNINGS = 1
542 endif # MOZ_DEBUG
543 endif # FAIL_ON_WARNINGS_DEBUG
545 # Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
546 ifdef FAIL_ON_WARNINGS
547 CXXFLAGS += $(WARNINGS_AS_ERRORS)
548 CFLAGS += $(WARNINGS_AS_ERRORS)
549 endif # FAIL_ON_WARNINGS
551 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
552 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
553 #// DLL version of the RTL is used...
555 #//------------------------------------------------------------------------
556 ifdef USE_STATIC_LIBS
557 RTL_FLAGS=-MT # Statically linked multithreaded RTL
558 ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
559 ifndef MOZ_NO_DEBUG_RTL
560 RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
561 endif
562 endif # MOZ_DEBUG || NS_TRACE_MALLOC
564 else # !USE_STATIC_LIBS
566 RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
567 ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
568 ifndef MOZ_NO_DEBUG_RTL
569 RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
570 endif
571 endif # MOZ_DEBUG || NS_TRACE_MALLOC
572 endif # USE_STATIC_LIBS
573 endif # WINNT && !GNU_CC
575 ifeq ($(OS_ARCH),Darwin)
576 # Darwin doesn't cross-compile, so just set both types of flags here.
577 HOST_CMFLAGS += -fobjc-exceptions
578 HOST_CMMFLAGS += -fobjc-exceptions
579 OS_COMPILE_CMFLAGS += -fobjc-exceptions
580 OS_COMPILE_CMMFLAGS += -fobjc-exceptions
581 endif
583 COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
584 COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
585 COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
586 COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
588 ifndef CROSS_COMPILE
589 HOST_CFLAGS += $(RTL_FLAGS)
590 endif
593 # Name of the binary code directories
595 # Override defaults
597 # We need to know where to find the libraries we
598 # put on the link line for binaries, and should
599 # we link statically or dynamic? Assuming dynamic for now.
601 ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
602 ifneq (,$(filter-out WINCE,$(OS_ARCH)))
603 LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
604 ifdef LIBXUL_SDK
605 LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
606 endif
607 endif
608 endif
610 # Default location of include files
611 IDL_DIR = $(DIST)/idl
613 XPIDL_FLAGS = -I$(srcdir) -I$(IDL_DIR)
614 ifdef LIBXUL_SDK
615 XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
616 endif
618 SDK_LIB_DIR = $(DIST)/sdk/lib
619 SDK_BIN_DIR = $(DIST)/sdk/bin
621 DEPENDENCIES = .md
623 MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
625 ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES)))
626 DEFINES += -DXPCONNECT_STANDALONE
627 endif
629 ifeq ($(OS_ARCH),OS2)
630 ELF_DYNSTR_GC = echo
631 else
632 ELF_DYNSTR_GC = :
633 endif
635 ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
636 OS_LIBS += $(MOZ_QT_LIBS)
637 endif
639 ifndef CROSS_COMPILE
640 ifdef USE_ELF_DYNSTR_GC
641 ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
642 ELF_DYNSTR_GC = $(DEPTH)/config/elf-dynstr-gc
643 endif
644 endif
645 endif
647 ifeq ($(OS_ARCH),Darwin)
648 ifdef NEXT_ROOT
649 export NEXT_ROOT
650 PBBUILD = NEXT_ROOT= $(PBBUILD_BIN)
651 else # NEXT_ROOT
652 PBBUILD = $(PBBUILD_BIN)
653 endif # NEXT_ROOT
654 PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
655 ifdef MACOS_SDK_DIR
656 PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
657 endif # MACOS_SDK_DIR
658 ifdef MACOSX_DEPLOYMENT_TARGET
659 export MACOSX_DEPLOYMENT_TARGET
660 PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)"
661 endif # MACOSX_DEPLOYMENT_TARGET
662 ifdef MOZ_OPTIMIZE
663 ifeq (2,$(MOZ_OPTIMIZE))
664 # Only override project defaults if the config specified explicit settings
665 PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)"
666 endif # MOZ_OPTIMIZE=2
667 endif # MOZ_OPTIMIZE
668 ifeq (1,$(HAS_XCODE_2_1))
669 # Xcode 2.1 puts its build products in a directory corresponding to the
670 # selected build style/configuration.
671 XCODE_PRODUCT_DIR = build/$(BUILDSTYLE)
672 else
673 XCODE_PRODUCT_DIR = build
674 endif # HAS_XCODE_2_1=1
675 endif # OS_ARCH=Darwin
678 ifdef MOZ_NATIVE_MAKEDEPEND
679 MKDEPEND_DIR =
680 MKDEPEND = $(CYGWIN_WRAPPER) $(MOZ_NATIVE_MAKEDEPEND)
681 else
682 MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend
683 MKDEPEND = $(CYGWIN_WRAPPER) $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
684 endif
686 # Set link flags according to whether we want a console.
687 ifdef MOZ_WINCONSOLE
688 ifeq ($(MOZ_WINCONSOLE),1)
689 ifeq ($(OS_ARCH),OS2)
690 BIN_FLAGS += -Zlinker -PM:VIO
691 endif
692 ifeq ($(OS_ARCH),WINNT)
693 ifdef GNU_CC
694 WIN32_EXE_LDFLAGS += -mconsole
695 else
696 WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE
697 endif
698 endif
699 else # MOZ_WINCONSOLE
700 ifeq ($(OS_ARCH),OS2)
701 BIN_FLAGS += -Zlinker -PM:PM
702 endif
703 ifeq ($(OS_ARCH),WINNT)
704 ifdef GNU_CC
705 WIN32_EXE_LDFLAGS += -mwindows
706 else
707 WIN32_EXE_LDFLAGS += -SUBSYSTEM:WINDOWS
708 endif
709 endif
710 endif
711 endif
713 # If we're building a component on MSVC, we don't want to generate an
714 # import lib, because that import lib will collide with the name of a
715 # static version of the same library.
716 ifeq ($(GNU_LD)$(OS_ARCH),WINNT)
717 ifdef IS_COMPONENT
718 LDFLAGS += -IMPLIB:fake.lib
719 DELETE_AFTER_LINK = fake.lib fake.exp
720 endif
721 endif
724 # Include any personal overrides the user might think are needed.
726 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
727 -include $(MY_CONFIG)
729 ######################################################################
730 # Now test variables that might have been set or overridden by $(MY_CONFIG).
732 DEFINES += -DOSTYPE=\"$(OS_CONFIG)\"
733 DEFINES += -DOSARCH=$(OS_ARCH)
735 ######################################################################
737 GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB $(FAKE_LIBRARY)
739 ifeq ($(OS_ARCH),Darwin)
740 ifndef NSDISTMODE
741 NSDISTMODE=absolute_symlink
742 endif
743 PWD := $(CURDIR)
744 endif
746 ifdef NSINSTALL_BIN
747 NSINSTALL = $(CYGWIN_WRAPPER) $(NSINSTALL_BIN)
748 else
749 ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
750 NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
751 else
752 NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
753 endif # OS2
754 endif # NSINSTALL_BIN
757 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
758 INSTALL = $(NSINSTALL)
759 else
760 ifeq ($(NSDISTMODE),copy)
761 # copy files, but preserve source mtime
762 INSTALL = $(NSINSTALL) -t
763 else
764 ifeq ($(NSDISTMODE),absolute_symlink)
765 # install using absolute symbolic links
766 ifeq ($(OS_ARCH),Darwin)
767 INSTALL = $(NSINSTALL) -L $(PWD)
768 else
769 INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
770 endif # Darwin
771 else
772 # install using relative symbolic links
773 INSTALL = $(NSINSTALL) -R
774 endif # absolute_symlink
775 endif # copy
776 endif # WINNT/OS2
778 # Use nsinstall in copy mode to install files on the system
779 SYSINSTALL = $(NSINSTALL) -t
781 ifeq ($(OS_ARCH),WINNT)
782 ifneq (,$(CYGDRIVE_MOUNT))
783 export CYGDRIVE_MOUNT
784 endif
785 endif
788 # Localization build automation
791 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
792 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
793 # overridden by the command line. (Besides, AB_CD is prettier).
794 AB_CD = $(MOZ_UI_LOCALE)
796 ifndef L10NBASEDIR
797 L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
798 endif
800 EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(L10NBASEDIR)/$(AB_CD)/$(subst /locales,,$(1)))
802 ifdef relativesrcdir
803 LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
804 endif
806 ifdef LOCALE_SRCDIR
807 # if LOCALE_MERGEDIR is set, use mergedir first, then the localization,
808 # and finally en-US
809 ifdef LOCALE_MERGEDIR
810 MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
811 endif
812 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
813 ifdef LOCALE_MERGEDIR
814 MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
815 endif
816 endif
818 ifdef WINCE
819 RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
820 else
821 ifeq (OS2,$(OS_ARCH))
822 RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
823 else
824 ifneq (WINNT,$(OS_ARCH))
825 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
826 endif # ! WINNT
827 endif # ! OS2
828 endif # ! WINCE
831 # Java macros
834 # Make sure any compiled classes work with at least JVM 1.4
835 JAVAC_FLAGS += -source 1.4
837 ifdef MOZ_DEBUG
838 JAVAC_FLAGS += -g
839 endif
841 ifdef TIERS
842 DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
843 STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
844 endif
846 OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizejars.py)