我的Makefile中有一个简单的目标:
file1:
touch $@
我可以使用以下方法建立此目标: make file1
如果我说:(make ./file1
'file1'是最新的),它也会生成
但是,如果我说:make $HOME/file1
那么它告诉我:
make: Nothing to be done for '/home/jesaremi/file1'
不管我使用哪种路径,有没有办法获得一致的结果?
您可以添加另一个规则:
$(shell pwd)/%: %
@:
这将使file1
规则适用于“ file1”,“ ./ file1”,“ / home / jesaremi / path_to_cwd / file1”,“〜jesaremi / path_to_cwd / file1”和“〜/ path_to_cwd / file1”。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句