GNU make manual 翻译( 九十五)

继续翻译

 

4.5.5 Directory Search and Implicit Rules
-----------------------------------------

The search through the directories specified in `VPATH' or with `vpath' also happens during consideration of implicit rules (*note Using Implicit Rules: Implicit Rules.).

   For example, when a file `foo.o' has no explicit rule, `make' considers implicit rules, such as the built-in rule to compile `foo.c' if that file exists.  If such a file is lacking in the current directory, the appropriate directories are searched for it.  If `foo.c' exists (or is mentioned in the makefile) in any of the directories, the implicit rule for C compilation is applied.

   The recipes of implicit rules normally use automatic variables as a matter of necessity; consequently they will use the file names found by directory search with no extra effort.

 

4.5.5 目录搜索与隐式规则
-----------------------------------------

对 VPATH 或者 vpath 中所指定的目录,隐式规则运行时也会发生(*note Using Implicit Rules: Implicit Rules.)

例如,当一个 foo.o 文件没有显式规则,make 就考虑隐式规则,就好像是编译 foo.c 文件的内建规则。

如果一个文件不在当前目录,将会寻找其他目录,如果此foo.c 文件存在(或者被 makefile提及),C 编译的隐式规则将被应用。

隐式规则的片段正常使用自动变量作为必须的因素;它们将用目录搜索的文件名而不需要额外的设定。

后文待续

posted @ 2012-09-20 08:26  健哥的数据花园  阅读(192)  评论(0编辑  收藏  举报