# This program was written by Alexander Siegel in September of 1989   
# at Cornell University.  It may may copied freely for private use or 
# public dispersion provided that this comment is not removed.  This  
# program, any portion of this program, or any derivative of this     
# program may not be sold or traded for financial gain.

# Name of game executable
GAME = xgolddig
# Name of level editor executable
EDITOR = makelev
# Directory where games binaries are stored
#BIN = /usr/public/${HOSTTYPE}/games
BIN = /usr/bin/X11
# Directory where the library for this game will be stored
LIB = /usr/lib/X11/games/${GAME}
# Directory where manual pages are kept
MANEXT = 6
MAN = /usr/man/man${MANEXT}
# Font used to display score
SCOREFONT = -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1
# -adobe-times-bold-r-normal--18-180-75-75-p-99-iso8859-1
# Height of SCOREFONT
SCORESIZE = 15

# Common compilers
#CC = cc
CC = gcc

# Some common choices for CFLAGS.

CFLAGS = -O2 -mint -fomit-frame-pointer -fno-defer-pop -mpcrel
#CFLAGS = -O2 -W -Wreturn-type -Wunused -finline-functions -D__USE_BSD_SIGNAL 
#CFLAGS = -g
#LDFLAGS = -L /usr/X11/lib -lbsd -s
LDFLAGS = -lX11 -lank -lsocket

all: ${GAME} ${EDITOR}

install: all
	-mkdir ${LIB}
	cp ${GAME} ${EDITOR} ${BIN}
# The next line sets up the level files so that anyone can edit all of
# the levels.  Remove this line to have better security.
	chmod 4755 ${BIN}/${EDITOR}
	touch ${LIB}/scores
# Allow anyone to modify the high score file.  An alternative is to
# change the mode bits of ${GAME} to be 4755.
	chmod 666 ${LIB}/scores
	cp goldlev* default ${LIB}
	cp golddig.p ${MAN}/golddig.${MANEXT}

update: all
	cp ${GAME} ${EDITOR} ${BIN}
# The next line sets up the level files so that anyone can edit all of
# the levels.  Remove this line to have better security.
	chmod 4755 ${BIN}/${EDITOR}

clean:
	rm -f *.o *~ bitmap/*~ core ${GAME} ${EDITOR}

SRCS = golddig.c shared.c badguy.c movement.c scores.c
OBJS = golddig.o shared.o badguy.o movement.o scores.o

lint:
	lint -DLIB=\"${LIB}\" -DSCOREFONT=\"${SCOREFONT}\" \
                       -DSCORESIZE=${SCORESIZE} ${SRCS}

${GAME}: ${OBJS}
	${CC} -o ${GAME} ${OBJS} ${LDFLAGS}

${EDITOR}: makelev.o shared.o
	${CC} -o ${EDITOR} makelev.o shared.o ${LDFLAGS}

.c.o:
	${CC} ${CFLAGS} -c '-DLIB="${LIB}"' '-DSCOREFONT="${SCOREFONT}"' \
                       -DSCORESIZE=${SCORESIZE} $<
