-   Programming (
-   -   print make dependency tree? (

chadwick 05-14-2009 03:01 PM

print make dependency tree?
I'm curious if anyone knows of a way to print out in a visual way the dependencies that are specified in a makefile.

Of course you could just read the makefile or run make and look at the compiler/linker commands that make prints when it executes, but I'm interested in something that would be more immediately obvious to the eye, to avoid having to spend my cognitive resources on unnecessary activities.

The reason I'm interested in this is that I have a project that someone else created that is composed of several files, and in order to start to understand what each file is, it's good to know what depends on what.

Obviously make builds a dependency tree itself, so it's a plausibly small leap to go from there to printing it out in a nice pleasing way. I'm curious if anyone's done that.

Sergei Steshenko 05-14-2009 04:34 PM

I think you'll need an additional script; if we are talking about GNU make, a dry run can be performed; see

man make

and pay attention to


All times are GMT -5. The time now is 09:40 PM.