GNU make manual 翻译( 九十八)

继续翻译

4.6 Phony Targets

=================



   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. Here is an example:



     clean:

             rm *.o temp



Because the `rm' command does not create a file named `clean', probably no such file will ever exist.  Therefore, the `rm' command will be executed every time you say `make clean'.  

4.6 伪目标
=================

伪目标不是一个文件的真实名字,它其实只是一个,你给make显式要求时要执行的片段的名字。

有两个原因需要使用伪目标: 防止和同名的文件冲突,提高性能。

如果你写了一个规则,其片段不是要创建目的文件,这个规则可以每次运行。下面是一个例子:

clean:
rm *.o temp

因为 rm 命令不生成一个名为 clean 的文件,可能这个文件也永远不会存在,因此,每次你输入 make clean 时,这个rm 命令都会得到执行。

后文翻译

你可能感兴趣的:(Make)