help-make
[Top][All Lists]
Advanced

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

Re: VPATH problem


From: Michael Ludwig
Subject: Re: VPATH problem
Date: Sun, 19 Feb 2012 23:46:11 +0100
User-agent: Mutt/1.5.20 (2009-12-10)

Bgh Ello schrieb am 18.02.2012 um 08:26 (-0800):
>      Greetings.  I am unable to get the simplest VPATH example working
> and could use some help.  I have a hello world program, hello.cpp in
> the src directory, and I can't reach it with VPATH.  Here is the
> makefile

Your question's already been answered. Just wanted to add that you could
get by with a simpler Makefile, relying on implicit rules (which would
also avoid the problem you ran into because you hardcoded a recipe):

$ find
./Makefile
./src
./src/hello.cpp

$ cat Makefile
CXXFLAGS = -O2 -Wall
EXEN = hello
VPATH = src

all: $(EXEN)

$ make
g++ -O2 -Wall    src/hello.cpp   -o hello

That's all you need. (For the moment.)
-- 
Michael Ludwig



reply via email to

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