I write a lot of Makefiles. In fact, I write a lot of Makefiles using
GNU Make and finally there's a book to complement the Free Software
Foundation's excellent GNU Make user guide. Also, finally, O'Reilly
has updated what must have been the worst book in their entire line
up: "Managing Projects with make"
Robert Mecklenburg's "Managing Project with GNU Make" is a must have
book if you end up writing or maintaining GNU Make Makefiles with more
than 100 lines in them. You don't need it if all your Makefiles are
created using ./configure, but every serious Makefile hacker should
read this book.
That's not to say that the book is perfect. Far from it. I was
annoyed while reading the book by the author's frequent, annoying
small errors (e.g. on p. 58 the author states that CURDIR contains the
argument of --include-dir when in fact it contains the full path of
the directory where GNU Make is looking for Makefiles) and over use of
the $(eval) (more on $(eval) below). In fact, the number of errors in
the book were surprising for an O'Reilly tome and it looks like the
edition could use a good proof-reading. I've sent in a detailed list
to the O'Reilly folks but nothing appears on their Errata web site
The section that describes the new $(eval) and $(value) functions
available since GNU Make 3.80 is excellent (pp. 82-86). And the book
contains a good discussion of the problems inherent in using recursive
make (pp. 108-116) and how to implement a non-recursive make
(pp. 117-123). The book is worth its cover price just for these three
Where I think the book really goes off track is in trying to shoehorn
too many things into GNU Make. Specifically, the author talks quite a
bit about ANT and spends an entire chapter showing how to replace ANT
with GNU Make. I found some of the things he thinks are wrong with
ANT to be silly: for example, "The Ant <mkdir> task does not invoke
the underlying mkdir program for your system. Instead, it executes
the Java mkdir() method of the java.io.File class. This may or may
not be what you expect." Sure, if you are a GNU Make user you'd
expect that mkdir is mkdir the command; Java programms a probably
quite familiar with java.io.File and are likely not to be confused. I
think the book would have been better without this chapter.
The section on parallel and distributed Make is really light.
Although this section describes the issues associated with trying to
parallelize a build, it wold have been nice to have a description of
There are only two books on GNU Make worth reading: this one and the
FSF's GNU Make manual. As I was reading Robert Mecklenburg's book I
couldn't help finding myself comparing it with the FSF manual (which
is the same as the info files installed with GNU Make).
Firstly, this isn't a good book to learn GNU Make from. Although Part
I of the book explains the basics of GNU Make with many examples, the
book does not provide a complete reference to GNU Make's language (for
example, Appendix A's list of command-line options is incomplete), and
has odd digressions (the section describing how += works (pp. 44-45)
makes it sound much more complex than it is) and ommissions (the
section on "Target- and Pattern-Specific Variables" (pp. 50-51) makes
no mention of pattern-specific variables at all).
Secondly, the author lurves the $(eval) function added in GNU Make
3.80. There are three problems with this: GNU Make 3.79.1 is commonly
seen in practice and doesn't contain $(eval), the implementation of
$(eval) in 3.80 has some bugs in it and the author uses $(eval) too
much, using it when it isn't needed. This hammer to crack a nut use
of $(eval) is annoying because it obscures simpler ways of writing
If you get this book and know a thing or two about Make jump directly
to Part II and read about benchmarking of Make, the really useful
debugging ideas and recursive/non-recursive make. Skip back to Part I
when you've got some time on your hands and need to have a fun read;
you'll know most of the material but there are gems worth finding.
When you are done with that have a good laugh about the "extreme Make"
in Appendix B. Skip over the description of the Linux Kernel
Makefile: it seems like it might be interesting, but isn't.
If you can only buy one book about GNU Make, then buy the Free
Software Foundation's GNU Make user guide. You'll be supporting the
people who actually created GNU Make, and you'll get a complete
reference to it. If you've already got the FSF book, then get Robert
Mecklenburg's excellent "advanced user's guide".