views:

113

answers:

2

So a couple years back I took some time to grok make, and it's paid off enormously. Writing little makefiles for building my projects and automating tasks is fun and productive.

The downside is, of course, that my makefiles are overspecific, especially when it comes to platforms and library locations.

So this is the point at which people tell me "autotools to the rescue!" And they certainly seem to do the trick when other people do them (I love downloading something and running configure && make && sudo make install and watching it just work), but I can't wrap my head around them.

I've looked in some configure.ac and Makefile.am files, and I just don't understand what's going on. I don't know what part of identifiers is developer's choice, and what part is meaningful to the autotools. I'm not sure I understand the entire flow and the point of Makefile.in. I think I'm just hitting a mental wall going from the system I'm used to (make) to something that's a layer or two above that.

Can anyone point me towards a tutorial or book (preferably not an overly dry one) that can teach me the joy of autotools? What the steps are, and how I can use them, how I can write my own configure.ac and Makefile.am from scratch? Show me how to be effective and have fun with them?

+4  A: 

I am not sure you can have fun with build systems... Have you been reading the Autotools Tutorial?

http://www.lrde.epita.fr/~adl/autotools.html

There are various resources about autotools, the problem is they tend to be incomplete, a bit outdated etc...

One recent and excellent document is Autotools Mythbuster, although it's not an introduction:

http://www.flameeyes.eu/autotools-mythbuster/index.html

elmarco
+1 for the links, thanks! But I hope you're wrong about your initial claim. With programming (and any sufficiently complex build system is programming), I often think if you're not having fun, you're doing it wrong. This may be the same tendency that leads programmers to prefer the most complex solution when a simple one will do, but that seems to be a vote for moderation more than anything else.
rampion
The most enlightening section of the Autotools Tutorial for me was the diagram of which files are used to generate which other files, and what they're all meant to do. That was the moment I understood the Joy of Autotools, and stopped seeing them as voodoo.
ptomato
+1  A: 

Although I consider Alexandre Duret-Lutz's Autotools Tutorial, mentioned in elmarco's answer, to be the very best available, you should also know about the Goat Book:

http://sourceware.org/autobook/

The versions of the tools it deals with are rather old, but it's a nice introduction and it's presented in a logical order. It's also more complete than the Tutorial. It is perhaps best used as supplementary reading after you've worked through the Tutorial.

ptomato