Is there a Make debugger? I need to figure out someone else's makefile
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 开发者_StackOverflow中文版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?
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.
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")
精彩评论