A Brief History of Build Systems #1: Introduction
The ancient practice of putting various monsters in unexplored regions of maps and the phrase based on that, “Here be dragons“, applies still to programming. Personally, I’ve always had a dragon the size of a moon (or battlestation, if one prefers) on my own mental map in the area of build systems. Hopefully, this should be a series, with several tutorials succeeding this brief summary of available options.
What is a Build System?
Just a quick introduction for those who are uninitiated into these rgb(0,0,0) arts. A build system offers a relatively easy way to automate building and packaging of a software system. While something as simple as a one-line shell script could supposedly be written for smaller projects, this has several problems. Firstly, it would tend to redundantly and naively recompile objects that have already been built and have not been changed. Secondly, this has no portability system; that is, it has no way to analyze the host system and find the appropriate utilities and libraries on differing platforms. There are more reasons, of course, but these are the crux of the matter.
Current Build Systems
Make
Make is one of the oldest build systems, having its first release in 1977 at Bell Labs. It is extremely simple, but pays the price; it has no configuration system, nor any automatic dependency analysis. This makes it a decent choice for smallish projects with any advanced portability needs, but most likely you’re better served by a more powerful tool. However, it should be noted that various projects such as Autoconf (see below) serve to expand this utility.
Autoconf
Autoconf and Automake together form a framework for generating Make scripts. Autoconf provides the portability configuration system, while Automake will automatically analyze your program structure to determine the order that things need to be rebuilt in. Unfortunately, on some level, this is merely lipstick on a pig (which is an idiom I used to be able to use without shifting my eyes), and due to the obscure language (m4) used to write Autoconf scripts, this is both a finicky and difficult option to use. Configuration is slow, and is extremely awkward if you wish to target Microsoft Windows. Last but not least, it is legendary for being extremely difficult to learn. It is, however, the most common build system on the Free Desktop.
SCons
I’ll get my bias off of my chest now: SCons is my current favorite build system. The scripts are written in Python, so you have a very powerful programming language to work within. The API is a bit less than ideal in some ways, but is still quite usable. Compilation is fast and portable, as well as being in one step (as opposed to the two-step compilation as used in Autoconf). The GNOME project is currently considering switching to it from Autoconf.
Waf
Waf is a descendent of SCons, and thus shares the power of Python. However, it is expanded in several ways: the API is retooled and is more intuitive in design in some ways; the configuration stage has been spawned into its own step; and compilation is quite pretty. Despite all of this, it does suffer from a lot of API irregularities and absolutely intolerable documentation. It is also important to note that Waf is unique in the build systems that I’m aware of in that the preferred way to use it is to actually ship it with the application itself instead of using a system-wide installation
CMake
CMake is the build system for KDE 4, and is a very nice and simple build system for projects of any size. However, this clean and simple design is detracted from by the simplistic (though not to the Make extreme by any means) language used to develop for it. If you can get past this weakness, however, very nice things lie inside, such as an integrated unit testing framework. It is worth noting that rather than being a base build system, it instead generates files for the native build system (Microsoft Visual C++ on Windows, Makefiles or KDevelop on *NIX, etc.)
Others
This is where the real dragons are; the previous build systems I have at least some experience with, but these are build systems I have only heard of. Despite this, I would feel remiss in my duties to you the reader if I did not at least mention some of the lesser-used options.
- Apache Ant is a build system is aimed at Java projects, and has its project files written in XML.
- Perforce Jam appears to be a C/C++ build system with a syntax reminiscent of Make, but with portability features, control structures, and automatic dependency ordering.
- QMake is a Makefile generator not unlike Autoconf, only with a much easier-to-learn syntax. It is part of the QT toolkit.
This list is by no means complete. If you have a favorite build system, please do mention it in the comments.
Posted in General Code | Comments


