86
84
core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
87
space :=$(nullstr) # EOL
89
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)))))))
88
91
# FINAL_TARGET specifies the location into which we copy end-user-shipped
89
92
# build products (typelibs, components, chrome).
92
95
# XPI-contents staging directory for ambitious and right-thinking extensions.
93
96
FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)
95
# MAKE_JARS_TARGET is a staging area for make-jars.pl. When packaging in
96
# the jar format, make-jars leaves behind a directory structure that's not
97
# needed in $(FINAL_TARGET). For both, flat, and symlink, the directory
98
# structure contains the chrome, so leave it in $(FINAL_TARGET).
99
ifeq (jar,$(MOZ_CHROME_FILE_FORMAT))
100
MAKE_JARS_TARGET = $(if $(XPI_NAME),$(FINAL_TARGET).stage,$(DIST)/chrome-stage)
102
MAKE_JARS_TARGET = $(FINAL_TARGET)
99
DEFINES += -DXPI_NAME=$(XPI_NAME)
105
102
# The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
156
150
ifneq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
157
JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib) $(MKSHLIB_UNFORCE_ALL)
151
JEMALLOC_LIBS = $(MKSHLIB_FORCE_ALL) $(call EXPAND_MOZLIBNAME,jemalloc) $(MKSHLIB_UNFORCE_ALL)
152
# If we are linking jemalloc into a program, we want the jemalloc symbols
154
ifneq (,$(SIMPLE_PROGRAMS)$(PROGRAM))
155
JEMALLOC_LIBS += $(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
160
CC := $(CC_WRAPPER) $(CC)
161
CXX := $(CXX_WRAPPER) $(CXX)
161
166
# determine debug-related options
163
168
_DEBUG_LDFLAGS :=
166
# global debugging is disabled
167
# check if it was explicitly enabled for this module
168
ifneq (, $(findstring $(MODULE), $(MOZ_DEBUG_MODULES)))
172
# global debugging is enabled
173
# check if it was explicitly disabled for this module
174
ifneq (, $(findstring ^$(MODULE), $(MOZ_DEBUG_MODULES)))
180
_DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
171
_DEBUG_CFLAGS += $(MOZ_DEBUG_ENABLE_DEFS) $(MOZ_DEBUG_FLAGS)
172
_DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
181
173
XULPPFLAGS += $(MOZ_DEBUG_ENABLE_DEFS)
183
175
_DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
184
176
XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
187
# determine if -g should be passed to the compiler, based on
188
# the current module, and the value of MOZ_DBGRINFO_MODULES
191
MOZ_DBGRINFO_MODULES += ALL_MODULES
192
pattern := ALL_MODULES ^ALL_MODULES
194
MOZ_DBGRINFO_MODULES += ^ALL_MODULES
195
pattern := ALL_MODULES ^ALL_MODULES
199
# our current Makefile specifies a module name - add it to our pattern
200
pattern += $(MODULE) ^$(MODULE)
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
210
first_match:=$(firstword $(filter $(pattern), $(MOZ_DBGRINFO_MODULES)))
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)
218
ifeq ($(first_match), ^$(MODULE))
219
# the user specified explicitly that this module
220
# should not be compiled with -g (nothing to do)
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)
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)
177
ifdef MOZ_DEBUG_SYMBOLS
178
_DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
179
_DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
183
MOZALLOC_LIB = $(call EXPAND_LIBNAME_PATH,mozalloc,$(DIST)/lib)
238
# (these might have been above when processing MOZ_DBGRINFO_MODULES)
239
185
OS_CFLAGS += $(_DEBUG_CFLAGS)
240
186
OS_CXXFLAGS += $(_DEBUG_CFLAGS)
241
187
OS_LDFLAGS += $(_DEBUG_LDFLAGS)
383
331
NO_PROFILE_GUIDED_OPTIMIZE = 1
334
# No sense in profiling tools
336
NO_PROFILE_GUIDED_OPTIMIZE = 1
339
# Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
340
# and we don't have the same build logic to re-link them in the second pass.
341
ifdef SIMPLE_PROGRAMS
342
NO_PROFILE_GUIDED_OPTIMIZE = 1
386
345
# Enable profile-based feedback
387
346
ifndef NO_PROFILE_GUIDED_OPTIMIZE
388
347
ifdef MOZ_PROFILE_GENERATE
389
# No sense in profiling tools
390
ifndef INTERNAL_TOOLS
391
348
OS_CFLAGS += $(PROFILE_GEN_CFLAGS)
392
349
OS_CXXFLAGS += $(PROFILE_GEN_CFLAGS)
393
350
OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
394
351
ifeq (WINNT,$(OS_ARCH))
395
352
AR_FLAGS += -LTCG
397
endif # INTERNAL_TOOLS
398
354
endif # MOZ_PROFILE_GENERATE
400
356
ifdef MOZ_PROFILE_USE
401
ifndef INTERNAL_TOOLS
402
357
OS_CFLAGS += $(PROFILE_USE_CFLAGS)
403
358
OS_CXXFLAGS += $(PROFILE_USE_CFLAGS)
404
359
OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
405
360
ifeq (WINNT,$(OS_ARCH))
406
361
AR_FLAGS += -LTCG
408
endif # INTERNAL_TOOLS
409
363
endif # MOZ_PROFILE_USE
410
364
endif # NO_PROFILE_GUIDED_OPTIMIZE
485
437
# Default command macros; can be overridden in <arch>.mk.
488
NFSPWD = $(CONFIG_TOOLS)/nfspwd
489
PURIFY = purify $(PURIFYOPTIONS)
490
QUANTIFY = quantify $(QUANTIFYOPTIONS)
440
NFSPWD = $(CONFIG_TOOLS)/nfspwd
441
PURIFY = purify $(PURIFYOPTIONS)
442
QUANTIFY = quantify $(QUANTIFYOPTIONS)
491
443
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)
444
XPIDL_COMPILE = $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX)
445
XPIDL_LINK = $(LIBXUL_DIST)/host/bin/host_xpt_link$(HOST_BIN_SUFFIX)
495
XPIDL_COMPILE = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
496
XPIDL_LINK = $(CYGWIN_WRAPPER) $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
447
XPIDL_COMPILE = $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
448
XPIDL_LINK = $(LIBXUL_DIST)/bin/xpt_link$(BIN_SUFFIX)
557
503
endif # MOZ_OPTIMIZE
558
504
endif # CROSS_COMPILE
506
# Check for FAIL_ON_WARNINGS & FAIL_ON_WARNINGS_DEBUG (Shorthand for Makefiles
507
# to request that we use the 'warnings as errors' compile flags)
509
# NOTE: First, we clear FAIL_ON_WARNINGS[_DEBUG] if we're doing a Windows PGO
510
# build, since WARNINGS_AS_ERRORS has been suspected of causing isuses in that
511
# situation. (See bug 437002.)
512
ifeq (WINNT_1,$(OS_ARCH)_$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
513
FAIL_ON_WARNINGS_DEBUG=
515
endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
517
# Also clear FAIL_ON_WARNINGS[_DEBUG] for Android builds, since
518
# they have some platform-specific warnings we haven't fixed yet.
519
ifeq ($(OS_TARGET),Android)
520
FAIL_ON_WARNINGS_DEBUG=
524
# Now, check for debug version of flag; it turns on normal flag in debug builds.
525
ifdef FAIL_ON_WARNINGS_DEBUG
529
endif # FAIL_ON_WARNINGS_DEBUG
531
# Check for normal version of flag, and add WARNINGS_AS_ERRORS if it's set to 1.
532
ifdef FAIL_ON_WARNINGS
533
CXXFLAGS += $(WARNINGS_AS_ERRORS)
534
CFLAGS += $(WARNINGS_AS_ERRORS)
535
endif # FAIL_ON_WARNINGS
561
537
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
562
538
#// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
723
# Flags needed to link against the component library
724
ifdef MOZ_COMPONENTLIB
725
MOZ_COMPONENTLIB_EXTRA_DSO_LIBS = mozcomps xpcom_compat
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))
735
699
# If we're building a component on MSVC, we don't want to generate an
736
700
# import lib, because that import lib will collide with the name of a
737
701
# static version of the same library.
754
718
DEFINES += -DOSTYPE=\"$(OS_CONFIG)\"
755
719
DEFINES += -DOSARCH=$(OS_ARCH)
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)
769
721
######################################################################
771
723
GARBAGE += $(DEPENDENCIES) $(MKDEPENDENCIES) $(MKDEPENDENCIES).bak core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
852
ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
798
ifdef LOCALE_MERGEDIR
799
MERGE_FILE = $(firstword \
800
$(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
801
$(wildcard $(LOCALE_SRCDIR)/$(1)) \
802
$(srcdir)/en-US/$(1) )
804
MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
806
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
809
RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
811
ifeq (OS2,$(OS_ARCH))
812
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
814
ifneq (WINNT,$(OS_ARCH))
853
815
RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
856
ifeq ($(OS_ARCH),OS2)
857
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
872
832
DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
873
833
STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
836
OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizejars.py)
838
CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py)
840
EXPAND_LIBS = $(PYTHON) -I$(DEPTH)/config $(topsrcdir)/config/expandlibs.py
841
EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py
842
EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py
843
EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
844
EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
845
EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
846
EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
847
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) --uselist -- $(MKSHLIB)