Stuff for GNU Make

GNU Make is "the Make of Makes" - the near-ultimate build tool (or at least the ultimate implementation of "make"). It is one of those tools which is an absolute must-have in my toolbox, and any machine without GNU Make installed is hardly a machine at all. Here you can find a small collection of stuff i have cobbled together for use with GNU Make. If you are unfamiliar with Make, Wikipedia has an interesting article about it.

Managing Projects with GNU Make, 3.xth Edition

If you want to get a good grasp of Make's features, O'Reilly's Managing Projects with GNU Make, Third Edition is an excellent resource, especially when used alongside the official GNU Make manual. It is available for purchase as a book (of typical O'Reilly quality) or electronically under the terms of the GNU Free Documentation License. Unfortunately, the publishers "cheat" a bit and make the content available only in PDF and they distribute the document as 22 separate PDFs, which makes the data not only difficult to use, but also difficult to adapt under its "open" license. Frustrated by O'Reilly's cheeky distribution, i have forked a copy of the book and reformatted it in OpenDocument format. The fork contains the entire contents of the 3rd Edition book (except for the index and one now-irrelevant section), all published errata for the book, plus has better intra-document cross-referencing. The long-term intention is to expand upon it, keep it up to date (e.g. continue applying errata as they come up), and include feedback from the user community.

The *.gz files below contain not only the docs but also some ready-to-use sample Makefile code.

Filename Size (bytes) Date (Y.M.D)
ManagingProjectsWithGNUMake-3.1.3.tar.gz 1445196 2009.07.27
ManagingProjectsWithGNUMake-3.1.3.pdf 1290114 2009.07.27
ManagingProjectsWithGNUMake-3.1.3.odt 264321 2009.07.27

Alternately, you can grab the book from Subversion by following the instructions at:

If you would like to contribute to the document, please send your feedback to me.


ShakeNMake is a helper makefile which supplies several useful features for single-directory project trees. It is intended to replace the whole configure/make process in source trees for very small, one-shot, or experimental projects. It is intended for use on platforms hosting GNU tools such as gcc, the GNU linker, bash, and GNU sed. It has undergone only limited testing under Cygwin. For the curious: it gets its name from an old American cooking product.

ShakeNMake is the very little brother of a full-fledged make-based build suite called toc: the other ./configure.

Using ShakeNMake is trivial. Simply copy shake-n-make.make to your project directory and create a Makefile like this:
default: all
include shake-n-make.make
# ... the rest of your code goes here ...
That will provide support for the following features:
  • Compiling C/C++ sources, including per-file compilation flags.
  • Building binaries from C/C++ sources and/or objects, including per-binary compile/link flags.
  • Building shared and static libraries.
  • Building a tarred or zipped distribution file ("make dist").
  • Installation and deinstallation of files.
  • Transparent and automatic (and fast) dependencies generation for C/C++.
  • Cleaning up the source tree.
  • Generating API documentation using Doxygen, including generation of a distribution tarball for the doxygen docs.
Here's a quick example of setting up the compilation of a DLL and a static library:
# Dynamic library:
myLibrary.DLL.OBJECTS = foo.o bar.o
myLibrary.LDFLAGS = -L/some/path -lmyOtherLib
$(call ShakeNMake.CALL.RULES.DLLS,myLibrary)

# Static library:
myLibrary.LIB.OBJECTS = $(myLibrary.DLL.OBJECTS)
$(call ShakeNMake.CALL.RULES.LIBS,myLibrary)

# Add the libs to the 'all' target:
all: myLibrary.LIB myLibrary.DLL
# Note that myLibrary.LIB and myLibrary.DLL are names of TARGETS, not FILES.
# If you want the FILE names, use $(myLibrary.LIB) and $(myLibrary.DLL).
That creates targets called myLibrary.DLL and myLibrary.LIB and sets the variables myLibrary.DLL and myLibrary.LIB to and myLibrary.a, respectively.

For a description of how to use all of the provided features, please read the docs in shake-n-make.make.


This tarball includes a complete demonstration mini-project for ShakeNMake:

Filename Size (bytes) Date (Y.M.D)
ShakeNMake-20070608.tar.gz 33322 2009.07.27
ShakeNMake-20070531.tar.gz 18745 2009.07.27

System Backups

In fact, i use GNU Make to generate backups of my Linux workstations. To do so, i implemented a fairly generic makefile which can be used on Unix hosts to generate backups for arbitrary "backup sets", which are user-defined collections of files. The whole process is fully documented in the included Makefile and sets.make, with example backup sets shown in sets.EXAMPLE.make.

Filename Size (bytes) Date (Y.M.D)
make-backups-20070611.tar.gz 2973 2009.07.27