Bug 1283439 - Include OpusDecoder.h only for Rust MP4 parsing r=kinetik
[gecko.git] / config / config.mk
blob11681418e5d7d8f6f4e457ad4c858957d6f35e47
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/.
7 # config.mk
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.
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
20 EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
22 ifndef topsrcdir
23 topsrcdir = $(DEPTH)
24 endif
26 ifndef INCLUDED_AUTOCONF_MK
27 include $(DEPTH)/config/autoconf.mk
28 endif
30 -include $(DEPTH)/.mozconfig.mk
32 ifndef EXTERNALLY_MANAGED_MAKE_FILE
33 # Import the automatically generated backend file. If this file doesn't exist,
34 # the backend hasn't been properly configured. We want this to be a fatal
35 # error, hence not using "-include".
36 ifndef STANDALONE_MAKEFILE
37 GLOBAL_DEPS += backend.mk
38 include backend.mk
39 endif
41 endif
43 space = $(NULL) $(NULL)
45 # Include defs.mk files that can be found in $(srcdir)/$(DEPTH),
46 # $(srcdir)/$(DEPTH-1), $(srcdir)/$(DEPTH-2), etc., and $(srcdir)
47 # where $(DEPTH-1) is one level less of depth, $(DEPTH-2), two, etc.
48 # i.e. for DEPTH=../../.., DEPTH-1 is ../.. and DEPTH-2 is ..
49 # These defs.mk files are used to define variables in a directory
50 # and all its subdirectories, recursively.
51 __depth := $(subst /, ,$(DEPTH))
52 ifeq (.,$(__depth))
53 __depth :=
54 endif
55 $(foreach __d,$(__depth) .,$(eval __depth = $(wordlist 2,$(words $(__depth)),$(__depth))$(eval -include $(subst $(space),/,$(strip $(srcdir) $(__depth) defs.mk)))))
57 COMMA = ,
59 # Sanity check some variables
60 CHECK_VARS := \
61 XPI_NAME \
62 LIBRARY_NAME \
63 MODULE \
64 DEPTH \
65 XPI_PKGNAME \
66 INSTALL_EXTENSION_ID \
67 SHARED_LIBRARY_NAME \
68 SONAME \
69 STATIC_LIBRARY_NAME \
70 $(NULL)
72 # checks for internal spaces or trailing spaces in the variable
73 # named by $x
74 check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x)))
76 $(foreach x,$(CHECK_VARS),$(check-variable))
78 ifndef INCLUDED_FUNCTIONS_MK
79 include $(MOZILLA_DIR)/config/makefiles/functions.mk
80 endif
82 RM = rm -f
84 # FINAL_TARGET specifies the location into which we copy end-user-shipped
85 # build products (typelibs, components, chrome). It may already be specified by
86 # a moz.build file.
88 # If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
89 # instead of $(DIST)/bin. In both cases, if DIST_SUBDIR is set, the files will be
90 # shipped to a $(DIST_SUBDIR) subdirectory.
91 FINAL_TARGET ?= $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)$(DIST_SUBDIR:%=/%)
92 # Override the stored value for the check to make sure that the variable is not
93 # redefined in the Makefile.in value.
94 FINAL_TARGET_FROZEN := '$(FINAL_TARGET)'
96 ifdef XPI_NAME
97 ACDEFINES += -DXPI_NAME=$(XPI_NAME)
98 endif
100 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
101 VERSION_NUMBER = 50
103 ifeq ($(HOST_OS_ARCH),WINNT)
104 ifeq ($(MOZILLA_DIR),$(topsrcdir))
105 win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
106 else
107 # This means we're in comm-central's topsrcdir, so we need to adjust
108 # WIN_TOP_SRC (which points to mozilla's topsrcdir) for the substitution
109 # to win_srcdir.
110 cc_WIN_TOP_SRC := $(WIN_TOP_SRC:%/mozilla=%)
111 win_srcdir := $(subst $(topsrcdir),$(cc_WIN_TOP_SRC),$(srcdir))
112 endif
113 BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix
114 else
115 win_srcdir := $(srcdir)
116 BUILD_TOOLS = $(MOZILLA_DIR)/build/unix
117 endif
119 CONFIG_TOOLS = $(MOZ_BUILD_ROOT)/config
120 AUTOCONF_TOOLS = $(MOZILLA_DIR)/build/autoconf
122 ifdef _MSC_VER
123 CC_WRAPPER ?= $(call py_action,cl)
124 CXX_WRAPPER ?= $(call py_action,cl)
125 endif # _MSC_VER
127 CC := $(CC_WRAPPER) $(CC)
128 CXX := $(CXX_WRAPPER) $(CXX)
129 MKDIR ?= mkdir
130 SLEEP ?= sleep
131 TOUCH ?= touch
133 PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
135 # determine debug-related options
136 _DEBUG_ASFLAGS :=
137 _DEBUG_CFLAGS :=
138 _DEBUG_LDFLAGS :=
139 _DEBUG_RUSTFLAGS :=
141 ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS))
142 ifeq ($(AS),$(YASM))
143 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
144 _DEBUG_ASFLAGS += -g cv8
145 else
146 ifneq ($(OS_ARCH),Darwin)
147 _DEBUG_ASFLAGS += -g dwarf2
148 endif
149 endif
150 else
151 _DEBUG_ASFLAGS += $(MOZ_DEBUG_FLAGS)
152 endif
153 _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
154 _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
155 _DEBUG_RUSTFLAGS += -g
156 endif
158 ASFLAGS += $(_DEBUG_ASFLAGS)
159 OS_CFLAGS += $(_DEBUG_CFLAGS)
160 OS_CXXFLAGS += $(_DEBUG_CFLAGS)
161 OS_LDFLAGS += $(_DEBUG_LDFLAGS)
162 RUSTFLAGS += $(_DEBUG_RUSTFLAGS)
164 # XXX: What does this? Bug 482434 filed for better explanation.
165 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
166 ifndef MOZ_DEBUG
168 # MOZ_DEBUG_SYMBOLS generates debug symbols in separate PDB files.
169 # Used for generating an optimized build with debugging symbols.
170 # Used in the Windows nightlies to generate symbols for crash reporting.
171 ifdef MOZ_DEBUG_SYMBOLS
172 ifdef HAVE_64BIT_BUILD
173 OS_LDFLAGS += -DEBUG -OPT:REF,ICF
174 else
175 OS_LDFLAGS += -DEBUG -OPT:REF
176 endif
177 endif
180 # Handle DMD in optimized builds.
182 ifdef MOZ_DMD
183 ifdef HAVE_64BIT_BUILD
184 OS_LDFLAGS = -DEBUG -OPT:REF,ICF
185 else
186 OS_LDFLAGS = -DEBUG -OPT:REF
187 endif
188 endif # MOZ_DMD
190 endif # MOZ_DEBUG
192 endif # WINNT && !GNU_CC
195 # Build using PIC by default
197 _ENABLE_PIC=1
199 # Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway,
200 # and we don't have the same build logic to re-link them in the second pass.
201 ifdef SIMPLE_PROGRAMS
202 NO_PROFILE_GUIDED_OPTIMIZE = 1
203 endif
205 # No sense in profiling unit tests
206 ifdef CPP_UNIT_TESTS
207 NO_PROFILE_GUIDED_OPTIMIZE = 1
208 endif
210 # Enable profile-based feedback
211 ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE))
212 ifdef MOZ_PROFILE_GENERATE
213 OS_CFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_GEN_CFLAGS))
214 OS_CXXFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_GEN_CFLAGS))
215 OS_LDFLAGS += $(PROFILE_GEN_LDFLAGS)
216 ifeq (WINNT,$(OS_ARCH))
217 AR_FLAGS += -LTCG
218 endif
219 endif # MOZ_PROFILE_GENERATE
221 ifdef MOZ_PROFILE_USE
222 OS_CFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_USE_CFLAGS))
223 OS_CXXFLAGS += $(if $(filter $(notdir $<),$(notdir $(NO_PROFILE_GUIDED_OPTIMIZE))),,$(PROFILE_USE_CFLAGS))
224 OS_LDFLAGS += $(PROFILE_USE_LDFLAGS)
225 ifeq (WINNT,$(OS_ARCH))
226 AR_FLAGS += -LTCG
227 endif
228 endif # MOZ_PROFILE_USE
229 endif # NO_PROFILE_GUIDED_OPTIMIZE
231 MAKE_JARS_FLAGS = \
232 -t $(topsrcdir) \
233 -f $(MOZ_JAR_MAKER_FILE_FORMAT) \
234 $(NULL)
236 ifdef USE_EXTENSION_MANIFEST
237 MAKE_JARS_FLAGS += -e
238 endif
240 TAR_CREATE_FLAGS = -chf
243 # Personal makefile customizations go in these optional make include files.
245 MY_CONFIG := $(DEPTH)/config/myconfig.mk
246 MY_RULES := $(DEPTH)/config/myrules.mk
249 # Default command macros; can be overridden in <arch>.mk.
251 CCC = $(CXX)
253 INCLUDES = \
254 -I$(srcdir) \
255 -I$(CURDIR) \
256 $(LOCAL_INCLUDES) \
257 -I$(ABS_DIST)/include \
258 $(NULL)
260 ifndef IS_GYP_DIR
261 # NSPR_CFLAGS and NSS_CFLAGS must appear ahead of the other flags to avoid Linux
262 # builds wrongly picking up system NSPR/NSS header files.
263 OS_INCLUDES := \
264 $(NSPR_CFLAGS) $(NSS_CFLAGS) \
265 $(MOZ_JPEG_CFLAGS) \
266 $(MOZ_PNG_CFLAGS) \
267 $(MOZ_ZLIB_CFLAGS) \
268 $(MOZ_PIXMAN_CFLAGS) \
269 $(NULL)
270 endif
272 include $(MOZILLA_DIR)/config/static-checking-config.mk
274 CFLAGS = $(OS_CPPFLAGS) $(OS_CFLAGS)
275 CXXFLAGS = $(OS_CPPFLAGS) $(OS_CXXFLAGS)
276 LDFLAGS = $(OS_LDFLAGS) $(MOZBUILD_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
278 ifdef MOZ_OPTIMIZE
279 ifeq (1,$(MOZ_OPTIMIZE))
280 ifneq (,$(if $(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE),$(MOZ_PGO_OPTIMIZE_FLAGS)))
281 CFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
282 CXXFLAGS += $(MOZ_PGO_OPTIMIZE_FLAGS)
283 else
284 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
285 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
286 endif # neq (,$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
287 else
288 CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
289 CXXFLAGS += $(MOZ_OPTIMIZE_FLAGS)
290 endif # MOZ_OPTIMIZE == 1
291 LDFLAGS += $(MOZ_OPTIMIZE_LDFLAGS)
292 RUSTFLAGS += $(MOZ_OPTIMIZE_RUSTFLAGS)
293 endif # MOZ_OPTIMIZE
295 HOST_CFLAGS += $(_DEPEND_CFLAGS)
296 HOST_CXXFLAGS += $(_DEPEND_CFLAGS)
297 ifdef CROSS_COMPILE
298 HOST_CFLAGS += $(HOST_OPTIMIZE_FLAGS)
299 else
300 ifdef MOZ_OPTIMIZE
301 ifeq (1,$(MOZ_OPTIMIZE))
302 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
303 else
304 HOST_CFLAGS += $(MOZ_OPTIMIZE_FLAGS)
305 endif # MOZ_OPTIMIZE == 1
306 endif # MOZ_OPTIMIZE
307 endif # CROSS_COMPILE
309 CFLAGS += $(MOZ_FRAMEPTR_FLAGS)
310 CXXFLAGS += $(MOZ_FRAMEPTR_FLAGS)
312 # Check for ALLOW_COMPILER_WARNINGS (shorthand for Makefiles to request that we
313 # *don't* use the warnings-as-errors compile flags)
315 # Don't use warnings-as-errors in Windows PGO builds because it is suspected of
316 # causing problems in that situation. (See bug 437002.)
317 ifeq (WINNT_1,$(OS_ARCH)_$(MOZ_PROFILE_GENERATE)$(MOZ_PROFILE_USE))
318 ALLOW_COMPILER_WARNINGS=1
319 endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
321 # Don't use warnings-as-errors in clang-cl because it warns about many more
322 # things than MSVC does.
323 ifdef CLANG_CL
324 ALLOW_COMPILER_WARNINGS=1
325 endif # CLANG_CL
327 # Use warnings-as-errors if ALLOW_COMPILER_WARNINGS is not set to 1 (which
328 # includes the case where it's undefined).
329 ifneq (1,$(ALLOW_COMPILER_WARNINGS))
330 CXXFLAGS += $(WARNINGS_AS_ERRORS)
331 CFLAGS += $(WARNINGS_AS_ERRORS)
332 endif # ALLOW_COMPILER_WARNINGS
334 COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS) $(_DEPEND_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS)
335 COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS) $(_DEPEND_CFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS)
336 COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS)
337 COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS)
338 ASFLAGS += $(MOZBUILD_ASFLAGS)
340 ifndef CROSS_COMPILE
341 HOST_CFLAGS += $(RTL_FLAGS)
342 endif
344 HOST_CFLAGS += $(HOST_DEFINES) $(MOZBUILD_HOST_CFLAGS)
345 HOST_CXXFLAGS += $(HOST_DEFINES) $(MOZBUILD_HOST_CXXFLAGS)
348 # Name of the binary code directories
350 # Override defaults
352 SDK_LIB_DIR = $(DIST)/sdk/lib
353 SDK_BIN_DIR = $(DIST)/sdk/bin
355 DEPENDENCIES = .md
357 ifdef MACOSX_DEPLOYMENT_TARGET
358 export MACOSX_DEPLOYMENT_TARGET
359 endif # MACOSX_DEPLOYMENT_TARGET
361 ifdef MOZ_USING_CCACHE
362 ifdef CLANG_CXX
363 export CCACHE_CPP2=1
364 endif
365 endif
367 # Set link flags according to whether we want a console.
368 ifeq ($(OS_ARCH),WINNT)
369 ifdef MOZ_WINCONSOLE
370 ifeq ($(MOZ_WINCONSOLE),1)
371 WIN32_EXE_LDFLAGS += $(WIN32_CONSOLE_EXE_LDFLAGS)
372 else # MOZ_WINCONSOLE
373 WIN32_EXE_LDFLAGS += $(WIN32_GUI_EXE_LDFLAGS)
374 endif
375 else
376 # For setting subsystem version
377 WIN32_EXE_LDFLAGS += $(WIN32_CONSOLE_EXE_LDFLAGS)
378 endif
379 endif # WINNT
381 ifdef _MSC_VER
382 ifeq ($(CPU_ARCH),x86_64)
383 # set stack to 2MB on x64 build. See bug 582910
384 WIN32_EXE_LDFLAGS += -STACK:2097152
385 endif
386 endif
389 # Include any personal overrides the user might think are needed.
391 -include $(topsrcdir)/$(MOZ_BUILD_APP)/app-config.mk
392 -include $(MY_CONFIG)
394 ######################################################################
396 GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) $(wildcard *.err) $(wildcard *.pure) $(wildcard *_pure_*.o) Templates.DB
398 ifeq ($(OS_ARCH),Darwin)
399 ifndef NSDISTMODE
400 NSDISTMODE=absolute_symlink
401 endif
402 PWD := $(CURDIR)
403 endif
405 NSINSTALL_PY := $(PYTHON) $(abspath $(MOZILLA_DIR)/config/nsinstall.py)
406 # For Pymake, wherever we use nsinstall.py we're also going to try to make it
407 # a native command where possible. Since native commands can't be used outside
408 # of single-line commands, we continue to provide INSTALL for general use.
409 # Single-line commands should be switched over to install_cmd.
410 NSINSTALL_NATIVECMD := %nsinstall nsinstall
412 ifdef NSINSTALL_BIN
413 NSINSTALL = $(NSINSTALL_BIN)
414 else
415 ifeq ($(HOST_OS_ARCH),WINNT)
416 NSINSTALL = $(NSINSTALL_PY)
417 else
418 NSINSTALL = $(DEPTH)/config/nsinstall$(HOST_BIN_SUFFIX)
419 endif # WINNT
420 endif # NSINSTALL_BIN
423 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT, $(OS_ARCH)))
424 INSTALL = $(NSINSTALL) -t
426 else
428 # This isn't laid out as conditional directives so that NSDISTMODE can be
429 # target-specific.
430 INSTALL = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(filter absolute_symlink, $(NSDISTMODE)), $(NSINSTALL) -L $(PWD), $(NSINSTALL) -R))
432 endif # WINNT
434 # The default for install_cmd is simply INSTALL
435 install_cmd ?= $(INSTALL) $(1)
437 # Use nsinstall in copy mode to install files on the system
438 SYSINSTALL = $(NSINSTALL) -t
439 # This isn't necessarily true, just here
440 sysinstall_cmd = install_cmd
443 # Localization build automation
446 # Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode
447 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
448 # overridden by the command line. (Besides, AB_CD is prettier).
449 AB_CD = $(MOZ_UI_LOCALE)
450 # Many locales directories want this definition.
451 ACDEFINES += -DAB_CD=$(AB_CD)
453 ifndef L10NBASEDIR
454 L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
455 else
456 IS_LANGUAGE_REPACK = 1
457 endif
459 EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(or $(realpath $(L10NBASEDIR)),$(abspath $(L10NBASEDIR)))/$(AB_CD)/$(subst /locales,,$(1)))
461 ifdef relativesrcdir
462 LOCALE_SRCDIR ?= $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
463 endif
465 ifdef relativesrcdir
466 MAKE_JARS_FLAGS += --relativesrcdir=$(relativesrcdir)
467 ifneq (en-US,$(AB_CD))
468 ifdef LOCALE_MERGEDIR
469 MAKE_JARS_FLAGS += --locale-mergedir=$(LOCALE_MERGEDIR)
470 endif
471 ifdef IS_LANGUAGE_REPACK
472 MAKE_JARS_FLAGS += --l10n-base=$(L10NBASEDIR)/$(AB_CD)
473 endif
474 else
475 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
476 endif # en-US
477 else
478 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
479 endif # ! relativesrcdir
481 ifdef LOCALE_MERGEDIR
482 MERGE_FILE = $(firstword \
483 $(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
484 $(wildcard $(LOCALE_SRCDIR)/$(1)) \
485 $(srcdir)/en-US/$(1) )
486 else
487 MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
488 endif
489 MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
491 # These marcros are similar to MERGE_FILE, but no merging, and en-US first.
492 # They're used for searchplugins, for example.
493 EN_US_OR_L10N_FILE = $(firstword \
494 $(wildcard $(srcdir)/en-US/$(1)) \
495 $(LOCALE_SRCDIR)/$(1) )
496 EN_US_OR_L10N_FILES = $(foreach f,$(1),$(call EN_US_OR_L10N_FILE,$(f)))
498 ifneq (WINNT,$(OS_ARCH))
499 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
500 endif # ! WINNT
503 # Java macros
506 # Make sure any compiled classes work with at least JVM 1.4
507 JAVAC_FLAGS += -source 1.4
509 ifdef MOZ_DEBUG
510 JAVAC_FLAGS += -g
511 endif
513 CREATE_PRECOMPLETE_CMD = $(PYTHON) $(abspath $(MOZILLA_DIR)/config/createprecomplete.py)
515 # MDDEPDIR is the subdirectory where dependency files are stored
516 MDDEPDIR := .deps
518 EXPAND_LIBS_EXEC = $(PYTHON) $(MOZILLA_DIR)/config/expandlibs_exec.py
519 EXPAND_LIBS_GEN = $(PYTHON) $(MOZILLA_DIR)/config/expandlibs_gen.py
520 EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
521 EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
522 EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
523 EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
524 EXPAND_MKSHLIB_ARGS = --uselist
525 ifdef SYMBOL_ORDER
526 EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER)
527 endif
528 EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB)
530 # $(call CHECK_SYMBOLS,lib,PREFIX,dep_name,test)
531 # Checks that the given `lib` doesn't contain dependency on symbols with a
532 # version starting with `PREFIX`_ and matching the `test`. `dep_name` is only
533 # used for the error message.
534 # `test` is an awk expression using the information in the variable `v` which
535 # contains a list of version items ([major, minor, ...]).
536 define CHECK_SYMBOLS
537 @$(TOOLCHAIN_PREFIX)readelf -sW $(1) | \
538 awk '$$8 ~ /@$(2)_/ { \
539 split($$8,a,"@"); \
540 split(a[2],b,"_"); \
541 split(b[2],v,"."); \
542 if ($(4)) { \
543 if (!found) { \
544 print "TEST-UNEXPECTED-FAIL | check_stdcxx | We do not want these $(3) symbol versions to be used:" \
546 print " ",$$8; \
547 found=1 \
550 END { \
551 if (found) { \
552 exit(1) \
555 endef
557 ifneq (,$(MOZ_LIBSTDCXX_TARGET_VERSION)$(MOZ_LIBSTDCXX_HOST_VERSION))
558 CHECK_STDCXX = $(call CHECK_SYMBOLS,$(1),GLIBCXX,libstdc++,v[1] > 3 || (v[1] == 3 && v[2] == 4 && v[3] > 16))
559 CHECK_GLIBC = $(call CHECK_SYMBOLS,$(1),GLIBC,libc,v[1] > 2 || (v[1] == 2 && v[2] > 12))
560 endif
562 ifeq (,$(filter $(OS_TARGET),WINNT Darwin))
563 CHECK_TEXTREL = @$(TOOLCHAIN_PREFIX)readelf -d $(1) | grep TEXTREL > /dev/null && echo 'TEST-UNEXPECTED-FAIL | check_textrel | We do not want text relocations in libraries and programs' || true
564 endif
566 ifeq ($(MOZ_WIDGET_TOOLKIT),android)
567 # While this is very unlikely (libc being added by the compiler at the end
568 # of the linker command line), if libmozglue.so ends up after libc.so, all
569 # hell breaks loose, so better safe than sorry, and check it's actually the
570 # case.
571 CHECK_MOZGLUE_ORDER = @$(TOOLCHAIN_PREFIX)readelf -d $(1) | grep NEEDED | awk '{ libs[$$NF] = ++n } END { if (libs["[libmozglue.so]"] && libs["[libc.so]"] < libs["[libmozglue.so]"]) { print "libmozglue.so must be linked before libc.so"; exit 1 } }'
572 endif
574 define CHECK_BINARY
575 $(call CHECK_GLIBC,$(1))
576 $(call CHECK_STDCXX,$(1))
577 $(call CHECK_TEXTREL,$(1))
578 $(call LOCAL_CHECKS,$(1))
579 $(call CHECK_MOZGLUE_ORDER,$(1))
580 endef
582 # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
583 # this file
584 OBJ_SUFFIX := $(_OBJ_SUFFIX)
586 # PGO builds with GCC build objects with instrumentation in a first pass,
587 # then objects optimized, without instrumentation, in a second pass. If
588 # we overwrite the objects from the first pass with those from the second,
589 # we end up not getting instrumentation data for better optimization on
590 # incremental builds. As a consequence, we use a different object suffix
591 # for the first pass.
592 ifndef NO_PROFILE_GUIDED_OPTIMIZE
593 ifdef MOZ_PROFILE_GENERATE
594 ifdef GNU_CC
595 OBJ_SUFFIX := i_o
596 endif
597 endif
598 endif
600 PLY_INCLUDE = -I$(MOZILLA_DIR)/other-licenses/ply
602 export CL_INCLUDES_PREFIX
603 # Make sure that the build system can handle non-ASCII characters
604 # in environment variables to prevent it from breking silently on
605 # non-English systems.
606 export NONASCII