使用单个动作/规则生成多个目标 [英] Generate multiple target using single action/rule

查看:57
本文介绍了使用单个动作/规则生成多个目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写一个规则以使用一个操作即可生成一组文件.

How do I write a rule to generate set of files using a single action.

示例: 文件xyz是由于脚本t.sh的单次执行而生成的,该脚本将文件a作为输入.

Example: Files x, y, z are generated as a result of single execution of script t.sh which takes file a as input.

x y z: a
    t.sh $@

GNU make尝试执行t.sh 3次.

GNU make tries to execute t.sh 3 times.

推荐答案

您可以实施因为您已经标记了此gnumake,所以我还应该指出,使用具有多个目标的GNU make模式规则(带有%的规则)将考虑两个都是从该规则的一次执行生成的:请参阅 GNU制作手册.

Because you've tagged this gnumake, I should also point out that using a GNU make pattern rule (the ones with %) with multiple targets WILL consider both generated from one execution of the rule: see the GNU make manual.

这篇关于使用单个动作/规则生成多个目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆