Use shell escaping instead of quoting

OSs don't agree on what the quote chars mean
pull/7559/head
Jimmy Brisson 2018-08-02 09:09:07 -05:00
parent 6adac922db
commit 58180dbafe
2 changed files with 13 additions and 3 deletions

View File

@ -75,11 +75,11 @@ SREC_CAT = srec_cat
{%- endif %}
{%- block additional_executables -%}{%- endblock %}
{% for flag in c_flags %}C_FLAGS += "{{flag}}"
{% for flag in c_flags %}C_FLAGS += {{shell_escape(flag)}}
{% endfor %}
{% for flag in cxx_flags %}CXX_FLAGS += "{{flag}}"
{% for flag in cxx_flags %}CXX_FLAGS += {{shell_escape(flag)}}
{% endfor %}
{% for flag in asm_flags %}ASM_FLAGS += "{{flag}}"
{% for flag in asm_flags %}ASM_FLAGS += {{shell_escape(flag)}}
{% endfor %}
LD_FLAGS :={%- block ld_flags -%} {{ld_flags|join(" ")}} {% endblock %}

View File

@ -29,6 +29,15 @@ from tools.export.exporters import Exporter, apply_supported_whitelist
from tools.utils import NotSupportedException
from tools.targets import TARGET_MAP
SHELL_ESCAPE_TABLE = {
"(": "\(",
")": "\)",
}
def shell_escape(string):
return "".join(SHELL_ESCAPE_TABLE.get(char, char) for char in string)
class Makefile(Exporter):
"""Generic Makefile template that mimics the behavior of the python build
@ -97,6 +106,7 @@ class Makefile(Exporter):
'link_script_option': self.LINK_SCRIPT_OPTION,
'user_library_flag': self.USER_LIBRARY_FLAG,
'needs_asm_preproc': self.PREPROCESS_ASM,
'shell_escape': shell_escape,
}
if hasattr(self.toolchain, "preproc"):