On 03/10/2010 03:29 AM, Daniel Veillard wrote:
> It would probably be better to write:
>
> -e 's![@]localstatedir[@]!$(localstatedir)!g' \
>
> as the substitution.
>
> Other than that, you have my ACK
Okay, I was afraid at first that the quoting of the expression would
defeat make variable substitution, but that works :-)
Make uses textual substitution, and the only escaping it manages are $
expansion and \-newline collapses. '' quoting doesn't come into play
until later, when sh is handed the already-substituted string. So it is
quite common to see '$(var)' constructs in make, with single rather than
double quotes, since then var is treated literally unless it contains an
embedded '. It's also common to see GNU make constructs to properly
escape embedded ', to provide truly robust make expansion.
Yes, that makes make an awful language to master, since there are two
levels of quoting to remember since two different tools will be
performing expansions.
No wonder automake is so complex: automake developers have to be
polyglots, to write a perl script that uses m4 to generate makefile
snippets containing portable shell code for building C programs.
Maintainers of Makefile.am are isolated from a little of this, but it's
still useful to know lots of languages. :)
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org