Here's a book that could teach you more than you ever thought possible about make.
One of those Unix utilities that I took for granted all these years, make is actually a lot more versatile than I imagined and quite a bit more complicated. For decades I ran through the standard four steps required to install optional software tools on the Unix systems that I managed -- configure, make, make install, and make clean -- the software building litany of the Unix sysadmin. To be honest, the syntax of the makefiles looked a lot trickier than any of the scripts I'd ever built and I was always grateful that I didn't have to modify them, never mind build them myself.
If at this point, you're wondering what I'm talking about, this book isn't for you. But just so you get some value out of this post, allow me to explain that the make utility allows developers to prepare instructions that make it possible for people to compile products from source code on a wide range of systems. The command is "make" and the file that contains the compilation instructions is called a "Makefile". That's probably all you need to know.
For those of you who need to build makefiles from scratch or troubleshoot them when the software build that they're intended to perform just isn't working, the story is altogether different. You might run into errors and spend a lot of time trying to figure out what's wrong and how to fix it. GNU make has been called "difficult" and "cryptic" and probably a lot of other things as well, but if a book can be said to have a theme, this book's theme is "It ain't necessarily so".
The book starts out with an assumption that you understand the very basics of make, but includes a chapter that revisits the elementary components such as environment variables, debugging variables, the make environment, target- and pattern-specific variables, logical operators, simple and recursive variables, built-in functions, etc.
Once you get past the basics, it treats you to an entire chapter on how to do debugging when working with make. There's no built-in debugger, but there's still a lot that you can do to track down problems that you run into and this chapter alone makes this book an essential read for anyone responsible for preparing makefiles. It details techniques such as dumping variables and tracing their use, tracing rule execution, making good use of the -d option, setting break points in rules and patterns, setting break points in makefiles, using pattern rules, non-recursive make, etc.
The remaining four chapters take you deeply into the building and rebuilding process, explain many of the problems that you could run into, provide advanced techniques that can be invaluable if and when you need them, and show you how to work with the GNU make standard library (GMSL).
You can expect to emerge from your reading of this book knowing how to avoid unnecessarily long build times, use some of the more advanced capabilities of make, avoid troublesome pitfalls -- especially when you're working with parallelization, manage automatic dependency generation along with rebuilding and non-recursive make, and do some very pragmatic troubleshooting when you run into problems.
I'd recommend it to anyone who needs to use make and wants to know how to avoid problems and use make most effectively. It's not an easy read, but it's amazingly thorough, extremely practical, and very well written.
An interesting side note on the author, John Graham-Cumming: Apparently, he is best known for successfully petitioning the British government to apologize for its treatment of Alan Turing. Having watched The Imitation Game, I was particularly pleased to see this noted on the back of the book.
This article is published as part of the IDG Contributor Network. Want to Join?
China said it plans to develop a prototype of an exascale supercomputer by the end of this year,...
It had a good 36-year run, but its day is done.
President Donald Trump is considering a new way of distributing the H-1B visa to ensure they go to the...
Six Democratic U.S. senators are co-sponsoring legislation that would require publicly traded companies...
Free download: Our handy PDF reveals where to find and how to use key tools for repairing most problems...
As some industry experts wonder whether Apple will add wireless charging to its next iPhone, others...
As more companies depend on information about their employees to make crucial decisions, HR and IT are...