TinyMUD Makefile and Subdirectories

Posted by The Illustrious Skwerl on Tue 23 Oct 2007 07:15 PM — 4 posts, 15,435 views.

#0
I ended up getting a decent computer free from my school on which to run Ubuntu and TinyMUD.

I'm trying to clean up the TinyMUD install directory, so I added a new directory o/ for .o and .d files. The Makefile modifications are being quite retentive, and I don't know why. >_<

make: *** No rule to make target `o/tinymudserver.o', needed by `grun'. Stop.



CC=g++
CCFLAGS=-g3 -Wall -w -pedantic -fmessage-length=0

O_FILES = o/tinymudserver.o o/strings.o o/player.o o/load.o o/commands.o o/states.o o/globals.o o/comms.o o/room.o

tonymudserver : $(O_FILES)
$(CC) $(CCFLAGS) -o grun $(O_FILES)

# dependency stuff, see:
http://www.cs.berkeley.edu/~smcpeak/autodepend/autodepend.html
# pull in dependency info for *existing* .o files
-include $(O_FILES:.o=.d)

.SUFFIXES : .o .cpp

.cpp.o :
$(CC) $(CCFLAGS) -c $<
$(CC) -MM $(CFLAGS) $*.cpp > o/$*.d

clean:
rm -f grun o/*.o o/*.d
USA #1
I'd suggest grabbing the SmaugFUSS makefile and emulate what they do. This kind of stuff is tricky and easy to mess up, even if you're fairly comfortable with makefiles. They do the kind of dependency and object file sorting that you want.
#2
the dependency stuff is of no import, really. I just want to be able to make with the object files popping into that directory. =/
USA #3
Even so, the FUSS makefile does that too, which is why I suggested that you look into it. You can probably almost copy-paste it, just adjusting the list of input files.