# Makefile for Phantasia 3.2
#
# MODIFIED TO COMPILE WITHOUT 'XSTR'.
#
# To create game:
#
# 1)  Set up a directory where the game and its support files will live.
#        (It is suggested that the source be kept somewhere else.)
# 2)  Set up the variables in Makefile to reflect your particular situation.
# 3)  Check out ok_to_play() at the end of main.c if you want to include
#        code to restrict access at certain times.
# 4)  'make install' and watch it fly.

#XSTR =		/t2/estes/bin/xstr
RM =		-rm

# Add '-ljobs' to LIBS if 4.1bsd
LIBS =		-lm -lcurses -ltermlib
# May need '-I/usr/include/sys' for 4.2bsd
CFLAGS =	-O -I. -Dpdp11

# DEST is where the program and its support files reside
DEST =		/usr/games/lib/phant

# The following are program constants which are implementation dependent.
#
# PATH is the same as $DEST.
# WIZARD is the login of the one who will clean up things.
# UID is the uid of game wizard.
# RAND is one more than the largest number generated by rand().
#	Possible values for this are:
#		32768.0		(for 15 bit rand())
#		65536.0		(for 16 bit rand())
#		2147483648.0	(for 31 bit rand())
# ACCESS is fopen() access to open a file for writing, but no
#	clearing the file,  e.g. "a", or "r+".  (Use "r+" if you have it.)
# define OK_TO_PLAY to restrict playing access.  Also see function ok_to_play()
#	in main.c, and tailor to your own needs.
# define ENEMY to include code for checking of a 'hit list' of resricted 
#	accounts.  The list of logins goes in the file 'enemy'.
# define BSD41 for 4.1bsd
# define BSD42 for 4.2bsd
# define USG3 for System III, or similar
# define USG5 for System V
FLAGS = 	-DPATH=\"${DEST} \
		-DWIZARD=\"romine\" \
		-DUID=100 \
		-DRAND=2147483648.0 \
		-DACCESS=\"r+\" \
		-DBSD42

OFILES =	main.o fight.o func0.o func1.o func2.o

all:		phantasia setfiles phant.help

# need separate i/d space on small machines
#phantasia:	${OFILES} strings.o
phantasia:	${OFILES}
#		${CC} ${OFILES} strings.o ${LIBS} -o phantasia
		${CC} ${OFILES} ${LIBS} -o phantasia

${OFILES}:	phant.h
#		${CC} -E ${CFLAGS} ${FLAGS} $*.c | ${XSTR} -c -
		${CC} -c ${CFLAGS} ${FLAGS} $*.c
#		${CC} -c ${CFLAGS} x.c
#		mv x.o $*.o

#strings.o:	${OFILES} strings
#		${XSTR}
#		${CC} -c xs.c
#		mv xs.o strings.o

setfiles:	phant.h setfiles.c
		${CC} ${CFLAGS} ${FLAGS} setfiles.c -o setfiles -lm

# the flags below on tbl and nroff are to make a line printable version
phant.help:	phant.nr
		tbl -TX phant.nr | nroff -man -Ttn300 > phant.help

install:	all
		cp phantasia monsters phant.help ${DEST}
		chmod 755 ${DEST}
		chmod 4711 ${DEST}/phantasia
		chmod 644 ${DEST}/phant.help
		setfiles

clean:
#		${RM} -f *.o phantasia phant.help strings x.c xs.c
		${RM} -f *.o phantasia phant.help
