[mythtv] FYI: Recursive Make Considered Harmful

Jim Paris jim at jtan.com
Sat Jan 24 14:20:53 EST 2004


> >                        Recursive Make Considered Harmful
>
> The writer of this article has no clue what he is talking about. Recursive
> make does not prevent you from rebuilding in a single directory without
> scanning all directories.

But recursive make can end up in broken builds, hence the occasional
"requires make distclean" in the mythtv-commits list.  And it's more
than just avoiding parsing a Makefile in every directory -- recursive
Make is terrible with cross-directory dependencies.

> Even on a normal system, do you really want to stat 1000 files to
> build one?

Takes about 0.5 seconds to stat 54000 files on my system; if it saves
one 10-minute make distclean over the course of a thousand compiles
then I've come out on top. :)

> Here's another gem: this guy recommends VPATH. Anyone with half a
> clue and some concern for make performance avoids VPATH like the
> plague.

He recommends VPATH if you need the ability to have a partial copy
of the code; that doesn't really apply to a project that's using
reasonable version-tracking systems like CVS.

> He also doesn't generate dependencies in the compile step, which is
> another waste;

You could modify his system to do this, but that feature doesn't exist
on all compilers, which is probably why it was excluded.

> But again, this guy isn't too smart. :)

Perhaps.  But IMHO, I think the real reason why recursive make is
necessary for Myth is because we're using qmake, which gives us no
choice.  And qmake handles most of the dependencies itself to avoid
many of the problems that recursive makes present (see the generated
mythtv/programs/mythfrontend/Makefile, for example, with their huge
lists of .h file dependencies).

-jim


More information about the mythtv-dev mailing list