subdirs = ./dir1/foo.1 ./dir2/bar.2
test:
for k in $(subdirs) ; do \
echo $$k ; \
echo $(notdir $$k) ; \
done
Here's the output I get:
% make test
for k in ./dir1/foo.1 ./dir2/bar.2 ; do \
echo $k ; \
echo $k ; \
done
/dir1/foo.1
/dir1/foo.1
/dir2/bar.2
/dir2/bar.2
but the output I *want* is
/dir1/foo.1
foo.1
/dir2/bar.2
bar.2
TIA---jtw
There's no way this is going to work, because $(notdir) is a Make function,
while $$k is only expanded when the shell is run by Make. So when Make comes
to expand $(notdir), it sees $$k as its argument, and that expands to itself
(since it has no leading directories).
You want to use `basename $$k` instead.