# Makefile 15.1 06/08/90 10:03:56
DTREKDIR = /usr/local/games/lib/dtrek
DTREKOWNER = daemon
DTREKGROUP = other
DTREK_GAME = dtrek
DTREK_ROBOT = dtrek_robot
DTREK_DAEMON = dtrek_daemon
DTREK_SCORES = dtrek_scores
DTREK_SHIPMENU = dtrek_shipmenu
EXECUTABLES = \
	$(DTREK_GAME) \
	$(DTREK_ROBOT) \
	$(DTREK_DAEMON) \
	$(DTREK_SCORES) \
	$(DTREK_SHIPMENU) 

DTREK_OBJS = \
		colors.o \
		coup.o \
		damw.o \
		data.o \
		death.o \
		dmessage.o \
		enter.o \
		gcontrol.o \
		general.o \
		getship.o \
		inform.o \
		input.o \
		interface.o \
		keymap.o \
		main.o \
		mode.o \
		newwin.o \
		orbit.o \
		phaser.o \
		planetlist.o \
		playerlist.o \
		pmessage.o \
		pstats.o \
		redraw.o \
		search.o \
		sintab.o \
		smessage.o \
		startdmn.o \
		stats.o \
		torp.o \
		util.o \
		war.o \
		warwin.o \
		warning.o \
		xdata.o

DAEMON_OBJS = \
		damage.o \
		data.o \
		daemon.o \
		general.o \
		orbit.o \
		planets.o \
		pmessage.o \
		repair.o \
		search.o \
		sintab.o \
		sphere.o \
		startdmn.o \
		vortex.o 

ROBOT_OBJS = \
		data.o \
		enter.o \
		gcontrol.o \
		general.o \
		getship.o \
		phaser.o \
		pmessage.o \
		robot.o \
		rmove.o \
		search.o \
		sintab.o \
		startdmn.o \
		torp.o \
		util.o \
		xdata.o

SHIPMENU_OBJS = \
		data.o \
		general.o \
		shipmenu.o 

SCORES_OBJS = \
		data.o \
		general.o \
		scores.o 

RDPLANETS_OBJS = \
	rdplanets.o \
	general.o \
	planets.o \
	data.o \
	sintab.o 

DTREK_FILES = $(DTREK_OBJS:.o=.c)
DAEMON_FILES = $(DAEMON_OBJS:.o=.c)
ROBOT_FILES = $(ROBOT_OBJS:.o=.c)
SHIPMENU_FILES = $(SHIPMENU_OBJS:.o=.c)
SCORES_FILES = $(SCORES_OBJS:.o=.c)

LIBS = -lX11 -lm

LOCALFLAGS=
OPTFLAGS=
FFLAGS= `hp9000s300&&echo "-Wc,-Nd4000,-Ns3000 +O1"||true`
CFLAGS = -DHPUX7 $(OPTFLAGS) $(FFLAGS) $(LOCALFLAGS) -DXTREK_OWNER=\"$(DTREKOWNER)\"

all: $(EXECUTABLES)

$(DTREK_GAME): $(DTREK_OBJS)
	@- rm -f $(DTREK_GAME)
	cc $(CFLAGS) -o $(DTREK_GAME) $(DTREK_OBJS) $(LIBS)
	-chmod 4711 $(DTREK_GAME)
	-chmod 4711 $(DTREKDIR)/$(DTREK_GAME)
	-chgrp $(DTREKGROUP) $(DTREKDIR)/$(DTREK_GAME)
	-chown $(DTREKOWNER) $(DTREKDIR)/$(DTREK_GAME)

$(DTREK_DAEMON): $(DAEMON_OBJS)
	@- rm -f $(DTREK_DAEMON)
	cc $(CFLAGS) -o $(DTREK_DAEMON) $(DAEMON_OBJS) $(LIBS) 
	-chmod 4711 $(DTREK_DAEMON)
	-chmod 4711 $(DTREKDIR)/$(DTREK_DAEMON)
	-chgrp $(DTREKGROUP) $(DTREKDIR)/$(DTREK_DAEMON)
	-chown $(DTREKOWNER) $(DTREKDIR)/$(DTREK_DAEMON)

$(DTREK_ROBOT): $(ROBOT_OBJS)
	@- rm -f $(DTREK_ROBOT)
	cc $(CFLAGS) -o $(DTREK_ROBOT) $(ROBOT_OBJS) $(LIBS)
	-chmod 4711 $(DTREK_ROBOT)
	-chmod 4711 $(DTREKDIR)/$(DTREK_ROBOT)
	-chgrp $(DTREKGROUP) $(DTREKDIR)/$(DTREK_ROBOT)
	-chown $(DTREKOWNER) $(DTREKDIR)/$(DTREK_ROBOT)

$(DTREK_SHIPMENU): $(SHIPMENU_OBJS)
	@- rm -f $(DTREK_SHIPMENU)
	cc $(CFLAGS) -o $(DTREK_SHIPMENU) $(SHIPMENU_OBJS) $(LIBS)
	-chmod 4711 $(DTREKDIR)/$(DTREK_SHIPMENU)
	-chgrp $(DTREKGROUP) $(DTREKDIR)/$(DTREK_SHIPMENU)
	-chown $(DTREKOWNER) $(DTREKDIR)/$(DTREK_SHIPMENU)

$(DTREK_SCORES): $(SCORES_OBJS)
	@- rm -f $(DTREK_SCORES)
	cc -o $(DTREK_SCORES) $(SCORES_OBJS) $(LIBS)
	-chmod 755 $(DTREK_SCORES)
	-chgrp $(DTREKGROUP) $(DTREK_SCORES)
	-chown $(DTREKOWNER) $(DTREK_SCORES)

rdplanets: rdplanets.c $(RDPLANETS_OBJS)
	cc -o rdplanets $(RDPLANETS_OBJS) -lm

install: $(EXECUTABLES)
	-chmod 4711 $(DTREK_GAME)
	-cp -p $(DTREK_GAME) $(DTREKDIR)/$(DTREK_GAME)
	-chmod 4711 $(DTREKDIR)/$(DTREK_GAME)
	-chgrp $(DTREKGROUP) $(DTREKDIR)/$(DTREK_GAME)
	-chown $(DTREKOWNER) $(DTREKDIR)/$(DTREK_GAME)
	-chmod 4711 $(DTREK_DAEMON)
	-cp -p $(DTREK_DAEMON) $(DTREKDIR)/$(DTREK_DAEMON)
	-chmod 4711 $(DTREKDIR)/$(DTREK_DAEMON)
	-chgrp $(DTREKGROUP) $(DTREKDIR)/$(DTREK_DAEMON)
	-chown $(DTREKOWNER) $(DTREKDIR)/$(DTREK_DAEMON)
	-chmod 4711 $(DTREK_ROBOT)
	-cp -p $(DTREK_ROBOT) $(DTREKDIR)/$(DTREK_ROBOT)
	-chmod 4711 $(DTREKDIR)/$(DTREK_ROBOT)
	-chgrp $(DTREKGROUP) $(DTREKDIR)/$(DTREK_ROBOT)
	-chown $(DTREKOWNER) $(DTREKDIR)/$(DTREK_ROBOT)
	-chmod 4711 $(DTREK_SHIPMENU)
	-cp -p $(DTREK_SHIPMENU) $(DTREKDIR)/$(DTREK_SHIPMENU)
	-chmod 4711 $(DTREKDIR)/$(DTREK_SHIPMENU)
	-chgrp $(DTREKGROUP) $(DTREKDIR)/$(DTREK_SHIPMENU)
	-chown $(DTREKOWNER) $(DTREKDIR)/$(DTREK_SHIPMENU)
	-cp -p $(DTREK_SCORES) $(DTREKDIR)/$(DTREK_SCORES)
	-touch $(DTREKDIR)/.planets $(DTREKDIR)/.motd 
	-chmod 644 $(DTREKDIR)/.motd
	-chmod 644 $(DTREKDIR)/.planets
	-chown $(DTREKOWNER) $(DTREKDIR)/.planets $(DTREKDIR)/.motd 
	-chgrp $(DTREKGROUP) $(DTREKDIR)/.planets $(DTREKDIR)/.motd 
	
lint:
	lint -abchp $(DTREK_FILES)

clean:
	-rm -f *.o core a.out $(EXECUTABLES)


###

XHEADERS= \
	/usr/include/X11R4/X11/Xlib.h \
	/usr/include/X11R4/X11/Xutil.h \
	xdata.h

STDIO = /usr/include/stdio.h

DTREK_HEADERS = \
	data.h		\
	defs.h  	\
	message.h  	\
	phaser.h  	\
	planet.h	\
	player.h  	\
	ship.h  	\
	shmem.h		\
	stats.h  	\
	status.h  	\
	system.h  	\
	torp.h  	\
	weapon.h 

colors.o: $(STDIO) $(XHEADERS) /usr/include/string.h defs.h 
coup.o: $(STDIO) $(DTREK_HEADERS)
daemon.o: $(STDIO) /usr/include/sys/types.h \
		/usr/include/sys/ipc.h /usr/include/sys/shm.h \
		/usr/include/fcntl.h /usr/include/sys/file.h \
		/usr/include/sys/ioctl.h /usr/include/signal.h \
		/usr/include/sys/signal.h /usr/include/setjmp.h \
		/usr/include/time.h $(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c daemon.c
damage.o: $(STDIO) $(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c damage.c
damw.o: $(STDIO) $(DTREK_HEADERS)
data.o: $(STDIO) $(DTREK_HEADERS) /usr/include/sys/param.h
death.o: $(XHEADERS) \
		$(STDIO) /usr/include/signal.h /usr/include/setjmp.h \
		/usr/include/sys/types.h /usr/include/time.h \
		$(DTREK_HEADERS)
dmessage.o: $(XHEADERS) $(STDIO) $(DTREK_HEADERS)
enter.o: \
		/usr/include/sys/types.h $(STDIO) \
		/usr/include/sys/ipc.h /usr/include/sys/shm.h \
		/usr/include/errno.h /usr/include/pwd.h /usr/include/ctype.h \
		$(DTREK_HEADERS)
gcontrol.o: /usr/include/time.h $(STDIO) $(DTREK_HEADERS) filenames.h \
		/usr/include/ndir.h /usr/include/sys/param.h
general.o: $(STDIO) /usr/include/sys/types.h \
		/usr/include/sys/param.h /usr/include/sys/signal.h \
		/usr/include/sys/times.h /usr/include/sys/time.h \
		/usr/include/sys/resource.h /usr/include/time.h \
		$(DTREK_HEADERS) /usr/include/errno.h filenames.h
	$(CC) -DIS_DAEMON $(CFLAGS) -c general.c
getship.o: $(STDIO) $(DTREK_HEADERS) /usr/include/sys/time.h \
		/usr/include/time.h $(XHEADERS)
inform.o: $(XHEADERS) $(STDIO) $(DTREK_HEADERS) /usr/include/time.h
input.o: $(XHEADERS) \
		$(STDIO) /usr/include/sys/types.h \
		/usr/include/time.h /usr/include/signal.h /usr/include/errno.h \
		$(DTREK_HEADERS)
interface.o: $(STDIO) $(DTREK_HEADERS)
keymap.o: $(XHEADERS) $(STDIO) defs.h \
		/usr/include/X11R4/X11/keysym.h /usr/include/X11R4/X11/keysymdef.h 
main.o: $(XHEADERS) \
		$(STDIO) /usr/include/string.h \
		/usr/include/sys/types.h /usr/include/time.h \
		/usr/include/signal.h /usr/include/setjmp.h /usr/include/pwd.h \
		$(DTREK_HEADERS)
mode.o:  $(XHEADERS) $(STDIO) $(DTREK_HEADERS)
newwin.o: $(XHEADERS) $(STDIO) /usr/include/math.h \
		/usr/include/sys/types.h /usr/include/time.h \
		$(DTREK_HEADERS)
orbit.o: $(STDIO) $(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c orbit.c
phaser.o: $(STDIO) $(DTREK_HEADERS) daemon.h
planetlist.o: $(XHEADERS) $(STDIO) $(DTREK_HEADERS) /usr/include/time.h
planets.o: $(STDIO) /usr/include/sys/types.h /usr/include/sys/stat.h \
		/usr/include/time.h /usr/include/fcntl.h \
		/usr/include/sys/file.h /usr/include/sys/ioctl.h \
		$(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c planets.c
playerlist.o: $(XHEADERS) $(STDIO) $(DTREK_HEADERS)
pmessage.o: $(STDIO) $(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c pmessage.c
pstats.o: $(XHEADERS) \
		$(STDIO) /usr/include/sys/types.h /usr/include/time.h \
		/usr/include/fcntl.h /usr/include/sys/resource.h \
		/usr/include/sys/file.h \
		$(DTREK_HEADERS)
redraw.o: $(XHEADERS) $(STDIO) $(DTREK_HEADERS) bitmaps.h daemon.h
repair.o: $(STDIO) $(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c repair.c
rmove.o: $(STDIO) /usr/include/signal.h \
		/usr/include/math.h \
		$(DTREK_HEADERS)
robot.o: $(STDIO) /usr/include/sys/types.h \
		/usr/include/time.h /usr/include/signal.h \
		/usr/include/setjmp.h /usr/include/pwd.h \
		$(DTREK_HEADERS)
scores.o: $(STDIO) /usr/include/fcntl.h /usr/include/sys/types.h \
		/usr/include/sys/stat.h /usr/include/sys/file.h \
		/usr/include/pwd.h /usr/include/time.h \
		$(DTREK_HEADERS)
search.o: $(STDIO) $(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c search.c
shipmenu.o: $(STDIO) /usr/include/sys/time.h \
		/usr/include/sys/param.h /usr/include/fcntl.h \
		/usr/include/X11R4/X11/X.h /usr/include/X11R4/X11/Xlib.h \
		/usr/include/X11R4/X11/StringDefs.h /usr/include/X11R4/X11/Intrinsic.h \
		/usr/include/sys/stat.h $(DTREK_HEADERS) daemon.h \
		/usr/include/pwd.h
sintab.o:  $(STDIO) defs.h
	$(CC) -DIS_DAEMON $(CFLAGS) -c sintab.c
smessage.o: $(XHEADERS) $(STDIO) $(DTREK_HEADERS) /usr/include/ctype.h
sphere.o: $(STDIO) $(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c sphere.c
startdmn.o: $(STDIO) $(XHEADERS) $(DTREK_HEADERS) daemon.h
	$(CC) -DIS_DAEMON $(CFLAGS) -c startdmn.c
stats.o: $(XHEADERS) \
		/usr/include/X11R4/X11/X10.h $(STDIO) \
		$(DTREK_HEADERS)
torp.o: $(STDIO) $(DTREK_HEADERS)
util.o: $(XHEADERS) $(STDIO) $(DTREK_HEADERS)
war.o:  $(STDIO) $(DTREK_HEADERS)
warwin.o:  $(XHEADERS) $(STDIO) $(DTREK_HEADERS)
warning.o: $(XHEADERS) $(STDIO) $(DTREK_HEADERS)
vortex.o: $(STDIO) $(DTREK_HEADERS)
	$(CC) -DIS_DAEMON $(CFLAGS) -c vortex.c
xdata.o: $(XHEADERS) 
