help-make
[Top][All Lists]
Advanced

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

Re: Why not solve the vpath missing directory problem?


From: Paul D. Smith
Subject: Re: Why not solve the vpath missing directory problem?
Date: Fri, 3 Nov 2006 00:48:26 -0500

On Wednesday, 1 November, Bryan Ischo (address@hidden) wrote:

> My question is then, why not fix this in GNU make?  Why not remove the
> prerequisite for the existence of the directory at the time that the vpath
> command is evaluated?
> 
> If the check were taken out, then vpath would be exactly the set of paths
> that the Makefile had specified, regardless of whether they existed or
> not.  This would make my example work correctly but would mean that anyone
> who depended upon vpath not including paths that don't exist would have a
> problem.  I've thought about it and I haven't thought of any way that this
> behavior (of vpath not including directories which don't exists) is
> useful.  Can anyone think of any reason that this behavior needs to be
> retained?

Although I wasn't there at the time, I'm pretty sure the main reason this
code exists is for performance: if the directory doesn't exist then nothing
can ever be found in it so don't bother trying to execute all those system
calls looking for files that can't exist.

There are other places in GNU make which don't behave properly in the
presence of command scripts doing something "behind make's back", because
GNU make performs extensive caching of directory contents: there is at
least one long-standing bug reported in Savannah about this.  The sole
reason for these abilities is performance.

Of course, this all assumes that all makefiles are well-formed such that
each command script generates only the targets that make thinks it will
generate, and has no side-effects.  In reality that is not always the
case... hence the bugs.  There's been a long-standing project to take a
hard look at GNU make's directory caching and fix it up; I have some ideas
on this but have not had the time to get into it.


As far as removing this behavior, I can think of only one scenario in which
make would behave differently after this change: if someone is _relying_ on
the fact that make will drop directories that don't exist from vpath.  They
would create the directories after make was invoked, specifically to avoid
having them in vpath.  However, I can't honestly believe anyone does this:
it seems to me to be too error-prone to be useful.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]