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
后文待续
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步