diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 538aa3dc9..1686a5d14 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -93,7 +93,7 @@ rsp_threshold = 4096 # variables (or variables we use them in) is interpreted directly by ninja # (e.g. the value of the depfile variable is a pathname that ninja will read # from, etc.), so it must not be shell quoted. -raw_names = {'DEPFILE', 'DESC', 'pool', 'description', 'targetdep'} +raw_names = {'DEPFILE_UNQUOTED', 'DESC', 'pool', 'description', 'targetdep'} def ninja_quote(text, is_build_line=False): if is_build_line: @@ -180,6 +180,9 @@ class NinjaRule: self.rsprefcount = 0 self.rspfile_quote_style = rspfile_quote_style # rspfile quoting style is 'gcc' or 'cl' + if self.depfile == '$DEPFILE': + self.depfile += '_UNQUOTED' + @staticmethod def _quoter(x, qf = quote_func): if isinstance(x, NinjaCommandArg): @@ -291,6 +294,9 @@ class NinjaBuildElement: elems = [elems] self.elems.append((name, elems)) + if name == 'DEPFILE': + self.elems.append((name + '_UNQUOTED', elems)) + def _should_use_rspfile(self): # 'phony' is a rule built-in to ninja if self.rulename == 'phony':