diff --git a/tools/export/makefile/__init__.py b/tools/export/makefile/__init__.py index c76bac7e1f..913a585ed2 100644 --- a/tools/export/makefile/__init__.py +++ b/tools/export/makefile/__init__.py @@ -111,7 +111,7 @@ class Makefile(Exporter): for key in ['include_paths', 'library_paths', 'hex_files', 'to_be_compiled']: ctx[key] = sorted(ctx[key]) - ctx.update(self.flags) + ctx.update(self.format_flags()) for templatefile in \ ['makefile/%s_%s.tmpl' % (self.TEMPLATE, @@ -128,6 +128,17 @@ class Makefile(Exporter): else: raise NotSupportedException("This make tool is in development") + def format_flags(self): + """Format toolchain flags for Makefile""" + flags = {} + for k, v in self.flags.iteritems(): + if k in ['asm_flags', 'c_flags', 'cxx_flags']: + flags[k] = map(lambda x: x.replace('"', '\\"'), v) + else: + flags[k] = v + + return flags + @staticmethod def build(project_name, log_name="build_log.txt", cleanup=True): """ Build Make project """