GNU make manual 翻译( 一百零三)

继续翻译

Now you can say just `make' to remake all three programs, or specify as
arguments the ones to remake (as in `make prog1 prog3').  Phoniness is
not inherited: the prerequisites of a phony target are not themselves
phony, unless explicitly declared to be so.

   When one phony target is a prerequisite of another, it serves as a
subroutine of the other.  For example, here `make cleanall' will delete
the object files, the difference files, and the file `program':

     .PHONY: cleanall cleanobj cleandiff

     cleanall : cleanobj cleandiff
             rm program

     cleanobj :
             rm *.o

     cleandiff :
             rm *.diff

现在你可以仅仅输入 make 来重新构建所有这三个程序,或者知道指定参数来构建一部分(例如 make prog1 prog2),伪目的不能继承:伪目的的前提条件不能是伪目的,除非明确地进行了如此的宣言。

当一个伪目的是另一个伪目的的前提条件时,它就像是另一个的子程序一样进行工作。例如,这里的 make cleanall 将删除目标文件,差异文件和 program文件:

.PHONY: cleanall cleanobj cleandiff

cleanall : cleanobj cleandiff
rm program

cleanobj :
rm *.o

cleandiff :
rm *.diff

后文待续

原文地址:https://www.cnblogs.com/gaojian/p/2695293.html