Graphing the DAG generated by make?

2019-03-15 18:17发布

问题:

My understanding is that when make executes, it generates a DAG internally to represent all the dependencies in the project. Is there a way to get at that DAG and graph it, say using something like graphviz?

I'm using gnu make on Ubuntu 8.04.

EDIT

I just ran across these tools called mamdag and mamdot. They're supposed to work with both nmake and gnu make, but I can't seem to find the options to get gnu make to spit out the mam file.

It can be downloaded here - these packages:

INIT
ast-base
ast-gpl

Just found this article by Glenn Fowler at AT&T describing the MAM language and the mamdot tool.

It seems like you have to patch gnu make for this to work, although I'm not 100% certain yet.

Maybe there's another way?

回答1:

You should try using Makefile::GraphViz's gvmake utility to create the graphs you want



回答2:

For the code side of things, doxygen will produce dependency diagrams between source and header files, if that is what you are interested in, without the use of make.