# # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
# # config.mk # # Determines the platform and builds the macros needed to load the # appropriate platform-specific .mk file, then defines all (most?) # of the generic macros. #
# Define an include-at-most-once flag
ifdef INCLUDED_CONFIG_MK
$(error Do not include config.mk twice!) endif
INCLUDED_CONFIG_MK = 1
EXIT_ON_ERROR = set -e; # Shell loops continue past errors without this.
ifndef topsrcdir
topsrcdir = $(DEPTH) endif
ifndef INCLUDED_AUTOCONF_MK include $(DEPTH)/config/autoconf.mk endif
-include $(DEPTH)/.mozconfig.mk
# MDDEPDIR is the subdirectory where dependency files are stored
MDDEPDIR := .deps
ifndef EXTERNALLY_MANAGED_MAKE_FILE # Import the automatically generated backend file. If this file doesn't exist, # the backend hasn't been properly configured. We want this to be a fatal # error, hence not using "-include".
ifndef STANDALONE_MAKEFILE
GLOBAL_DEPS += backend.mk include backend.mk
# Add e.g. `export:: $(EXPORT_TARGETS)` rules. The *_TARGETS variables are defined # in backend.mk.
$(foreach tier,$(RUNNABLE_TIERS),$(eval $(if $(filter .,$(DEPTH)),recurse_$(tier):,$(tier)::) $($(call varize,$(tier))_TARGETS))) endif
endif
space = $(NULL) $(NULL)
# Include defs.mk files that can be found in $(srcdir)/$(DEPTH), # $(srcdir)/$(DEPTH-1), $(srcdir)/$(DEPTH-2), etc., and $(srcdir) # where $(DEPTH-1) is one level less of depth, $(DEPTH-2), two, etc. # i.e. for DEPTH=../../.., DEPTH-1 is ../.. and DEPTH-2 is .. # These defs.mk files are used to define variables in a directory # and all its subdirectories, recursively.
__depth := $(subst /, ,$(DEPTH)) ifeq (.,$(__depth))
__depth := endif
$(foreach __d,$(__depth) .,$(eval __depth = $(wordlist 2,$(words $(__depth)),$(__depth))$(eval -include $(subst $(space),/,$(strip $(srcdir) $(__depth) defs.mk)))))
# checks for internal spaces or trailing spaces in the variable # named by $x
check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x)))
$(foreach x,$(CHECK_VARS),$(check-variable))
ifndef INCLUDED_FUNCTIONS_MK include $(MOZILLA_DIR)/config/makefiles/functions.mk endif
RM = rm -f
# FINAL_TARGET specifies the location into which we copy end-user-shipped # build products (typelibs, components, chrome). It may already be specified by # a moz.build file. # # If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME) # instead of $(DIST)/bin. In both cases, if DIST_SUBDIR is set, the files will be # shipped to a $(DIST_SUBDIR) subdirectory.
FINAL_TARGET ?= $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)$(DIST_SUBDIR:%=/%) # Override the stored value for the check to make sure that the variable is not # redefined in the Makefile.in value.
FINAL_TARGET_FROZEN := '$(FINAL_TARGET)'
# Don't build SIMPLE_PROGRAMS with PGO, since they don't need it anyway, # and we don't have the same build logic to re-link them in the second pass.
ifdef SIMPLE_PROGRAMS
NO_PROFILE_GUIDED_OPTIMIZE = 1 endif
# No sense in profiling unit tests
ifdef CPP_UNIT_TESTS
NO_PROFILE_GUIDED_OPTIMIZE = 1 endif
# Overloaded by comm builds to refer to $(commtopsrcdir), so that # `mail` resolves in en-US builds and in repacks.
LOCALE_TOPDIR ?= $(topsrcdir)
MAKE_JARS_FLAGS = \
-t $(LOCALE_TOPDIR) \
-f $(MOZ_JAR_MAKER_FILE_FORMAT) \
$(NULL)
ifdef MOZ_LTO ifeq (Darwin,$(OS_TARGET)) # When linking on macOS, debug info is not linked along with the final binary, # and the dwarf data stays in object files until they are "linked" with the # dsymutil tool. # With LTO, object files are temporary, and are not kept around, which # means there's no object file for dsymutil to do its job. Consequently, # there is no debug info for LTOed compilation units. # The macOS linker has however an option to explicitly keep those object # files, which dsymutil will then find. # The catch is that the linker uses sequential numbers for those object # files, and doesn't avoid conflicts from multiple linkers running at # the same time. So in directories with multiple binaries, object files # from the first linked binaries would be overwritten by those of the # last linked binary. So we use a subdirectory containing the name of the # linked binary.
LDFLAGS += -Wl,-object_path_lto,$(@F).lto.o/ endif endif
# We only add color flags if neither the flag to disable color # (e.g. "-fno-color-diagnostics" nor a flag to control color # (e.g. "-fcolor-diagnostics=never") is present. define colorize_flags ifeq (,$(filter $(COLOR_CFLAGS:-f%=-fno-%),$$(1))$(findstring $(COLOR_CFLAGS),$$(1)))
$(1) += $(COLOR_CFLAGS) endif endef
ifdef MACH_STDOUT_ISATTY
ifdef COLOR_CFLAGS # TODO Bug 1319166 - iTerm2 interprets some bytes sequences as a # request to show a print dialog. Don't enable color on iTerm2 until # a workaround is in place. ifneq ($(TERM_PROGRAM),iTerm.app)
$(foreach var,$(color_flags_vars),$(eval $(call colorize_flags,$(var)))) endif endif endif
# # Name of the binary code directories # # Override defaults
DEPENDENCIES = .md
# Export to propagate to cl and submake for third-party code. # Eventually, we'll want to just use -I.
ifdef INCLUDE exportINCLUDE endif
# Export to propagate to link.exe and submake for third-party code. # Eventually, we'll want to just use -LIBPATH.
ifdef LIB export LIB endif
# Set link flags according to whether we want a console. ifeq ($(OS_ARCH),WINNT)
ifdef MOZ_WINCONSOLE ifeq ($(MOZ_WINCONSOLE),1)
WIN32_EXE_LDFLAGS += $(WIN32_CONSOLE_EXE_LDFLAGS) else# MOZ_WINCONSOLE
WIN32_EXE_LDFLAGS += $(WIN32_GUI_EXE_LDFLAGS) endif else # For setting subsystem version
WIN32_EXE_LDFLAGS += $(WIN32_CONSOLE_EXE_LDFLAGS) endif endif# WINNT
ifeq ($(OS_ARCH),WINNT) ifneq (,$(filter msvc clang-cl,$(CC_TYPE))) ifneq ($(TARGET_CPU),x86) # Normal operation on 64-bit Windows needs 2 MB of stack. (Bug 582910) # ASAN requires 6 MB of stack. # Setting the stack to 8 MB to match the capability of other systems # to deal with frame construction for unreasonably deep DOM trees # with worst-case styling. This uses address space unnecessarily for # non-main threads, but that should be tolerable on 64-bit systems. # (Bug 256180)
WIN32_EXE_LDFLAGS += -STACK:8388608 else # Since this setting affects the default stack size for non-main # threads, too, to avoid burning the address space, increase only # 512 KB over the default. Just enough to be able to deal with # reasonable styling applied to DOM trees whose depth is near what # Blink's HTML parser can output, esp. # layout/base/crashtests/507119.html (Bug 256180)
ifndef MOZ_DEBUG
WIN32_EXE_LDFLAGS += -STACK:1572864 else # In debug builds, layout code has extra logging helpers on the stack, # which can go over the 1.5MB limit on some deeply-nested crashtests.
WIN32_EXE_LDFLAGS += -STACK:2097152 endif endif else ifneq ($(TARGET_CPU),x86)
MOZ_PROGRAM_LDFLAGS += -Wl,-Xlink=-STACK:8388608 else
MOZ_PROGRAM_LDFLAGS += -Wl,-Xlink=-STACK:1572864 endif endif endif
# This isn't laid out as conditional directives so that NSDISTMODE can be # target-specific.
INSTALL = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(filter absolute_symlink, $(NSDISTMODE)), $(NSINSTALL) -L $(PWD), $(NSINSTALL) -R))
endif# WINNT
# The default for install_cmd is simply INSTALL
install_cmd ?= $(INSTALL) $(1)
# Use nsinstall in copy mode to install files on the system
SYSINSTALL = $(NSINSTALL) -t # This isn't necessarily true, just here
sysinstall_cmd = install_cmd
# # Localization build automation #
# Because you might wish to "make locales AB_CD=ab-CD", we don't hardcode # MOZ_UI_LOCALE directly, but use an intermediate variable that can be # overridden by the command line. (Besides, AB_CD is prettier).
AB_CD = $(MOZ_UI_LOCALE)
include $(MOZILLA_DIR)/config/AB_rCD.mk
# Many locales directories want this definition.
ACDEFINES += -DAB_CD=$(AB_CD)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.