BSD make 有一个:Q
变量扩展修饰符,在FreeBSD make 手册页中记录如下:
:Q Quotes every shell meta-character in the variable, so that it can be
passed safely through recursive invocations of make.
如果 variablevar
具有 value a b\c"d'e$f
,则$(var:Q)
扩展为a\ b\\c\"d\'e\$f
(或等效的)。这对于将字符串传递给 shell 很有用,而不必担心 shell 会解释任何特殊字符。
GNU make 有等价物吗?还是我必须自己转义特殊字符?