[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: why is ./foobar target noted as foobar ??
From: |
Paul Smith |
Subject: |
RE: why is ./foobar target noted as foobar ?? |
Date: |
Sun, 04 Mar 2012 03:22:55 -0500 |
Please don't top-post.
On Thursday, March 01, 2012 10:00 AM, Mark Galeck (CW) wrote:
> With this makefile
>
> ./foobar:
> touch $@
>
> make prints "touch foobar" .
On Thu, 2012-03-01 at 10:17 -0800, Mark Galeck (CW) wrote:
> I know the manual says "$@ is the _file_ name" but surely, this does
> not literally mean "only the file name not the directory". For
> example, dir/foobar works. Also dir/./foobar works. Only "." at the
> very beginning does not work.
No, it does not literally mean that.
This is a special feature to handle only "./" (and "././", etc.) that
was added to GNU make a long, long time ago; from the manual:
* Strip leading sequences of `./' from file names, so that `./FILE'
and `FILE' are considered to be the same file.
It has been considered a bug before, and I don't necessarily disagree.
That is, I'm OK with make recognizing that the strings "./foo" and "foo"
refer to the same file on the disk for the purposes of determining
out-of-dateness etc. but I don't think make should be changing the value
of address@hidden
On the other hand, what should make do if it sees two rules like:
./foo: ; @echo with dir
foo: ; @echo without dir
...?
See also https://savannah.gnu.org/bugs/index.php?10708
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist