help-make
[Top][All Lists]
Advanced

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

vpath and a library in the current directory


From: Maxim Nikulin
Subject: vpath and a library in the current directory
Date: Thu, 25 Aug 2005 23:11:44 +0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1

Hi,

I'm confused with -l prerequisites and library search feature. Let's imagine I have a rule to build a library and a program that must be linked with this library. The problem that is make doesn't build and look for the library in the current directory. The example below demonstrates the problem.

$ cat fail.mk
fail: -lbad
        echo $@
libbad.so:
        touch $@

$ make -f fail.mk
make: *** No rule to make target `-lbad', needed by `fail'.  Stop.

I'm expecting such output:

$ make -f fail.mk
touch libbad.so
echo fail
fail

The behavior is different if I ask make to build the library in a subdirectory instead of working directory:

$ cat well.mk
dummy := $(shell test -d dir || mkdir dir)
well: -lgood
        echo $@
dir/libgood.so:
        touch $@
vpath lib%.so dir

$ make -f well.mk
touch dir/libgood.so
echo well
well

I tried this test with make-3.80-9 debian/sarge package and with 3.81beta3 version. Although documentation states that make firstly searches the current directory, I've tried to add ./ to vpath and change rule in the first example to "./libbad.so:" but it didn't help.

Are there any reasons why make handles current directory and subdirectory in different ways?

Thanks in advance

--
Maxim Nikulin




reply via email to

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