[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make 3.79.1 basename bug with absolute filenames
From: |
Paul D. Smith |
Subject: |
Re: make 3.79.1 basename bug with absolute filenames |
Date: |
Wed, 23 Jan 2002 20:50:12 -0500 |
%% address@hidden writes:
k> make 3.79.1, solaris 2.7, compiled with gcc 2.95.2.
k> Here's a two-line GNUmakefile:
k> default:
k> @echo $(basename /src/foo)
k> And here's the output of running it:
k> $ make -f m
k> /src/foo
k> Shouldn't that just be `foo'?
Nope. Confusingly enough, the basename function in make doesn't emulate
all of the behavior of the basename program in the shell. It _only_
does the "strip the suffix" part.
The manual sez:
`$(basename NAMES...)'
Extracts all but the suffix of each file name in NAMES. If the
file name contains a period, the basename is everything starting
up to (and not including) the last period. Periods in the
directory part are ignored. If there is no period, the basename
is the entire file name. For example,
$(basename src/foo.c src-1.0/bar hacks)
produces the result `src/foo src-1.0/bar hacks'.
What you want is $(notdir ...), not $(basename ...) ...
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist