On Fri, 2009-12-11 at 11:18 +1800, Peng Yu wrote: > GraphViz can be used to plot a graph. I'm wondering if there is a easy > way to generate dependency graph (exported to a figure that can be > visualized) for a Makefile.
There is nothing built into make. You can use "make -p" to see a copy of the database which will give you any explicit dependencies and could be postprocessed with perl/awk/etc. However, there is no way to know what the implicit dependencies are since make doesn't compute them ever unless it actually wants to build the target. It *might* be possible to do this after a complete build if you give the -B option, as well as -d, but the parsing will be a lot more complicated since you'll have to watch the debug output to see all the prerequisites that make considers when building a target. There is also the remake project which you can find on sourceforge, which might have some help for you on this: http://bashdb.sourceforge.net/remake/ The "download" link here seems to lead me off into the weeds, but if you go to the sourceforge.net project page link and use the "View all files" button you can find it. I can't say for sure but I think the debugging output of remake is more conducive to parsing, at any rate. _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
