~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to mozilla/config/config.mk

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This Source Code Form is subject to the terms of the Mozilla Public
 
3
# License, v. 2.0. If a copy of the MPL was not distributed with this
 
4
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
5
 
 
6
#
 
7
# config.mk
 
8
#
 
9
# Determines the platform and builds the macros needed to load the
 
10
# appropriate platform-specific .mk file, then defines all (most?)
 
11
# of the generic macros.
 
12
#
 
13
 
 
14
# Define an include-at-most-once flag
 
15
ifdef INCLUDED_CONFIG_MK
 
16
$(error Do not include config.mk twice!)
 
17
endif
 
18
INCLUDED_CONFIG_MK = 1
 
19
 
 
20
EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
 
21
 
 
22
ifndef topsrcdir
 
23
topsrcdir       = $(DEPTH)
 
24
endif
 
25
 
 
26
ifndef INCLUDED_AUTOCONF_MK
 
27
include $(DEPTH)/config/autoconf.mk
 
28
endif
 
29
 
 
30
COMMA = ,
 
31
 
 
32
# Sanity check some variables
 
33
CHECK_VARS := \
 
34
 XPI_NAME \
 
35
 LIBRARY_NAME \
 
36
 MODULE \
 
37
 DEPTH \
 
38
 SHORT_LIBNAME \
 
39
 XPI_PKGNAME \
 
40
 INSTALL_EXTENSION_ID \
 
41
 SHARED_LIBRARY_NAME \
 
42
 STATIC_LIBRARY_NAME \
 
43
 $(NULL)
 
44
 
 
45
# checks for internal spaces or trailing spaces in the variable
 
46
# named by $x
 
47
check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x)))
 
48
 
 
49
$(foreach x,$(CHECK_VARS),$(check-variable))
 
50
 
 
51
core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
 
52
core_realpath = $(if $(realpath $(1)),$(realpath $(1)),$(call core_abspath,$(1)))
 
53
 
 
54
nullstr :=
 
55
space :=$(nullstr) # EOL
 
56
 
 
57
core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1)))))))
 
58
 
 
59
RM = rm -f
 
60
 
 
61
# LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
 
62
LIBXUL_DIST ?= $(DIST)
 
63
 
 
64
# FINAL_TARGET specifies the location into which we copy end-user-shipped
 
65
# build products (typelibs, components, chrome).
 
66
#
 
67
# If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
 
68
# If DIST_SUBDIR is set, the files will be shipped to $(DIST)/$(DIST_SUBDIR)
 
69
# Otherwise, the default $(DIST)/bin will be used.
 
70
FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(if $(DIST_SUBDIR),$(DIST)/bin/$(DIST_SUBDIR),$(DIST)/bin))
 
71
 
 
72
ifdef XPI_NAME
 
73
DEFINES += -DXPI_NAME=$(XPI_NAME)
 
74
endif
 
75
 
 
76
# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
 
77
VERSION_NUMBER          = 50
 
78
 
 
79
ifeq ($(HOST_OS_ARCH),WINNT)
 
80
win_srcdir      := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
 
81
BUILD_TOOLS     = $(WIN_TOP_SRC)/build/unix
 
82
else
 
83
win_srcdir      := $(srcdir)
 
84
BUILD_TOOLS     = $(topsrcdir)/build/unix
 
85
endif
 
86
 
 
87
CONFIG_TOOLS    = $(MOZ_BUILD_ROOT)/config
 
88
AUTOCONF_TOOLS  = $(topsrcdir)/build/autoconf
 
89
 
 
90
#
 
91
# Strip off the excessively long version numbers on these platforms,
 
92
# but save the version to allow multiple versions of the same base
 
93
# platform to be built in the same tree.
 
94
#
 
95
ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD SunOS,$(OS_ARCH)))
 
96
OS_RELEASE      := $(basename $(OS_RELEASE))
 
97
 
 
98
# Allow the user to ignore the OS_VERSION, which is usually irrelevant.
 
99
ifdef WANT_MOZILLA_CONFIG_OS_VERSION
 
100
OS_VERS         := $(suffix $(OS_RELEASE))
 
101
OS_VERSION      := $(shell echo $(OS_VERS) | sed 's/-.*//')
 
102
endif
 
103
 
 
104
endif
 
105
 
 
106
OS_CONFIG       := $(OS_ARCH)$(OS_RELEASE)
 
107
 
 
108
FINAL_LINK_LIBS = $(DEPTH)/config/final-link-libs
 
109
FINAL_LINK_COMPS = $(DEPTH)/config/final-link-comps
 
110
FINAL_LINK_COMP_NAMES = $(DEPTH)/config/final-link-comp-names
 
111
 
 
112
MOZ_UNICHARUTIL_LIBS = $(LIBXUL_DIST)/lib/$(LIB_PREFIX)unicharutil_s.$(LIB_SUFFIX)
 
113
MOZ_WIDGET_SUPPORT_LIBS    = $(DIST)/lib/$(LIB_PREFIX)widgetsupport_s.$(LIB_SUFFIX)
 
114
 
 
115
ifdef _MSC_VER
 
116
ifdef .PYMAKE
 
117
PYCOMMANDPATH += $(topsrcdir)/build
 
118
CC_WRAPPER ?= %cl InvokeClWithDependencyGeneration
 
119
CXX_WRAPPER ?= %cl InvokeClWithDependencyGeneration
 
120
else
 
121
CC_WRAPPER ?= $(PYTHON) -O $(topsrcdir)/build/cl.py
 
122
CXX_WRAPPER ?= $(PYTHON) -O $(topsrcdir)/build/cl.py
 
123
endif # .PYMAKE
 
124
endif # _MSC_VER
 
125
 
 
126
CC := $(CC_WRAPPER) $(CC)
 
127
CXX := $(CXX_WRAPPER) $(CXX)
 
128
MKDIR ?= mkdir
 
129
SLEEP ?= sleep
 
130
TOUCH ?= touch
 
131
 
 
132
ifdef .PYMAKE
 
133
PYCOMMANDPATH += $(topsrcdir)/config
 
134
endif
 
135
 
 
136
PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
 
137
 
 
138
# determine debug-related options
 
139
_DEBUG_ASFLAGS :=
 
140
_DEBUG_CFLAGS :=
 
141
_DEBUG_LDFLAGS :=
 
142
 
 
143
ifdef MOZ_DEBUG
 
144
  _DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
 
145
  XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
 
146
else
 
147
  _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
 
148
  XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
 
149
endif
 
150
 
 
151
ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS))
 
152
  ifeq ($(AS),yasm)
 
153
    ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
 
154
      _DEBUG_ASFLAGS += -g cv8
 
155
    else
 
156
      ifneq ($(OS_ARCH),Darwin)
 
157
        _DEBUG_ASFLAGS += -g dwarf2
 
158
      endif
 
159
    endif
 
160
  else
 
161
    _DEBUG_ASFLAGS += $(MOZ_DEBUG_FLAGS)
 
162
  endif
 
163
  _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
 
164
  _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
 
165
endif
 
166
 
 
167
MOZALLOC_LIB = $(call EXPAND_LIBNAME_PATH,mozalloc,$(DIST)/lib)
 
168
 
 
169
ASFLAGS += $(_DEBUG_ASFLAGS)
 
170
OS_CFLAGS += $(_DEBUG_CFLAGS)
 
171
OS_CXXFLAGS += $(_DEBUG_CFLAGS)
 
172
OS_LDFLAGS += $(_DEBUG_LDFLAGS)
 
173
 
 
174
# XXX: What does this? Bug 482434 filed for better explanation.
 
175
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
 
176
ifdef MOZ_DEBUG
 
177
ifneq (,$(MOZ_BROWSE_INFO)$(MOZ_BSCFILE))
 
178
OS_CFLAGS += -FR
 
179
OS_CXXFLAGS += -FR
 
180
endif
 
181
else # ! MOZ_DEBUG
 
182
 
 
183
# MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
 
184
# Used for generating an optimized build with debugging symbols.
 
185
# Used in the Windows nightlies to generate symbols for crash reporting.
 
186
ifdef MOZ_DEBUG_SYMBOLS
 
187
OS_CXXFLAGS += -UDEBUG -DNDEBUG
 
188
OS_CFLAGS += -UDEBUG -DNDEBUG
 
189
ifdef HAVE_64BIT_OS
 
190
OS_LDFLAGS += -DEBUG -OPT:REF,ICF
 
191
else
 
192
OS_LDFLAGS += -DEBUG -OPT:REF
 
193
endif
 
194
endif
 
195
 
 
196
#
 
197
# Handle trace-malloc in optimized builds.
 
198
# No opt to give sane callstacks.
 
199
#
 
200
ifdef NS_TRACE_MALLOC
 
201
MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG
 
202
ifdef HAVE_64BIT_OS
 
203
OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF,ICF
 
204
else
 
205
OS_LDFLAGS = -DEBUG -PDB:NONE -OPT:REF
 
206
endif
 
207
endif # NS_TRACE_MALLOC
 
208
 
 
209
endif # MOZ_DEBUG
 
210
 
 
211
# We don't build a static CRT when building a custom CRT,
 
212
# it appears to be broken. So don't link to jemalloc if
 
213
# the Makefile wants static CRT linking.
 
214
ifeq ($(MOZ_MEMORY)_$(USE_STATIC_LIBS),1_1)
 
215
# Disable default CRT libs and add the right lib path for the linker
 
216
MOZ_GLUE_LDFLAGS=
 
217
endif
 
218
 
 
219
endif # WINNT && !GNU_CC
 
220
 
 
221
ifdef MOZ_GLUE_PROGRAM_LDFLAGS
 
222
DEFINES += -DMOZ_GLUE_IN_PROGRAM
 
223
else
 
224
MOZ_GLUE_PROGRAM_LDFLAGS=$(MOZ_GLUE_LDFLAGS)
 
225
endif
 
226
 
 
227
#
 
228
# Build using PIC by default
 
229
#
 
230
_ENABLE_PIC=1
 
231
 
 
232
# Determine if module being compiled is destined
 
233
# to be merged into libxul
 
234
 
 
235
ifdef LIBXUL_LIBRARY
 
236
ifdef IS_COMPONENT
 
237
ifdef MODULE_NAME
 
238
DEFINES += -DXPCOM_TRANSLATE_NSGM_ENTRY_POINT=1
 
239
else
 
240
$(error Component makefile does not specify MODULE_NAME.)
 
241
endif
 
242
endif
 
243
FORCE_STATIC_LIB=1
 
244
SHORT_LIBNAME=
 
245
endif
 
246
 
 
247
# If we are building this component into an extension/xulapp, it cannot be
 
248
# statically linked. In the future we may want to add a xulapp meta-component
 
249
# build option.
 
250
 
 
251
ifdef XPI_NAME
 
252
ifdef IS_COMPONENT
 
253
EXPORT_LIBRARY=
 
254
FORCE_STATIC_LIB=
 
255
FORCE_SHARED_LIB=1
 
256
endif
 
257
endif
 
258
 
 
259
ifndef SHARED_LIBRARY_NAME
 
260
ifdef LIBRARY_NAME
 
261
SHARED_LIBRARY_NAME=$(LIBRARY_NAME)
 
262
endif
 
263
endif
 
264
 
 
265
ifndef STATIC_LIBRARY_NAME
 
266
ifdef LIBRARY_NAME
 
267
STATIC_LIBRARY_NAME=$(LIBRARY_NAME)
 
268
endif
 
269
endif
 
270
 
 
271
# No sense in profiling tools
 
272
ifdef INTERNAL_TOOLS
 
273
NO_PROFILE_GUIDED_OPTIMIZE = 1
 
274
endif
 
275
 
 
276
# Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
 
277
# and we don't have the same build logic to re-link them in the second pass.
 
278
ifdef SIMPLE_PROGRAMS
 
279
NO_PROFILE_GUIDED_OPTIMIZE = 1
 
280
endif
 
281
 
 
282
# No sense in profiling unit tests
 
283
ifdef CPP_UNIT_TESTS
 
284
NO_PROFILE_GUIDED_OPTIMIZE = 1
 
285
endif
 
286
 
 
287
# Enable profile-based feedback
 
288
ifndef NO_PROFILE_GUIDED_OPTIMIZE
 
289
ifdef MOZ_PROFILE_GENERATE
 
290
OS_CFLAGS += $(PROFILE_GEN_CFLAGS)
 
291
OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS)
 
292
OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
 
293
ifeq (WINNT,$(OS_ARCH))
 
294
AR_FLAGS += -LTCG
 
295
endif
 
296
endif # MOZ_PROFILE_GENERATE
 
297
 
 
298
ifdef MOZ_PROFILE_USE
 
299
OS_CFLAGS += $(PROFILE_USE_CFLAGS)
 
300
OS_CXXFLAGS += $(PROFILE_USE_CFLAGS)
 
301
OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
 
302
ifeq (WINNT,$(OS_ARCH))
 
303
AR_FLAGS += -LTCG
 
304
endif
 
305
endif # MOZ_PROFILE_USE
 
306
endif # NO_PROFILE_GUIDED_OPTIMIZE
 
307
 
 
308
 
 
309
# Does the makefile specifies the internal XPCOM API linkage?
 
310
ifneq (,$(MOZILLA_INTERNAL_API)$(LIBXUL_LIBRARY))
 
311
DEFINES += -DMOZILLA_INTERNAL_API
 
312
endif
 
313
 
 
314
# Force XPCOM/widget/gfx methods to be _declspec(dllexport) when we're
 
315
# building libxul libraries
 
316
ifdef LIBXUL_LIBRARY
 
317
DEFINES += \
 
318
                -D_IMPL_NS_COM \
 
319
                -DEXPORT_XPT_API \
 
320
                -DEXPORT_XPTC_API \
 
321
                -D_IMPL_NS_GFX \
 
322
                -D_IMPL_NS_WIDGET \
 
323
                -DIMPL_XREAPI \
 
324
                -DIMPL_NS_NET \
 
325
                -DIMPL_THEBES \
 
326
                $(NULL)
 
327
 
 
328
ifndef JS_SHARED_LIBRARY
 
329
DEFINES += -DSTATIC_EXPORTABLE_JS_API
 
330
endif
 
331
endif
 
332
 
 
333
# Flags passed to JarMaker.py
 
334
MAKE_JARS_FLAGS = \
 
335
        -t $(topsrcdir) \
 
336
        -f $(MOZ_CHROME_FILE_FORMAT) \
 
337
        $(NULL)
 
338
 
 
339
ifdef USE_EXTENSION_MANIFEST
 
340
MAKE_JARS_FLAGS += -e
 
341
endif
 
342
 
 
343
ifdef BOTH_MANIFESTS
 
344
MAKE_JARS_FLAGS += --both-manifests
 
345
endif
 
346
 
 
347
TAR_CREATE_FLAGS = -cvhf
 
348
TAR_CREATE_FLAGS_QUIET = -chf
 
349
 
 
350
ifeq ($(OS_ARCH),BSD_OS)
 
351
TAR_CREATE_FLAGS = -cvLf
 
352
TAR_CREATE_FLAGS_QUIET = -cLf
 
353
endif
 
354
 
 
355
ifeq ($(OS_ARCH),OS2)
 
356
TAR_CREATE_FLAGS = -cvf
 
357
TAR_CREATE_FLAGS_QUIET = -cf
 
358
endif
 
359
 
 
360
#
 
361
# Personal makefile customizations go in these optional make include files.
 
362
#
 
363
MY_CONFIG       := $(DEPTH)/config/myconfig.mk
 
364
MY_RULES        := $(DEPTH)/config/myrules.mk
 
365
 
 
366
#
 
367
# Default command macros; can be overridden in <arch>.mk.
 
368
#
 
369
CCC = $(CXX)
 
370
XPIDL_LINK = $(PYTHON) $(LIBXUL_DIST)/sdk/bin/xpt.py link
 
371
 
 
372
# Java macros
 
373
JAVA_GEN_DIR  = _javagen
 
374
JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
 
375
JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
 
376
 
 
377
OS_INCLUDES += $(NSPR_CFLAGS) $(NSS_CFLAGS) $(MOZ_JPEG_CFLAGS) $(MOZ_PNG_CFLAGS) $(MOZ_ZLIB_CFLAGS)
 
378
 
 
379
INCLUDES = \
 
380
  $(LOCAL_INCLUDES) \
 
381
  -I$(srcdir) \
 
382
  -I. \
 
383
  -I$(DIST)/include \
 
384
  $(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include) \
 
385
  $(OS_INCLUDES) \
 
386
  $(NULL)
 
387
 
 
388
include $(topsrcdir)/config/static-checking-config.mk
 
389
 
 
390
CFLAGS          = $(OS_CPPFLAGS) $(OS_CFLAGS)
 
391
CXXFLAGS        = $(OS_CPPFLAGS) $(OS_CXXFLAGS)
 
392
LDFLAGS         = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
 
393
 
 
394
# Allow each module to override the *default* optimization settings
 
395
# by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
 
396
# arguments to --enable-optimize
 
397
ifdef MOZ_OPTIMIZE
 
398
ifeq (1,$(MOZ_OPTIMIZE))
 
399
ifdef MODULE_OPTIMIZE_FLAGS
 
400
CFLAGS          += $(MODULE_OPTIMIZE_FLAGS)
 
401
CXXFLAGS        += $(MODULE_OPTIMIZE_FLAGS)
 
402
else
 
403
ifneq (,$(if $(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE),$(MOZ_PGO_OPTIMIZE_FLAGS)))
 
404
CFLAGS          += $(MOZ_PGO_OPTIMIZE_FLAGS)
 
405
CXXFLAGS        += $(MOZ_PGO_OPTIMIZE_FLAGS)
 
406
else
 
407
CFLAGS          += $(MOZ_OPTIMIZE_FLAGS)
 
408
CXXFLAGS        += $(MOZ_OPTIMIZE_FLAGS)
 
409
endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
 
410
endif # MODULE_OPTIMIZE_FLAGS
 
411
else
 
412
CFLAGS          += $(MOZ_OPTIMIZE_FLAGS)
 
413
CXXFLAGS        += $(MOZ_OPTIMIZE_FLAGS)
 
414
endif # MOZ_OPTIMIZE == 1
 
415
LDFLAGS         += $(MOZ_OPTIMIZE_LDFLAGS)
 
416
endif # MOZ_OPTIMIZE
 
417
 
 
418
ifdef CROSS_COMPILE
 
419
HOST_CFLAGS     += $(HOST_OPTIMIZE_FLAGS)
 
420
else
 
421
ifdef MOZ_OPTIMIZE
 
422
ifeq (1,$(MOZ_OPTIMIZE))
 
423
ifdef MODULE_OPTIMIZE_FLAGS
 
424
HOST_CFLAGS     += $(MODULE_OPTIMIZE_FLAGS)
 
425
else
 
426
HOST_CFLAGS     += $(MOZ_OPTIMIZE_FLAGS)
 
427
endif # MODULE_OPTIMIZE_FLAGS
 
428
else
 
429
HOST_CFLAGS     += $(MOZ_OPTIMIZE_FLAGS)
 
430
endif # MOZ_OPTIMIZE == 1
 
431
endif # MOZ_OPTIMIZE
 
432
endif # CROSS_COMPILE
 
433
 
 
434
CFLAGS += $(MOZ_FRAMEPTR_FLAGS)
 
435
CXXFLAGS += $(MOZ_FRAMEPTR_FLAGS)
 
436
 
 
437
# Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
 
438
# to request that we use the 'warnings as errors' compile flags)
 
439
 
 
440
# NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
 
441
# build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
 
442
# situation. (See bug 437002.)
 
443
ifeq (WINNT_1,$(OS_ARCH)_$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
 
444
FAIL_ON_WARNINGS_DEBUG=
 
445
FAIL_ON_WARNINGS=
 
446
endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
 
447
 
 
448
# Now, check for debug version of flag; it turns on normal flag in debug builds.
 
449
ifdef FAIL_ON_WARNINGS_DEBUG
 
450
ifdef MOZ_DEBUG
 
451
FAIL_ON_WARNINGS = 1
 
452
endif # MOZ_DEBUG
 
453
endif # FAIL_ON_WARNINGS_DEBUG
 
454
 
 
455
# Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
 
456
ifdef FAIL_ON_WARNINGS
 
457
CXXFLAGS += $(WARNINGS_AS_ERRORS)
 
458
CFLAGS   += $(WARNINGS_AS_ERRORS)
 
459
endif # FAIL_ON_WARNINGS
 
460
 
 
461
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
 
462
#// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
 
463
#// DLL version of the RTL is used...
 
464
#//
 
465
#//------------------------------------------------------------------------
 
466
ifdef USE_STATIC_LIBS
 
467
RTL_FLAGS=-MT          # Statically linked multithreaded RTL
 
468
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
 
469
ifndef MOZ_NO_DEBUG_RTL
 
470
RTL_FLAGS=-MTd         # Statically linked multithreaded MSVC4.0 debug RTL
 
471
endif
 
472
endif # MOZ_DEBUG || NS_TRACE_MALLOC
 
473
 
 
474
else # !USE_STATIC_LIBS
 
475
 
 
476
RTL_FLAGS=-MD          # Dynamically linked, multithreaded RTL
 
477
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
 
478
ifndef MOZ_NO_DEBUG_RTL
 
479
RTL_FLAGS=-MDd         # Dynamically linked, multithreaded MSVC4.0 debug RTL
 
480
endif
 
481
endif # MOZ_DEBUG || NS_TRACE_MALLOC
 
482
endif # USE_STATIC_LIBS
 
483
endif # WINNT && !GNU_CC
 
484
 
 
485
ifeq ($(OS_ARCH),Darwin)
 
486
# Compiling ObjC requires an Apple compiler anyway, so it's ok to set
 
487
# host CMFLAGS here.
 
488
HOST_CMFLAGS += -fobjc-exceptions
 
489
HOST_CMMFLAGS += -fobjc-exceptions
 
490
OS_COMPILE_CMFLAGS += -fobjc-exceptions
 
491
OS_COMPILE_CMMFLAGS += -fobjc-exceptions
 
492
ifeq ($(MOZ_WIDGET_TOOLKIT),uikit)
 
493
OS_COMPILE_CMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
 
494
OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
 
495
endif
 
496
endif
 
497
 
 
498
COMPILE_CFLAGS  = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS)
 
499
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS)
 
500
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
 
501
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
 
502
 
 
503
ifndef CROSS_COMPILE
 
504
HOST_CFLAGS += $(RTL_FLAGS)
 
505
endif
 
506
 
 
507
#
 
508
# Name of the binary code directories
 
509
#
 
510
# Override defaults
 
511
 
 
512
# We need to know where to find the libraries we
 
513
# put on the link line for binaries, and should
 
514
# we link statically or dynamic?  Assuming dynamic for now.
 
515
 
 
516
ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
 
517
LIBS_DIR        = -L$(DIST)/bin -L$(DIST)/lib
 
518
ifdef LIBXUL_SDK
 
519
LIBS_DIR        += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
 
520
endif
 
521
endif
 
522
 
 
523
# Default location of include files
 
524
IDL_DIR         = $(DIST)/idl
 
525
 
 
526
XPIDL_FLAGS = -I$(srcdir) -I$(IDL_DIR)
 
527
ifdef LIBXUL_SDK
 
528
XPIDL_FLAGS += -I$(LIBXUL_SDK)/idl
 
529
endif
 
530
 
 
531
SDK_LIB_DIR = $(DIST)/sdk/lib
 
532
SDK_BIN_DIR = $(DIST)/sdk/bin
 
533
 
 
534
DEPENDENCIES    = .md
 
535
 
 
536
MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
 
537
 
 
538
ifeq ($(OS_ARCH),OS2)
 
539
ELF_DYNSTR_GC   = echo
 
540
else
 
541
ELF_DYNSTR_GC   = :
 
542
endif
 
543
 
 
544
ifndef CROSS_COMPILE
 
545
ifdef USE_ELF_DYNSTR_GC
 
546
ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
 
547
ELF_DYNSTR_GC   = $(DEPTH)/config/elf-dynstr-gc
 
548
endif
 
549
endif
 
550
endif
 
551
 
 
552
ifeq ($(OS_ARCH),Darwin)
 
553
ifdef NEXT_ROOT
 
554
export NEXT_ROOT
 
555
PBBUILD = NEXT_ROOT= $(PBBUILD_BIN)
 
556
else # NEXT_ROOT
 
557
PBBUILD = $(PBBUILD_BIN)
 
558
endif # NEXT_ROOT
 
559
PBBUILD_SETTINGS = GCC_VERSION="$(GCC_VERSION)" SYMROOT=build ARCHS="$(OS_TEST)"
 
560
ifdef MACOS_SDK_DIR
 
561
PBBUILD_SETTINGS += SDKROOT="$(MACOS_SDK_DIR)"
 
562
endif # MACOS_SDK_DIR
 
563
ifdef MACOSX_DEPLOYMENT_TARGET
 
564
export MACOSX_DEPLOYMENT_TARGET
 
565
PBBUILD_SETTINGS += MACOSX_DEPLOYMENT_TARGET="$(MACOSX_DEPLOYMENT_TARGET)"
 
566
endif # MACOSX_DEPLOYMENT_TARGET
 
567
 
 
568
ifdef MOZ_OPTIMIZE
 
569
ifeq (2,$(MOZ_OPTIMIZE))
 
570
# Only override project defaults if the config specified explicit settings
 
571
PBBUILD_SETTINGS += GCC_MODEL_TUNING= OPTIMIZATION_CFLAGS="$(MOZ_OPTIMIZE_FLAGS)"
 
572
endif # MOZ_OPTIMIZE=2
 
573
endif # MOZ_OPTIMIZE
 
574
endif # OS_ARCH=Darwin
 
575
 
 
576
ifdef MOZ_USING_CCACHE
 
577
ifdef CLANG_CXX
 
578
export CCACHE_CPP2=1
 
579
endif
 
580
endif
 
581
 
 
582
ifdef MOZ_NATIVE_MAKEDEPEND
 
583
MKDEPEND_DIR =
 
584
MKDEPEND = $(MOZ_NATIVE_MAKEDEPEND)
 
585
else
 
586
MKDEPEND_DIR = $(CONFIG_TOOLS)/mkdepend
 
587
MKDEPEND = $(MKDEPEND_DIR)/mkdepend$(BIN_SUFFIX)
 
588
endif
 
589
 
 
590
# Set link flags according to whether we want a console.
 
591
ifdef MOZ_WINCONSOLE
 
592
ifeq ($(MOZ_WINCONSOLE),1)
 
593
ifeq ($(OS_ARCH),OS2)
 
594
BIN_FLAGS       += -Zlinker -PM:VIO
 
595
endif
 
596
ifeq ($(OS_ARCH),WINNT)
 
597
ifdef GNU_CC
 
598
WIN32_EXE_LDFLAGS       += -mconsole
 
599
else
 
600
WIN32_EXE_LDFLAGS       += -SUBSYSTEM:CONSOLE
 
601
endif
 
602
endif
 
603
else # MOZ_WINCONSOLE
 
604
ifeq ($(OS_ARCH),OS2)
 
605
BIN_FLAGS       += -Zlinker -PM:PM
 
606
endif
 
607
ifeq ($(OS_ARCH),WINNT)
 
608
ifdef GNU_CC
 
609
WIN32_EXE_LDFLAGS       += -mwindows
 
610
else
 
611
WIN32_EXE_LDFLAGS       += -SUBSYSTEM:WINDOWS
 
612
endif
 
613
endif
 
614
endif
 
615
endif
 
616
 
 
617
# If we're building a component on MSVC, we don't want to generate an
 
618
# import lib, because that import lib will collide with the name of a
 
619
# static version of the same library.
 
620
ifeq ($(GNU_LD)$(OS_ARCH),WINNT)
 
621
ifdef IS_COMPONENT
 
622
LDFLAGS += -IMPLIB:fake.lib
 
623
DELETE_AFTER_LINK = fake.lib fake.exp
 
624
endif
 
625
endif
 
626
 
 
627
#
 
628
# Include any personal overrides the user might think are needed.
 
629
#
 
630
-include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
 
631
-include $(MY_CONFIG)
 
632
 
 
633
######################################################################
 
634
 
 
635
GARBAGE         += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
 
636
 
 
637
ifeq ($(OS_ARCH),Darwin)
 
638
ifndef NSDISTMODE
 
639
NSDISTMODE=absolute_symlink
 
640
endif
 
641
PWD := $(CURDIR)
 
642
endif
 
643
 
 
644
NSINSTALL_PY := $(PYTHON) $(call core_abspath,$(topsrcdir)/config/nsinstall.py)
 
645
# For Pymake, wherever we use nsinstall.py we're also going to try to make it
 
646
# a native command where possible. Since native commands can't be used outside
 
647
# of single-line commands, we continue to provide INSTALL for general use.
 
648
# Single-line commands should be switched over to install_cmd.
 
649
NSINSTALL_NATIVECMD := %nsinstall nsinstall
 
650
 
 
651
ifdef NSINSTALL_BIN
 
652
NSINSTALL = $(NSINSTALL_BIN)
 
653
else
 
654
ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
 
655
NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
 
656
else
 
657
ifeq ($(HOST_OS_ARCH),WINNT)
 
658
NSINSTALL = $(NSINSTALL_PY)
 
659
else
 
660
NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
 
661
endif # WINNT
 
662
endif # OS2
 
663
endif # NSINSTALL_BIN
 
664
 
 
665
 
 
666
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
 
667
INSTALL = $(NSINSTALL) -t
 
668
ifdef .PYMAKE
 
669
install_cmd = $(NSINSTALL_NATIVECMD) -t $(1)
 
670
endif # .PYMAKE
 
671
 
 
672
else
 
673
 
 
674
# This isn't laid out as conditional directives so that NSDISTMODE can be
 
675
# target-specific.
 
676
INSTALL         = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(filter absolute_symlink, $(NSDISTMODE)), $(NSINSTALL) -L $(PWD), $(NSINSTALL) -R))
 
677
 
 
678
endif # WINNT/OS2
 
679
 
 
680
# The default for install_cmd is simply INSTALL
 
681
install_cmd ?= $(INSTALL) $(1)
 
682
 
 
683
# Use nsinstall in copy mode to install files on the system
 
684
SYSINSTALL      = $(NSINSTALL) -t
 
685
# This isn't necessarily true, just here
 
686
sysinstall_cmd = install_cmd
 
687
 
 
688
#
 
689
# Localization build automation
 
690
#
 
691
 
 
692
# Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
 
693
# MOZ_UI_LOCALE directly, but use an intermediate variable that can be
 
694
# overridden by the command line. (Besides, AB_CD is prettier).
 
695
AB_CD = $(MOZ_UI_LOCALE)
 
696
 
 
697
ifndef L10NBASEDIR
 
698
  L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
 
699
else
 
700
  IS_LANGUAGE_REPACK = 1
 
701
endif
 
702
 
 
703
EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(call core_realpath,$(L10NBASEDIR))/$(AB_CD)/$(subst /locales,,$(1)))
 
704
 
 
705
ifdef relativesrcdir
 
706
LOCALE_SRCDIR = $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
 
707
endif
 
708
 
 
709
ifdef LOCALE_SRCDIR
 
710
# if LOCALE_MERGEDIR is set, use mergedir first, then the localization,
 
711
# and finally en-US
 
712
ifdef LOCALE_MERGEDIR
 
713
MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
 
714
endif
 
715
MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 
716
ifdef LOCALE_MERGEDIR
 
717
MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
 
718
endif
 
719
endif
 
720
 
 
721
ifdef LOCALE_MERGEDIR
 
722
MERGE_FILE = $(firstword \
 
723
  $(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
 
724
  $(wildcard $(LOCALE_SRCDIR)/$(1)) \
 
725
  $(srcdir)/en-US/$(1) )
 
726
else
 
727
MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
 
728
endif
 
729
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
 
730
 
 
731
ifeq (OS2,$(OS_ARCH))
 
732
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(LIBXUL_DIST)"
 
733
else
 
734
ifneq (WINNT,$(OS_ARCH))
 
735
RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
 
736
endif # ! WINNT
 
737
endif # ! OS2
 
738
 
 
739
#
 
740
# Java macros
 
741
#
 
742
 
 
743
# Make sure any compiled classes work with at least JVM 1.4
 
744
JAVAC_FLAGS += -source 1.4
 
745
 
 
746
ifdef MOZ_DEBUG
 
747
JAVAC_FLAGS += -g
 
748
endif
 
749
 
 
750
ifdef TIERS
 
751
DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
 
752
STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
 
753
endif
 
754
 
 
755
OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizejars.py)
 
756
 
 
757
CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py)
 
758
 
 
759
EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py $(if $@,--depend $(MDDEPDIR)/$(@F).pp --target $@)
 
760
EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py $(if $@,--depend $(MDDEPDIR)/$(@F).pp)
 
761
EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
 
762
EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
 
763
EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
 
764
EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
 
765
EXPAND_MKSHLIB_ARGS = --uselist
 
766
ifdef SYMBOL_ORDER
 
767
EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER)
 
768
endif
 
769
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB)
 
770
 
 
771
ifdef STDCXX_COMPAT
 
772
ifneq ($(OS_ARCH),Darwin)
 
773
CHECK_STDCXX = objdump -p $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev/null && echo "TEST-UNEXPECTED-FAIL | | We don't want these libstdc++ symbols to be used:" && objdump -T $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && exit 1 || exit 0
 
774
endif
 
775
 
 
776
EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,stdc++compat,$(DEPTH)/build/unix/stdc++compat)
 
777
HOST_EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,host_stdc++compat,$(DEPTH)/build/unix/stdc++compat)
 
778
endif
 
779
 
 
780
# autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
 
781
# this file
 
782
OBJ_SUFFIX := $(_OBJ_SUFFIX)
 
783
 
 
784
# PGO builds with GCC build objects with instrumentation in a first pass,
 
785
# then objects optimized, without instrumentation, in a second pass. If
 
786
# we overwrite the ojects from the first pass with those from the second,
 
787
# we end up not getting instrumentation data for better optimization on
 
788
# incremental builds. As a consequence, we use a different object suffix
 
789
# for the first pass.
 
790
ifndef NO_PROFILE_GUIDED_OPTIMIZE
 
791
ifdef MOZ_PROFILE_GENERATE
 
792
ifdef GNU_CC
 
793
OBJ_SUFFIX := i_o
 
794
endif
 
795
endif
 
796
endif
 
797
 
 
798
# EXPAND_LIBNAME - $(call EXPAND_LIBNAME,foo)
 
799
# expands to $(LIB_PREFIX)foo.$(LIB_SUFFIX) or -lfoo, depending on linker
 
800
# arguments syntax. Should only be used for system libraries
 
801
 
 
802
# EXPAND_LIBNAME_PATH - $(call EXPAND_LIBNAME_PATH,foo,dir)
 
803
# expands to dir/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
 
804
 
 
805
# EXPAND_MOZLIBNAME - $(call EXPAND_MOZLIBNAME,foo)
 
806
# expands to $(DIST)/lib/$(LIB_PREFIX)foo.$(LIB_SUFFIX)
 
807
 
 
808
ifdef GNU_CC
 
809
EXPAND_LIBNAME = $(addprefix -l,$(1))
 
810
else
 
811
EXPAND_LIBNAME = $(foreach lib,$(1),$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 
812
endif
 
813
EXPAND_LIBNAME_PATH = $(foreach lib,$(1),$(2)/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 
814
EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 
815
 
 
816
# Include internal ply only if needed
 
817
ifndef MOZ_SYSTEM_PLY
 
818
PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
 
819
endif
 
820
 
 
821
export CL_INCLUDES_PREFIX
 
822
 
 
823
ifeq ($(MOZ_WIDGET_GTK),2)
 
824
MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS)
 
825
endif