继续翻译
复制代码
If you know that one or more of your makefiles cannot be remade and
you want to keep `make' from performing an implicit rule search on
them, perhaps for efficiency reasons, you can use any normal method of
preventing implicit rule lookup to do so. For example, you can write
an explicit rule with the makefile as the target, and an empty recipe
(*note Using Empty Recipes: Empty Recipes.).
If the makefiles specify a double-colon rule to remake a file with a
recipe but no prerequisites, that file will always be remade (*note
Double-Colon::). In the case of makefiles, a makefile that has a
double-colon rule with a recipe but no prerequisites will be remade
every time `make' is run, and then again after `make' starts over and
reads the makefiles in again. This would cause an infinite loop:
`make' would constantly remake the makefile, and never do anything
else. So, to avoid this, `make' will *not* attempt to remake makefiles
which are specified as targets of a double-colon rule with a recipe but
no prerequisites.
复制代码
如果你知道有一个或多个 makefile没能被重新生成,并且你想要让 make 继续在这些文件上执行隐式规则搜索,也许从效率方面考虑,你可以用普通的方法来防止隐式规则搜索。例如你可以为作为目的的makefile写一个显式规则,和一个空的片段.
(*note Using Empty Recipes: Empty Recipes)
如果makefile 指定了一个 双冒号规则来用没有前提条件,只有片段的方式来重新生成一个文件,这个文件将肯定会被重新生成(*note Double-Colon::)
在这种场合下,一个makefile拥有 双冒号规则,只有片段没有前提条件,则此文件将在每次make 运行的时候,被重新生成。然后,make 启动完毕后再次读入此makefile时再次被重新生成。
这将会到导致无限循环:make 会不断地重新生成此 makefile,并且永远也干不了其他的事情了。
为了防止这一点,make 不会试图去 重新生成一个 双冒号规则下的有片段无前提条件的,被定义为目的makefile。
后文待续
本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/09/14/2684932.html,如需转载请自行联系原作者