Bug 973649 - Add logic for CFLAGS, CXXFLAGS and LDFLAGS to moz.build; r=gps
This commit is contained in:
@@ -26,7 +26,6 @@ LIBS += \
|
|||||||
-lsuspend \
|
-lsuspend \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
OS_LDFLAGS += -Wl,--export-dynamic
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
STL_FLAGS=
|
STL_FLAGS=
|
||||||
|
|||||||
@@ -39,3 +39,5 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
|||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
'/widget/gonk/libdisplay',
|
'/widget/gonk/libdisplay',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
LDFLAGS += ['-Wl,--export-dynamic']
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ include $(topsrcdir)/config/static-checking-config.mk
|
|||||||
|
|
||||||
CFLAGS = $(OS_CPPFLAGS) $(OS_CFLAGS)
|
CFLAGS = $(OS_CPPFLAGS) $(OS_CFLAGS)
|
||||||
CXXFLAGS = $(OS_CPPFLAGS) $(OS_CXXFLAGS)
|
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
|
# Allow each module to override the *default* optimization settings
|
||||||
# by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
|
# 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
|
||||||
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_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) $(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) $(EXTRA_COMPILE_FLAGS)
|
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS) $(EXTRA_COMPILE_FLAGS)
|
||||||
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(EXTRA_COMPILE_FLAGS)
|
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS) $(EXTRA_COMPILE_FLAGS)
|
||||||
ASFLAGS += $(EXTRA_ASSEMBLER_FLAGS)
|
ASFLAGS += $(EXTRA_ASSEMBLER_FLAGS)
|
||||||
|
|
||||||
ifndef CROSS_COMPILE
|
ifndef CROSS_COMPILE
|
||||||
|
|||||||
@@ -242,15 +242,16 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||||||
'RESFILE',
|
'RESFILE',
|
||||||
'DEFFILE',
|
'DEFFILE',
|
||||||
'SDK_LIBRARY',
|
'SDK_LIBRARY',
|
||||||
'CFLAGS',
|
|
||||||
'CXXFLAGS',
|
|
||||||
'LDFLAGS',
|
|
||||||
'WIN32_EXE_LDFLAGS',
|
'WIN32_EXE_LDFLAGS',
|
||||||
]
|
]
|
||||||
for v in varlist:
|
for v in varlist:
|
||||||
if v in sandbox and sandbox[v]:
|
if v in sandbox and sandbox[v]:
|
||||||
passthru.variables[v] = 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
|
# NO_VISIBILITY_FLAGS is slightly different
|
||||||
if sandbox['NO_VISIBILITY_FLAGS']:
|
if sandbox['NO_VISIBILITY_FLAGS']:
|
||||||
passthru.variables['VISIBILITY_FLAGS'] = ''
|
passthru.variables['VISIBILITY_FLAGS'] = ''
|
||||||
|
|||||||
@@ -688,7 +688,7 @@ VARIABLES = {
|
|||||||
"""Flags passed to the C compiler for all of the C source files
|
"""Flags passed to the C compiler for all of the C source files
|
||||||
declared in this directory.
|
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
|
added to the compiler's command line in the same order as they
|
||||||
appear in the moz.build file.
|
appear in the moz.build file.
|
||||||
""", 'binaries'),
|
""", 'binaries'),
|
||||||
@@ -697,7 +697,25 @@ VARIABLES = {
|
|||||||
"""Flags passed to the C++ compiler for all of the C++ source files
|
"""Flags passed to the C++ compiler for all of the C++ source files
|
||||||
declared in this directory.
|
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
|
added to the compiler's command line in the same order as they
|
||||||
appear in the moz.build file.
|
appear in the moz.build file.
|
||||||
""", 'binaries'),
|
""", 'binaries'),
|
||||||
@@ -706,7 +724,7 @@ VARIABLES = {
|
|||||||
"""Flags passed to the linker when linking all of the libraries and
|
"""Flags passed to the linker when linking all of the libraries and
|
||||||
executables declared in this directory.
|
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
|
added to the linker's command line in the same order as they
|
||||||
appear in the moz.build file.
|
appear in the moz.build file.
|
||||||
""", 'libs'),
|
""", 'libs'),
|
||||||
|
|||||||
@@ -340,17 +340,17 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
'USE_STATIC_LIBS': [
|
'USE_STATIC_LIBS': [
|
||||||
'USE_STATIC_LIBS := 1',
|
'USE_STATIC_LIBS := 1',
|
||||||
],
|
],
|
||||||
'CFLAGS': [
|
'MOZBUILD_CFLAGS': [
|
||||||
'CFLAGS += -fno-exceptions',
|
'MOZBUILD_CFLAGS += -fno-exceptions',
|
||||||
'CFLAGS += -w',
|
'MOZBUILD_CFLAGS += -w',
|
||||||
],
|
],
|
||||||
'CXXFLAGS': [
|
'MOZBUILD_CXXFLAGS': [
|
||||||
'CXXFLAGS += -fcxx-exceptions',
|
'MOZBUILD_CXXFLAGS += -fcxx-exceptions',
|
||||||
'CXXFLAGS += -include foo.h',
|
'MOZBUILD_CXXFLAGS += -include foo.h',
|
||||||
],
|
],
|
||||||
'LDFLAGS': [
|
'MOZBUILD_LDFLAGS': [
|
||||||
'LDFLAGS += -framework Foo',
|
'MOZBUILD_LDFLAGS += -framework Foo',
|
||||||
'LDFLAGS += -x',
|
'MOZBUILD_LDFLAGS += -x',
|
||||||
],
|
],
|
||||||
'WIN32_EXE_LDFLAGS': [
|
'WIN32_EXE_LDFLAGS': [
|
||||||
'WIN32_EXE_LDFLAGS += -subsystem:console',
|
'WIN32_EXE_LDFLAGS += -subsystem:console',
|
||||||
|
|||||||
@@ -176,9 +176,9 @@ class TestEmitterBasic(unittest.TestCase):
|
|||||||
RESFILE='bar.res',
|
RESFILE='bar.res',
|
||||||
DEFFILE='baz.def',
|
DEFFILE='baz.def',
|
||||||
USE_STATIC_LIBS=True,
|
USE_STATIC_LIBS=True,
|
||||||
CFLAGS=['-fno-exceptions', '-w'],
|
MOZBUILD_CFLAGS=['-fno-exceptions', '-w'],
|
||||||
CXXFLAGS=['-fcxx-exceptions', '-include foo.h'],
|
MOZBUILD_CXXFLAGS=['-fcxx-exceptions', '-include foo.h'],
|
||||||
LDFLAGS=['-framework Foo', '-x'],
|
MOZBUILD_LDFLAGS=['-framework Foo', '-x'],
|
||||||
WIN32_EXE_LDFLAGS=['-subsystem:console'],
|
WIN32_EXE_LDFLAGS=['-subsystem:console'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -38,3 +38,4 @@ LOCAL_INCLUDES += [
|
|||||||
'../..',
|
'../..',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
CMFLAGS += ['-std=c99']
|
||||||
|
|||||||
Reference in New Issue
Block a user