[Top][All Lists]

[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


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: -lbad
        echo $@
        touch $@

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

I'm expecting such output:

$ make -f
echo fail

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

$ cat
dummy := $(shell test -d dir || mkdir dir)
well: -lgood
        echo $@
        touch $@
vpath dir

$ make -f
touch dir/
echo 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 "./" 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]