2.11BSD/src/games/phantasia/Makefile

# Makefile for Phantasia 3.2 (1.2 2.11BSD - 1997/9/22)
#
# 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.

RM =		-rm

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

# DEST is where the program and its support files reside
#   If this changes then the symbolic link in the 'install' target must change.
DEST =		/usr/games/lib/phantasia

# 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=\"daemon\" \
		-DUID=1 \
		-DRAND=32768.0 \
		-DACCESS=\"r+\" \
		-DENEMY \
		-DBSD42

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

all:		phantasia setfiles phant.help phantasia.0

# need separate i/d space on small machines
#phantasia:	${OFILES} ${NOOPT} strings.o
phantasia:	${OFILES} ${NOOPT}
#		${CC} ${OFILES} ${NOOPT} strings.o ${LIBS} -o phantasia
		-if [ X${SEPFLAG} = "X-i" ]; then \
			${CC} main.o fight.o -Z func0.o -Z func1.o \
				-Z func2.o -Y ${LIBS} -i -o phantasia; \
		elif [ X${SEPFLAG} = "X-n" ]; then \
			@echo "Need overlay scheme (HA!)"; \
		else \
			${CC} ${OFILES} ${NOOPT} ${LIBS} -o phantasia; \
		fi

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

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

strings.o:	${OFILES} ${NOOPT} 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

# DO NOT use an absolute pathname in the symbolic link below.  Figure out
#   what the relative path is.

install:	all phantasia.0
	rm -f ${DESTDIR}/usr/games/phantasia
	ln -s lib/phantasia/phantasia ${DESTDIR}/usr/games/phantasia
	-mkdir ${DESTDIR}${DEST}
	cp phantasia monsters phant.help ${DESTDIR}${DEST}
	chmod 755 ${DESTDIR}${DEST}
	chmod 4711 ${DESTDIR}${DEST}/phantasia
	chmod 644 ${DESTDIR}${DEST}/phant.help
	./setfiles
	install -m 444 -o bin -g bin  phantasia.0 ${DESTDIR}/usr/man/cat6

phantasia.0: phant.nr
	/usr/man/manroff phant.nr > phantasia.0

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