/[jscoverage]/trunk/js/config/config.mk
ViewVC logotype

Contents of /trunk/js/config/config.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 507 - (show annotations)
Sun Jan 10 07:23:34 2010 UTC (12 years, 4 months ago) by siliconforks
File size: 23798 byte(s)
Update SpiderMonkey from Firefox 3.6rc1.

1 #
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 #
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/
9 #
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.
14 #
15 # The Original Code is mozilla.org code.
16 #
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.
21 #
22 # Contributor(s):
23 # Benjamin Smedberg <benjamin@smedbergs.us>
24 #
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.
36 #
37 # ***** END LICENSE BLOCK *****
38
39 #
40 # config.mk
41 #
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.
45 #
46
47 # Define an include-at-most-once flag
48 INCLUDED_CONFIG_MK = 1
49
50 EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
51
52 ifndef topsrcdir
53 topsrcdir = $(DEPTH)
54 endif
55
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
64
65 COMMA = ,
66
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)
79
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)))
83
84 $(foreach x,$(CHECK_VARS),$(check-variable))
85
86 core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
87
88 # FINAL_TARGET specifies the location into which we copy end-user-shipped
89 # build products (typelibs, components, chrome).
90 #
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)
94
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
104
105 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
106 VERSION_NUMBER = 50
107
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
115
116 CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
117 AUTOCONF_TOOLS = $(topsrcdir)/build/autoconf
118
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
129
130 #
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.
134 #
135 ifneq (,$(filter FreeBSD HP-UX IRIX Linux NetBSD OpenBSD OSF1 SunOS,$(OS_ARCH)))
136 OS_RELEASE := $(basename $(OS_RELEASE))
137
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
143
144 endif
145
146 OS_CONFIG := $(OS_ARCH)$(OS_RELEASE)
147
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
151
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)
154
155 ifdef MOZ_MEMORY
156 ifneq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
157 JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib) $(MKSHLIB_UNFORCE_ALL)
158 endif
159 endif
160
161 # determine debug-related options
162 _DEBUG_CFLAGS :=
163 _DEBUG_LDFLAGS :=
164
165 ifndef MOZ_DEBUG
166 # global debugging is disabled
167 # check if it was explicitly enabled for this module
168 ifneq (, $(findstring $(MODULE), $(MOZ_DEBUG_MODULES)))
169 MOZ_DEBUG:=1
170 endif
171 else
172 # global debugging is enabled
173 # check if it was explicitly disabled for this module
174 ifneq (, $(findstring ^$(MODULE), $(MOZ_DEBUG_MODULES)))
175 MOZ_DEBUG:=
176 endif
177 endif
178
179 ifdef MOZ_DEBUG
180 _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
181 XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
182 else
183 _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
184 XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
185 endif
186
187 # determine if -g should be passed to the compiler, based on
188 # the current module, and the value of MOZ_DBGRINFO_MODULES
189
190 ifdef MOZ_DEBUG
191 MOZ_DBGRINFO_MODULES += ALL_MODULES
192 pattern := ALL_MODULES ^ALL_MODULES
193 else
194 MOZ_DBGRINFO_MODULES += ^ALL_MODULES
195 pattern := ALL_MODULES ^ALL_MODULES
196 endif
197
198 ifdef MODULE
199 # our current Makefile specifies a module name - add it to our pattern
200 pattern += $(MODULE) ^$(MODULE)
201 endif
202
203 # start by finding the first relevant module name
204 # (remember that the order of the module names in MOZ_DBGRINFO_MODULES
205 # is reversed from the order the user specified to configure -
206 # this allows the user to put general names at the beginning
207 # of the list, and to override them with explicit module names later
208 # in the list)
209
210 first_match:=$(firstword $(filter $(pattern), $(MOZ_DBGRINFO_MODULES)))
211
212 ifeq ($(first_match), $(MODULE))
213 # the user specified explicitly that
214 # this module should be compiled with -g
215 _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
216 _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
217 else
218 ifeq ($(first_match), ^$(MODULE))
219 # the user specified explicitly that this module
220 # should not be compiled with -g (nothing to do)
221 else
222 ifeq ($(first_match), ALL_MODULES)
223 # the user didn't mention this module explicitly,
224 # but wanted all modules to be compiled with -g
225 _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
226 _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
227 else
228 ifeq ($(first_match), ^ALL_MODULES)
229 # the user didn't mention this module explicitly,
230 # but wanted all modules to be compiled without -g (nothing to do)
231 endif
232 endif
233 endif
234 endif
235
236
237 # append debug flags
238 # (these might have been above when processing MOZ_DBGRINFO_MODULES)
239 OS_CFLAGS += $(_DEBUG_CFLAGS)
240 OS_CXXFLAGS += $(_DEBUG_CFLAGS)
241 OS_LDFLAGS += $(_DEBUG_LDFLAGS)
242
243 # XXX: What does this? Bug 482434 filed for better explanation.
244 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
245 ifdef MOZ_DEBUG
246 ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
247 OS_CFLAGS += -FR
248 OS_CXXFLAGS += -FR
249 endif
250 else # ! MOZ_DEBUG
251
252 # We don't build a static CRT when building a custom CRT,
253 # it appears to be broken. So don't link to jemalloc if
254 # the Makefile wants static CRT linking.
255 ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_)
256 # Disable default CRT libs and add the right lib path for the linker
257 OS_LDFLAGS += $(MOZ_MEMORY_LDFLAGS)
258 endif
259
260 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
261 # Used for generating an optimized build with debugging symbols.
262 # Used in the Windows nightlies to generate symbols for crash reporting.
263 ifdef MOZ_DEBUG_SYMBOLS
264 OS_CXXFLAGS += -Zi -UDEBUG -DNDEBUG
265 OS_CFLAGS += -Zi -UDEBUG -DNDEBUG
266 OS_LDFLAGS += -DEBUG -OPT:REF -OPT:nowin98
267 endif
268
269 ifdef MOZ_QUANTIFY
270 # -FIXED:NO is needed for Quantify to work, but it increases the size
271 # of executables, so only use it if building for Quantify.
272 WIN32_EXE_LDFLAGS += -FIXED:NO
273
274 # We need -OPT:NOICF to prevent identical methods from being merged together.
275 # Otherwise, Quantify doesn't know which method was actually called when it's
276 # showing you the profile.
277 OS_LDFLAGS += -OPT:NOICF
278 endif
279
280 #
281 # Handle trace-malloc in optimized builds.
282 # No opt to give sane callstacks.
283 #
284 ifdef NS_TRACE_MALLOC
285 MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG
286 OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF -OPT:nowin98
287 endif # NS_TRACE_MALLOC
288
289 endif # MOZ_DEBUG
290 endif # WINNT && !GNU_CC
291
292 #
293 # Build using PIC by default
294 # Do not use PIC if not building a shared lib (see exceptions below)
295 #
296
297 ifndef BUILD_STATIC_LIBS
298 _ENABLE_PIC=1
299 endif
300 ifneq (,$(FORCE_SHARED_LIB)$(FORCE_USE_PIC))
301 _ENABLE_PIC=1
302 endif
303
304 # In Firefox, all components are linked into either libxul or the static
305 # meta-component, and should be compiled with PIC.
306 ifdef MOZ_META_COMPONENT
307 _ENABLE_PIC=1
308 endif
309
310 # If module is going to be merged into the nsStaticModule,
311 # make sure that the entry points are translated and
312 # the module is built static.
313
314 ifdef IS_COMPONENT
315 ifdef EXPORT_LIBRARY
316 ifneq (,$(BUILD_STATIC_LIBS))
317 ifdef MODULE_NAME
318 DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
319 FORCE_STATIC_LIB=1
320 endif
321 endif
322 endif
323 endif
324
325 # Determine if module being compiled is destined
326 # to be merged into libxul
327
328 ifdef MOZ_ENABLE_LIBXUL
329 ifdef LIBXUL_LIBRARY
330 ifdef IS_COMPONENT
331 ifdef MODULE_NAME
332 DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
333 else
334 $(error Component makefile does not specify MODULE_NAME.)
335 endif
336 endif
337 FORCE_STATIC_LIB=1
338 _ENABLE_PIC=1
339 SHORT_LIBNAME=
340 endif
341 endif
342
343 # If we are building this component into an extension/xulapp, it cannot be
344 # statically linked. In the future we may want to add a xulapp meta-component
345 # build option.
346
347 ifdef XPI_NAME
348 _ENABLE_PIC=1
349 ifdef IS_COMPONENT
350 EXPORT_LIBRARY=
351 FORCE_STATIC_LIB=
352 FORCE_SHARED_LIB=1
353 endif
354 endif
355
356 #
357 # Disable PIC if necessary
358 #
359
360 ifndef _ENABLE_PIC
361 DSO_CFLAGS=
362 ifeq ($(OS_ARCH)_$(HAVE_GCC3_ABI),Darwin_1)
363 DSO_PIC_CFLAGS=-mdynamic-no-pic
364 else
365 DSO_PIC_CFLAGS=
366 endif
367 endif
368
369 ifndef SHARED_LIBRARY_NAME
370 ifdef LIBRARY_NAME
371 SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
372 endif
373 endif
374
375 ifndef STATIC_LIBRARY_NAME
376 ifdef LIBRARY_NAME
377 STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
378 endif
379 endif
380
381 # This comes from configure
382 ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE
383 NO_PROFILE_GUIDED_OPTIMIZE = 1
384 endif
385
386 # Enable profile-based feedback
387 ifndef NO_PROFILE_GUIDED_OPTIMIZE
388 ifdef MOZ_PROFILE_GENERATE
389 # No sense in profiling tools
390 ifndef INTERNAL_TOOLS
391 OS_CFLAGS += $(PROFILE_GEN_CFLAGS)
392 OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS)
393 OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
394 ifeq (WINNT,$(OS_ARCH))
395 AR_FLAGS += -LTCG
396 endif
397 endif # INTERNAL_TOOLS
398 endif # MOZ_PROFILE_GENERATE
399
400 ifdef MOZ_PROFILE_USE
401 ifndef INTERNAL_TOOLS
402 OS_CFLAGS += $(PROFILE_USE_CFLAGS)
403 OS_CXXFLAGS += $(PROFILE_USE_CFLAGS)
404 OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
405 ifeq (WINNT,$(OS_ARCH))
406 AR_FLAGS += -LTCG
407 endif
408 endif # INTERNAL_TOOLS
409 endif # MOZ_PROFILE_USE
410 endif # NO_PROFILE_GUIDED_OPTIMIZE
411
412
413 # Does the makefile specifies the internal XPCOM API linkage?
414 ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY))
415 DEFINES += -DMOZILLA_INTERNAL_API
416 endif
417
418 # Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
419 # building libxul libraries
420 ifdef MOZ_ENABLE_LIBXUL
421 ifdef LIBXUL_LIBRARY
422 DEFINES += \
423 -D_IMPL_NS_COM \
424 -DEXPORT_XPT_API \
425 -DEXPORT_XPTC_API \
426 -D_IMPL_NS_COM_OBSOLETE \
427 -D_IMPL_NS_GFX \
428 -D_IMPL_NS_WIDGET \
429 -DIMPL_XREAPI \
430 -DIMPL_NS_NET \
431 -DIMPL_THEBES \
432 $(NULL)
433
434 ifndef MOZ_NATIVE_ZLIB
435 DEFINES += -DZLIB_INTERNAL
436 endif
437 endif
438 endif
439
440 # Force _all_ exported methods to be |_declspec(dllexport)| when we're
441 # building them into the executable.
442
443 ifeq (,$(filter-out WINNT WINCE OS2, $(OS_ARCH)))
444 ifdef BUILD_STATIC_LIBS
445 DEFINES += \
446 -D_IMPL_NS_GFX \
447 -D_IMPL_NS_MSG_BASE \
448 -D_IMPL_NS_WIDGET \
449 $(NULL)
450 endif
451 endif
452
453 # Flags passed to make-jars.pl
454
455 MAKE_JARS_FLAGS = \
456 -t $(topsrcdir) \
457 -f $(MOZ_CHROME_FILE_FORMAT) \
458 $(NULL)
459
460 ifdef USE_EXTENSION_MANIFEST
461 MAKE_JARS_FLAGS += -e
462 endif
463
464 ifdef BOTH_MANIFESTS
465 MAKE_JARS_FLAGS += --both-manifests
466 endif
467
468 TAR_CREATE_FLAGS = -cvhf
469
470 ifeq ($(OS_ARCH),BSD_OS)
471 TAR_CREATE_FLAGS = -cvLf
472 endif
473
474 ifeq ($(OS_ARCH),OS2)
475 TAR_CREATE_FLAGS = -cvf
476 endif
477
478 #
479 # Personal makefile customizations go in these optional make include files.
480 #
481 MY_CONFIG := $(DEPTH)/config/myconfig.mk
482 MY_RULES := $(DEPTH)/config/myrules.mk
483
484 #
485 # Default command macros; can be overridden in <arch>.mk.
486 #
487 CCC = $(CXX)
488 NFSPWD = $(CONFIG_TOOLS)/nfspwd
489 PURIFY = purify $(PURIFYOPTIONS)
490 QUANTIFY = quantify $(QUANTIFYOPTIONS)
491 ifdef CROSS_COMPILE
492 XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX)
493 XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/host/bin/host_xpt_link$(HOST_BIN_SUFFIX)
494 else
495 XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
496 XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
497 endif
498
499 # Java macros
500 JAVA_GEN_DIR = _javagen
501 JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
502 JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
503
504 INCLUDES = \
505 $(LOCAL_INCLUDES) \
506 -I$(srcdir) \
507 -I. \
508 -I$(DIST)/include -I$(DIST)/include/nsprpub \
509 $(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include -I$(LIBXUL_SDK)/include/nsprpub) \
510 $(OS_INCLUDES) \
511 $(NULL)
512
513 include $(topsrcdir)/config/static-checking-config.mk
514
515 ifdef MOZ_SHARK
516 OS_CFLAGS += -F/System/Library/PrivateFrameworks
517 OS_CXXFLAGS += -F/System/Library/PrivateFrameworks
518 OS_LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD
519 endif # ifdef MOZ_SHARK
520
521 CFLAGS = $(OS_CFLAGS)
522 CXXFLAGS = $(OS_CXXFLAGS)
523 LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
524
525 # Allow each module to override the *default* optimization settings
526 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
527 # arguments to --enable-optimize
528 ifdef MOZ_OPTIMIZE
529 ifeq (1,$(MOZ_OPTIMIZE))
530 ifdef MODULE_OPTIMIZE_FLAGS
531 CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
532 CXXFLAGS += $(MODULE_OPTIMIZE_FLAGS)
533 else
534 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
535 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
536 endif # MODULE_OPTIMIZE_FLAGS
537 else
538 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
539 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
540 endif # MOZ_OPTIMIZE == 1
541 LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
542 endif # MOZ_OPTIMIZE
543
544 ifdef CROSS_COMPILE
545 HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS)
546 else
547 ifdef MOZ_OPTIMIZE
548 ifeq (1,$(MOZ_OPTIMIZE))
549 ifdef MODULE_OPTIMIZE_FLAGS
550 HOST_CFLAGS += $(MODULE_OPTIMIZE_FLAGS)
551 else
552 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
553 endif # MODULE_OPTIMIZE_FLAGS
554 else
555 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
556 endif # MOZ_OPTIMIZE == 1
557 endif # MOZ_OPTIMIZE
558 endif # CROSS_COMPILE
559
560
561 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
562 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
563 #// DLL version of the RTL is used...
564 #//
565 #//------------------------------------------------------------------------
566 ifdef USE_STATIC_LIBS
567 RTL_FLAGS=-MT # Statically linked multithreaded RTL
568 ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
569 ifndef MOZ_NO_DEBUG_RTL
570 RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
571 endif
572 endif # MOZ_DEBUG || NS_TRACE_MALLOC
573
574 else # !USE_STATIC_LIBS
575
576 RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
577 ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
578 ifndef MOZ_NO_DEBUG_RTL
579 RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
580 endif
581 endif # MOZ_DEBUG || NS_TRACE_MALLOC
582 endif # USE_STATIC_LIBS
583 endif # WINNT && !GNU_CC
584
585 ifeq ($(OS_ARCH),Darwin)
586 # Darwin doesn't cross-compile, so just set both types of flags here.
587 HOST_CMFLAGS += -fobjc-exceptions
588 HOST_CMMFLAGS += -fobjc-exceptions
589 OS_COMPILE_CMFLAGS += -fobjc-exceptions
590 OS_COMPILE_CMMFLAGS += -fobjc-exceptions
591 endif
592
593 COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
594 COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(PROFILER_CFLAGS) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
595 COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
596 COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
597
598 ifndef CROSS_COMPILE
599 HOST_CFLAGS += $(RTL_FLAGS)
600 endif
601
602 #
603 # Name of the binary code directories
604 #
605 # Override defaults
606
607 # We need to know where to find the libraries we
608 # put on the link line for binaries, and should
609 # we link statically or dynamic? Assuming dynamic for now.
610
611 ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
612 ifneq (,$(filter-out WINCE,$(OS_ARCH)))
613 LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
614 ifdef LIBXUL_SDK
615 LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
616 endif
617 endif
618 endif
619
620 # Default location of include files
621 IDL_DIR = $(DIST)/idl
622
623 XPIDL_FLAGS = -I$(srcdir) -I$(IDL_DIR)
624 ifdef LIBXUL_SDK
625 XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
626 endif
627
628 SDK_LIB_DIR = $(DIST)/sdk/lib
629 SDK_BIN_DIR = $(DIST)/sdk/bin
630
631 DEPENDENCIES = .md
632
633 MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
634
635 ifdef GC_LEAK_DETECTOR
636 XPCOM_LIBS += -lboehm
637 endif
638
639 ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES)))
640 DEFINES += -DXPCONNECT_STANDALONE
641 endif
642
643 ifeq ($(OS_ARCH),OS2)
644 ELF_DYNSTR_GC = echo
645 else
646 ELF_DYNSTR_GC = :
647 endif
648
649 ifndef CROSS_COMPILE
650 ifdef USE_ELF_DYNSTR_GC
651 ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
652 ELF_DYNSTR_GC = $(DEPTH)/config/elf-dynstr-gc
653 endif
654 endif
655 endif
656
657 ifeq ($(OS_ARCH),Darwin)
658 ifdef NEXT_ROOT
659 export NEXT_ROOT
660 PBBUILD = NEXT_ROOT= $(PBBUILD_BIN)
661 else # NEXT_ROOT
662 PBBUILD = $(PBBUILD_BIN)
663 endif # NEXT_ROOT
664 PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
665 ifdef MACOS_SDK_DIR
666 PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
667 endif # MACOS_SDK_DIR
668 ifdef MACOSX_DEPLOYMENT_TARGET
669 export MACOSX_DEPLOYMENT_TARGET
670 PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)"
671 endif # MACOSX_DEPLOYMENT_TARGET
672 ifdef MOZ_OPTIMIZE
673 ifeq (2,$(MOZ_OPTIMIZE))
674 # Only override project defaults if the config specified explicit settings
675 PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)"
676 endif # MOZ_OPTIMIZE=2
677 endif # MOZ_OPTIMIZE
678 ifeq (1,$(HAS_XCODE_2_1))
679 # Xcode 2.1 puts its build products in a directory corresponding to the
680 # selected build style/configuration.
681 XCODE_PRODUCT_DIR = build/$(BUILDSTYLE)
682 else
683 XCODE_PRODUCT_DIR = build
684 endif # HAS_XCODE_2_1=1
685 endif # OS_ARCH=Darwin
686
687
688 ifdef MOZ_NATIVE_MAKEDEPEND
689 MKDEPEND_DIR =
690 MKDEPEND = $(CYGWIN_WRAPPER) $(MOZ_NATIVE_MAKEDEPEND)
691 else
692 MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend
693 MKDEPEND = $(CYGWIN_WRAPPER) $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
694 endif
695
696 # Set link flags according to whether we want a console.
697 ifdef MOZ_WINCONSOLE
698 ifeq ($(MOZ_WINCONSOLE),1)
699 ifeq ($(OS_ARCH),OS2)
700 BIN_FLAGS += -Zlinker -PM:VIO
701 endif
702 ifeq ($(OS_ARCH),WINNT)
703 ifdef GNU_CC
704 WIN32_EXE_LDFLAGS += -mconsole
705 else
706 WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE
707 endif
708 endif
709 else # MOZ_WINCONSOLE
710 ifeq ($(OS_ARCH),OS2)
711 BIN_FLAGS += -Zlinker -PM:PM
712 endif
713 ifeq ($(OS_ARCH),WINNT)
714 ifdef GNU_CC
715 WIN32_EXE_LDFLAGS += -mwindows
716 else
717 WIN32_EXE_LDFLAGS += -SUBSYSTEM:WINDOWS
718 endif
719 endif
720 endif
721 endif
722
723 # Flags needed to link against the component library
724 ifdef MOZ_COMPONENTLIB
725 MOZ_COMPONENTLIB_EXTRA_DSO_LIBS = mozcomps xpcom_compat
726
727 # Tell the linker where NSS is, if we're building crypto
728 ifeq ($(OS_ARCH),Darwin)
729 ifeq (,$(findstring crypto,$(MOZ_META_COMPONENTS)))
730 MOZ_COMPONENTLIB_EXTRA_LIBS = $(foreach library, $(patsubst -l%, $(LIB_PREFIX)%$(DLL_SUFFIX), $(filter -l%, $(NSS_LIBS))), -dylib_file @executable_path/$(library):$(DIST)/bin/$(library))
731 endif
732 endif
733 endif
734
735 # If we're building a component on MSVC, we don't want to generate an
736 # import lib, because that import lib will collide with the name of a
737 # static version of the same library.
738 ifeq ($(GNU_LD)$(OS_ARCH),WINNT)
739 ifdef IS_COMPONENT
740 LDFLAGS += -IMPLIB:fake.lib
741 DELETE_AFTER_LINK = fake.lib fake.exp
742 endif
743 endif
744
745 #
746 # Include any personal overrides the user might think are needed.
747 #
748 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
749 -include $(MY_CONFIG)
750
751 ######################################################################
752 # Now test variables that might have been set or overridden by $(MY_CONFIG).
753
754 DEFINES += -DOSTYPE=\"$(OS_CONFIG)\"
755 DEFINES += -DOSARCH=$(OS_ARCH)
756
757 # For profiling
758 ifdef ENABLE_EAZEL_PROFILER
759 ifndef INTERNAL_TOOLS
760 ifneq ($(LIBRARY_NAME), xpt)
761 ifneq (, $(findstring $(shell $(topsrcdir)/build/unix/print-depth-path.sh | awk -F/ '{ print $$2; }'), $(MOZ_PROFILE_MODULES)))
762 PROFILER_CFLAGS = $(EAZEL_PROFILER_CFLAGS) -DENABLE_EAZEL_PROFILER
763 PROFILER_LIBS = $(EAZEL_PROFILER_LIBS)
764 endif
765 endif
766 endif
767 endif
768
769 ######################################################################
770
771 GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
772
773 ifeq ($(OS_ARCH),Darwin)
774 ifndef NSDISTMODE
775 NSDISTMODE=absolute_symlink
776 endif
777 PWD := $(CURDIR)
778 endif
779
780 ifdef NSINSTALL_BIN
781 NSINSTALL = $(CYGWIN_WRAPPER) $(NSINSTALL_BIN)
782 else
783 ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
784 NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
785 else
786 NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
787 endif # OS2
788 endif # NSINSTALL_BIN
789
790
791 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
792 INSTALL = $(NSINSTALL)
793 else
794 ifeq ($(NSDISTMODE),copy)
795 # copy files, but preserve source mtime
796 INSTALL = $(NSINSTALL) -t
797 else
798 ifeq ($(NSDISTMODE),absolute_symlink)
799 # install using absolute symbolic links
800 ifeq ($(OS_ARCH),Darwin)
801 INSTALL = $(NSINSTALL) -L $(PWD)
802 else
803 INSTALL = $(NSINSTALL) -L `$(NFSPWD)`
804 endif # Darwin
805 else
806 # install using relative symbolic links
807 INSTALL = $(NSINSTALL) -R
808 endif # absolute_symlink
809 endif # copy
810 endif # WINNT/OS2
811
812 # Use nsinstall in copy mode to install files on the system
813 SYSINSTALL = $(NSINSTALL) -t
814
815 ifeq ($(OS_ARCH),WINNT)
816 ifneq (,$(CYGDRIVE_MOUNT))
817 export CYGDRIVE_MOUNT
818 endif
819 endif
820
821 #
822 # Localization build automation
823 #
824
825 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
826 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
827 # overridden by the command line. (Besides, AB_CD is prettier).
828 AB_CD = $(MOZ_UI_LOCALE)
829
830 ifndef L10NBASEDIR
831 L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
832 endif
833
834 EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(L10NBASEDIR)/$(AB_CD)/$(subst /locales,,$(1)))
835
836 ifdef relativesrcdir
837 LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
838 endif
839
840 ifdef LOCALE_SRCDIR
841 # if LOCALE_MERGEDIR is set, use mergedir first, then the localization,
842 # and finally en-US
843 ifdef LOCALE_MERGEDIR
844 MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
845 endif
846 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
847 ifdef LOCALE_MERGEDIR
848 MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
849 endif
850 endif
851
852 ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
853 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
854 endif
855
856 ifeq ($(OS_ARCH),OS2)
857 RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
858 endif
859
860 #
861 # Java macros
862 #
863
864 # Make sure any compiled classes work with at least JVM 1.4
865 JAVAC_FLAGS += -source 1.4
866
867 ifdef MOZ_DEBUG
868 JAVAC_FLAGS += -g
869 endif
870
871 ifdef TIERS
872 DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
873 STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
874 endif

  ViewVC Help
Powered by ViewVC 1.1.24