An Illusory Intertwingling of Reason and Response

Tech: Yes, I’m a geek. I admit it. At least I’m not a nerd!

Tafel :: tech

Thursday, September 21, 2006

Recursive Make Considered Harmful

Every once in a while, I'll stumble across some real gems in my online researches. Today it happened with make.

I've been trying for some time to really get a handle on Makefiles, and to come up with a "One True Makefile" I could use for all my projects. See, I have a small (but growing) set of utility scripts with which I create my programming environment, including one that sets up a basic project for me. (I don't believe in topheavy IDEs . . . a text editor and a terminal are "integrated" enough for me.)

Of course, one of the things it does is places a Makefile set up for the project at hand in the project directory. In fact, if you make a bare project like that, you get a beautiful little implementation of true . . . it'll build and return 0 at you all day long if you let it.

Well, one of the problems I had with my second-edition Makefile was that I had to do clean builds a lot, since it wasn't tracking dependencies fabulously well (especially with regards to headers).

Well, my new Makefile is better-designed, and is going to integrate with my utility environment: namely dependencies are managed by depend.sh. I have to manually add header files as dependencies, but it saves the overhead of makedepend's zillions of dependencies. (Though I may write a makedepend parser to pull out only local dependencies, since they're the only ones likely to change during a development cycle.)

Anyway, I just wanted to point you to some of the better resources I found in my ongoing quest for Makefile goodness.