help-make
[Top][All Lists]
Advanced

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

Re: Re: customizing implicit rules


From: Philip Guenther
Subject: Re: Re: customizing implicit rules
Date: Tue, 23 Oct 2007 04:22:42 -0600

On 10/23/07, Aditya Kher <address@hidden> wrote:
...
> > > I get
> > > %pwd
> > > /home/usr/boo
> > > %gmake -n
> > > g++ -o /home/usr/boo/../source_dir/foo.o ../source_dir/foo.cpp
> > >
> > > while without $CURDIR in the variable definition, I get
> > > %gmake -n
> > > g++ -o /home/usr/source_dir/foo.o ../source_dir/foo.cpp
> > >
> > > so its essentially the same regardless of use of $CURDIR.

You need to set VPATH so that make knows to look for the source files
in a directory other than the current, and completely trim out the
paths of the files in ${objects}:

CPP_DIR:=/home/user/source_dir
VPATH = ${CPP_DIR}
CPP=g++
objects:=$(patsubst ${CPP_DIR}/%.cpp,%.o,$(wildcard ${CPP_DIR}/*.cpp))
all: ${objects}


Philip Guenther




reply via email to

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