Trying to make sense of all the relationships described in a big bundle of Makefiles? Don't! Draw them instead!
The #OpenZFS userspace components in the source tree have some fairly complicated interconnections, which I'm slowly working to disentangle. Some complexity is ok, but you want it to be clearly described and labelled. That's what I'm working towards.
It's hard to just open up all the makefiles and draw the connections in your head. It's made more difficult by some libtool quirks that can make surprising things happen when dynamic and static objects are mixed in together.
So, I wrote a little Perl program that scans all the Makefiles and builds up a map of all the interconnections, and then emits a Graphviz DOT file to draw it.
Here's the result! On the left, the linkages on the master branch right now; on the right, the vasty improved version from my cleanup branch (and still lots more to go).
Programs are green, dynamic libs are purple, static libs are orange. The arrow colour is a linkage to an object of that type. That red dashed line on the left is highlighting a place where a static lib is linking to a dynamic lib. This is the trigger for one of those surprising quirks, and it has to go.
I knew it was there from studying the library output, but I couldn't figure out how it was happening. It was worth the time to do this, and now I'm running it over and over as I make changes to peel away the layers.
So yeah, draw pictures. It's fun, and it helps!
Feel free to hack the script for your own ends, if you cbf making your own: https://gist.github.com/robn/7c27c71bdfa773953101de9f60daf0be