help-make
[Top][All Lists]
Advanced

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

Problems with vpath directive in v3.81


From: Martin Willers
Subject: Problems with vpath directive in v3.81
Date: Sun, 1 Jul 2007 12:30:28 +0200
User-agent: KMail/1.9.1

Hi!

I think I'm experiencing a problem with the vpath directive.

My project consists of a top-level Makefile and a number of subdirs,
each of which contains its own Makefile that gets called by the
top-level one and that creates a static library which then gets added
to the top-level-target linker line:

  MODULES := foo1 foo2 foo3 foo4 foo5 foo6 foo7

  MODULE_LIBS := $(patsubst %,-l%,$(MODULES))
  MODULE_DIRS := $(patsubst %,-L%,$(MODULES))

  vpath %.a ./lib $(MODULES) /lib

  .PHONY: all
  all: $(MODULES) toplevel

  toplevel: main.o $(MODULE_LIBS)
          $(CC) -o $@ main.o $(MODULE_DIRS) $(MODULE_LIBS)

  .PHONY: $(MODULES)
  $(MODULES):
          $(MAKE) -C $@

Now, as long as MODULES contains up to 7 directory names, everything
is working fine. However, as soon as I add the 8th directory (let's call 
it "foo8"), make starts complaining:

  make: *** No rule to make target `-lfoo8', needed by `toplevel'.  Stop.

The Makefile in foo8 is exactly the same as in all the other subdirs (except 
for the library name, of course), and the file foo8/libfoo8.a really DOES 
exist. If I put any of the other dirs instead of foo8 as last entry of 
MODULES, then make complains about that one, and foo8 is ok.

Running make with -d shows this on processing each module:
         No implicit rule found for `-lfoo7'.
         Finished prerequisites of target file `-lfoo7'.
        No need to remake target `-lfoo7'; using VPATH name `foo7/libfoo7.a'.

With the 8th directory, the reference to VPATH just doesn't show up:
         No implicit rule found for `-lfoo8'.
         Finished prerequisites of target file `-lfoo8'.
        Must remake target `-lfoo8'.

As far as I can tell, there is no other difference between handling of -lfoo7 
and -lfoo8 in the output of "make -d".
"make --print-data-base" shows this for the vpath part of target "toplevel":

# VPATH Search Paths
vpath %.h ./include
vpath %.a ./lib:foo1:foo2:foo3:foo4:foo5:foo6:foo7:foo8:/lib
vpath %.so ./lib
# 3 `vpath' search paths.
# No general (`VPATH' variable) search path.


Unfortunately, I haven't been able to reproduce this problem with a 
stripped-down directory structure yet, so I cannot give you a live example.

Does anyony have an idea what is going on here?
I'm using GNU make 3.81.

-- 
 Martin




reply via email to

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