# X-BASED DINO
#
#	Makefile.std
#
###
#
#  Copyright (c) 1994 - 95	David Albert Bagley, bagleyd@source.asset.com
#
#                   All Rights Reserved
#
#  Permission to use, copy, modify, and distribute this software and
#  its documentation for any purpose and without fee is hereby granted,
#  provided that the above copyright notice appear in all copies and
#  that both that copyright notice and this permission notice appear in
#  supporting documentation, and that the name of the author not be
#  used in advertising or publicity pertaining to distribution of the
#  software without specific, written prior permission.
#
#  This program is distributed in the hope that it will be "playable",
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#

# Set your C compiler
#CC		= gcc
CC		= cc
#CC		= acc

LINT		= lint
#LINT		= alint

# Set your print command
PRINT		= lpr
#PRINT		= enscript -2r

# X include files
XINC		= -I/usr/local/include
#XINC		= -I/usr/include/X11R4
#XINC		= -I/usr/include/X11R5
#XINC		= -I${OPENWINHOME}/include
#XINC		= -I${MOTIFHOME}/include

# X libraries
XLIBPATH	= -L/usr/local/lib
#XLIBPATH	= -L/usr/lib/X11R4
#XLIBPATH	= -L/usr/lib/X11R5
#XLIBPATH	= -L${OPENWINHOME}/lib
#XLIBPATH	= -L${MOTIFHOME}/lib

# to use Motif (xm), uncomment
# XM include path, below is a guess
#XMINC		= -I/usr/local/include
#
# XM library, the path is a guess
#XMLIB		= -L/usr/local/lib -lXm
#XMLIB		= -lXm

wIDGET		= dino
WIDGET		= Dino
WIDGET2		= ${WIDGET}2d
WIDGET3		= ${WIDGET}3d

SCOREFILE	= ./${wIDGET}.scores
DATAFILE	= ./${wIDGET}.data

XPROGRAM	= x${wIDGET}
XMPROGRAM	= xm${wIDGET}
VER		= x${wIDGET}

COPT		= -O

DEFINES		= ${XMDEF}\
	 -DSCOREFILE=\"${SCOREFILE}\" -DDATAFILE=\"${DATAFILE}\"

INCLUDES	= ${XMINC} ${XINC}

CFLAGS		= ${COPT} ${DEFINES} ${INCLUDES}

LIBS		= ${XLIBPATH} ${XMLIB} -lXt -lX11

HDRS=\
		${WIDGET}.h\
		${WIDGET}P.h\
		${WIDGET2}.h\
		${WIDGET2}P.h\
		${WIDGET3}.h\
		${WIDGET3}P.h
SRCS=\
		rngs.c\
		${WIDGET}.c\
		${WIDGET2}.c\
		${WIDGET3}.c\
		${WIDGET}U.c
OBJS=\
		rngs.o\
		${WIDGET}.o\
		${WIDGET2}.o\
		${WIDGET3}.o\
		${WIDGET}U.o

#OBJS		= ${SRCS:.c=.o}


all:	${OBJS} ${XPROGRAM}.o
	${CC} -o ${XPROGRAM} ${OBJS} ${XPROGRAM}.o ${LIBS}

all.xm:	${OBJS} ${XMPROGRAM}.o
	${CC} -o ${XMPROGRAM} ${OBJS} ${XMPROGRAM}.o ${LIBS}

${WIDGET}.o:	${WIDGET}P.h ${WIDGET2}P.h ${WIDGET3}P.h ${WIDGET}.h

${WIDGET}U.o:	${WIDGET}P.h ${WIDGET2}P.h ${WIDGET3}P.h ${WIDGET}.h

${WIDGET2}.o:	${WIDGET}P.h ${WIDGET}.h ${WIDGET2}P.h ${WIDGET2}.h

${WIDGET3}.o:	${WIDGET}P.h ${WIDGET}.h ${WIDGET3}P.h ${WIDGET3}.h

${XPROGRAM}.o:	${WIDGET}.h ${WIDGET2}.h ${WIDGET3}.h

${XMPROGRAM}.o:	${WIDGET}.h ${WIDGET2}.h ${WIDGET3}.h

debug:	all
debug:=COPT=-g -DDEBUG -Wall

lint:
	${LINT} -ax -DLINT ${DEFINES} ${INCLUDES} ${SRCS}\
	${XPROGRAM}.c ${XMPROGRAM}.c

run:
	./${XPROGRAM}

run.xm:
	./${XMPROGRAM}

clean:
	rm -f *.o ${XPROGRAM} ${XMPROGRAM} core *~ *% *.bak make.log MakeOut

clean.all:	clean
	rm -f Makefile

tar:	clean.all
	cd .. ; tar cvf ${VER}.tar ${VER}/${WIDGET}.h ${VER}/${WIDGET}P.h\
		${VER}/${WIDGET}.c ${VER}/${XPROGRAM}.c ${VER}/${WIDGET}U.c\
		${VER}/${WIDGET2}.h ${VER}/${WIDGET2}P.h ${VER}/${WIDGET2}.c\
		${VER}/${WIDGET3}.h ${VER}/${WIDGET3}P.h ${VER}/${WIDGET3}.c\
		${VER}/README ${VER}/${wIDGET}.xbm ${VER}/${WIDGET}.ad\
		${VER}/Imakefile ${VER}/Makefile.std ${VER}/${VER}.man\
		${VER}/${wIDGET}.scores ${VER}/make.com ${VER}/rngs.c\
		${VER}/mouse-l.xbm ${VER}/mouse-m.xbm ${VER}/mouse-r.xbm\
		${VER}/${XMPROGRAM}.c

compress:	tar
	cd .. ; compress -f ${VER}.tar

gzip:	tar
	cd .. ; gzip -f ${VER}.tar

tgz:	tar
	cd .. ; gzip -c ${VER}.tar > `echo ${VER} | cut -c1-8`.tgz ;\
		rm -f ${VER}.tar

read:
	more README

man:
	nroff -man ${VER}.man | more

print:
	${PRINT} ${HDRS} ${SRCS}

install:	all
	install ${XPROGRAM} /usr/local/bin

install.xm:	all
	install ${XMPROGRAM} /usr/local/bin
