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!
С уважением, Александр Гавенко.
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make