help-make
[Top][All Lists]
Advanced

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

Re: auto-dependency usefulness?


From: Noel Yap
Subject: Re: auto-dependency usefulness?
Date: Thu, 02 Oct 2003 08:27:41 -0400

Russell Shaw wrote:
> 
> Bryce Schober wrote:
> > When I first looked at the auto-dependency stuff at
> > http://make.paulandlesley.org/autodep.html, I was pretty excited, but
> > now I'm not so sure.  What I'd really like is this:
> >
> > lib/
> >   foo.h
> >   foo.c
> > src/
> >   main.c
> >
> > In this scenario, foo.h declares a "library" function defined in foo.c.
> > This function is called in main.c, which includes foo.h.  As far as I
> > know, this is the generally accepted way to modularize things.  However,
> > gcc's dependency generation doesn't trace main.c's dependency on foo.c,
> > only on foo.h.  How can this dependency be known?  Or even assumed,
> > given that there is a corresponding .c file for .h file?
> 
> main.c doesn't depend on foo.c because you can change the internals
> of foo.c but if its interface doesn't change, then main.c would
> still be compiled the same. main.c would only be compiled different
> if foo.h changed.

Pedantically, assuming static linking, the following dependencies hold:

main: main.o foo.a
main.o: main.c foo.h
foo.a: foo.o
foo.o: foo.c foo.h

IOW, source files don't depend on anything.

HTH,
Noel
-- 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]