Makefile显示“make: Nothing to be done for xxxx”的解决方法

来源:互联网 发布:美萍软件使用教程 编辑:程序博客网 时间:2024/05/16 14:03

1. 问题

添加一个Makefile的target的时,总会出现“make: Nothing to be done for `xxxxx’”的提示,而书写语法表面正确。

2. 原因

Makefile的target和目录或文件名字冲突。

A phony target is one that is not really the name of a file;
rather it is just a name for a recipe to be executed when you make an explicit request.
There are two reasons to use a phony target:
to avoid a conflict with a file of the same name, and to improve performance.
If you write a rule whose recipe will not create the target file, the recipe will be executed every time the target comes up for remaking.

3. 总结

GNU默认Makefile的target是一个文件(或目录)。
它会先检测同级目录下是否已存在这个文件,如果存在,则会abort掉make 进程,并提示

make: Nothing to be done for `xxxx’

这种情况需要.PHONY来避免问题的出现,phony的意思是“赝品”,在这里可以形象的理解成“不是文件”。

参考文献:
[1] http://blog.csdn.net/linuxtiger/article/details/7955060 作者: 对象

0 0
原创粉丝点击