diff --git a/tools/export/makefile/__init__.py b/tools/export/makefile/__init__.py index 22ffcc8023..797c8647a5 100644 --- a/tools/export/makefile/__init__.py +++ b/tools/export/makefile/__init__.py @@ -126,8 +126,15 @@ class Makefile(Exporter): ctx.update(self.format_flags()) # Add the virtual path the the include option in the ASM flags - ctx['asm_flags'] = map(lambda item: "-I" + ctx['vpath'][0] + "/" + item[2:] - if item.startswith('-I') else item, ctx['asm_flags']) + new_asm_flags = [] + for flag in ctx['asm_flags']: + if flag.startswith('-I'): + new_asm_flags.append("-I{}/{}".format(ctx['vpath'][0], flag[2:])) + elif flag.startswith('--preinclude='): + new_asm_flags.append("--preinclude={}/{}".format(ctx['vpath'][0], flag[13:])) + else: + new_asm_flags.append(flag) + ctx['asm_flags'] = new_asm_flags for templatefile in \ ['makefile/%s_%s.tmpl' % (self.TEMPLATE, @@ -148,7 +155,7 @@ class Makefile(Exporter): """Format toolchain flags for Makefile""" flags = {} for k, v in self.flags.items(): - if k in ['asm_flags', 'c_flags', 'cxx_flags']: + if k in ['c_flags', 'cxx_flags']: flags[k] = map(lambda x: x.replace('"', '\\"'), v) else: flags[k] = v