[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a question about $(call function
From: |
ali hagigat |
Subject: |
Re: a question about $(call function |
Date: |
Tue, 14 Jun 2011 11:38:29 +0430 |
>philip:
> This is incorrect. 'call' is a builtin function; $(call var1) is an
> invocation of a function that return 'kk', which is *not* a built in
> function.
Dear Philip,
The manual says:
"If variable is the name of a builtin
function, the builtin function is always invoked "
If the purpose of the manual is that variable is exactly the name of
the built in function like "call" as you said, then we have some thing
like the following:
$(call call,pp)
In this example our variable is the name of a built in function but
how it wants to be expanded? as the manual said!! If i accept your
word the manual does not make sense.
When i read the manual i thought that the meaning of this sentence of
the manual:
"If variable is the name of a builtin function "
is that the variable expands and the result is a function like:
$(call $(call kk),pp)
> Because on the immediately preceding Makefile line you set 'kk' to
> 'aba', so $(call kk,pp) expands to 'aba'.
>
I did not set kk to aba!! kk has a separate defintion:
kk=$(1)00 , which never executes and my question is that why it is
never considered?
Lets move step by step, when we have var2=$(call $(call var1),pp).
What is the first expansion? is it:
var2=$(call kk,pp)
or
var2=$(call aba, pp)
In any case , none of the two functions of aba or kk are called? Why?
If the expansion is not var2=$(call kk,pp) or var2=$(call aba, pp)?
So what is it then?
I have written the example again:
>> kk=$(1)00
>> aba=$(1)11
>> var1=kk
>> $(call var1)=aba
>> var2=$(call $(call var1),pp)
>> all: ;
>> $(warning var2=$(var2))
Regards
---------------------------------
On Mon, Jun 13, 2011 at 7:43 PM, Philip Guenther <address@hidden> wrote:
> On Sun, Jun 12, 2011 at 11:27 PM, ali hagigat <address@hidden> wrote:
>> Thanks Mr. Smith for the answer however I have two questions:
>>
>> 1) According to the manual, "If variable is the name of a builtin
>> function, the builtin function is always invoked ". So why in the
>> cited example when we have:
>> var2=$(call $(call var1),pp)
>> Our variable here is $(call var1) and it is a built in function.
>
> This is incorrect. 'call' is a builtin function; $(call var1) is an
> invocation of a function that return 'kk', which is *not* a built in
> function.
>
>
>
>> Why
>> it is not called? so:
>> var2=$(call kk,pp)
>> var2=pp00
>
> Because on the immediately preceding Makefile line you set 'kk' to
> 'aba', so $(call kk,pp) expands to 'aba'.
>
>
>
>> 2) if $(call var1)=aba is considered, so:
>> var2=$(call aba, pp)
>> var2=pp11
>> Why var2=aba? why aba function is not called with its $(1)=pp?
>
> Ah! Are you thinking that "$(call var1)=aba" set a literal variable
> named "$(call var1)", such that "$(call var1)" will expand to 'aba'?
> That's not correct: the left side of an assignment undergoes expansion
> just like the right in order to determine the name of the variable
> being set. This is described near the bottom of the "6.3.2 Computed
> Variable Names" section in the documentation.
>
>
> Philip Guenther
>