help-make
[Top][All Lists]
Advanced

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

RE: Difference between $(call macro) and $(macro)


From: Rakesh Sharma
Subject: RE: Difference between $(call macro) and $(macro)
Date: Tue, 18 Feb 2014 11:15:25 -0800

Hello Paul,

Thanks very much for the clarifications. I was wrongly under the assumption 
that $(call macro) is equivalent to $(macro) (provided macro is a deferred 
variety of variable).

> Subject: Re: Difference between $(call macro) and $(macro)
> From: address@hidden
> To: address@hidden
> CC: address@hidden
> Date: Tue, 18 Feb 2014 08:04:35 -0500
> 
> On Tue, 2014-02-18 at 02:14 -0800, Rakesh Sharma wrote:
> > What's going on here? Apparently,  the construct $(macro) picks up the
> > $1/$2/... values from the macro in which it was placed. However, the
> > construct $(call macro) picks up the $1/$2 ... values from its' own
> > argument list. And, that is also why when we write $(macro,,) this
> > seems to rid the problem of the unintentional grabbing of the parent
> > macro's arguments.
> 
> This is definitely correct behavior.
> 
> When make sees $(call foo), that's an invocation of the user-defined
> function "foo".  In preparation for calling that user-defined function,
> make will bind the special argument variables $1, $2, etc. to the
> arguments to the user-defined function.  Here there are no arguments
> given in this invocation, so they are all bound to the empty value.
> 
> When make sees $(foo) that's a straightforward expansion of the macro
> named "foo".  No special operations are involved, it just looks up the
> macro named "foo", expands (or not, if "foo" is simple) the value, and
> uses the result.  There's no special handling of $1, etc.
> 
> As for "$(foo,,)", that's expanding the variable named, literally,
> "foo,,".  Since that variable likely doesn't exist this will always
> expand to the empty string (unless you defined it of course).
> 
> 
                                          

reply via email to

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