[Top][All Lists]

[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 <address@hidden> wrote:
> On Jan 6, 7:34 am, Steve Calfee <address@hidden> wrote:
> > > CC = g++
> > > vpath %.cpp .:../../parent/comp01
> > That is not the syntax for vpath. Look in the make manual. A very good
> > source is
> 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

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 $@

        rm *.o comp01

[1] Managing Projects with GNU make, 3/e (Chap 02)

Ishan De Silva
-- Blogs are ideal for Personal Knowledge Bases --

reply via email to

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