[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#27697: auto-include-dependency failure case



On Tue, 13 Oct 1998, Avery Pennarun wrote:

> On Mon, Oct 12, 1998 at 06:47:14PM -0600, Jason Gunthorpe wrote:
> 
> > What I have been doing of late is generating the .d file when the .o file
> > is built. Nothing depends on the .d file but if it exists it is included.
> > This makes the .o file depend on all included files and the .c file
> > automatically. Also the .d file depends on nothing so there is no rebuild
> > rule for it.
> 
> Hmm, what a good idea.  I hadn't thought of doing it that way.
> 
> > make in it's tracks. The only remaining problem is erasing header-files
> > requires a make clean :<
> 
> I hate that.  I've considered just adding a "%.h:" blank rule, but I don't
> like the looks of that...

I personally think this is a fairly major problem with make's
dependencies, you can't specify a non-important dependency.
 
> I don't know what automake does, but I've found that gcc -MM for each file
> is really slow... it takes about 1/2 the time of actually compiling the
> file!

Actually gcc -MM is fast
time g++ -I ../build/include -MM `find -name "*.cc"` [55 files]
real    0m14.477s  

Sure, it could be faster, but .2 seconds per file is fairly good.

The trouble is when you use include directives with .d files that have
generation rules make re-parses -EVERYTHING- as it has to re-include the
updated file! This is insanely slow and is what causes the huge speed
loss. 

My makefiles run very, very fast because I don't use .d rules and I use
the -MD flag when compiling to .o, so the dep generation literally takes
no time, it's done as a side effect of preprocessing. 

Jason


Reply to: