Makefile匹配任何规则作为中间 [英] Makefile match anything rule as intermediate
本文介绍了Makefile匹配任何规则作为中间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑这个简单的Makefile:
Consider this simple Makefile:
%.one: %.two
echo one
%.two: %.three
echo two
%.three: %.four
echo three
all: hi.one
按预期,全部制作
将产生:
echo three
three
echo two
two
echo one
one
但是,如果我制定的中间规则没有任何前缀/后缀:
But if I make an intermediate rule without any prefix/suffix:
%.one: %
echo one
%: %.three
echo one
%.three: %.four
echo one
all: hi.one
Make将失败,因为说没有规则可以使 hi.one
.使用Make完全不可能吗?
Make will fail saying there is no rule to make hi.one
. Is this simply impossible with Make?
推荐答案
这是不可能的,因为模式规则的依赖性,非终端匹配规则将被忽略.
No this isn't possible, non-terminal match-anything rules are ignored for dependencies of pattern rules.
This isn't actually mentioned in the manual, but the following comment in the make source (implicit.c:321) makes it clear
/* Rules that can match any filename and are not terminal
are ignored if we're recursing, so that they cannot be
intermediate files. */
这篇关于Makefile匹配任何规则作为中间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文