Reputation: 3024
I have a simple target in my Makefile:
file1:
touch $@
I can build this target using: make file1
It also builds if I say: make ./file1
('file1' is up to date)
However if i say: make $HOME/file1
then it tells me:
make: Nothing to be done for '/home/jesaremi/file1'
Is there a way to get consistent results regardless of what path I use?
Upvotes: 0
Views: 153
Reputation: 99164
You could add another rule:
$(shell pwd)/%: %
@:
This will allow the file1
rule to work for "file1", "./file1", "/home/jesaremi/path_to_cwd/file1", "~jesaremi/path_to_cwd/file1" and "~/path_to_cwd/file1".
Upvotes: 1