GNU make manual 翻译(六十八)
继续翻译
Secondary Expansion of Explicit Rules ------------------------------------- During the secondary expansion of explicit rules, `$$@' and `$$%' evaluate, respectively, to the file name of the target and, when the target is an archive member, the target member name. The `$$<' variable evaluates to the first prerequisite in the first rule for this target. `$$^' and `$$+' evaluate to the list of all prerequisites of rules _that have already appeared_ for the same target (`$$+' with repetitions and `$$^' without). The following example will help illustrate these behaviors: .SECONDEXPANSION: foo: foo.1 bar.1 $$< $$^ $$+ # line #1 foo: foo.2 bar.2 $$< $$^ $$+ # line #2 foo: foo.3 bar.3 $$< $$^ $$+ # line #3 In the first prerequisite list, all three variables (`$$<', `$$^', and `$$+') expand to the empty string. In the second, they will have values `foo.1', `foo.1 bar.1', and `foo.1 bar.1' respectively. In the third they will have values `foo.1', `foo.1 bar.1 foo.2 bar.2', and `foo.1 bar.1 foo.2 bar.2 foo.1 foo.1 bar.1 foo.1 bar.1' respectively.
在对显式规则进行二次扩展期间,
当目的是一个归档的成员,$$@ 和 $$% 分别被解析成为目的的名称--目的成员的各个名称。
$$< 变量给出此第一个规则里的目的的第一个前提条件。
$$^ 和 $$+ 此规则的所有的前提条件列表($$+ 有重复运算能力,$$^则没有)
下面是一个例子,可以帮组我们理解其行为:
.SECONDEXPANSION:
foo: foo.1 bar.1 $$< $$^ $$+ # line #1
foo: foo.2 bar.2 $$< $$^ $$+ # line #2
foo: foo.3 bar.3 $$< $$^ $$+ # line #3
In the first prerequisite list, all three variables (`$$<', `$$^',
and `$$+') expand to the empty string. In the second, they will have
values `foo.1', `foo.1 bar.1', and `foo.1 bar.1' respectively. In the
third they will have values `foo.1', `foo.1 bar.1 foo.2 bar.2', and
`foo.1 bar.1 foo.2 bar.2 foo.1 foo.1 bar.1 foo.1 bar.1' respectively.
在第一行的前提条件列表中,此三个变量($$<,$$^,$$+)分别都是空串。
在第二行,它们将分别拥有 foo.1, foo.1 bar.1 和 foo.1 bar.1 的值。
在第三行,它们将分别拥有
foo.1
foo.1 bar.1 foo.2 bar.2
foo.1 bar.1 foo.2 bar.2 foo.1 foo.1 bar.1 foo.1 bar.1
后文待续