help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exact paths vs canonical paths


From: Paul Smith
Subject: Re: Exact paths vs canonical paths
Date: Mon, 25 Oct 2010 11:13:04 -0400

On Mon, 2010-10-25 at 15:33 +0300, Angel Tsankov wrote:
> >>>> ./a.out: a.o
> >>>>  @echo $@  # Prints a.out instead of ./a.out

I believe there is a bug about this already reported in Savannah
somewhere, asking that $@ always contain the exact string for the target
that was used in the makefile.  Make has to turn this into a canonical
name so that if you write two different rules for the same target, but
one with "./" and one without, the prerequisites etc. are hooked up
properly.

We need to read the manual carefully regarding canonical paths, etc. to
see what the manual guarantees before we can make changes to the default
behavior.  There are times where this will make a difference, as you've
described.

For now you can always add the path back, with something like:

        $(if $(findstring /,$@),$@,./$@)

so if no "/" appears in $@ then you get "./$@" otherwise you get "$@".

-- 
-------------------------------------------------------------------------------
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]