ROGUE_OBJS = curses.o hit.o init.o inventory.o level.o machdep.o main.o \
    message.o monster.o move.o object.o pack.o play.o random.o ring.o \
    room.o save.o score.o spec_hit.o throw.o trap.o use.o zap.o

CC = cc -O
#CC = gcc -O2

# Put into CFLAGS those UNIX "defines" which apply to your system.
#
# Options:
#	-DUNIX		for all Unix based systems
#	-DUNIX_BSD4_2	for most BSD based Unix systems
#	-DUNIX_SYSV	for System V based Unix systems
#	-DBAD_NONL	for systems with the nonl() curses bug
#	-DCURSES 	enables a self-contained curses emulation package
# 			Remember to remove the "-lcurses -ltermlib"
#			if compiling with -DCURSES.
#	-Ml		compile with large model (SysV PC/AT's)

# COHERENT 4.2 compiled with MWC C
CFLAGS = -c -VPSTR -DUNIX -DUNIX_SYSV
# COHERENT 4.2 compiled with GNU C
#CFLAGS = -c -fwritable-strings -DUNIX -DUNIX_SYSV
# COHERENT 3.x
#CFLAGS = -c -DUNIX -DUNIX_SYSV -DCURSES
#CFLAGS = -c -DUNIX -DUNIX_BSD4_2	# BSD4.[23]
#CFLAGS = -c -DUNIX -DUNIX_SYSV		# Vanilla SysV
#CFLAGS = -c -DUNIX -DUNIX_SYSV -Ml	# Microport SysV, Rel2 for PC/AT

# Put into LDFLAGS those options which apply to your system.
#
# Options:
#	-lcurses	use standard curses package
#	-ltermlib	to extract terminal capabilities
#	-Ml		link with large model (SysV PC/AT's)

LDFLAGS = -s -f -lcurses	# COHERENT 4.2 compiled with MWC C
#LDFLAGS = -s -lcurses		# COHERENT 4.2 compiled with GNU C
#LDFLAGS = -s			# COHERENT 3.x
#LDFLAGS = -lcurses -ltermlib	# Vanilla BSD and SysV
#LDFLAGS = -Ml -lcurses		# Microport SysV, Rel2 for PC/AT
#LDFLAGS =			# for use with self-contained curses package (-DCURSES)

rogue: $(ROGUE_OBJS)
	$(CC) $(ROGUE_OBJS) $(LDFLAGS) -o rogue

curses.o: curses.c rogue.h
	$(CC) $(CFLAGS) curses.c

hit.o: hit.c rogue.h
	$(CC) $(CFLAGS) hit.c

init.o: init.c rogue.h
	$(CC) $(CFLAGS) init.c

inventory.o: inventory.c rogue.h
	$(CC) $(CFLAGS) inventory.c

level.o: level.c rogue.h
	$(CC) $(CFLAGS) level.c

machdep.o: machdep.c rogue.h
	$(CC) $(CFLAGS) machdep.c

main.o: main.c rogue.h
	$(CC) $(CFLAGS) main.c

message.o: message.c rogue.h
	$(CC) $(CFLAGS) message.c

monster.o: monster.c rogue.h
	$(CC) $(CFLAGS) monster.c

move.o: move.c rogue.h
	$(CC) $(CFLAGS) move.c

object.o: object.c rogue.h
	$(CC) $(CFLAGS) object.c

pack.o: pack.c rogue.h
	$(CC) $(CFLAGS) pack.c

play.o: play.c rogue.h
	$(CC) $(CFLAGS) play.c

random.o: random.c
	$(CC) $(CFLAGS) random.c

ring.o: ring.c rogue.h
	$(CC) $(CFLAGS) ring.c

room.o: room.c rogue.h
	$(CC) $(CFLAGS) room.c

save.o: save.c rogue.h
	$(CC) $(CFLAGS) save.c

score.o: score.c rogue.h
	$(CC) $(CFLAGS) score.c

spec_hit.o: spec_hit.c rogue.h
	$(CC) $(CFLAGS) spec_hit.c

throw.o: throw.c rogue.h
	$(CC) $(CFLAGS) throw.c

trap.o: trap.c rogue.h
	$(CC) $(CFLAGS) trap.c

use.o: use.c rogue.h
	$(CC) $(CFLAGS) use.c

zap.o: zap.c rogue.h
	$(CC) $(CFLAGS) zap.c

clean:
	rm -f rogue core *.o
