config/config.mk

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial