Preface - The GNU Make Book (2015)

The GNU Make Book (2015)


I can no longer remember when I first encountered a make program, but I imagine that, as with many programmers, I was trying to build someone else’s software. And like many programmers, I was probably surprised and seduced by the simplicity of make’s syntax without realizing the hidden depths and power of this universal program.

After many years of working with a variety of real makefiles, blogging about my findings, and answering GNU make questions from my blog readers, I gained real-world insights and a deep appreciation for GNU make. Many of these insights came from founding a company called Electric Cloud, where one of my projects was to completely replicate the functionality of GNU make. To do so, I absorbed the GNU make manual; wrote countless test makefiles to ensure that my “GNU make,” written in C++, worked like the real program; and spent hours testing my version against enormous real-world makefiles supplied by our customers.

From my experiences with GNU make came my desire to write a book to share tips, warnings, solutions, and further possibilities, big and small, that would help programmers get the most out of this sometimes difficult but ultimately indispensable program. The core make syntax results in makefiles that are terse and understandable (at least small parts are) but can be difficult to maintain. On the bright side, make provides just enough functionality for software builds without including too many extra features. Many make replacements have found niches but have failed to displace GNU make (and other similar make programs).

I hope this book will be a practical source of help for those of you who wrangle makefiles daily or for anyone who has wondered, “Now, how do I do that using make?” If you’re new to GNU make, I recommend that you start with Chapter 1 and work your way through the book. Otherwise, feel free to skip around. In any case, I hope you will find ideas to help you spend less time debugging makefiles and more time running fast builds.


Because GNU make is sensitive about different types of whitespace, whenever a tab character is needed I’ve usedfor clarity.

I’d particularly like to thank the following people who encouraged me in my makefile hacking and GNU make programming: Mike Maciag, Eric Melski, Usman Muzaffar (who pops up in Chapter 4), John Ousterhout, and the maintainer of GNU make, Paul Smith. Finally, I’m very grateful to the team at No Starch Press who jumped at the idea of publishing a book about GNU make when I emailed them out of the blue; they have been a great team to work with.