• Home

CodingExperiments.com

$ sudo make money

Search

Category:

  • Apple Inc.
  • Facts
  • Fun
  • Google
  • Google Android
  • Ideas
  • Internet
  • Linux
  • Microsoft
  • Programming
  • Rants
  • Security
  • Uncategorized
  • web 2.0

Archives:

  • April 2010
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007

Pages

  • About
  • About
    • The Authors
  • Commenting your code
  • How to Write Papers with Groff
  • ModCMS Anti-Spam Component Set
  • ModCMS Technical Specifications
  • Regular Expressions Guessing Game
  • Saving code directly to a web server
  • The (Almost) Perfect PHP 404 Page

Meta:

  • RSS
  • Comments RSS

Awesomeness tracker

CodingExperiments at Blogged View blog authority
Free Page Rank Tool

A Brief History of Build Systems #1: Introduction

November 16th, 2008 by i80and

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 Programming | View Comments

  • Alex
    I think that having a "very powerful scripting language" available in the buildsystem is actually no advantage, but can instead lead to problems. Instead of relatively simple build scripts you will end up with more or less sophisticated Python programs. I doubt that this is something desirable for build scripts. Consider this.

    It would be really nice if we (KDE & Gnome) would agree on a common buildsystem. And, completely unbiased, CMake is of course the obvious choice ;-)

    If you want to give CMake a try, I'm sure you will get a lot of support, there's the mailing list, I'll try my best, and maybe also the CMake developers would be interested.

    Alex, the KDE buildsystem guy

    If you want, drop me a mail (neundorf AT kde DOT org)
  • i80and
    Sorry for the late response.

    CMake is indeed a superb build system, and to be honest it sort of still wages war in my head against SCons.

    I do agree that having a full scripting language available can easily lead to convoluted messes that cause more problems than they solve. However, in some ways, it is more convenient. For one, it's easier to learn in one sense (although harder in another) as an existing development language is used. For another, using a full language, you can do more. As with anything else, of course, this can be both a gift and a curse.

    SCons and CMake have two different philosophies as to the role of a build system, and neither has won as the succeeder to autoconf quite yet.

    And thanks; if I have any problems with CMake, I may follow one of those routes.
blog comments powered by Disqus

 
Wordpress Themes by and Website Templates by Blogcut Blogged Blog Directory Blog Directory - Blogged