# Makefile for Dungeon.
# Note: as of this date (Oct 2001), the Gnu fortran compiler will not
# compile Dungeon because of some intrinsic function conflicts, plus
# octal DATA syntax problems.
#
# The free f2c compiler from 
#
# 	http://netlib.bell-labs.com/netlib/f2c/
#
# compiles the sources quite competently.  It should also be available
# in most Linux and *BSD distributions.  -- Rick Slater Oct 2001

FC = f2c
FFLAGS = -A -C -Nn802 -NL400 #-c
CFLAGS = -O

.f.c:
	$(FC) $(FFLAGS) $<

all:	dungeon textcnv bin2txt

dungeon: dungeon.c gdt.c objects.c rooms.c timefnc.c \
	game.c machdep.c parser.c subr.c verbs.c gettim.C \
	random.C dungeon.o gdt.o objects.o rooms.o timefnc.o \
	game.o machdep.o parser.o subr.o verbs.o gettim.o \
	random.o libdungeon.a
	$(CC) -s -o dungeon dungeon.o -L. -ldungeon -lf2c -lm

textcnv: textcnv.c
	$(CC) -s -o textcnv textcnv.c -lf2c -lm

bin2txt: bin2txt.c
	$(CC) -s -o bin2txt bin2txt.c -lf2c -lm

# The gettim.C and random.C functions enable Dungeon to keep track of the elapsed
# time in the game and to access random number functions.  The uppercase suffix
# normally indicates a C++ program, so it is overridden.  That way, "make clean"
# will not remove the two C programs which must be kept.

gettim.o: gettim.C
	$(CC) -O -x c -c gettim.C

random.o: random.C
	$(CC) -O -x c -c random.C

libdungeon.a:	gdt.o objects.o rooms.o timefnc.o game.o machdep.o \
		parser.o subr.o verbs.o gettim.o random.o
	\rm -f libdungeon.a
	\ar rcuv libdungeon.a gdt.o objects.o rooms.o timefnc.o \
	game.o machdep.o parser.o subr.o verbs.o gettim.o random.o
	-\ranlib libdungeon.a

clean:
	-\rm -f *.c *.o libdungeon.a dungeon textcnv bin2txt textdata.dat
