help-make
[Top][All Lists]
Advanced

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

Re: auto-dep cannot possibly work?


From: Paul Smith
Subject: Re: auto-dep cannot possibly work?
Date: Sat, 14 Nov 2009 14:39:55 -0500

On Sat, 2009-11-14 at 10:19 -0800, Mark Galeck wrote:
> If you have full-paths to your include files, as shown above, then
> what if a creative developer, decides to put in another header file on
> which foobar.c depends, with the same name name as one of the existing
> ones, but in a directory that is earlier in the compiler search path
> (as specified by such things as -I options in the makefile), and does
> not remove the existing header file in the later directory.  (I know
> it may not be good software engineering, but it is allowed and so I
> should be able to handle it.)  Well, the above auto-dependency
> makefiles will never detect that file, will think that nothing
> changed, and will not rebuild foobar.o, and the system fails.

I think your conclusions are a little strong here.

Yes, it's true that IF someone adds a new header file that has the same
name as an existing header file, and IF that new header file appears in
a directory that is before the existing header directory on the -I list
for the compiler, and IF the addition of that header file does not
require the source file or any other header file that the source file
includes to be modified (and hence rebuilt), THEN make will not
recompile that file automatically and you'll have to run a separate
"rebuild dependency" target or something to force it.  Thereafter it
will work fine again.

In real life, the automated dependencies do get out of sync
occasionally, and sometimes you have to regenerate them.

To go from an extra manual step in this extremely unusual situation to
"cannot possibly work" seems to me to be a reach.

I'm not aware of any compiler that generates header file output using
only the value in the #include line, although I do think that is a
useful option if it existed.  Of course, you don't have to use the
compiler: you can use a separate tool that you run with the compiler,
that generates output however you like.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist





reply via email to

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