Re: source dependencies cleanup?

Peter T. Breuer (
Tue, 3 Dec 1996 23:01:29 +0000 (WET)

"A month of sundays ago Paul Flinders wrote:"
> -M makes gcc output dependancies to stdout, it needs a separate
> pass to be made use of and is slow. When I did do dependancies
> this way I quickly discovered that it's faster to do it in Perl as some
> people have mentioned.
> -MD makes the preprocessor output the dependancies to a separate
> file during normal compilation. It adds just the amout of time taken to
> open a file and spit half a K or so to it to the compilation. The need
> for a separate "make depend" phase goes away and the dependancies
> can't get out of date.

a) it isn't 8 seconds worth of fast, which is the mkdep time.

b) it requires you to recompile every touched file every time you make
any update to your system, even if you don't want those files to be
compiled. Call the time to recompile the dependencies as it goes X.
Call the time to recompile the object code Y. So the total is X + Y.

c) because of b) (and a)!), it is a lot slower than a makedep follwed
by a conditional recompilation. Suppose the makedep takes an extra
20% of Y, but that after the makedep I only have to actually recompile
50% of my files. Then the time to recompile is
0.2*Y + 0.5*Y = 0.7*Y

This cannot be worse that X+Y!! You would only have a chance of winning
out if I had to recompile 80% of my files after an upgrade, which is
not the case.

In any case, what really happens is that I run mkdep, which takes 0s
effectively, and then get a slightly worse approximation to the files
taht I need to recompile. Say I have to recompile 60% instead of 50%.
Then the total time used is
0 + 0.6*Y = 0.6*Y

> "make config" seems to result in most things being re-compiled anyway
> as a result of <linux/config.h> and <linux/autoconf.h> being touched.
> This could be avoided but only at the expense of splitting the config
> options into several files.

Good point.

Peter T. Breuer Phd. Ing.,
Area de Ingenieria Telematica E-mail:
Dpto. Ingenieria Tel: +34 1 624 99 47
Universidad Carlos III de Madrid Fax: +34 1 624 94 30/65
Butarque 15, E-28911 Leganes URL: