Ramblings

2009/11/17

A Better Make

I love these features of GNU Make:

  • Variables localized to a dependency graph.
  • Automatic mtime checking to see if a target is out of date.
  • Easy to append new prerequisites to a target.
  • Macro expansion (although making this a default for "=" has probably confused a lot of people, and there are a lot of 'gotcha's).
  • Order-only prerequisites (ability to assert ordering of targets, but not force a target to be rebuilt because the prerequisite was rebuilt).
  • Ability to run targets in parallel rocks!
  • Ability to model targets that generate makefiles.
Here are some things that are just plain frustrating about GNU Make:
  • Dealing with special characters in filenames, anything from spaces to "%" to ":" is a royal PITA!
  • Make needs a "real" syntax, not just a glorified lexer (similar as above).
  • No easy way to model rules that generate multiple build artifacts.
  • Challenging to make it portable.
  • No support for local variables.
I've looked for alternatives, but most of the alternatives are missing out on at least a few of the things I love about GNU Make. Rake seems to have a lot of strong potential, if only it wasn't slow and had more of the features I love about GNU Make.

I've been contemplating writing yet another make system that uses Lua to describe the build process, and has a lot of stuff just "builtin" so that you can more easily write a cross platform makefile. I'm thinking, that the build phase will use libev so that multiple targets can be built at the same time without the complications of multi-threading.