在 makefile 中构建多个目标而不包含所有目标
我有一个目标列表,它们都为特定语言调用 msgfmt。我想将它们全部称为,但我真的不想创建一个巨大的 all
目标。还有其他方法告诉 make 应该构建多个目标吗?
I have a list of targets that are all calling msgfmt for a specific language. I would like to call them all, but I do not really want to create a huge all
target. Is there some other way to tell make that multiple targets should be build?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
all
目标在任何方面都没有特殊之处。按照惯例,这是第一个目标,因此也是默认目标。任何其他虚假目标都可以取代它。只需创建一些目标,将其声明为
.PHONY
,让所有 msgfmt 目标作为该目标的先决条件,并将其设置为不同于第一个目标的目标。如果变量中已有目标列表,则可以使用该变量作为先决条件列表。
The
all
target is not special in any way. It is only by convention that this is the first, and thus the default target. Any other phony target can take its' place.Just create some target, declare it as
.PHONY
, let all your msgfmt targets as prerequisites of this target, and make it something other then your first one.If you already have a list of targets in a variable, you can use that variable as the prerequisite list.