Makefile 包含 .depend
在我的 makefile 中,我有一个:
include .depend
我也有一个
depend:
rules for buiding .depend
现在,问题是,当“.depend”不存在时,我无法运行“make dependent”;我必须做“touch .depend; make dependent”
有没有办法告诉Make“如果.depend不存在,仍然允许我运行'make dependent'”?
谢谢!
In my makefile, I have a:
include .depend
I also have a
depend:
rules for buiding .depend
Now, here is the problem, when ".depend" does not exist, I can't run "make depend"; I have to do "touch .depend; make depend"
Is there anyway to tell Make "if .depend does not exist, still allow me to run 'make depend'" ?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设你的意思是你不能运行“make dependent”,因为 Make 不愿尝试包含不存在的文件。如果您使用 GNUMake,则可以使用 -include:
如果文件存在,这将包含该文件,但如果不存在,则继续执行,不会出现错误。
(我听说 sinclude 在其他一些版本的 Make 中也做了同样的事情。)
I assume you mean that you can't run "make depend" because Make balks at trying to include a file that doesn't exist. If you're using GNUMake you can use -include:
This will include the file if it exists, but continue without error if it doesn't.
(I've heard that sinclude does the same thing in some other versions of Make.)