help-gnu-utils
[Top][All Lists]
Advanced

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

Re: VPATH question


From: Ishan
Subject: Re: VPATH question
Date: Mon, 7 Jan 2008 04:05:32 -0800 (PST)
User-agent: G2/1.0

On Jan 7, 9:16 am, Ishan <ishan.desi...@gmail.com> wrote:
> On Jan 6, 7:34 am, Steve Calfee <stevecal...@nothotmail.com> wrote:
>
> > > CC = g++
>
> > > vpath %.cpp .:../../parent/comp01
>
> > That is not the syntax for vpath. Look in the make manual. A very good
> > source ishttp://make.paulandlesley.org/
>
> What's wrong here? What I'm trying to say here is, for any
> prerequisite ending with .cpp, look either in the current directory or
> in "../../parent/comp01" directory. This is how the manual says. Am I
> wrong?
>
> Thanks,
> Ishan.

I found what was wrong. The problem is that "make cannot use the
appropriate path to the source if you hardcode the filename" [1].

When automatic variables are used as shown below, the problem is
solved.

CC = g++

VPATH = .:../../parent/comp01
CXXFLAGS = -ggdb -I ../../parent/comp01

OBJECTS = main.o Factory.o Context.o FactoryEx.o ContextEx.o

comp01: $(OBJECTS)
        $(CC) $(OBJECTS) -o $@

clean:
        rm *.o comp01



[1] Managing Projects with GNU make, 3/e (Chap 02)
<http://www.oreilly.com/catalog/make3/book/ch02.pdf>

Cheers,
Ishan De Silva
-- Blogs are ideal for Personal Knowledge Bases --
[http://personal-knowledge-base.blogspot.com/]


reply via email to

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