help-make
[Top][All Lists]
Advanced

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

how to force make to do a secondary search for source files?


From: George Brink
Subject: how to force make to do a secondary search for source files?
Date: Fri, 25 May 2007 09:27:06 -0700 (PDT)

I am trying to move all my object and intermediate
files into additional folder.
I have two files in 'src' folder - main.cpp and
icons.xrc. icons.xrc is converted into icons.cpp, and
than compiled and linked as a regular source file

 So my Makefile looks like this:
-------------
OBJS=main.o resource.o
SDIR=obj

vpath %.xrc src
vpath %.cpp src obj

all: subdirs test

subdirs: $(SDIR)

$(SDIR):
    mkdir $@

test: $(OBJS)
    g++ -o$@ $(OBJS)

%.cpp: %.xrc
   wxrc -c -oobj\$@ $<

%.o: %.cpp
   g++ -c -oobj\$@ $<
-------------

Output on a FIRST run of this Makefile is:
-------------
mkdir obj
g++ -c -oobj\main.o src\main.cpp
wxrc -c -oobj\icons.cpp src\icons.xrc
g++ -c -oobj\icons.o icons.cpp
g++: icons.cpp no such file or directory
g++: no input files
-------------
wxrc works perfectly and creates intemediate source
file in subfolder 'obj', but make can not find it and
I have an error.
On the SECOND run of make, icons.cpp already exists
and make can find it. Output is:
--------------
g++ -c -oobj\icons.o obj\icons.cpp
g++ -otest obj\main.o icons.o
g++: icons.o no such file or directory
--------------
Now make fail on linking. And on the third run I have
nice and fully compiled executable.

So what am I doing wrong? How to tell make to do a
secondary search in vpath of all files which were not
existed before start of actual compilation?



George Brink


       
____________________________________________________________________________________Take
 the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC




reply via email to

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