#
# Whatever you put in for $(CC) must be able to grok ANSI C.
#

# GCC:
CC=gcc
#OPTIM= -g -pipe -W -Wreturn-type -Wunused -Wcomment -Wwrite-strings
OPTIM= -g -W -Wreturn-type -Wunused -Wcomment -Wwrite-strings

# IBM RT C compiler:
#CC=cc
#OPTIM=-g

# Dec 3100 C compiler
#CC=cc
#OPTIM= -g -Dconst=

# 
# To log failed commands (HUH's) to stderr, include -DLOG_FAILED_COMMANDS
# To restricted object-creating commands to users with the BUILDER bit,
#   include -DRESTRICTED_BUILDING
# To log all commands, include -DLOG_COMMANDS
# To force fork_and_dump() to use vfork() instead of fork(), include 
#   -DUSE_VFORK.
# To force grow_database() to be clever about its memory management,
#   include -DDB_DOUBLING.  Use this only if your realloc does not allocate
#   in powers of 2 (if you already have a clever realloc, this option will
#   only cost you extra space).
# 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).
# To include code for keeping track of the number of blocks allocated,
#   include -DTEST_MALLOC.
# To include code which attempts to compress string data, include -DCOMPRESS.
# To eliminate the message third parties see when a player whispers, include
#   -DQUIET_WHISPER.
# To include gender flags and pronoun substitution code, 
#   include -DGENDER.
# To allow players to claim ownership of objects using @chown, 
#   include -DPLAYER_CHOWN.  This also adds the CHOWN_OK flag,
#   to indicate whether an object is @chownable.
# To include teleport-to-player destinations for exits,
#   include -DTELEPORT_TO_PLAYER.
# To make the ``examine'' command display full names for types and flags,
#   use -DVERBOSE_EXAMINE
# To display "has connected" and "has disconnected" messages, use
#   -DCONNECT_MESSAGES
# To allow players to set HAVEN flags, use -DHAVEN.
# To allow players to set ABODE flags, use -DABODE.
# To allow the game to dump core after PANIC dumps, use -DCOREDUMP.
# For the WHO list for wizards to show hostnames instead of addresses, use
# -DHOSTNAMES.


DEFS= -DGOD_PRIV -DGENDER -DVERBOSE_EXAMINE -DPLAYER_CHOWN -DQUIET_WHISPER -DCONNECT_MESSAGES -DTELEPORT_TO_PLAYER -DHAVEN -DABODE -DCOMPRESS -DRECYCLE -DCOREDUMP -DREGISTRATION -DDB_DOUBLING

CFLAGS= $(OPTIM) $(DEFS)

# 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 stringutil.c utils.c wiz.c db.c game.c \
	boolexp.c unparse.c compress.c property.c hashtab.c

# .o versions of above
OFILES= create.o game.o help.o look.o match.o move.o player.o predicates.o \
	rob.o set.o speech.o stringutil.o utils.o wiz.o db.o boolexp.o \
	unparse.o compress.o property.o hashtab.o librwho.a

# Files in the standard distribution
# currently missing sanity-check.c extract.c dump.c
# I have replaced sanity-check.c with sanity.c -- it's my own version
DISTFILES= $(CFILES) config.h db.h externs.h interface.h match.h \
	interface.c decompress.c\
	help.txt muck.doc minimal.db\
 	README restart\
	CHANGES Makefile copyright.h sanity.c

OUTFILES= netmuck decompress sanity

# paths is likely to remain broken, missing dump extract
#all: netmuck decompress TAGS sanity
all: netmuck decompress sanity

TAGS: *.c *.h
	etags *.c *.h

netmuck: interface.o $(OFILES)
	-mv -f netmuck netmuck~
	$(CC) $(CFLAGS) -o netmuck interface.o $(OFILES)

sanity: sanity.o utils.o db.o compress.o
	rm -f sanity
	$(CC) $(CFLAGS) -o sanity sanity.o utils.o db.o compress.o

#dump: dump.o unparse.o db.o compress.o
#	-rm -f dump
#	$(CC) $(CFLAGS) -o dump dump.o unparse.o db.o compress.o
#
#sanity-check: sanity-check.o utils.o db.o compress.o
#	-rm -f sanity-check
#	$(CC) $(CFLAGS) -o sanity-check sanity-check.o utils.o db.o compress.o
#
#extract: extract.o utils.o db.o compress.o
#	-rm -f extract
#	$(CC) $(CFLAGS) -o extract extract.o utils.o db.o compress.o
#
#paths: paths.o unparse.o db.o compress.o
#	-rm -f paths
#	$(CC) $(CFLAGS) -o paths paths.o unparse.o db.o compress.o
#
decompress: decompress.o compress.o
	-rm -f decompress
	$(CC) $(CFLAGS) -o decompress decompress.o compress.o

clean:
	-rm -f *.o *~ a.out core gmon.out $(OUTFILES)

dist.tar.Z: $(DISTFILES)
	tar cvf - $(DISTFILES) | compress -c > dist.tar.Z.NEW
	mv dist.tar.Z.NEW dist.tar.Z

depend:
	makedepend -- $(CFLAGS) -- $(CFILES) interface.c

# DO NOT DELETE THIS LINE -- make depend depends on it.

create.o: copyright.h db.h /usr/include/stdio.h config.h interface.h
create.o: externs.h match.h /usr/include/strings.h /usr/include/ctype.h
game.o: copyright.h /usr/include/stdio.h /usr/include/ctype.h
game.o: /usr/include/signal.h /usr/include/sys/wait.h db.h config.h
game.o: interface.h match.h externs.h
help.o: copyright.h db.h /usr/include/stdio.h config.h interface.h externs.h
look.o: copyright.h db.h /usr/include/stdio.h config.h interface.h match.h
look.o: externs.h
match.o: copyright.h /usr/include/ctype.h db.h /usr/include/stdio.h config.h
match.o: match.h
move.o: copyright.h db.h /usr/include/stdio.h config.h interface.h match.h
move.o: externs.h
player.o: copyright.h db.h /usr/include/stdio.h config.h interface.h
player.o: externs.h
predicates.o: copyright.h /usr/include/ctype.h db.h /usr/include/stdio.h
predicates.o: interface.h config.h externs.h
rob.o: copyright.h db.h /usr/include/stdio.h config.h interface.h match.h
rob.o: externs.h
set.o: copyright.h /usr/include/stdio.h /usr/include/ctype.h
set.o: /usr/include/string.h db.h config.h match.h interface.h externs.h
speech.o: copyright.h db.h /usr/include/stdio.h interface.h match.h config.h
speech.o: externs.h
stringutil.o: copyright.h /usr/include/ctype.h externs.h db.h
stringutil.o: /usr/include/stdio.h
utils.o: copyright.h db.h /usr/include/stdio.h
wiz.o: copyright.h db.h /usr/include/stdio.h interface.h match.h externs.h
db.o: copyright.h /usr/include/stdio.h /usr/include/ctype.h db.h config.h
db.o: interface.h
game.o: copyright.h /usr/include/stdio.h /usr/include/ctype.h
game.o: /usr/include/signal.h /usr/include/sys/wait.h db.h config.h
game.o: interface.h match.h externs.h
boolexp.o: copyright.h /usr/include/ctype.h /usr/include/string.h db.h
boolexp.o: /usr/include/stdio.h match.h externs.h config.h interface.h
unparse.o: db.h copyright.h /usr/include/stdio.h externs.h config.h
unparse.o: interface.h
property.o: copyright.h db.h /usr/include/stdio.h externs.h
interface.o: copyright.h /usr/include/stdio.h /usr/include/sys/types.h
interface.o: /usr/include/sys/file.h /usr/include/sys/time.h
interface.o: /usr/include/signal.h /usr/include/sys/ioctl.h
interface.o: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
interface.o: /usr/include/sys/wait.h /usr/include/fcntl.h
interface.o: /usr/include/sys/errno.h /usr/include/ctype.h
interface.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
interface.o: /usr/include/netdb.h db.h interface.h config.h