help-make
[Top][All Lists]
Advanced

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

Re: Bug in $(call ...) ?


From: Alexey Neyman
Subject: Re: Bug in $(call ...) ?
Date: Tue, 21 Dec 2004 10:33:50 +0300
User-agent: KMail/1.6.2

On Monday 20 December 2004 20:47, Boris Kolpackov wrote:
> Alexey Neyman <address@hidden> writes:
> 
> > X = echo
> > A = $($(1)) $$(1) $$(2)
> >
> > B := $(call A,X)
> >
> > C = echo $(1) $(2)
> >
> > all:
> >         @echo '[$(call B,hi,lo)]'
> >         @echo '[$(call C,hi,lo)]'
> 
> It appears that non-recursive variables don't work well with 
> $(call ). 

Yes, that's exactly what I was trying to express :-)

> A fix could be to just make variables temporarily-recursive in the
> context of $(call ) and restore the original mode after $(call ) is
> completed. Of course, the following will be possible then

Though there are workarounds (at least two were suggested in the 
list), from reading the make.info I'd expect this behavior:

     $(call VARIABLE,PARAM,PARAM,...)

   When `make' expands this function, it assigns each PARAM to
temporary variables `$(1)', `$(2)', etc.  The variable `$(0)' will
contain VARIABLE.  There is no maximum number of parameter arguments.
There is no minimum, either, but it doesn't make sense to use `call'
with no parameters.

   Then VARIABLE is expanded as a `make' variable in the context of
these temporary assignments.  Thus, any reference to `$(1)' in the
value of VARIABLE will resolve to the first PARAM in the invocation of
`call'.

(note the last paragraph, it says that VARIABLE is always expanded).

Regards,
Alexey.

-- 
For mundane material concerns, seek the help of the one-eyed beings.
                        -- Pkunks, SC2




reply via email to

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