mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 978594 - Part 2: Add support for expressing per-source build flags to moz.build; r=glandium
--HG-- extra : rebase_source : 254d8acf1a6a53845a2e2d6d895217515ea7b836
This commit is contained in:
parent
acde2c54aa
commit
a8d5c6ba79
@ -972,7 +972,7 @@ $(HOST_CMMOBJS):
|
||||
$(COBJS):
|
||||
$(REPORT_BUILD)
|
||||
@$(MAKE_DEPS_AUTO_CC)
|
||||
$(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
# DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
|
||||
# 'moc' only knows about #defines it gets on the command line (-D...), not in
|
||||
@ -994,55 +994,55 @@ ifdef ASFILES
|
||||
# a '-c' flag.
|
||||
$(ASOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(AS) $(ASOUTOPTION)$@ $(ASFLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
|
||||
$(AS) $(ASOUTOPTION)$@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(AS_DASH_C_FLAG) $(_VPATH_SRCS)
|
||||
endif
|
||||
|
||||
$(SOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(AS) -o $@ $(ASFLAGS) $(LOCAL_INCLUDES) $(TARGET_LOCAL_INCLUDES) -c $<
|
||||
$(AS) -o $@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(LOCAL_INCLUDES) $(TARGET_LOCAL_INCLUDES) -c $<
|
||||
|
||||
$(CPPOBJS):
|
||||
$(REPORT_BUILD)
|
||||
@$(MAKE_DEPS_AUTO_CXX)
|
||||
$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(CMMOBJS):
|
||||
$(REPORT_BUILD)
|
||||
@$(MAKE_DEPS_AUTO_CXX)
|
||||
$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(CMOBJS):
|
||||
$(REPORT_BUILD)
|
||||
@$(MAKE_DEPS_AUTO_CC)
|
||||
$(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.s,$(CPPSRCS:%.cpp=%.s)): %.s: %.cpp $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CCC) -S $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.s,$(CPPSRCS:%.cc=%.s)): %.s: %.cc $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CCC) -S $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.s,$(CSRCS:%.c=%.s)): %.s: %.c $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CC) -S $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(CC) -S $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.i,$(CPPSRCS:%.cpp=%.i)): %.i: %.cpp $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.i,$(CPPSRCS:%.cc=%.i)): %.i: %.cc $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.i,$(CSRCS:%.c=%.i)): %.i: %.c $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(CC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(filter %.i,$(CMMSRCS:%.mm=%.i)): %.i: %.mm $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(REPORT_BUILD)
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
$(CCC) -C $(PREPROCESS_OPTION)$@ $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
|
||||
|
||||
$(RESFILE): %.res: %.rc
|
||||
$(REPORT_BUILD)
|
||||
|
@ -37,6 +37,7 @@ from ..frontend.data import (
|
||||
JavaJarData,
|
||||
LibraryDefinition,
|
||||
LocalInclude,
|
||||
PerSourceFlag,
|
||||
Program,
|
||||
Resources,
|
||||
SandboxDerived,
|
||||
@ -442,6 +443,9 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
elif isinstance(obj, GeneratedInclude):
|
||||
self._process_generated_include(obj.path, backend_file)
|
||||
|
||||
elif isinstance(obj, PerSourceFlag):
|
||||
self._process_per_source_flag(obj, backend_file)
|
||||
|
||||
elif isinstance(obj, InstallationTarget):
|
||||
self._process_installation_target(obj, backend_file)
|
||||
|
||||
@ -1085,6 +1089,10 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
path = ''
|
||||
backend_file.write('LOCAL_INCLUDES += -I%s%s\n' % (path, generated_include))
|
||||
|
||||
def _process_per_source_flag(self, per_source_flag, backend_file):
|
||||
for flag in per_source_flag.flags:
|
||||
backend_file.write('%s_FLAGS += %s\n' % (per_source_flag.file_name, flag))
|
||||
|
||||
def _process_java_jar_data(self, jar, backend_file):
|
||||
target = jar.name
|
||||
backend_file.write('JAVA_JAR_TARGETS += %s\n' % target)
|
||||
|
@ -470,6 +470,21 @@ class GeneratedInclude(SandboxDerived):
|
||||
self.path = path
|
||||
|
||||
|
||||
class PerSourceFlag(SandboxDerived):
|
||||
"""Describes compiler flags specified for individual source files."""
|
||||
|
||||
__slots__ = (
|
||||
'file_name',
|
||||
'flags',
|
||||
)
|
||||
|
||||
def __init__(self, sandbox, file_name, flags):
|
||||
SandboxDerived.__init__(self, sandbox)
|
||||
|
||||
self.file_name = file_name
|
||||
self.flags = flags
|
||||
|
||||
|
||||
class JARManifest(SandboxDerived):
|
||||
"""Describes an individual JAR manifest file and how to process it.
|
||||
|
||||
|
@ -33,6 +33,7 @@ from .data import (
|
||||
JARManifest,
|
||||
LibraryDefinition,
|
||||
LocalInclude,
|
||||
PerSourceFlag,
|
||||
PreprocessedTestWebIDLFile,
|
||||
PreprocessedWebIDLFile,
|
||||
Program,
|
||||
@ -307,6 +308,11 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
if no_pgo_sources:
|
||||
passthru.variables['NO_PROFILE_GUIDED_OPTIMIZE'] = no_pgo_sources
|
||||
|
||||
sources_with_flags = [f for f in sources if sources[f].flags]
|
||||
for f in sources_with_flags:
|
||||
ext = mozpath.splitext(f)[1]
|
||||
yield PerSourceFlag(sandbox, f, sources[f].flags)
|
||||
|
||||
exports = sandbox.get('EXPORTS')
|
||||
if exports:
|
||||
yield Exports(sandbox, exports,
|
||||
|
@ -84,7 +84,7 @@ VARIABLES = {
|
||||
populated by calling add_android_eclipse{_library}_project().
|
||||
""", 'export'),
|
||||
|
||||
'SOURCES': (StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool}), list,
|
||||
'SOURCES': (StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool, 'flags': list}), list,
|
||||
"""Source code files.
|
||||
|
||||
This variable contains a list of source code files to compile.
|
||||
|
Loading…
Reference in New Issue
Block a user