Skip to content

Commit e9d3166

Browse files
committed
Expose present get_compile_options API in Toolcahins
1 parent 15a9a03 commit e9d3166

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

tools/export/exporters.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ def flags(self):
105105
config_header = self.toolchain.get_config_header()
106106
flags = {key + "_flags": copy.deepcopy(value) for key, value
107107
in self.toolchain.flags.iteritems()}
108-
asm_defines = ["-D" + symbol for symbol in self.toolchain.get_symbols(True)]
108+
asm_defines = self.toolchain.get_compile_options(
109+
self.toolchain.get_symbols(for_asm=True),
110+
filter(None, self.resources.inc_dirs),
111+
for_asm=True)
109112
c_defines = ["-D" + symbol for symbol in self.toolchain.get_symbols()]
110113
flags['asm_flags'] += asm_defines
111114
flags['c_flags'] += c_defines

tools/toolchains/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,25 @@ def get_config_option(self, config_header):
13561356
"""
13571357
raise NotImplemented
13581358

1359+
@abstractmethod
1360+
def get_compile_options(self, defines, includes, for_asm=False):
1361+
"""Generate the compiler options from the defines and includes
1362+
1363+
Positional arguments:
1364+
defines -- The preprocessor macros defined on the command line
1365+
includes -- The include file search paths
1366+
1367+
Keyword arguments:
1368+
for_asm -- generate the assembler options instead of the compiler options
1369+
1370+
Return value:
1371+
A list of the command line arguments that will force the inclusion the specified header
1372+
1373+
Side effects:
1374+
None
1375+
"""
1376+
raise NotImplemented
1377+
13591378
@abstractmethod
13601379
def assemble(self, source, object, includes):
13611380
"""Generate the command line that assembles.

0 commit comments

Comments
 (0)