help-make
[Top][All Lists]
Advanced

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

RE: Number of arguments, a. la $# in gnu make?


From: Rakesh Sharma
Subject: RE: Number of arguments, a. la $# in gnu make?
Date: Sat, 15 Feb 2014 10:11:24 -0800

Hello Paul,

Ok that will simplify the validation for a macro.  This was just my hanger on 
from shell code where the distinction matters whether a variable is empty or 
undefined 😌 .

As for the $0 stuff,  my intention was to generate a make code on the fly 
except for $0 (by doubling ..)
& then having it eval-ed  within the main function (tr-validate) where in the 
value on $0 can then be plugged in from there.

I am not very clear about how make parses its code & then additonal layers of 
parsing done by eval.

Would you please let me in on as to how make performs the above in the case of 
eval?

Thanks,
Rakesh
Sharma

> Subject: Re: Number of arguments, a. la $# in gnu make?
> From: address@hidden
> To: address@hidden
> CC: address@hidden
> Date: Sat, 15 Feb 2014 12:50:13 -0500
> 
> On Sat, 2014-02-15 at 09:17 -0800, Rakesh Sharma wrote:
> > This is a template for a make-based "tr" macro which transliterates
> > from listA to listB in the text.
> > 
> > Before running "tr" I intend to run some validations on the arguments
> > to "tr".  The macro "-tr-validate" does that task and it is here that
> > the number of arguments to a function's need was sorely felt. 
> 
> I'm not sure I see the point in showing different error messages for
> "missing" vs. "empty" arguments.  If you don't need to keep that
> distinction then you have a much simpler result: just see if any of the
> values you expect are the empty string.
> 
> > Also in this macro is it possible to factor in the $0 in the exit-code
> > macro itself, so that we dont need to specify it in the invocation of
> > exit-code macro everytime.? I tried various alternatives using
> > $(eval.... but nothing worked.
> 
> I don't see any way it's possible.  When you invoke call $0 is always
> set to the current function.  Once that's done it's not possible to
> access the previous $0 from the "calling" function, inside the "called"
> function.  There's no facility in GNU make to access the "outer" value
> of an overridden variable.
> 
                                          

reply via email to

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