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