views:

362

answers:

3

I have a large legacy codebase with very complicated makefiles, with lots of variables. Sometimes I need to change them, and I find that it's very difficult to figure out why the change isn't working the way I expect. What I'd like to find is a tool that basically does step-through-debugging of the "make" process, where I would give it a directory, and I would be able to see the value of different variables at different points in the process. None of the debug flags to make seem to show me what I want, although it's possible that I'm missing something. Does anyone know of a way to do this?

+5  A: 

Have you been looking at the output from running make -n and make -np, and the biggie make -nd?

Are you using a fairly recent version of gmake?

Have you looked at the free chapter on Debugging Makefiles available on O'Reilly's site for their excellent book "Managing Projects with GNU Make" (Amazon Link).

HTH.

cheers,

Rob

Rob Wells
A: 

I'm not aware of any specific flag that does exactly what you want, but

--print-data-base
sounds like it might be useful.

argv0
+2  A: 

I'm sure that remake is what you are looking for.

From the homepage:

remake is a patched and modernized version of GNU make utility that adds improved error reporting, the ability to trace execution in a comprehensible way, and a debugger.

It has gdb-like interface and is supported by mdb-mode in (x)emacs which means breakponts, watches etc. And there's DDD if you don't like (x)emacs

Rajish