help-make
[Top][All Lists]
Advanced

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

Making to alternate directories


From: Mike Chartier
Subject: Making to alternate directories
Date: Wed, 08 Dec 2004 18:34:19 -0500
User-agent: Mozilla Thunderbird 0.6 (X11/20040519)

I would like to setup my make file such that
 %.o go to $(OBJDIR)
 %.so go to $(LIBDIR)
 % (executables) go to $(BINDIR)

I can't make-then-move. The source I'm building is NFS mounted and the whole point is to make the binaries on locally mounted disks.

I've tried many things and this almost works:

##########################

vpath %.so $(LIBDIR)
vpath %.o $(OBJDIR)

libMylib.so : myObj1.o myObj2.o ...

%.so :
   $(CXX) -shared $(CPPFLAGS) $(CXXFLAGS) -o $(LIBDIR)/$@ $^

%.o : %.cpp %.h
   $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(OBJDIR)/$@ -c $<

#################

The problem is of course that if the %.o files aren't made the first time through make can't find them when it finished making them (to make %.so). The second pass works perfectly but I have to be able to compile in one pass (at least from the developer's prospective) without generating errors (on good builds).

Another nice feature would be to be able to generate prerequisites automatically (section 4.13 of the manual) but I don't see how I can integrate that with what I'm doing.

Any suggestions would be greatly appriciated. Thanks!





reply via email to

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