################################################################# # # Makefile for PernMush 1.17 # ################################################################# # GCC: CC=gcc AR = ar OPTIM= -g -O2 -pipe -Wall -W -Wno-parentheses -Wno-unused LDFLAGS = -g INCS = -I. # The suffix appended to executables. # This should be set for Cygwin and Windows. EXE = .exe #EXE = # By default, db.c initially allocates enough space for 10000 objects, then # grows the space if needed. To change this value, include # -DDB_INITIAL_SIZE=xxxx where xxxx is the new value (minimum 1). # Choose ONE of the following based on how you want the mud to handle RWHO #a) Defualt: do not use the RWHO server at all. DEFS= LIBS= -lcrypt -lm #b) ONLY send info to an RWHO server #DEFS= -DRWHO_SEND #LIBS= -LRWHO -lrwho -lcrypt -lm #c) READ rwho info as well as send it. This is dangerous UNLESS the RWHO # server is on the same machine, or on another locally connected one. The # danger being that it could freeze the mud if the connection timed out. #DEFS= -DRWHO_SEND -DFULL_RWHO #LIBS= -LRWHO -lrwho -lcrypt -lm CFLAGS= $(OPTIM) $(DEFS) $(INCS) # Everything needed to use db.c SHARED_FILES = db.c compress.c player_list.c stringutil.c attrib.c mem_check.c SHARED_OFILES = $(SHARED_FILES:.c=.o) DB_FILES = destroy.c DB_OFILES = $(DB_FILES:.c=.o) DUMP_FILES = dump.c unparse.c DUMP_OFILES = $(DUMP_FILES:.c=.o) # Everything except interface.c --- allows for multiple interfaces CFILES= create.c game.c help.c look.c match.c move.c player.c predicates.c \ rob.c set.c speech.c utils.c wiz.c timer.c boolexp.c unparse.c \ cque.c eval.c wild.c interface.c mail.c OFILES = $(CFILES:.c=.o) HFILES = attrib.h config.h copyright.h db.h externs.h globals.h \ help.h interface.h match.h mem_check.h oldattrib.h \ version.h AUX_FILES = CHANGES OLDCHANGES README \ decompress.c extract.c mkindx.c announce.c \ Makefile Makefile.bor Makefile.dgm Makefile.vc Makefile.lcc \ CHANGELOG os.h INSTALL_NOTES RWHO_LIB = rwho/librwho.a RWHO_FILES = rwho/clilib.c rwho/mudwho.c RWHO_OFILES = $(RWHO_FILES:.c=.o) RWHO_AUXFILES = rwho/HOW_TO rwho/README GAME_FILES = game/connect.txt game/create.txt game/disable.txt game/helptext \ game/leave.txt game/news.txt game/register.txt game/restart \ game/welcome.txt game/wizard.txt game/data/minimal.db.Z # Files in the standard distribution DISTFILES= $(CFILES) $(SHARED_FILES) $(DB_FILES) $(DUMP_FILES) \ $(HFILES) $(AUX_FILES) $(RWHO_FILES) $(RWHO_AUXFILES) $(GAME_FILES) OBJDEPENDS = $(OFILES) $(DB_OFILES) $(DUMP_OFILES) $(SHARED_OFILES) \ $(RWHO_OFILES) decompress.o extract.o mkindx.o announce.o PDIST= $(patsubst %,pernmush/%,$(DISTFILES)) RELEASE=dist TARGETS= $(RWHO_LIB) extract$(EXE) dump$(EXE) mkindx$(EXE) netmush$(EXE) \ decompress$(EXE) announce$(EXE) mudwho$(EXE) all: $(TARGETS) netmush$(EXE) : $(OFILES) $(DB_OFILES) $(SHARED_OFILES) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) mkindx$(EXE): mkindx.o $(CC) $(LDFLAGS) -o $@ $^ dump$(EXE): $(DUMP_OFILES) $(SHARED_OFILES) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) extract$(EXE): extract.o utils.o $(SHARED_OFILES) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) decompress$(EXE): decompress.o compress.o $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) announce$(EXE): announce.o $(CC) $(LDFLAGS) -o $@ $^ mudwho$(EXE): rwho/mudwho.o $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(RWHO_LIB) : rwho/clilib.o $(AR) rsc $@ $^ clean: -rm -f a.out gmon.out $(TARGETS) $(OBJDEPENDS) $(OBJDEPENDS:.o=.d) dist: ln -s ./ pernmush tar czvf pernmush-1.17-$(RELEASE).tar.gz $(PDIST) rm pernmush # pull in dependency info for *existing* .o files -include $(OBJDEPENDS:.o=.d) # compile and generate dependency info; # more complicated dependency computation, so all prereqs listed # will also become command-less, prereq-less targets # sed: append directory to object target. (gcc bug?) # sed: strip the target (everything before colon) # sed: remove any continuation backslashes # fmt -1: list words one per line # sed: strip leading spaces # sed: add trailing colons %.o: %.c $(CC) -c $(CFLAGS) $*.c -o $*.o @$(CC) -MM $(CFLAGS) $*.c > $*.d @mv -f $*.d $*.d.tmp @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ sed -e 's/^ *//' -e 's/$$/:/' >> $*.d @rm -f $*.d.tmp