Makefile中处理组件的顺序 [英] Order of processing components in makefile

查看:115
本文介绍了Makefile中处理组件的顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在makefile中,依赖关系行的格式为-

In a makefile, the dependency line is of the form -

abc: x y z

这三个组件(x,y,z)本身都是makefile中更下方的依赖关系行中的目标.

All three of the components (x,y,z) are themselves targets in dependency lines further down in the makefile.

如果调用 make abc ,将以什么顺序执行三个目标x,y,z?

If make abc is invoked, in what order will the three targets x,y,z be executed?

推荐答案

默认情况下,执行顺序与先决条件列表中指定的顺序相同,除非在这些先决条件之间定义了任何依赖关系.

By default, the order of execution is the same as specified in the prerequisites list, unless there are any dependencies defined between these prerequisites.

abc: x y z

订单为x y z.

abc: x y z
y : z

订单应为x z y.

但是理想情况下,您应该设计Makefile,使其不依赖于指定先决条件的顺序.也就是说,如果y应该在z之后执行,则必须y : z依赖项.

But ideally, you should design your Makefiles so that it wouldn't rely on the order in which prerequisites are specified. That is, if y should be executed after z, there must be a y : z dependence.

请记住,GNU Make可以并行执行一些配方,请参见垫子的答案.

And keep in mind that GNU Make can execute some recipes in parallel, see Mat's answer.

这篇关于Makefile中处理组件的顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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