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

This commit is contained in:
Ehsan Akhgari 2014-02-18 15:30:27 -05:00
parent 6735b2344d
commit 97afa6dc6b
6 changed files with 53 additions and 0 deletions

View File

@ -242,6 +242,9 @@ class TreeMetadataEmitter(LoggingMixin):
'RESFILE',
'DEFFILE',
'SDK_LIBRARY',
'CFLAGS',
'CXXFLAGS',
'LDFLAGS',
]
for v in varlist:
if v in sandbox and sandbox[v]:

View File

@ -683,6 +683,33 @@ VARIABLES = {
'SPHINX_PYTHON_PACKAGE_DIRS': (StrictOrderingOnAppendList, list,
"""Directories containing Python packages that Sphinx documents.
""", None),
'CFLAGS': (list, list,
"""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
added to the compiler's command line in the same order as they
appear in the moz.build file.
""", 'binaries'),
'CXXFLAGS': (list, list,
"""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
added to the compiler's command line in the same order as they
appear in the moz.build file.
""", 'binaries'),
'LDFLAGS': (list, list,
"""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
added to the linker's command line in the same order as they
appear in the moz.build file.
""", 'libs'),
}
# The set of functions exposed to the sandbox.

View File

@ -41,3 +41,7 @@ RESFILE = 'bar.res'
DEFFILE = 'baz.def'
USE_STATIC_LIBS = True
CFLAGS += ['-fno-exceptions', '-w']
CXXFLAGS += ['-fcxx-exceptions', '-include foo.h']
LDFLAGS += ['-framework Foo', '-x']

View File

@ -340,6 +340,18 @@ class TestRecursiveMakeBackend(BackendTester):
'USE_STATIC_LIBS': [
'USE_STATIC_LIBS := 1',
],
'CFLAGS': [
'CFLAGS += -fno-exceptions',
'CFLAGS += -w',
],
'CXXFLAGS': [
'CXXFLAGS += -fcxx-exceptions',
'CXXFLAGS += -include foo.h',
],
'LDFLAGS': [
'LDFLAGS += -framework Foo',
'LDFLAGS += -x',
]
}
for var, val in expected.items():

View File

@ -47,3 +47,7 @@ RESFILE = 'bar.res'
DEFFILE = 'baz.def'
USE_STATIC_LIBS = True
CFLAGS += ['-fno-exceptions', '-w']
CXXFLAGS += ['-fcxx-exceptions', '-include foo.h']
LDFLAGS += ['-framework Foo', '-x']

View File

@ -176,6 +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'],
)
variables = objs[0].variables