x
Loading
 Loading
Hello, Guest | Login | Register

Recursive make Reloaded

It’s been eight years since recursive make was called” harmful,” but developers still use it. Here’s how to break the habit.

In 1997, Peter Miller wrote a now famous paper entitled “Recursive make Considered Harmful” (available online at (http://www.pcug.org.au/~millerp/rmch/recu-make-cons-harm.html), which details why recursive use of make is slow, problematic, and unnecessary. But eight years later, it’s still common to see recursive make used in projects. Even GNU make itself has a recursive Makefile!
Yet recursive make is easy to avoid and undo. Let’s look at a short, working example that eliminates recursive make. As you’ll see, you can use the very same model to write new Makefile s that are effective, easy to maintain, and fast. Your improved Makefile s can also leverage parallel compilation for maximum speed.
Recursive make is fundamentally wrong because it breaks the one thing that make is really good at: tracking the dependencies between files. Each call to make generates a separate graph of dependencies between objects and source code. At best, the separate graphs may actually be unrelated, but in many situations may contain the same files.
For make to work best it needs to know all of the dependencies in a build. When some dependencies are missing or perhaps even erroneous, make may work unreliably, or be forced to do more work than necessary, say, updating the same file more than once. Moreover, recursive make is forced to enter subdirectories and create processes even when no work to be done; this effect is particularly…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace