本文共 1036 字,大约阅读时间需要 3 分钟。
继续翻译
Now you can say just `make' to remake all three programs, or specify asarguments the ones to remake (as in `make prog1 prog3'). Phoniness isnot inherited: the prerequisites of a phony target are not themselvesphony, unless explicitly declared to be so. When one phony target is a prerequisite of another, it serves as asubroutine of the other. For example, here `make cleanall' will deletethe 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 programcleanobj :
rm *.ocleandiff :
rm *.diff后文待续
本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/09/20/2695293.html,如需转载请自行联系原作者