am__memoize = $(or $(am__memoized_value/$1),$(strip \
$(eval am__memoized_value/$1 := $$2))$(am__memoized_value/$1))
-## $(call am__strip_suffixes_0, SUFFIXES, WORD)
-## --------------------------------------------
-## Strip any of the SUFFIXES from WORD. Even if WORD terminates with
-## several suffixes, only one is stripped: the first one that matches.
-am__strip_suffixes_0 = $(strip \
- $(if $(strip $(1)), \
- $(if $(filter %$(firstword $(1)), $(2)), \
- $(patsubst %$(firstword $(1)), %, $(2)), \
- $(call am__strip_suffixes_0, \
- $(call am__strip_firstword, $(1)), $(2))), \
- $(2)))
-
## $(call am__strip_suffixes, SUFFIXES, LIST)
## ------------------------------------------
## Strip any of the SUFFIXES from each of the entries of LIST. Even if an
## entry of LIST terminates with several suffixes, only one is stripped:
## the first one that matches.
-am__strip_suffixes = \
- $(foreach am__i,$(2),$(call am__strip_suffixes_0,$(1),$(am__i)))
+am__private_suffix = .,;&!@
+am__strip_suffixes = $(strip \
+ $(if \
+ $(strip $1), \
+ $(patsubst %$(am__private_suffix),%, \
+ $(call am__strip_suffixes, \
+ $(call am__strip_firstword,$1), \
+ $(patsubst %$(firstword $1),%$(am__private_suffix),$2))), \
+ $2))
## Some derived variables that have been found to be useful.
pkgdatadir = $(datadir)/@PACKAGE@
am_create_testdir=empty
. ./defs || Exit 1
-plan_ 5
+plan_ 4
cp "$am_amdir"/header-vars.am . \
|| fatal_ "fetching makefile fragment headers-vars.am"
test '$(call am__uniq,3 1 1 4 1 4 1 1)' = '3 1 4'
test '$(call am__uniq, 1 3 1 )' = '1 3'
-.PHONY: test-strip-suffixes0
-test-strip-suffixes0:
- test '$(call am__strip_suffixes_0,,)' = ''
- test '$(call am__strip_suffixes_0, ,)' = ''
- test '$(call am__strip_suffixes_0,, )' = ''
- test '$(call am__strip_suffixes_0, , )' = ''
- test '$(call am__strip_suffixes_0,x,)' = ''
- test '$(call am__strip_suffixes_0,x, )' = ''
- test '$(call am__strip_suffixes_0,x y, )' = ''
- test '$(call am__strip_suffixes_0,,x)' = 'x'
- test '$(call am__strip_suffixes_0, ,x)' = 'x'
- test '$(call am__strip_suffixes_0,.c,foo.c)' = 'foo'
- test '$(call am__strip_suffixes_0,.c .c++, bar.c++)' = 'bar'
- test '$(call am__strip_suffixes_0,.c .c++, bar.cxx)' = 'bar.cxx'
- test '$(call am__strip_suffixes_0,x,ax)' = 'a'
- test '$(call am__strip_suffixes_0,x,xa)' = 'xa'
- test '$(call am__strip_suffixes_0,x,xx)' = 'x'
- test '$(call am__strip_suffixes_0,x,xux)' = 'xu'
- test '$(call am__strip_suffixes_0, .a .b, x.a.a)' = 'x.a'
- test '$(call am__strip_suffixes_0, .a .b, x.a.b)' = 'x.a'
- test '$(call am__strip_suffixes_0, .a .b, x.b.a)' = 'x.b'
- test '$(call am__strip_suffixes_0, .a .b, x.b.b)' = 'x.b'
- # Corner cases: the *first* matched suffix is stripped
- test '$(call am__strip_suffixes_0, .a .b.a, foo.b.a)' = 'foo.b'
- test '$(call am__strip_suffixes_0, .b.a .a, foo.b.a)' = 'foo'
-
.PHONY: test-strip-suffixes
test-strip-suffixes:
test '$(call am__strip_suffixes,,)' = ''
test '$(call am__strip_suffixes,.c,foo.c)' = 'foo'
test '$(call am__strip_suffixes,.foo,a.foo b.foo)' = 'a b'
test '$(call am__strip_suffixes, x y, ax ay ax)' = 'a a a'
+ test '$(call am__strip_suffixes,x,ax)' = 'a'
+ test '$(call am__strip_suffixes,x,xa)' = 'xa'
+ test '$(call am__strip_suffixes,x,xx)' = 'x'
+ test '$(call am__strip_suffixes,x,xux)' = 'xu'
test '$(call am__strip_suffixes, .c .c++, \
foo.c bar.c++ baz.cxx zap.c)' = 'foo bar baz.cxx zap'
test '$(call am__strip_suffixes, .a .b, \
1.a.a 2.a.b 3.b.a 4.b.b)' = '1.a 2.a 3.b 4.b'
# Corner cases: the *first* matched suffix is stripped
+ test '$(call am__strip_suffixes,.a .b,x.a.a)' = 'x.a'
+ test '$(call am__strip_suffixes,.a .b,x.a.b)' = 'x.a'
+ test '$(call am__strip_suffixes,.a .b,x.b.a)' = 'x.b'
+ test '$(call am__strip_suffixes,.a .b,x.b.b)' = 'x.b'
test '$(call am__strip_suffixes, .a .b.a, foo.b.a bar.a)' \
- = 'foo.b bar'
+ = 'foo.b bar'
test '$(call am__strip_suffixes, .b.a .a, foo.b.a bar.a)' \
- = 'foo bar'
+ = 'foo bar'
END
command_ok_ am__strip_firstword $MAKE test-strip-firstword
command_ok_ am__strip_lastword $MAKE test-strip-lastword
command_ok_ am__uniq $MAKE test-uniq
-command_ok_ am__test_strip_suffixes_0 $MAKE test-strip-suffixes0
command_ok_ am__test_strip_suffixes $MAKE test-strip-suffixes
: