[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a question about $(call function
From: |
Philip Guenther |
Subject: |
Re: a question about $(call function |
Date: |
Mon, 13 Jun 2011 08:13:10 -0700 |
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