AlloyMUSH-1.1/conf/
AlloyMUSH-1.1/misc/
AlloyMUSH-1.1/scripts/
AlloyMUSH-1.1/vms/
# Makefile for TinyMUSH 2.0
#
# Search for the text 'CONFIGURATION SECTION' and make any changes needed
# there.

SHELL=/bin/sh
topdir = ..
srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
# CPP = @CPP@	# This is broken in autoconf.  Sigh.
CPP = $(CC) -E
LIBS = @LIBS@
LIBOBJS = @LIBOBJS@

OPTIM = -O

# UnterMUD database layer.
UDBA_SRC = $(topdir)/src/udb_acache.c $(topdir)/src/udb_achunk.c $(topdir)/src/udb_attr.c
UDBA_OBJ = udb_acache.o udb_achunk.o udb_attr.o
UDBA_FLG = -DCACHE_ATTRS

UDBO_SRC = $(topdir)/src/udb_ocache.c $(topdir)/src/udb_ochunk.c $(topdir)/src/udb_obj.c
UDBO_OBJ = udb_ocache.o udb_ochunk.o udb_obj.o
UDBO_FLG = -DCACHE_OBJS

UDB_SRC = $(topdir)/src/udb_misc.c
UDB_OBJ = udb_misc.o
UDB_INC	= $(topdir)/src/udb.h $(topdir)/src/udb_defs.h

# Everything needed to use the database in standalone mode.
SA_OBJ	= sa-boolexp.o sa-conf.o sa-db.o sa-db_rw.o \
	  sa-flags.o sa-htab.o sa-log.o sa-object.o sa-player_c.o \
	  sa-predicates.o sa-stringutil.o sa-unparse.o sa-vattr.o

# Distribution source files
D_SRC	= $(topdir)/src/alloc.c $(topdir)/src/boolexp.c $(topdir)/src/bsd.c \
	  $(topdir)/src/command.c $(topdir)/src/compat.c $(topdir)/src/conf.c \
	  $(topdir)/src/cque.c $(topdir)/src/create.c $(topdir)/src/db.c \
	  $(topdir)/src/db_rw.c $(topdir)/src/eval.c $(topdir)/src/file_c.c \
	  $(topdir)/src/flags.c $(topdir)/src/functions.c $(topdir)/src/game.c \
	  $(topdir)/src/help.c $(topdir)/src/htab.c $(topdir)/src/log.c $(topdir)/src/look.c \
	  $(topdir)/src/match.c $(topdir)/src/move.c $(topdir)/src/netcommon.c \
	  $(topdir)/src/object.c $(topdir)/src/player.c $(topdir)/src/player_c.c \
	  $(topdir)/src/powers.c $(topdir)/src/predicates.c $(topdir)/src/quota.c \
	  $(topdir)/src/rob.c $(topdir)/src/set.c $(topdir)/src/speech.c \
	  $(topdir)/src/stringutil.c $(topdir)/src/timer.c $(topdir)/src/unparse.c \
	  $(topdir)/src/vattr.c $(topdir)/src/walkdb.c $(topdir)/src/wild.c \
	  $(topdir)/src/wiz.c $(topdir)/src/func-alloy.c $(topdir)/src/ansi.c \
	  $(topdir)/src/override.c
D_OBJ	= alloc.o boolexp.o bsd.o command.o compat.o conf.o \
	  cque.o create.o db.o db_rw.o eval.o file_c.o flags.o \
	  functions.o game.o help.o htab.o log.o look.o match.o move.o \
	  netcommon.o object.o player.o player_c.o powers.o predicates.o \
	  quota.o rob.o set.o speech.o stringutil.o timer.o unparse.o vattr.o \
	  walkdb.o wild.o wiz.o func-alloy.o ansi.o override.o
D_INC	= $(topdir)/src/ansi.h $(topdir)/src/alloc.h $(topdir)/src/attrs.h \
	  $(topdir)/src/command.h $(topdir)/src/config.h $(topdir)/src/copyright.h \
	  $(topdir)/src/externs.h $(topdir)/src/fifo.h \
	  $(topdir)/src/file_c.h $(topdir)/src/flags.h \
	  $(topdir)/src/functions.h $(topdir)/src/help.h \
	  $(topdir)/src/htab.h $(topdir)/src/interface.h \
	  $(topdir)/src/match.h $(topdir)/src/misc.h $(topdir)/src/mudconf.h \
	  $(topdir)/src/mushdb.h $(topdir)/src/powers.h \
	  $(topdir)/src/rwho_clilib.h $(topdir)/src/vattr.h

# RWHO source files
WHO_SRC	= $(topdir)/src/rwho_clilib.c
WHO_OBJ	= rwho_clilib.o
WHO_FLG	= -DRWHO_IN_USE
RWHO_FL	= -DLOCAL_RWHO_SERVER

# Version number routine
VER_SRC	= $(topdir)/obj/version.c
VER_OBJ	= version.o
VER_INC	= $(topdir)/src/patchlevel.h
VER_FLG	= -DMUSH_BUILD_DATE="\"`date`\"" \
	  -DMUSH_BUILD_NUM="\"`sh ./buildnum.sh`\""

# ===================== CONFIGURATION SECTION ====================
#
# Select the correct C compiler.  Whatever you choose, it must be able
# to grok ANSI C (function prototypes)
#
#-----CC or GCC (must be able to grok function prototypes)
#
DEFS = -I. -I@srcdir@
#
#-----GCC if the libraries were built for a pcc-derived cc compiler
#     (most systems)
#
#DEFS = -fpcc-struct-return -Wall -I. -I@srcdir@
#
#-----GCC with GCC-compatible libraries if you want verbose error messages
#
#DEFS = -Wall -I. -I@srcdir@
#
#-----HP-UX C compiler
#
#DEFS = -w +Obb800 -Aa -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_HPUX_SOURCE -D_INCLUDE_XOPEN_SOURCE -I. -I@srcdir@
#
#-----MIPS C compiler (also DEC 3xxx, Prime EXL7xxx)
#
#DEFS = -signed -I. -I@srcdir@

# Libraries.  Use the second line if you want to use the resolver to get
# hostnames and your libc doesn't use it already.  If you use it, you'd
# better have your nameserver working or things may hang for a while when
# people try to login from distant sites.  Use the third line if you're running
# on a SysV-ish system and BSD support isn't built in to the standard libc.
#
MORELIBS	= -lm
#MORELIBS	= -lm -lnsl -lsocket -L/usr/ucblib -lucb	# Mips

# Set this to the directory where the MUSH game lives.
GAME	= /usr/games/lib/mush

# If you want to be able to transmit RWHO data, uncomment these lines:
WHO_S	= $(WHO_SRC)
WHO_O	= $(WHO_OBJ)
WHO_F	= $(WHO_FLG)

# If you want to allow the local RWHO command (only recommended if you are on
# the same machine or subnet as the RWHO server), uncomment these lines:
#RWHO_F	= $(RWHO_FL)

# If you want "identd" support, which automatically determines the username
# of connected players (presuming their hosts support identd authentication),
# at the cost of a possible brief freeze (configurable, and set by default
# to 5 seconds) at each new connection, then you will need to FTP, from
# caisr2.caisr.cwru.edu, /pub/mush/libident-0.14.tar.gz, build that, and
# then uncomment these lines:
#IDENT_LIB = -L../lib.ident-0.14 -lident
#IDENT_F = -DUSE_IDENTD=1

# Select the level at which you want cacheing to be performed.  Prior releases
# of MUSH only supported attribute-level cacheing.
# 
# ----- Attribute-level cacheing.
#UDB_S	= $(UDBA_SRC) $(UDB_SRC)
#UDB_O	= $(UDBA_OBJ) $(UDB_OBJ)
#UDB_F	= $(UDBA_FLG)

# ----- Object-level cacheing.
UDB_S	= $(UDBO_SRC) $(UDB_SRC)
UDB_O	= $(UDBO_OBJ) $(UDB_OBJ)
UDB_F	= $(UDBO_FLG)

# Select the networking support you have.  Currently only BSD networking
# is supported.
#
# ----- BSD networking
NET_S	= $(topdir)/src/bsd.c
NET_O	= bsd.o

# Look at the very bottom if you have an old make that doesn't understand
# pattern rules.  There's a few lines that need to be commented out and
# one other that needs to be added.

# ================== END OF CONFIGURATION SECTION =================

# Auxiliary source files: only used by offline utilities.
AUX_SRC	= $(topdir)/src/dbconvert.c $(topdir)/src/mkindx.c $(topdir)/src/unsplit.c
LIB_SRC = $(topdir)/src/myndbm.c
LIB_INC = $(topdir)/src/myndbm.h

DEBUG	= $(OPTIM)
ALLCFLAGS = $(CFLAGS) $(DEBUG) $(DEFS) \
	    $(WHO_F) $(RWHO_F) $(RLIM_F) $(UDB_F) $(IDENT_F)

#Auxiliary files
A_INST	= $(topdir)/README $(topdir)/NOTES $(topdir)/HIGHLIGHTS \
	  $(topdir)/CREDITS $(topdir)/CHANGES \
	  $(topdir)/README-2.0 $(topdir)/CHANGES-2.0
A_TXT	= $(topdir)/text/badsite.txt $(topdir)/text/connect.txt \
	  $(topdir)/text/create_reg.txt $(topdir)/text/down.txt \
	  $(topdir)/text/guest.txt $(topdir)/text/help.txt \
	  $(topdir)/text/motd.txt $(topdir)/text/news.txt \
	  $(topdir)/text/newuser.txt $(topdir)/text/quit.txt \
	  $(topdir)/text/register.txt $(topdir)/text/wizhelp.txt \
	  $(topdir)/text/wizmotd.txt $(topdir)/text/full.txt
A_SH	= $(topdir)/scripts/db_load $(topdir)/scripts/db_unload \
	  $(topdir)/scripts/db_check $(topdir)/obj/buildnum.sh
A_RT	= $(topdir)/scripts/Startmush $(topdir)/scripts/mush.config
A_CONF	= $(topdir)/conf/netmush.conf $(topdir)/conf/alias.conf \
	  $(topdir)/conf/compat.conf
A_MISC	= $(topdir)/misc/README $(topdir)/misc/ind.el \
	  $(topdir)/misc/indinit.el $(topdir)/misc/indent.pro
A_VMS	= $(topdir)/src/vms_dbm.c $(topdir)/src/vms_dbm.h \
	  $(topdir)/vms/startmush.com $(topdir)/vms/compile.com \
	  $(topdir)/vms/link.com 
A_AUTO	= $(topdir)/obj/configure $(topdir)/obj/configure.in \
	  $(topdir)/obj/autoconf.h.in $(topdir)/obj/Makefile.in \
	  $(topdir)/obj/.depend $(topdir)/obj/buildnum.data
AUXIL	= $(A_INST) $(A_TXT) $(A_SH) $(A_CONF) $(A_MISC) $(A_RT) $(A_VMS) \
	  $(A_AUTO)

#Installation files
INSTALL_PROG	= netmush dbconvert mkindx $(topdir)/scripts/db_load \
		  $(topdir)/scripts/db_unload $(topdir)/scripts/db_check
INSTALL_TARG	= $(INSTALL_PROG) $(topdir)/text/*.txt \
		  $(topdir)/conf/*.conf $(topdir)/scripts/Startmush \
		  $(topdir)/scripts/mush.config
REINSTALL_TARG	= $(INSTALL_PROG) $(topdir)/text/help.txt \
		  $(topdir)/text/wizhelp.txt $(topdir)/conf/alias.conf \
		  $(topdir)/conf/compat.conf

#compiliation source files
ALLSRC	= $(D_SRC) $(UDB_SRC) $(UDBA_SRC) $(UDBO_SRC) $(VER_SRC) \
	  $(WHO_SRC) $(AUX_SRC) $(LIB_SRC)
ALLINC	= $(D_INC) $(UDB_INC) $(VER_INC) $(NET_INC) $(LIB_INC)
SRC	= $(D_SRC) $(UDB_S) $(WHO_S)
OBJ	= $(D_OBJ) $(UDB_O) $(WHO_O)

# Files in the standard distribution
DIST	= $(ALLSRC) $(ALLINC) $(AUXIL)

OUT	= netmush mkindx dbconvert

all: $(OUT)

new-install: $(INSTALL_TARG)
	-mkdir $(GAME)
	cp $(INSTALL_TARG) $(GAME)

install: $(REINSTALL_TARG)
	cp $(REINSTALL_TARG) $(GAME)

$(topdir)/TAGS: *.c *.h $(srcdir)/*.c $(srcdir)/*.h
	-etags -o $(topdir)/TAGS *.c *.h $(srcdir)/*.c $(srcdir)/*.h

mkindx: mkindx.o
	$(CC) $(ALLCFLAGS) -o mkindx mkindx.o

unsplit: unsplit.o
	$(CC) $(ALLCFLAGS) -o unsplit unsplit.o

dbconvert: dbconvert.o $(SA_OBJ) $(UDB_O) $(ALLOC_O)$(LIBOBJS)
	$(CC) $(ALLCFLAGS) -o dbconvert dbconvert.o $(SA_OBJ) $(UDB_O) $(ALLOC_O) $(LIBS) $(MORELIBS) $(LIBOBJS)

saber:	$(SRC)
	#load $(SRC)

saber-o: $(OBJ) $(LIBOBJS)
	#load $(OBJ) $(VER_OBJ) $(LIBS) $(MORELIBS)

netmush: $(OBJ) $(LIBOBJS)
	$(CC) $(ALLCFLAGS) $(VER_FLG) -c $(VER_SRC)
	-rm -f netmush
	$(CC) $(ALLCFLAGS) -o netmush $(OBJ) $(LIBOBJS) $(VER_OBJ) $(LIBS) $(MORELIBS) $(IDENT_LIB)

dist.tar.Z: $(DIST)
	-rm -f buildnum.data
	echo 0 > buildnum.data
	cd ..; tar cvhf -  `echo $(DIST) | sed 's/\.\.\///g'` | compress -c > dist.tar.Z.NEW
	mv dist.tar.Z.NEW dist.tar.Z

dist.tar.gz: $(DIST)
	-rm -f buildnum.data
	echo 0 > buildnum.data
	cd ..; tar cvhf - `echo $(DIST) | sed 's/\.\.\///g'` | gzip -c > obj/dist.tar.gz.NEW
	mv dist.tar.gz.NEW dist.tar.gz

depend: $(ALLSRC) unsplit
	for i in $(D_SRC) $(UDBA_SRC) $(UDBO_SRC) $(AUX_SRC) \
	$(WHO_SRC) $(LIB_SRC); do $(CPP) $(ALLCFLAGS) -M $(srcdir)/$$i; \
	done | sed -e 's:/usr[^ ]* ::g' | \
	sed 's,$*\.o,sa-& &,g' | unsplit > .depend~
	mv .depend~ .depend

index: help.indx news.indx wizhelp.indx

help.indx: help.txt
	./mkindx help.txt help.indx

news.indx: news.txt
	./mkindx news.txt news.indx

wizhelp.indx: wizhelp.txt
	./mkindx wizhelp.txt wizhelp.indx

verify:
	runtest --tool mush --src ./testsuite

realclean:
	-rm -f *.o a.out core gmon.out mush.*log mush.*sum $(OUT) netmush~ \
	unsplit

clean:
	-rm -f *.o a.out core gmon.out mush.*log mush.*sum $(OUT)

patrules:
	for file in ../src/*.c ; \
	do \
	    echo $$file | sed -e 's,\.\./src/\(.*\)\.c,\1.o:	&,';\
	    echo $$file | sed -e 's,\.\./src/\(.*\)\.c,	$$(CC) $$(ALLCFLAGS) -c &,';\
	    echo $$file | sed -e 's,\.\./src/\(.*\)\.c,sa-\1.o:	&,';\
	    echo $$file | sed -e 's,\.\./src/\(.*\)\.c,	$$(CC) $$(ALLCFLAGS) -DSTANDALONE -c & -o sa-\1.o,';\
	done > patrules


# EXTRA CONFIGURATION STUFF HERE
#
# These are pattern rules for make targets.  They will only work properly
# if your make understands VPATH and pattern rules.
# If you have an old version of make, we recommend getting GNU make and
# using that (it's much nicer).  Failing that, comment out these lines:
#
.c.o:
	$(CC) $(ALLCFLAGS) -c $<

sa-%.o: %.c
	$(CC) $(ALLCFLAGS) -DSTANDALONE -c $< -o $@
#
# and either uncomment this line:
#

#include patrules

#
# Or, if your make doesn't understand "include", just textually include
# the file patrules into this file right here.

#
# This is the list of dependancy rules.  If your make doesn't understand
# "include", you can just comment out the include and textually include
# it if you want.
# Just commenting out this line won't hurt anything for a virgin build,
# but may cause problems should you make any changes and recompile.
#
include .depend