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: Oleksandr Gavenko
Subject: Re: Exact paths vs canonical paths
Date: Mon, 25 Oct 2010 13:12:37 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.11) Gecko/20101013 Thunderbird/3.1.5

On 25.10.2010 11:16, Angel Tsankov wrote:

How can I get $@ to expand to the exact path of the target rather than
to a canonical path, e.g.

./a.out: a.o
@echo $@ # Prints a.out instead of ./a.out

I can guess such method:

./new.txt:
        echo $@
         # get full path and strip current dir to get relative path:
        echo $(patsubst $(shell echo $$PWD)/%,%,$(abspath $@))

  $make ./new.txt
make
echo new.txt
new.txt
echo new.txt
new.txt

--
С уважением, Александр Гавенко



reply via email to

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