我想使用.SECONDEXPANSION:如http://make.mad-scientist.net/secondary-expansion所述。我有以下makefile:
.SECONDEXPANSION:
x.deps := y.foo
%.foo: $$($$*.deps)
echo $@
不幸的是,当我尝试make x.foo
时,我得到了
make: *** No rule to make target `.foo'. Stop.
使用-Rd
运行它,我得
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-pc-linux-gnu
Reading makefiles...
[...]
Updating goal targets....
Considering target file `x.foo'.
File `x.foo' does not exist.
Looking for an implicit rule for `x.foo'.
Trying pattern rule with stem `x'.
Trying rule prerequisite `y.foo'.
Trying pattern rule with stem `x'.
Trying rule prerequisite `y.foo'.
Looking for a rule with intermediate file `y.foo'.
Avoiding implicit rule recursion.
No implicit rule found for `x.foo'.
Finished prerequisites of target file `x.foo'.
Must remake target `x.foo'.
make: *** No rule to make target `x.foo'. Stop.
我认为它不起作用,因为根据文档,"没有一个隐含规则可以在链中出现多次。"但这正是我所需要的 - 让x.foo解析为y.foo,它解析为没有依赖关系的规则。我的应用程序需要统一(* .foo)命名方案。任何人都可以提出解决方案吗?不幸的是,顺便说一句,我必须使用make 3.81,而不是更近期的东西。