PageRenderTime 518ms CodeModel.GetById 482ms app.highlight 31ms RepoModel.GetById 1ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/js/config/config.mk

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