[Top][All Lists]

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

[bug #20394] vpath directive drops entries

From: Paul D. Smith
Subject: [bug #20394] vpath directive drops entries
Date: Sat, 07 Jul 2007 21:01:15 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20061201 Firefox/ (Ubuntu-feisty)

Follow-up Comment #2, bug #20394 (project make):

It's not exactly correct to say that GNU make caches directories from the
10th on, but you're on exactly the right track; thanks for the note.

What make actually does is cache EVERY directory... BUT it caches them
"lazily", AND it only allows 10 directories to be open at any one time. 
Basically, when make wants to check a file in a directory it opens the
directory for reading and looks for that file.  As it reads the directory it
caches the contents.  Once the file is found, it leaves the directory open
but stops reading.  If make looks for another file in that directory and it's
not in the cache, make continues reading (and caching) where it left off.  If
it gets to the end of the directory it closes the directory.

In order to avoid too many directories being open by make at one time, if
make gets to a point where more than 10 directories are open, it will
completely read and cache the current (latest) directory, then close it.

The issue of make's caching is well-known (see bug #443 for example).  In
your case it takes an odd twist but this is definitely the issue.  A
completely correctly-written makefile shouldn't run across cache problems,
but I recognize there are situations where it's not possible to write that
makefile.  However, in your case I think you can do what you want.  Change
your makefile like this:

LIBS := $(patsubst %,-l%,$(SUBDIRS))
LIBTARGETS := $(foreach L,$(LIBS),$(L)/lib$(L).a)

all: $(TARGET)

        $(CC) -o $@ $(LIBDIRS) $(LIBS)

        $(MAKE) -w -C $(@D) -f Makefile $(MAKECMDGOALS)

This has some other advantages over the method you were using (for one thing,
your example does not work properly if any of the sub-makes fail).


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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