Bug 973649 - Add logic for CFLAGS, CXXFLAGS and LDFLAGS to moz.build; r=gps

This commit is contained in:
Ms2ger
2014-02-26 12:49:00 -08:00
parent 0c7e444429
commit aa09185ba5
9 changed files with 45 additions and 31 deletions

View File

@@ -26,7 +26,6 @@ LIBS += \
-lsuspend \
$(NULL)
endif
OS_LDFLAGS += -Wl,--export-dynamic
endif
STL_FLAGS=

View File

@@ -39,3 +39,5 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
LOCAL_INCLUDES += [
'/widget/gonk/libdisplay',
]
LDFLAGS += ['-Wl,--export-dynamic']

View File

@@ -481,7 +481,7 @@ include $(topsrcdir)/config/static-checking-config.mk
CFLAGS = $(OS_CPPFLAGS) $(OS_CFLAGS)
CXXFLAGS = $(OS_CPPFLAGS) $(OS_CXXFLAGS)
LDFLAGS = $(OS_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
LDFLAGS = $(OS_LDFLAGS) $(MOZBUILD_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
# Allow each module to override the *default* optimization settings
# by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
@@ -587,10 +587,10 @@ OS_COMPILE_CMMFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
endif
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS) $(EXTRA_COMPILE_FLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS) $(EXTRA_COMPILE_FLAGS)
ASFLAGS += $(EXTRA_ASSEMBLER_FLAGS)
ifndef CROSS_COMPILE

View File

@@ -242,15 +242,16 @@ class TreeMetadataEmitter(LoggingMixin):
'RESFILE',
'DEFFILE',
'SDK_LIBRARY',
'CFLAGS',
'CXXFLAGS',
'LDFLAGS',
'WIN32_EXE_LDFLAGS',
]
for v in varlist:
if v in sandbox and sandbox[v]:
passthru.variables[v] = sandbox[v]
for v in ['CFLAGS', 'CXXFLAGS', 'CMFLAGS', 'CMMFLAGS', 'LDFLAGS']:
if v in sandbox and sandbox[v]:
passthru.variables['MOZBUILD_' + v] = sandbox[v]
# NO_VISIBILITY_FLAGS is slightly different
if sandbox['NO_VISIBILITY_FLAGS']:
passthru.variables['VISIBILITY_FLAGS'] = ''

View File

@@ -688,7 +688,7 @@ VARIABLES = {
"""Flags passed to the C compiler for all of the C source files
declared in this directory.
Note that the ordering of flags matter here, these flags will be
Note that the ordering of flags matters here, these flags will be
added to the compiler's command line in the same order as they
appear in the moz.build file.
""", 'binaries'),
@@ -697,7 +697,25 @@ VARIABLES = {
"""Flags passed to the C++ compiler for all of the C++ source files
declared in this directory.
Note that the ordering of flags matter here, these flags will be
Note that the ordering of flags matters here; these flags will be
added to the compiler's command line in the same order as they
appear in the moz.build file.
""", 'binaries'),
'CMFLAGS': (list, list,
"""Flags passed to the Objective-C compiler for all of the Objective-C
source files declared in this directory.
Note that the ordering of flags matters here; these flags will be
added to the compiler's command line in the same order as they
appear in the moz.build file.
""", 'binaries'),
'CMMFLAGS': (list, list,
"""Flags passed to the Objective-C++ compiler for all of the
Objective-C++ source files declared in this directory.
Note that the ordering of flags matters here; these flags will be
added to the compiler's command line in the same order as they
appear in the moz.build file.
""", 'binaries'),
@@ -706,7 +724,7 @@ VARIABLES = {
"""Flags passed to the linker when linking all of the libraries and
executables declared in this directory.
Note that the ordering of flags matter here, these flags will be
Note that the ordering of flags matters here; these flags will be
added to the linker's command line in the same order as they
appear in the moz.build file.
""", 'libs'),

View File

@@ -340,17 +340,17 @@ class TestRecursiveMakeBackend(BackendTester):
'USE_STATIC_LIBS': [
'USE_STATIC_LIBS := 1',
],
'CFLAGS': [
'CFLAGS += -fno-exceptions',
'CFLAGS += -w',
'MOZBUILD_CFLAGS': [
'MOZBUILD_CFLAGS += -fno-exceptions',
'MOZBUILD_CFLAGS += -w',
],
'CXXFLAGS': [
'CXXFLAGS += -fcxx-exceptions',
'CXXFLAGS += -include foo.h',
'MOZBUILD_CXXFLAGS': [
'MOZBUILD_CXXFLAGS += -fcxx-exceptions',
'MOZBUILD_CXXFLAGS += -include foo.h',
],
'LDFLAGS': [
'LDFLAGS += -framework Foo',
'LDFLAGS += -x',
'MOZBUILD_LDFLAGS': [
'MOZBUILD_LDFLAGS += -framework Foo',
'MOZBUILD_LDFLAGS += -x',
],
'WIN32_EXE_LDFLAGS': [
'WIN32_EXE_LDFLAGS += -subsystem:console',

View File

@@ -176,9 +176,9 @@ class TestEmitterBasic(unittest.TestCase):
RESFILE='bar.res',
DEFFILE='baz.def',
USE_STATIC_LIBS=True,
CFLAGS=['-fno-exceptions', '-w'],
CXXFLAGS=['-fcxx-exceptions', '-include foo.h'],
LDFLAGS=['-framework Foo', '-x'],
MOZBUILD_CFLAGS=['-fno-exceptions', '-w'],
MOZBUILD_CXXFLAGS=['-fcxx-exceptions', '-include foo.h'],
MOZBUILD_LDFLAGS=['-framework Foo', '-x'],
WIN32_EXE_LDFLAGS=['-subsystem:console'],
)

View File

@@ -1,7 +0,0 @@
# 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/.
include $(topsrcdir)/config/rules.mk
COMPILE_CMFLAGS += -std=c99

View File

@@ -38,3 +38,4 @@ LOCAL_INCLUDES += [
'../..',
]
CMFLAGS += ['-std=c99']