GNU make manual 翻译( 一百一十七)

继续翻译

   The TARGET-PATTERN and PREREQ-PATTERNS say how to compute the
prerequisites of each target.  Each target is matched against the
TARGET-PATTERN to extract a part of the target name, called the "stem".
This stem is substituted into each of the PREREQ-PATTERNS to make the
prerequisite names (one from each PREREQ-PATTERN).

   Each pattern normally contains the character `%' just once.  When the
TARGET-PATTERN matches a target, the `%' can match any part of the
target name; this part is called the "stem".  The rest of the pattern
must match exactly.  For example, the target `foo.o' matches the
pattern `%.o', with `foo' as the stem.  The targets `foo.c' and
`foo.out' do not match that pattern.

   The prerequisite names for each target are made by substituting the
stem for the `%' in each prerequisite pattern.  For example, if one
prerequisite pattern is `%.c', then substitution of the stem `foo'
gives the prerequisite name `foo.c'.  It is legitimate to write a
prerequisite pattern that does not contain `%'; then this prerequisite
is the same for all targets.

The TARGET-PATTERN and PREREQ-PATTERNS say how to compute the
prerequisites of each target. Each target is matched against the
TARGET-PATTERN to extract a part of the target name, called the "stem".
This stem is substituted into each of the PREREQ-PATTERNS to make the
prerequisite names (one from each PREREQ-PATTERN).

目的模式(TARGET-PATTERN)和前提模式(PREREQ-PATTERN)指出如何为每一个目的计算前提条件。每个目的都通过目的模式来解析出一部分目的名来进行匹配,成为枝干。这个枝干会被替换成每一个前提模式以生成前提条件名称(一个 前提模式一个)

上述每个模式同行都只包含%符号一次。当目的模式匹配了一个目的,%能够匹配任何目的名的部分,这个部分称为 枝干。剩余的模式必须精确匹配。例如,目的 foo.o 匹配模式 %.o, foo为枝干。目的 foo.c 和 foo.out 并不匹配此模式。

每个目的的前提条件名通过在前提条件模式中为%替换枝干部分形成。例如,如果一个前提条件的模式是 %.c, 那么对枝干 foo的替换给出了前提条件名 foo.c。 写一个不包含%的前提条件模式是可以的,此时这个前提条件名称对所有目的都相同。

后文待续

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