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

@@ -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'],
)