bug-make
[Top][All Lists]
Advanced

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

Re: Inconsistent VPATH behavior ..


From: Paul D. Smith
Subject: Re: Inconsistent VPATH behavior ..
Date: Sun, 9 Mar 2003 20:38:16 -0500

%% Harsha Kalidindi <address@hidden> writes:

  hk>          ../install/scripts/% : %
  hk>                  $(INSTALL) -m 444 $(<) $(@)

  hk> gmake is looking in $(VPATH)/../install/scripts. We are not
  hk> expecting it to. We expect it to look in VPATH only for sources
  hk> when they don't exist in the current source tree ..

But you've left out, again, the most important part of your makefile
(this is why I am asking you to create a small _complete_ example that
shows the behavior you have a problem with).

Remember that make works from the "root" of the dependency graph _down_;
it doesn't work from the leaves _up_.

So, if make is trying to build a file that matches the above rule, then
it's because you defined it as a prerequisite like this:

  install:  ../install/scripts/foo

If you run "make install", then make says "OK, I need to build
../install/scripts/foo".  It looks to see if that file exists.  If it
does, then VPATH is never consulted.

If it doesn't exist, then if VPATH is defined make uses it to try to
find the target.  How does this work?  Make doesn't really grok the
structure of pathnames: to make every pathname is just a string.  It
appends the string to the end of each directory (adding a "/" separator)
in VPATH and checks if _that_ file exists.  If it does, then this is the
VPATH pathname of that file.


I'm not sure I'm making myself clear, or whether I'm understanding your
real problem.  All of the above behavior is expected and is not a bug.
If you think I'm still missing the point, there _could_ be a bug here,
but I'll need you to provide me a small test makefile etc. that will
reproduce the problem.  Once I can see a complete example I can be sure
about whether what you see is correct or not.

-- 
-------------------------------------------------------------------------------
 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]