Bug 555463 - Deal with sync wm_setfocus events from child. r=enn.
[mozilla-central.git] / config / config.mk
blobc3f2d65f4a64d2111ae39256313e27ed2e0caf4e
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 COMMA = ,
67 # Sanity check some variables
68 CHECK_VARS := \
69 XPI_NAME \
70 LIBRARY_NAME \
71 MODULE \
72 DEPTH \
73 SHORT_LIBNAME \
74 XPI_PKGNAME \
75 INSTALL_EXTENSION_ID \
76 SHARED_LIBRARY_NAME \
77 STATIC_LIBRARY_NAME \
78 $(NULL)
80 # checks for internal spaces or trailing spaces in the variable
81 # named by $x
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 core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
88 # FINAL_TARGET specifies the location into which we copy end-user-shipped
89 # build products (typelibs, components, chrome).
91 # It will usually be the well-loved $(DIST)/bin, today, but can also be an
92 # XPI-contents staging directory for ambitious and right-thinking extensions.
93 FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)
95 # MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in
96 # the jar format, make-jars leaves behind a directory structure that's not
97 # needed in $(FINAL_TARGET). For both, flat, and symlink, the directory
98 # structure contains the chrome, so leave it in $(FINAL_TARGET).
99 ifeq (jar,$(MOZ_CHROME_FILE_FORMAT))
100 MAKE_JARS_TARGET = $(if $(XPI_NAME),$(FINAL_TARGET).stage,$(DIST)/chrome-stage)
101 else
102 MAKE_JARS_TARGET = $(FINAL_TARGET)
103 endif
105 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
106 VERSION_NUMBER = 50
108 ifeq ($(HOST_OS_ARCH),WINNT)
109 win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
110 BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix
111 else
112 win_srcdir := $(srcdir)
113 BUILD_TOOLS = $(topsrcdir)/build/unix
114 endif
116 CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
117 AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
119 ifeq ($(OS_ARCH),QNX)
120 ifeq ($(OS_TARGET),NTO)
121 LD := qcc -Vgcc_ntox86 -nostdlib
122 else
123 LD := $(CC)
124 endif
125 endif
126 ifeq ($(OS_ARCH),BeOS)
127 BEOS_ADDON_WORKAROUND = 1
128 endif
131 # Strip off the excessively long version numbers on these platforms,
132 # but save the version to allow multiple versions of the same base
133 # platform to be built in the same tree.
135 ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
136 OS_RELEASE := $(basename $(OS_RELEASE))
138 # Allow the user to ignore the OS_VERSION, which is usually irrelevant.
139 ifdef WANT_MOZILLA_CONFIG_OS_VERSION
140 OS_VERS := $(suffix $(OS_RELEASE))
141 OS_VERSION := $(shell echo $(OS_VERS) | sed 's/-.*//')
142 endif
144 endif
146 OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
148 FINAL_LINK_LIBS = $(DEPTH)/config/final-link-libs
149 FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps
150 FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names
152 MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX)
153 MOZ_WIDGET_SUPPORT_LIBS = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX)
155 ifdef MOZ_MEMORY
156 ifneq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
157 JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_MOZLIBNAME,jemalloc) $(MKSHLIB_UNFORCE_ALL)
158 endif
159 endif
161 # determine debug-related options
162 _DEBUG_CFLAGS :=
163 _DEBUG_LDFLAGS :=
165 ifdef MOZ_DEBUG
166 _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) $(MOZ_DEBUG_FLAGS)
167 _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
168 XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
169 else
170 _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
171 XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
172 ifdef MOZ_DEBUG_SYMBOLS
173 _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
174 _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
175 endif
176 endif
178 MOZALLOC_LIB = $(call EXPAND_MOZLIBNAME,mozalloc)
180 OS_CFLAGS += $(_DEBUG_CFLAGS)
181 OS_CXXFLAGS += $(_DEBUG_CFLAGS)
182 OS_LDFLAGS += $(_DEBUG_LDFLAGS)
184 # XXX: What does this? Bug 482434 filed for better explanation.
185 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
186 ifdef MOZ_DEBUG
187 ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
188 OS_CFLAGS += -FR
189 OS_CXXFLAGS += -FR
190 endif
191 else # ! MOZ_DEBUG
193 # We don't build a static CRT when building a custom CRT,
194 # it appears to be broken. So don't link to jemalloc if
195 # the Makefile wants static CRT linking.
196 ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_)
197 # Disable default CRT libs and add the right lib path for the linker
198 OS_LDFLAGS += $(MOZ_MEMORY_LDFLAGS)
199 endif
201 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
202 # Used for generating an optimized build with debugging symbols.
203 # Used in the Windows nightlies to generate symbols for crash reporting.
204 ifdef MOZ_DEBUG_SYMBOLS
205 OS_CXXFLAGS += -Zi -UDEBUG -DNDEBUG
206 OS_CFLAGS += -Zi -UDEBUG -DNDEBUG
207 OS_LDFLAGS += -DEBUG -OPT:REF
208 endif
210 ifdef MOZ_QUANTIFY
211 # -FIXED:NO is needed for Quantify to work, but it increases the size
212 # of executables, so only use it if building for Quantify.
213 WIN32_EXE_LDFLAGS += -FIXED:NO
215 # We need -OPT:NOICF to prevent identical methods from being merged together.
216 # Otherwise, Quantify doesn't know which method was actually called when it's
217 # showing you the profile.
218 OS_LDFLAGS += -OPT:NOICF
219 endif
222 # Handle trace-malloc in optimized builds.
223 # No opt to give sane callstacks.
225 ifdef NS_TRACE_MALLOC
226 MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG
227 OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF -OPT:nowin98
228 endif # NS_TRACE_MALLOC
230 endif # MOZ_DEBUG
231 endif # WINNT && !GNU_CC
234 # Build using PIC by default
235 # Do not use PIC if not building a shared lib (see exceptions below)
238 ifndef BUILD_STATIC_LIBS
239 _ENABLE_PIC=1
240 endif
241 ifneq (,$(FORCE_SHARED_LIB)$(FORCE_USE_PIC))
242 _ENABLE_PIC=1
243 endif
245 # In Firefox, all components are linked into either libxul or the static
246 # meta-component, and should be compiled with PIC.
247 ifdef MOZ_META_COMPONENT
248 _ENABLE_PIC=1
249 endif
251 # If module is going to be merged into the nsStaticModule,
252 # make sure that the entry points are translated and
253 # the module is built static.
255 ifdef IS_COMPONENT
256 ifdef EXPORT_LIBRARY
257 ifneq (,$(BUILD_STATIC_LIBS))
258 ifdef MODULE_NAME
259 DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
260 FORCE_STATIC_LIB=1
261 endif
262 endif
263 endif
264 endif
266 # Determine if module being compiled is destined
267 # to be merged into libxul
269 ifdef MOZ_ENABLE_LIBXUL
270 ifdef LIBXUL_LIBRARY
271 ifdef IS_COMPONENT
272 ifdef MODULE_NAME
273 DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
274 else
275 $(error Component makefile does not specify MODULE_NAME.)
276 endif
277 endif
278 FORCE_STATIC_LIB=1
279 _ENABLE_PIC=1
280 SHORT_LIBNAME=
281 endif
282 endif
284 # If we are building this component into an extension/xulapp, it cannot be
285 # statically linked. In the future we may want to add a xulapp meta-component
286 # build option.
288 ifdef XPI_NAME
289 _ENABLE_PIC=1
290 ifdef IS_COMPONENT
291 EXPORT_LIBRARY=
292 FORCE_STATIC_LIB=
293 FORCE_SHARED_LIB=1
294 endif
295 endif
298 # Disable PIC if necessary
301 ifndef _ENABLE_PIC
302 DSO_CFLAGS=
303 ifeq ($(OS_ARCH)_$(HAVE_GCC3_ABI),Darwin_1)
304 DSO_PIC_CFLAGS=-mdynamic-no-pic
305 else
306 DSO_PIC_CFLAGS=
307 endif
308 endif
310 ifndef SHARED_LIBRARY_NAME
311 ifdef LIBRARY_NAME
312 SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
313 endif
314 endif
316 ifndef STATIC_LIBRARY_NAME
317 ifdef LIBRARY_NAME
318 STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
319 endif
320 endif
322 # This comes from configure
323 ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
324 NO_PROFILE_GUIDED_OPTIMIZE = 1
325 endif
327 # Enable profile-based feedback
328 ifndef NO_PROFILE_GUIDED_OPTIMIZE
329 ifdef MOZ_PROFILE_GENERATE
330 # No sense in profiling tools
331 ifndef INTERNAL_TOOLS
332 OS_CFLAGS += $(PROFILE_GEN_CFLAGS)
333 OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS)
334 OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
335 ifeq (WINNT,$(OS_ARCH))
336 AR_FLAGS += -LTCG
337 endif
338 endif # INTERNAL_TOOLS
339 endif # MOZ_PROFILE_GENERATE
341 ifdef MOZ_PROFILE_USE
342 ifndef INTERNAL_TOOLS
343 OS_CFLAGS += $(PROFILE_USE_CFLAGS)
344 OS_CXXFLAGS += $(PROFILE_USE_CFLAGS)
345 OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
346 ifeq (WINNT,$(OS_ARCH))
347 AR_FLAGS += -LTCG
348 endif
349 endif # INTERNAL_TOOLS
350 endif # MOZ_PROFILE_USE
351 endif # NO_PROFILE_GUIDED_OPTIMIZE
354 # Does the makefile specifies the internal XPCOM API linkage?
355 ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY))
356 DEFINES += -DMOZILLA_INTERNAL_API
357 endif
359 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
360 # building libxul libraries
361 ifdef MOZ_ENABLE_LIBXUL
362 ifdef LIBXUL_LIBRARY
363 DEFINES += \
364 -D_IMPL_NS_COM \
365 -DEXPORT_XPT_API \
366 -DEXPORT_XPTC_API \
367 -D_IMPL_NS_GFX \
368 -D_IMPL_NS_WIDGET \
369 -DIMPL_XREAPI \
370 -DIMPL_NS_NET \
371 -DIMPL_THEBES \
372 $(NULL)
374 ifndef MOZ_NATIVE_ZLIB
375 DEFINES += -DZLIB_INTERNAL
376 endif
377 endif
378 endif
380 # Force _all_ exported methods to be |_declspec(dllexport)| when we're
381 # building them into the executable.
383 ifeq (,$(filter-out WINNT WINCE OS2, $(OS_ARCH)))
384 ifdef BUILD_STATIC_LIBS
385 DEFINES += \
386 -D_IMPL_NS_GFX \
387 -D_IMPL_NS_MSG_BASE \
388 -D_IMPL_NS_WIDGET \
389 $(NULL)
390 endif
391 endif
393 # Flags passed to make-jars.pl
395 MAKE_JARS_FLAGS = \
396 -t $(topsrcdir) \
397 -f $(MOZ_CHROME_FILE_FORMAT) \
398 $(NULL)
400 ifdef USE_EXTENSION_MANIFEST
401 MAKE_JARS_FLAGS += -e
402 endif
404 ifdef BOTH_MANIFESTS
405 MAKE_JARS_FLAGS += --both-manifests
406 endif
408 TAR_CREATE_FLAGS = -cvhf
410 ifeq ($(OS_ARCH),BSD_OS)
411 TAR_CREATE_FLAGS = -cvLf
412 endif
414 ifeq ($(OS_ARCH),OS2)
415 TAR_CREATE_FLAGS = -cvf
416 endif
419 # Personal makefile customizations go in these optional make include files.
421 MY_CONFIG := $(DEPTH)/config/myconfig.mk
422 MY_RULES := $(DEPTH)/config/myrules.mk
425 # Default command macros; can be overridden in <arch>.mk.
427 CCC = $(CXX)
428 NFSPWD = $(CONFIG_TOOLS)/nfspwd
429 PURIFY = purify $(PURIFYOPTIONS)
430 QUANTIFY = quantify $(QUANTIFYOPTIONS)
431 ifdef CROSS_COMPILE
432 XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX)
433 XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpt_link$(HOST_BIN_SUFFIX)
434 else
435 XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
436 XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
437 endif
439 # Java macros
440 JAVA_GEN_DIR = _javagen
441 JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
442 JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
444 INCLUDES = \
445 $(LOCAL_INCLUDES) \
446 -I$(srcdir) \
447 -I. \
448 -I$(DIST)/include -I$(DIST)/include/nsprpub \
449 $(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include -I$(LIBXUL_SDK)/include/nsprpub) \
450 $(OS_INCLUDES) \
451 $(NULL)
453 include $(topsrcdir)/config/static-checking-config.mk
455 ifdef MOZ_SHARK
456 OS_CFLAGS += -F/System/Library/PrivateFrameworks
457 OS_CXXFLAGS += -F/System/Library/PrivateFrameworks
458 OS_LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD
459 endif # ifdef MOZ_SHARK
461 CFLAGS = $(OS_CFLAGS)
462 CXXFLAGS = $(OS_CXXFLAGS)
463 LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
465 # Allow each module to override the *default* optimization settings
466 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
467 # arguments to --enable-optimize
468 ifdef MOZ_OPTIMIZE
469 ifeq (1,$(MOZ_OPTIMIZE))
470 ifdef MODULE_OPTIMIZE_FLAGS
471 CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
472 CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
473 else
474 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
475 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
476 endif # MODULE_OPTIMIZE_FLAGS
477 else
478 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
479 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
480 endif # MOZ_OPTIMIZE == 1
481 LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
482 endif # MOZ_OPTIMIZE
484 ifdef CROSS_COMPILE
485 HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS)
486 else
487 ifdef MOZ_OPTIMIZE
488 ifeq (1,$(MOZ_OPTIMIZE))
489 ifdef MODULE_OPTIMIZE_FLAGS
490 HOST_CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
491 else
492 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
493 endif # MODULE_OPTIMIZE_FLAGS
494 else
495 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
496 endif # MOZ_OPTIMIZE == 1
497 endif # MOZ_OPTIMIZE
498 endif # CROSS_COMPILE
501 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
502 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
503 #// DLL version of the RTL is used...
505 #//------------------------------------------------------------------------
506 ifdef USE_STATIC_LIBS
507 RTL_FLAGS=-MT # Statically linked multithreaded RTL
508 ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
509 ifndef MOZ_NO_DEBUG_RTL
510 RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
511 endif
512 endif # MOZ_DEBUG || NS_TRACE_MALLOC
514 else # !USE_STATIC_LIBS
516 RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
517 ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
518 ifndef MOZ_NO_DEBUG_RTL
519 RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
520 endif
521 endif # MOZ_DEBUG || NS_TRACE_MALLOC
522 endif # USE_STATIC_LIBS
523 endif # WINNT && !GNU_CC
525 ifeq ($(OS_ARCH),Darwin)
526 # Darwin doesn't cross-compile, so just set both types of flags here.
527 HOST_CMFLAGS += -fobjc-exceptions
528 HOST_CMMFLAGS += -fobjc-exceptions
529 OS_COMPILE_CMFLAGS += -fobjc-exceptions
530 OS_COMPILE_CMMFLAGS += -fobjc-exceptions
531 endif
533 COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
534 COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
535 COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
536 COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
538 ifndef CROSS_COMPILE
539 HOST_CFLAGS += $(RTL_FLAGS)
540 endif
543 # Name of the binary code directories
545 # Override defaults
547 # We need to know where to find the libraries we
548 # put on the link line for binaries, and should
549 # we link statically or dynamic? Assuming dynamic for now.
551 ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
552 ifneq (,$(filter-out WINCE,$(OS_ARCH)))
553 LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
554 ifdef LIBXUL_SDK
555 LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
556 endif
557 endif
558 endif
560 # Default location of include files
561 IDL_DIR = $(DIST)/idl
563 XPIDL_FLAGS = -I$(srcdir) -I$(IDL_DIR)
564 ifdef LIBXUL_SDK
565 XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
566 endif
568 SDK_LIB_DIR = $(DIST)/sdk/lib
569 SDK_BIN_DIR = $(DIST)/sdk/bin
571 DEPENDENCIES = .md
573 MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
575 ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES)))
576 DEFINES += -DXPCONNECT_STANDALONE
577 endif
579 ifeq ($(OS_ARCH),OS2)
580 ELF_DYNSTR_GC = echo
581 else
582 ELF_DYNSTR_GC = :
583 endif
585 ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
586 OS_LIBS += $(MOZ_QT_LIBS)
587 endif
589 ifndef CROSS_COMPILE
590 ifdef USE_ELF_DYNSTR_GC
591 ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
592 ELF_DYNSTR_GC = $(DEPTH)/config/elf-dynstr-gc
593 endif
594 endif
595 endif
597 ifeq ($(OS_ARCH),Darwin)
598 ifdef NEXT_ROOT
599 export NEXT_ROOT
600 PBBUILD = NEXT_ROOT= $(PBBUILD_BIN)
601 else # NEXT_ROOT
602 PBBUILD = $(PBBUILD_BIN)
603 endif # NEXT_ROOT
604 PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
605 ifdef MACOS_SDK_DIR
606 PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
607 endif # MACOS_SDK_DIR
608 ifdef MACOSX_DEPLOYMENT_TARGET
609 export MACOSX_DEPLOYMENT_TARGET
610 PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)"
611 endif # MACOSX_DEPLOYMENT_TARGET
612 ifdef MOZ_OPTIMIZE
613 ifeq (2,$(MOZ_OPTIMIZE))
614 # Only override project defaults if the config specified explicit settings
615 PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)"
616 endif # MOZ_OPTIMIZE=2
617 endif # MOZ_OPTIMIZE
618 ifeq (1,$(HAS_XCODE_2_1))
619 # Xcode 2.1 puts its build products in a directory corresponding to the
620 # selected build style/configuration.
621 XCODE_PRODUCT_DIR = build/$(BUILDSTYLE)
622 else
623 XCODE_PRODUCT_DIR = build
624 endif # HAS_XCODE_2_1=1
625 endif # OS_ARCH=Darwin
628 ifdef MOZ_NATIVE_MAKEDEPEND
629 MKDEPEND_DIR =
630 MKDEPEND = $(CYGWIN_WRAPPER) $(MOZ_NATIVE_MAKEDEPEND)
631 else
632 MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend
633 MKDEPEND = $(CYGWIN_WRAPPER) $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
634 endif
636 # Set link flags according to whether we want a console.
637 ifdef MOZ_WINCONSOLE
638 ifeq ($(MOZ_WINCONSOLE),1)
639 ifeq ($(OS_ARCH),OS2)
640 BIN_FLAGS += -Zlinker -PM:VIO
641 endif
642 ifeq ($(OS_ARCH),WINNT)
643 ifdef GNU_CC
644 WIN32_EXE_LDFLAGS += -mconsole
645 else
646 WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE
647 endif
648 endif
649 else # MOZ_WINCONSOLE
650 ifeq ($(OS_ARCH),OS2)
651 BIN_FLAGS += -Zlinker -PM:PM
652 endif
653 ifeq ($(OS_ARCH),WINNT)
654 ifdef GNU_CC
655 WIN32_EXE_LDFLAGS += -mwindows
656 else
657 WIN32_EXE_LDFLAGS += -SUBSYSTEM:WINDOWS
658 endif
659 endif
660 endif
661 endif
663 # If we're building a component on MSVC, we don't want to generate an
664 # import lib, because that import lib will collide with the name of a
665 # static version of the same library.
666 ifeq ($(GNU_LD)$(OS_ARCH),WINNT)
667 ifdef IS_COMPONENT
668 LDFLAGS += -IMPLIB:fake.lib
669 DELETE_AFTER_LINK = fake.lib fake.exp
670 endif
671 endif
674 # Include any personal overrides the user might think are needed.
676 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
677 -include $(MY_CONFIG)
679 ######################################################################
680 # Now test variables that might have been set or overridden by $(MY_CONFIG).
682 DEFINES += -DOSTYPE=\"$(OS_CONFIG)\"
683 DEFINES += -DOSARCH=$(OS_ARCH)
685 ######################################################################
687 GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
689 ifeq ($(OS_ARCH),Darwin)
690 ifndef NSDISTMODE
691 NSDISTMODE=absolute_symlink
692 endif
693 PWD := $(CURDIR)
694 endif
696 ifdef NSINSTALL_BIN
697 NSINSTALL = $(CYGWIN_WRAPPER) $(NSINSTALL_BIN)
698 else
699 ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
700 NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
701 else
702 NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
703 endif # OS2
704 endif # NSINSTALL_BIN
707 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
708 INSTALL = $(NSINSTALL)
709 else
710 ifeq ($(NSDISTMODE),copy)
711 # copy files, but preserve source mtime
712 INSTALL = $(NSINSTALL) -t
713 else
714 ifeq ($(NSDISTMODE),absolute_symlink)
715 # install using absolute symbolic links
716 ifeq ($(OS_ARCH),Darwin)
717 INSTALL = $(NSINSTALL) -L $(PWD)
718 else
719 INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
720 endif # Darwin
721 else
722 # install using relative symbolic links
723 INSTALL = $(NSINSTALL) -R
724 endif # absolute_symlink
725 endif # copy
726 endif # WINNT/OS2
728 # Use nsinstall in copy mode to install files on the system
729 SYSINSTALL = $(NSINSTALL) -t
731 ifeq ($(OS_ARCH),WINNT)
732 ifneq (,$(CYGDRIVE_MOUNT))
733 export CYGDRIVE_MOUNT
734 endif
735 endif
738 # Localization build automation
741 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
742 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
743 # overridden by the command line. (Besides, AB_CD is prettier).
744 AB_CD = $(MOZ_UI_LOCALE)
746 ifndef L10NBASEDIR
747 L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
748 endif
750 EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(L10NBASEDIR)/$(AB_CD)/$(subst /locales,,$(1)))
752 ifdef relativesrcdir
753 LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
754 endif
756 ifdef LOCALE_SRCDIR
757 # if LOCALE_MERGEDIR is set, use mergedir first, then the localization,
758 # and finally en-US
759 ifdef LOCALE_MERGEDIR
760 MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
761 endif
762 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
763 ifdef LOCALE_MERGEDIR
764 MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
765 endif
766 endif
768 ifdef WINCE
769 RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
770 else
771 ifeq (OS2,$(OS_ARCH))
772 RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
773 else
774 ifneq (WINNT,$(OS_ARCH))
775 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
776 endif # ! WINNT
777 endif # ! OS2
778 endif # ! WINCE
781 # Java macros
784 # Make sure any compiled classes work with at least JVM 1.4
785 JAVAC_FLAGS += -source 1.4
787 ifdef MOZ_DEBUG
788 JAVAC_FLAGS += -g
789 endif
791 ifdef TIERS
792 DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
793 STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
794 endif