help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limiting expansion of make variables


From: Paul Smith
Subject: Re: Limiting expansion of make variables
Date: Tue, 18 Apr 2017 11:55:29 -0400

On Tue, 2017-04-18 at 17:28 +0200, Richard Cavell wrote:
> It seems to make no difference to make whether I use single or double
> quotes.
> dumpvars: foo.o bar.o foobar
>        @echo '$$(RM) is :' $(RM)
>        @echo "$$^ is :" $^

This is because "$^" is not a valid shell variable, so the shell just
passes it along without change.

But if you use:

  echo "$$(RM) is :" $(RM)

then the shell will try to run the command "RM" which likely doesn't
exist.  Here you need the backslash.

However, it's best to always use single quotes in make recipes.  It
guards you against virtually all types of special characters (except
single quotes themselves) and it doesn't matter to make, since make
pays no attention to quotes of any type.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]