您的位置:首页 > 其它

Makefile(1) --- .PHONY

2014-04-11 00:46 183 查看
.PHONY is a special built-in target name.

.PHONY's prerequisites are considered to be phony targets. When it is time to consider such a target, make will run its recipe unconditionally, regardless of whether a file with that name exists or
what its last-modification time is.

Case 1:

$ ls

Makefile test

$ cat Makefile

test :

echo "target test~"

$ make

make: `test' is up to date.

Case 2:

$ ls

Makefile test

$ cat Makefile

.PHONY : test

test :

echo "target test~"

$ make

echo "target test~"

target test~

用”.PHONY : test“,无论target test是否存在,它的recipes总是无条件执行。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: