help-make
[Top][All Lists]
Advanced

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

Re: .SECONDEXPANSION and patsubst


From: Oleksandr Gavenko
Subject: Re: .SECONDEXPANSION and patsubst
Date: Wed, 15 Sep 2010 18:26:30 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100825 Thunderbird/3.1.3

On 15.09.2010 17:10, Martin d'Anjou wrote:
Hi,

I do not understand this .SECONDEXPANSION problem with patsubst. It
seems patsubst has no effect. Here is the code:
.SECONDEXPANSION:
test_foo_core := core_bar
core_%:
@echo CORE $@
test_%: core_$$(patsubst core_%,%,$$(test_$$*_core))
@echo TEST $@

And how it executes:
$ make test_foo
CORE core_core_bar <<<<<< actual result core_core_bar
TEST test_foo

Expected result:
CORE core_bar <<<<<<< expected result, core_bar
TEST test_foo

I expect $(patsubst) to chop off the leading "core_" and to see
"core_bar", and not "core_core_bar".

I am sure it is something very simple, but after many hours of working
on this, another pair of eyes would be much appreciated!

This worked as not desired:

variable := prefix_value
.SECONDEXPANSION:
test_%: $$(info $$(patsubst prefix_%,%_suffix,$$(variable)))
        @echo TEST $@

  $ make test_foo
prefix_value
TEST test_foo

When change example to

PERCENT = %
variable := prefix_value
.SECONDEXPANSION:
test_%: $$(info $$(patsubst prefix_$$(PERCENT),$$(PERCENT)_suffix,$$(variable)))
        @echo TEST $@

work successful:

  $ make test_foo
value_suffix
TEST test_foo

So  '%' in patsubst conflict with '%' mining in static rules!

--
Happy hacking!
С уважением, Александр Гавенко.



reply via email to

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