[distcc] improved gcc -MD handling

George Garvey tmwg-distcc at inxservices.com
Thu Nov 21 23:05:05 GMT 2002


On Thu, Nov 21, 2002 at 12:10:35PM -0800, Martin Pool wrote:
> I put some changes into distcc CVS last night that improve gcc -MD
> handling.  These should make the most common cases work properly.

   With gcc 3.2.1, -MD works badly, as before: some .d files are put in
the output directory with the .o files, some are not. I presume they are
in the temporary directory still, as before, but didn't look.
   However, -M -MF does work with just a slight drop in efficiency, so
I'll very happily take it until -MD is worked out: even if that's never.
The drop is that there is no automatic target for the .d file during
compilation that I know of in make. So sed or something needs to be used
to create the name of the -MF .d file from the name of the object file
in order to get both .d and .o generation in one invocation of the
compiler. (Our output files are not put in the current working
directory.)
   But I don't need to invoke the compiler twice now. Our makefiles have
a problem, in that building the .d files separately caused many of them
to be made over and over again, even when nothing obvious had changed,
and the .o file would never be rebuilt. I didn't track down what caused
that, because make's debug output is such a pain. It only happened with
-j#, never with a non-concurrent compile. Many of the .cc files are
generated by a program, that is also built in the same makefiles, so I
guess there must be a circular dependency somewhere when the .d files
were thrown into the mix with concurrency, too.
   I remember when GCC decided to change the meaning of -MD. I like the
new meaning, but it sure makes compatability with many versions
difficult. I can sympathize with the difficulty of the problem.
   FYI, our makefiles compile with CC set to 'distcc gcc', if that
matters.
   I'm very pleased to have a way to do this now.



More information about the distcc mailing list