[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to echo a "$" to a file in Makefile.am
From: |
Stefano Lattarini |
Subject: |
Re: How to echo a "$" to a file in Makefile.am |
Date: |
Fri, 2 Jul 2010 16:43:44 +0200 |
User-agent: |
KMail/1.12.1 (Linux/2.6.30-2-686; KDE/4.3.4; i686; ; ) |
At Friday 02 July 2010, Lyre wrote:
> In Makefile.am, I wrote an custom rule which append the program's
> path to the startup script. it looks like:
>
> echo $(datadir)/myprogram/program-name $OPTIONS >> /bin/program-name
>
> I want to get :
>
> /usr/share/myprogram/program-name $OPTIONS
>
> however, waht I accully get is :
>
> /usr/share/myprogram/program-name PTIONS
That's because make interprets the `$O' in `$OPTION' as a make macro
expansion, and since you didn't define `O' anywere, it comes out empty.
To obtain a literal `$', use:
echo $(datadir)/myprogram/program-name $$OPTIONS >> /bin/program-name
But note that, this way, the shell will see the `$OPTIONS' token, and will
expand it as a shell variable expansion; if you don't want this, use:
echo '$(datadir)/myprogram/program-name $$OPTIONS' >> /bin/program-name
instead.
BTW, your question was really about make, not automake; if you are using
GNU make, then you can refer to its reference manual:
<http://www.gnu.org/software/make/manual/make.html>
or you can find more information about the standardized make behaviour here:
<http://www.opengroup.org/onlinepubs/009695399/utilities/make.html>
HTH,
Stefano