Bug 1245764 - Move Windows RTL flags (-MD/-MT) flags out of config.mk. r=gps

This commit is contained in:
Mike Hommey 2016-02-04 16:17:42 +09:00
parent ae14fdcda2
commit 95180267e2
6 changed files with 15 additions and 39 deletions

View File

@ -357,36 +357,6 @@ CXXFLAGS += $(WARNINGS_AS_ERRORS)
CFLAGS += $(WARNINGS_AS_ERRORS)
endif # ALLOW_COMPILER_WARNINGS
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
#// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
#// DLL version of the RTL is used...
#//
#//------------------------------------------------------------------------
ifdef MOZ_ASAN
# ASAN-instrumented code tries to link against the dynamic CRT, which can't be
# used in the same link as the static CRT.
USE_STATIC_LIBS=
endif # MOZ_ASAN
ifdef USE_STATIC_LIBS
RTL_FLAGS=-MT # Statically linked multithreaded RTL
ifdef MOZ_DEBUG
ifndef MOZ_NO_DEBUG_RTL
RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL
endif
endif # MOZ_DEBUG
else # !USE_STATIC_LIBS
RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL
ifdef MOZ_DEBUG
ifndef MOZ_NO_DEBUG_RTL
RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL
endif
endif # MOZ_DEBUG
endif # USE_STATIC_LIBS
endif # WINNT && !GNU_CC
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS) $(_DEPEND_CFLAGS) $(CFLAGS) $(MOZBUILD_CFLAGS)
COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS) $(_DEPEND_CFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS)

View File

@ -729,7 +729,6 @@ class TreeMetadataEmitter(LoggingMixin):
'ANDROID_GENERATED_RESFILES',
'DISABLE_STL_WRAPPING',
'EXTRA_DSO_LDOPTS',
'USE_STATIC_LIBS',
'PYTHON_UNIT_TESTS',
'RCFILE',
'RESFILE',
@ -769,6 +768,21 @@ class TreeMetadataEmitter(LoggingMixin):
elif dist_install is False:
passthru.variables['NO_DIST_INSTALL'] = True
# Ideally, this should be done in templates, but this is difficult at
# the moment because USE_STATIC_LIBS can be set after a template
# returns. Eventually, with context-based templates, it will be
# possible.
if (context.config.substs.get('OS_ARCH') == 'WINNT' and
not context.config.substs.get('GNU_CC')):
use_static_lib = (context.get('USE_STATIC_LIBS') and
not context.config.substs.get('MOZ_ASAN'))
rtl_flag = '-MT' if use_static_lib else '-MD'
if (context.config.substs.get('MOZ_DEBUG') and
not context.config.substs.get('MOZ_NO_DEBUG_RTL')):
rtl_flag += 'd'
# Use a list, like MOZBUILD_*FLAGS variables
passthru.variables['RTL_FLAGS'] = [rtl_flag]
generated_files = set()
for obj in self._process_generated_files(context):
generated_files.add(obj.output)

View File

@ -11,8 +11,6 @@ RESFILE = 'bar.res'
RCINCLUDE = 'bar.rc'
DEFFILE = 'baz.def'
USE_STATIC_LIBS = True
CFLAGS += ['-fno-exceptions', '-w']
CXXFLAGS += ['-fcxx-exceptions', '-option with spaces']
LDFLAGS += ['-ld flag with spaces', '-x']

View File

@ -292,9 +292,6 @@ class TestRecursiveMakeBackend(BackendTester):
'DEFFILE': [
'DEFFILE := baz.def',
],
'USE_STATIC_LIBS': [
'USE_STATIC_LIBS := 1',
],
'MOZBUILD_CFLAGS': [
'MOZBUILD_CFLAGS += -fno-exceptions',
'MOZBUILD_CFLAGS += -w',

View File

@ -13,8 +13,6 @@ RESFILE = 'bar.res'
RCINCLUDE = 'bar.rc'
DEFFILE = 'baz.def'
USE_STATIC_LIBS = True
CFLAGS += ['-fno-exceptions', '-w']
CXXFLAGS += ['-fcxx-exceptions', '-include foo.h']
LDFLAGS += ['-framework Foo', '-x']

View File

@ -178,7 +178,6 @@ class TestEmitterBasic(unittest.TestCase):
'RESFILE': 'bar.res',
'RCINCLUDE': 'bar.rc',
'DEFFILE': 'baz.def',
'USE_STATIC_LIBS': True,
'MOZBUILD_CFLAGS': ['-fno-exceptions', '-w'],
'MOZBUILD_CXXFLAGS': ['-fcxx-exceptions', '-include foo.h'],
'MOZBUILD_LDFLAGS': ['-framework Foo', '-x', '-DELAYLOAD:foo.dll',