考虑这个简单的 Makefile:
%.one: %.two
echo one
%.two: %.three
echo two
%.three: %.four
echo three
all: hi.one
正如预期的那样,make all
将产生:
echo three
three
echo two
two
echo one
one
但是如果我制定一个没有任何前缀/后缀的中间规则:
%.one: %
echo one
%: %.three
echo one
%.three: %.four
echo one
all: hi.one
make 会失败,表示没有规则可制定hi.one
。这对 Make 来说是不可能的吗?
不,这是不可能的,对于模式规则的依赖关系,非终端匹配任何规则都会被忽略。
手册中实际上没有提到这一点,但是 make 源代码中的以下注释(隐式.c:321 http://git.savannah.gnu.org/cgit/make.git/tree/implicit.c)说得很清楚
/* Rules that can match any filename and are not terminal
are ignored if we're recursing, so that they cannot be
intermediate files. */
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)