2004-09-21 04:00:31 +00:00
|
|
|
# -*-perl-*-
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-09-21 04:00:31 +00:00
|
|
|
$description = "Test the subst and patsubst functions";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-09-21 04:00:31 +00:00
|
|
|
$details = "";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-09-21 04:00:31 +00:00
|
|
|
# Generic patsubst test: test both the function and variable form.
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-09-21 04:00:31 +00:00
|
|
|
run_make_test('
|
|
|
|
foo := a.o b.o c.o
|
|
|
|
bar := $(foo:.o=.c)
|
|
|
|
bar2:= $(foo:%.o=%.c)
|
|
|
|
bar3:= $(patsubst %.c,%.o,x.c.c bar.c)
|
|
|
|
all:;@echo $(bar); echo $(bar2); echo $(bar3)',
|
|
|
|
'',
|
|
|
|
'a.c b.c c.c
|
|
|
|
a.c b.c c.c
|
|
|
|
x.c.o bar.o');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-09-21 04:00:31 +00:00
|
|
|
# Patsubst without '%'--shouldn't match because the whole word has to match
|
|
|
|
# in patsubst. Based on a bug report by Markus Mauhart <qwe123@chello.at>
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-09-21 04:00:31 +00:00
|
|
|
run_make_test('all:;@echo $(patsubst Foo,Repl,FooFoo)', '', 'FooFoo');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-09-21 04:00:31 +00:00
|
|
|
# Variable subst where a pattern matches multiple times in a single word.
|
|
|
|
# Based on a bug report by Markus Mauhart <qwe123@chello.at>
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2004-09-21 04:00:31 +00:00
|
|
|
run_make_test('
|
|
|
|
A := fooBARfooBARfoo
|
|
|
|
all:;@echo $(A:fooBARfoo=REPL)', '', 'fooBARREPL');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|