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

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

_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to