tags:

views:

72

answers:

1

I'm trying to debug a complex Makefile. How do you get GNU make to print all the commands it runs? I couldn't find the answer in the man page (using the -d flag doesn't seem to print it).

(This isn't necessary info to answer my question, but in case you're wondering: I'm having trouble compiling a project built on NVIDIA's CUDA library. I can compile it myself, but using their Makefile results in a nasty compiler error. I'd like to use their provided Makefile for easier packaging, and inclusion of other packages that they link in already.)

Thanks

+5  A: 

-n triggers a "dry run" in which no command is executed, though the commands which would execute are printed.

If your Makefile is recursive, though, this won't help much.

strager
IIRC, `-n` works just fine with recursive `Makefiles` if they use `$(MAKE)`.
Michael Krelin - hacker
doh. Exactly what I was looking for -- I need to get my eyes checked. Much thanks for the speedy response. (also, it seems to work fine with CUDA's nested Makefiles)
marcopolo1010
@hacker, I did not know that. Thanks for the tip. =]
strager