GNU Makefile第一个目标未被调用 [英] GNU Makefile first target not getting invoked

查看:109
本文介绍了GNU Makefile第一个目标未被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 GNU Makefile将每条配方行都视为不带连续字符的子shell命令

target_compile: PROJECT_SIM_OPTS += -LDFLAGS -L${CURRENT_DIR},-lm -load

target_compile: copy_shared_object actual_compile_with_sim_opts
    @echo PROJECT_SIM_OPTS=${PROJECT_SIM_OPTS} ...

制作Makefile时,我可以看到第二个target_compile被触发,但没有第一个target_compile被触发,除了变量之外,第一个target_compile没有依赖关系和配方.我尝试在该行的末尾在PROJECT_SIM_OPTS;之前添加override,但是仍然无法正常工作.

When I make the Makefile, I am able to see the second target_compile fire off but not the first target_compile which has no dependencies and recipe except a variable. I tried adding override before PROJECT_SIM_OPTS and ; at the end of the line but still it is not working.

没有报告错误消息,这使得检测起来更加困难.简而言之,我必须将这段代码嵌入另一个Makefile中,如果第一个目标可以工作,我将看到其中包含-LDFLAGS -L${CURRENT_DIR},-lm -load生成的文件.由于此文件是在没有这些标志的情况下生成的,因此我有把握地说,第一个目标未触发.

There is no Error message reported which makes it even harder to detect. In nutshell, I have to embed this piece of code in another Makefile and if the first target would work, I will see a file generated with -LDFLAGS -L${CURRENT_DIR},-lm -load in it. Since this file is being generated without these flags, I am confident to say that first target is not firing.

两个target_compile如何一起工作?

How can the two target_compile work together?

推荐答案

原来是订购问题.就我而言

It turned out to be an ordering issue. In my case

target_compile: copy_shared_object actual_compile_with_sim_opts
    @echo PROJECT_SIM_OPTS=${PROJECT_SIM_OPTS} ...

actual_compile_with_sim_optscopy_shared_object

一旦我这样放置依赖项, actual_compile_with_sim_opts: copy_shared_object

Once I put the dependency like this, actual_compile_with_sim_opts: copy_shared_object

我能够使两个目标都带有适当的标志

I was able to get both targets to work with proper flags

感谢@Beta的所有帮助.

Thanks @Beta for all the help.

这篇关于GNU Makefile第一个目标未被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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