Makefile始终运行目标 [英] Makefile always running target

查看:94
本文介绍了Makefile始终运行目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能会错过这个Makefile非常明显的东西:

I may miss something very obvious with this Makefile:

convert: devel/bar
  touch convert

init: devel/foo
  echo 'init'

devel/foo:
  mkdir -p devel
  touch devel/foo

devel/bar: init
  touch devel/bar

当我运行它时,总是会调用devel/bar目标.我希望它调用convert,检查文件devel/bar,并且仅在找不到该文件的情况下才调用该目标.如果删除对init的依赖,一切都会按预期进行.我在做什么错了?

When I run it, the devel/bar target always gets called. I'd expect it to call convert, check the file devel/bar, and call that target only if that file is not found. If I remove its dependency on init, everything works as I would expect. What am I doing wrong?

推荐答案

您没有创建名为init的文件,因此init总是过时的.因此,所有依赖它的东西总是过时的.

You're not creating a file called init, so init is always out-of-date. Therefore everything that depends on it is always out-of-date.

这篇关于Makefile始终运行目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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