# Untermud makefile CC = gcc AR = ar YACC = yacc # If you don't have or care to use lint/splint set this to nothing LINT = #LINT = splint # The suffix appended to executables. # This should be set for Cygwin and Windows. EXE = .exe #EXE = #the value of FLAGS is passed to CFLAGS (incl. in subdirs) CFLAGS = -g -O2 -pipe -Wall -W -Wno-parentheses -Wno-unused LDFLAGS = -g # Include directories INCS = -I./ -I./U # See LINT above - these flags for splint LINTFLAGS = $(INCS) -weak -warnposixheaders +relaxtypes -retvalother # LIBS may be defined to be any other system libraries you may require # old dbm not in libc requires '-ldbm'. To use Berkely DBM require '-ldb'. LIBS = -lgdbm -lgdbm_compat #if building with combat, include this #COMBAT= COMBAT = combat.c HDR = config.h mud.h comp.h vars.h look.h match.h cmd.h sbuf.h trans.h sym.h xact.h \ combat.h os.h SRC = mud.c $(COMBAT) cron.c net.c do_go.c do_look.c login.c trans.c version.c \ run.c sym.c activ.c vars.c cmd.c xact.c xmit.c cache.c bool.c util.c \ match.c obj.c sbuf.c list.c rot.c alloc.c errors.c misc2.c misc.c os.c # .o versions of above OBJ = $(SRC:.c=.o) XTRA = README README_2.0a README_COMBAT CHANGES COPYRIGHT Makefile INSTALL_NOTES \ untermud-2.4-orig.tar.gz makefile.bor makefile.vc \ bootup buildh buildd buildg bootup.cmd buildh.cmd buildd.cmd buildg.cmd CMDLIB = CMD/libcmd.a CMDSRC = CMD/_dump.c CMD/_echo.c CMD/_wall.c CMD/_force.c CMD/_if.c CMD/_mark.c \ CMD/_rand.c CMD/build.c CMD/destroy.c CMD/do.c CMD/drop.c CMD/examine.c \ CMD/go.c CMD/inv.c CMD/kill.c CMD/look.c CMD/news.c CMD/page.c \ CMD/passwd.c CMD/quit.c CMD/read.c CMD/say.c CMD/take.c CMD/use.c \ CMD/which.c CMD/telep.c CMD/wear.c CMD/whisper.c CMD/wizard.c CMDOBJ = $(CMDSRC:.c=.o) CMDXTRA = CMD/README DBLIB = DB/libdb.a DBSRC = DB/oif.c DB/expr.c DB/dbmchunk.c DB/dbmconf.c DB/gdbmchunk.c \ DB/gdbmconf.c DB/hashconf.c DB/hashdir.c DBOBJ = $(DBSRC:.c=.o) DBXTRA = DB/README DB/dumpdb.c DB/loaddb.c DB/comp.c DB/bigrams.c \ DB/config DB/startup DB/minimal_db.oif DBUTIL = misc.o alloc.o obj.o sbuf.o list.o ULIB = U/libu.a UHDR = U/u.h USRC = U/bltin.c U/uinterp.y U/u_util.c U/b_cmd.c U/b_echo.c U/b_err.c \ U/b_lst.c U/b_match.c U/b_misc.c U/b_int.c U/b_oid.c U/b_rnd.c \ U/b_time.c U/b_str.c UOBJ = U/bltin.o U/uinterp.o U/u_util.o U/b_cmd.o U/b_echo.o U/b_err.o \ U/b_lst.o U/b_match.o U/b_misc.o U/b_int.o U/b_oid.o U/b_rnd.o \ U/b_time.o U/b_str.o UXTRA = U/README MISCSRC = MISC/bonk.c MISC/oif2set.c MISCOBJ = $(MISCSRC:.c=.o) MISCXTRA = $(MISCSRC:.c=.doc) MISCDBCHKSRC = MISC/dbchk/dbchk.c MISC/dbchk/dbchk_cache.c MISCDBCHKOBJ = $(MISCDBCHKSRC:.c=.o) #if building without RWHO support, change RWHOLIB to nothing: #RWHOLIB = RWHOLIB = RWHO/librwho.a RWHOHDR = RWHO/rwho.h RWHOSRC = RWHO/updat.c RWHO/clilib.c RWHOOBJ = $(RWHOSRC:.c=.o) RWHOXTRA = RWHO/mudwho.c RWHO/mwhoforvm RWHO/HOW_TO RWHO/rwhodoc RWHO/README # RWHO daemon RWHOD = RWHO/rwhod RWHODSRC = $(RWHOD)/mwhod.c RWHODOBJ = $(RWHODSRC:.c=.o) RWHODXTRA = $(RWHOD)/mwhod.doc $(RWHOD)/README OTHER = DOC/* HELP/* MISC/oifextract/* # Files in the standard distribution DISTFILES = $(SRC) $(HDR) $(XTRA) $(CMDSRC) $(CMDXTRA) $(DBSRC) $(DBXTRA) \ $(UHDR) $(USRC) $(UXTRA) $(RWHOHDR) $(RWHOSRC) $(RWHOXTRA) $(RWHODSRC) \ $(RWHODXTRA) $(OTHER) $(MISCSRC) $(MISCXTRA) $(MISCDBCHKSRC) PDIST = $(patsubst %,untermud/%,$(DISTFILES)) RELEASE = dist # Dependency information OBJDEPENDS = $(OBJ) $(CMDOBJ) $(DBOBJ) $(UOBJ) $(RWHOOBJ) \ DB/dumpdb.o DB/loaddb.o DB/comp.o DB/bigrams.o \ RWHO/mudwho.o $(MISCOBJ) $(MISCDBCHKOBJ) $(RWHODOBJ) ALLLIBS = $(CMDLIB) $(DBLIB) $(ULIB) $(RWHOLIB) TARGETS = mud$(EXE) mudwho$(EXE) dumpdb$(EXE) loaddb$(EXE) bigrams$(EXE) \ comp$(EXE) bonk$(EXE) oif2set$(EXE) dbchk$(EXE) mwhod$(EXE) all: $(TARGETS) mud$(EXE) : $(OBJ) $(CMDLIB) $(DBLIB) $(ULIB) $(RWHOLIB) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) mudwho$(EXE) : RWHO/mudwho.o $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) dumpdb$(EXE) : DB/dumpdb.o $(DBUTIL) $(DBLIB) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) loaddb$(EXE) : DB/loaddb.o $(DBUTIL) $(DBLIB) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) comp$(EXE) : DB/comp.o $(CC) $(LDFLAGS) -o $@ $^ bigrams$(EXE) : DB/bigrams.o $(CC) $(LDFLAGS) -o $@ $^ $(CMDLIB) : $(CMDOBJ) $(AR) rsc $@ $^ $(DBLIB) : $(DBOBJ) $(AR) rsc $@ $^ $(ULIB) : $(UOBJ) y.tab.h $(AR) rsc $@ $(UOBJ) U/uinterp.c y.tab.h : U/uinterp.y $(YACC) -d U/uinterp.y mv y.tab.c U/uinterp.c $(RWHOLIB) : $(RWHOOBJ) $(AR) rsc $@ $^ mwhod$(EXE) : $(RWHODOBJ) $(CC) $(LDFLAGS) -o $@ $^ bonk$(EXE) : MISC/bonk.o $(CC) $(LDFLAGS) -o $@ $^ oif2set$(EXE) : MISC/oif2set.o $(CC) $(LDFLAGS) -o $@ $^ dbchk$(EXE) : $(MISCDBCHKOBJ) $(DBUTIL) $(DBLIB) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) clean : @echo "Cleaning..." @-rm -f *.d $(TARGETS) $(ALLLIBS) \ DB/dumpdb.o DB/loaddb.o DB/comp.o DB/bigrams.o \ U/uinterp.c y.tab.h RWHO/mudwho.o $(OBJDEPENDS) \ $(OBJDEPENDS:.o=.d) @echo "Done." dist : ln -s ./ untermud -tar czvf untermud-$(RELEASE).tar.gz $(PDIST) --exclude=.svn rm untermud # 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 ifdef LINT -$(LINT) $(LINTFLAGS) $*.c endif $(CC) -c $(CFLAGS) $(INCS) $*.c -o $*.o @$(CC) -MM $(CFLAGS) $(INCS) $*.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