help-make
[Top][All Lists]
Advanced

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

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


From: Noel Yap
Subject: Re: Bug in $(call ...) ?
Date: Mon, 20 Dec 2004 10:57:03 -0500
User-agent: Mozilla Thunderbird 0.5 (Windows/20040212)

I'm not sure, but using $(eval) might help in your situation.

Alexey Neyman wrote:

On Monday 20 December 2004 18:14, you wrote:

Double dollar sign causes a single dollar sign literal to be present in the string. I don't think that is what you want here.


Yes, but that dollar sign is accompanied by a left parenthesis, digit and a right parenthesis. I'd assume this character sequence to be replaced with positional argument when this string is passed as $(0) to the $(call). I mixed in comments to illustrate the way I assumed the evaluation should happen. Please point me to the line where I made a mistake.

X = echo
A = $($(1)) $$(1) $$(2)

# $(0) = "$($(1)) $$(1) $$(2)"
# $(1) = X
# -> B = "echo $(1) $(2)"
B := $(call A,X)

# should be the same string as $(B), right ?
C = echo $(1) $(2)

all:
# $(0) = "echo $(1) $(2)"
# $(1) = "hi"
# $(2) = "lo"
# -> $(call B,hi,lo) should be "echo hi lo",
# but instead is "echo $(1) $(2)"
        @echo '[$(call B,hi,lo)]'
# $(0) = "echo $(1) $(2)"
# $(1) = "hi"
# $(2) = "lo"
# -> $(call B,hi,lo) is "echo hi lo", as it should be.
        @echo '[$(call C,hi,lo)]'


> On Mon, Dec 20, 2004 at 05:56:33PM +0300, Alexey Neyman

wrote:
Well, I'll use it, thanks. However, it seems that it's actually a workaround. Perhaps this Makefile will illustrate better what I

mean:

<<<<
X = echo
A = $($(1)) $$(1) $$(2)
B := $(call A,X)
C = echo $(1) $(2)

$(warning "$(value B)")
$(warning "$(value C)")

all:
       @echo '[$(call B,hi,lo)]'
       @echo '[$(call C,hi,lo)]'

Note that the $(warning)s show that the values of B and C are the same. Yet, the results of echo differ:

Makefile:6: "echo $(1) $(2)"
Makefile:7: "echo $(1) $(2)"
[echo $(1) $(2)]
[echo hi lo]


On Monday 20 December 2004 16:33, you wrote:

Perhaps the following modifications get you what you want. I

think

perhaps you are just missing the passthrough for the numbered

parameters

for B.

X = echo
A = $($(1)) $(2) $(3)
B = $(call A,X,$(1),$(2))

all: @echo '[$(B)]'
       @echo '[$(call B,hi,lo)]'
       $(call B,hi,lo)

 Ken

On Mon, Dec 20, 2004 at 01:40:02PM +0300, Alexey Neyman wrote:

Hi,

address@hidden:~/tmp> cat Makefile
X = echo
A = $($(1)) $$(1) $$(2)
B = $(call A,X)

all:
       @echo '[$(B)]'
       @echo '[$(call B,hi,lo)]'
address@hidden:~/tmp> make all
[echo $(1) $(2)]
[echo $(1) $(2)]

I thought the "$(call B,hi,lo)" should have evaluated to "echo

hi
lo",
shouldn't it?

Regards,
Alexey.

--
Ah, an insult... a sometimes necessary and constructive

release of
tension.
                       -- Pkunks, SC2


_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make

--
All are welcome to our nest.
We are Pkunk, we cannot help but love all.
                       -- Pkunks, SC2






reply via email to

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