BSD make has a :Q
variable expansion modifier, documented in the FreeBSD make man page as follows:
:Q Quotes every shell meta-character in the variable, so that it can be
passed safely through recursive invocations of make.
If variable var
has value a b\c"d'e$f
, then $(var:Q)
expands to a\ b\\c\"d\'e\$f
(or something equivalent). This is useful to pass strings to the shell without worrying that the shell will interpret any special characters.
Does GNU make have an equivalent? Or do I have to escape special characters my own?