On 10/23/07, Aditya Kher <[EMAIL PROTECTED]> 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
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make