在生成的先决条件中使用生成目标名称 [英] Using make target name in generated prerequisite
本文介绍了在生成的先决条件中使用生成目标名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做的所有事情...
All I am wanting to do something along the lines of...
some_file.out : ..... ver_$(basename $@).ver:
.....
$@
不会按预期扩展,而只会在规则标题中扩展.在规则的内部,ver_$(basename $@).ver
的所有用法均可根据需要扩展.我将如何修改它以使其按需工作?
The $@
does not expand as expected but only in the rule header. Inside the body of the rule all uses of ver_$(basename $@).ver
expand as desired. How would I modify this to make it work as desired?
推荐答案
您将省略号省略了示例中的许多重要部分以提供完整的解决方案.但是,一种选择是使用静态模式规则,像这样:
You have ellipses eliding too many important parts of your example to provide a full solution. However, one option is to use static pattern rules, like this:
some_file.out : %.out : ver_%.ver
...
如果这还不够,您可以使用二次扩展,但这是一个更大的锤子.
If that isn't sufficient you can use secondary expansion, but that's a bigger hammer.
这篇关于在生成的先决条件中使用生成目标名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文