GNU make manual 翻译( 一百二十六)

继续翻译

   Once you've defined the rule to remake the `.d' files, you then use
the `include' directive to read them all in.  *Note Include::.  For
example:

     sources = foo.c bar.c

     include $(sources:.c=.d)

(This example uses a substitution variable reference to translate the
list of source files `foo.c bar.c' into a list of prerequisite
makefiles, `foo.d bar.d'.  *Note Substitution Refs::, for full
information on substitution references.)  Since the `.d' files are
makefiles like any others, `make' will remake them as necessary with no
further work from you.  *Note Remaking Makefiles::.

   Note that the `.d' files contain target definitions; you should be
sure to place the `include' directive _after_ the first, default goal
in your makefiles or run the risk of having a random object file become
the default goal.  *Note How Make Works::.

一旦你已经定义了重新建立 .d 文件的规则,你就可以用 include 指令来把它们都读入。 *Note Include ::

例如:

sources = foo.c bar.c

include $(sources:.c=.d)

(这个例子使用了一个替换变量参照功能来把 foo.c bar.c 翻译成前提条件文件 foo.d bar.d 详细信息,参考*Note Substitution Refs:: )

因为 .d 文件和其他的文件类似,make 将会按照需要重新生成此类文件。*Note Remaking Makefiles::

请注意,.d 文件包含了目的的定义;你应当确认把 include 指令放在第一行之后,否则会导致某个随机的文件称为缺省 终点。 *Note How Make Works::

后文待续

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