有没有Make调试器?我需要弄清楚别人的 makefile
我需要向非常复杂的多层 makefile(大量包含文件、大量目标、大量变量)添加一些功能,该文件是由其他人编写的,当然,这些人已经不再在公司工作了。这里有些人了解其中的一些,但不了解全部。
是否有一个 Make 调试器,我可以单步执行它,或者是否有某种等效的方法来跟踪编译流经的许多文件和目标的执行?或者有其他方法可以了解这个东西是如何工作的吗?
I need to add some capabilities to very complex, multi-layered makefile (lots of include files, lots of targets, lots of variables) that was written by someone else who of course is no longer with the company. There are some folks here who understand some of it, but not the whole thing.
Is there a Make debugger where I can single-step through it, or some equivalent way to follow the execution through the many files and targets that a compile flows through? Or is there some other way to get a handle on how this thing works?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
GNU Make 有各种选项用于打印一些调试信息运行时的信息。
-d
会打印出一大堆调试信息;也许太多了,也许不是你需要的,但你可以尝试筛选一下。还有一些选项,例如用于进行空运行的-n
、用于打印规则数据库的-p
、用于打印目录的-w
您可以帮助跟踪复杂的递归生成中的问题,并使用--warn-undefined-variables
来跟踪变量的某些问题。如果这些都不起作用,您可能需要尝试 Remake,它声称是经过修补的 GNU make用调试器。我还没有使用过它,但是从文档来看,它看起来可能有帮助你出去了,它还有一些关于尝试追踪 Makefile 中的错误的更多建议。
GNU Make has various options for printing out some debugging information while running.
-d
will print out a whole lot of debugging information; perhaps too much, and perhaps not what you need, but you might try sifting through that. There are also options like-n
for doing a dry run,-p
for printing the database of rules,-w
for printing out which directory you're in to help track down issues in complicated recursive makes, and--warn-undefined-variables
for tracking down certain problems with variables.If none of that works, you might want to try Remake, which claims to be a patched GNU make with a debugger. I haven't used it, but from the documentation, it looks like it might help you out, and it has some more advice on trying to track down bugs in Makefiles.
您可能想看看这篇文章 http://oreilly.com/catalog/make3/ book/ch12.pdf(Oreilly 的“使用 GNU Make 管理项目,第三版”中的“调试 Makefiles”一章)
You might want to look at this article http://oreilly.com/catalog/make3/book/ch12.pdf (A chapter "Debugging Makefiles" from Oreilly's "Managing Projects with GNU Make, Third Edition")