#
# Makefile for XTrek
# $Header: /blackbird/home/jeff/TAPE2/xtrek.new/RCS/Makefile,v 3.1 88/09/20 00:46:55 jeff Exp $
#

# These are the directories that XTrek will be installed in
DESTDIR = /usr/local/bin/X11
LIBDIR = /usr/local/lib/X11/xtrek

# This is the directory where the man page will be installed
MANDIR = /usr/man/mann

# This is the suffix for the man page file, should probably be 6, n, or l
MANSUFFIX = n

# This is the owner of the xtrek files.  The daemon will be installed
# setuid to this user
XTREKOWNER = games

# This is the path of the X11 font compiler
FC = /usr/local/src/X.V11R2/fonts/compiler/fc

# This is the path of the X11 font directory
XFONTDIR = /usr/local/lib/X11/fonts

R_OBJS = colors.o \
		coup.o \
		data.o \
		death.o \
		detonate.o \
		dmessage.o \
		enter.o \
		getship.o \
		inform.o \
		input.o \
		interface.o \
		main.o \
		newwin.o \
		orbit.o \
		phaser.o \
		planetlist.o \
		playerlist.o \
		pstats.o \
		redraw.o \
		sintab.o \
		smessage.o \
		startdaemon.o \
		stats.o \
		torp.o \
		util.o \
		war.o \
		warning.o \
		x11utils.o \
		myatan.o

R_FILES = colors.c \
		coup.c \
		data.c \
		death.c \
		detonate.c \
		dmessage.c \
		enter.c \
		getship.c \
		inform.c \
		input.c \
		interface.c \
		main.c \
		newwin.c \
		orbit.c \
		phaser.c \
		planetlist.c \
		playerlist.c \
		pstats.c \
		redraw.c \
		sintab.c \
		smessage.c \
		startdaemon.c \
		stats.c \
		torp.c \
		util.c \
		war.c \
		warning.c \
		x11utils.c \
		myatan.c

D_OBJS =	daemon.o \
		sintab.o \
		data.o \
		myatan.o
#		random.o   -- put this back if you have a better rand()

r_OBJS =	data.o \
		detonate.o \
		enter.o \
		getship.o \
		interface.o \
		phaser.o \
		robot.o \
		rmove.o \
		sintab.o \
		startdaemon.o \
		torp.o \
		util.o \
		myatan.o

LIBS = -lX11 -loldX -lm

CFLAGS = -g -DDEBUG -DREMAP -I. -DLIBDIR=\"$(LIBDIR) -DFONTDIRHACK

all: xtrek daemon robot xtrek.snf

xtrek: $(R_OBJS)
	cc $(CFLAGS) -o xtrek $(R_OBJS) $(LIBS)
	chmod 4711 xtrek

daemon: $(D_OBJS)
	cc $(CFLAGS) -o daemon $(D_OBJS) -lm
	chmod 4711 daemon

robot: $(r_OBJS)
	cc $(CFLAGS) -o robot $(r_OBJS) $(LIBS)
	chmod 4711 robot

xtrek.snf: xtrek.bdf
	$(FC) xtrek.bdf > xtrek.snf

install: xtrek daemon robot xtrek.snf
	-mv $(DESTDIR)/xtrek $(DESTDIR)/xtrek.old
	cp xtrek $(DESTDIR)
	chmod 4711 $(DESTDIR)/xtrek
	chown $(XTREKOWNER) $(DESTDIR)/xtrek
	-mv $(LIBDIR)/daemon $(LIBDIR)/daemon.old
	cp daemon $(LIBDIR)
	chmod 4711 $(LIBDIR)/daemon
	chown $(XTREKOWNER) $(LIBDIR)/daemon
	-mv $(LIBDIR)/robot $(LIBDIR)/robot.old
	cp robot $(LIBDIR)
	chmod 4711 $(LIBDIR)/robot
	chown $(XTREKOWNER) $(LIBDIR)/robot
	touch $(LIBDIR)/.planets $(LIBDIR)/.motd $(LIBDIR)/.scores
	chown $(XTREKOWNER) $(LIBDIR)/.planets $(LIBDIR)/.motd \
	$(LIBDIR)/.scores
	chmod 644 $(LIBDIR)/.scores $(LIBDIR)/.motd
	chmod 600 $(LIBDIR)/.planets
	cp xtrek.6 $(MANDIR)/xtrek.$(MANSUFFIX)
	cp xtrek_ship.6 $(MANDIR)/xtrek_ship.$(MANSUFFIX)
	cp xtrek.me $(LIBDIR)
	cp xtrek.snf $(LIBDIR)
	-cp xtrek.snf $(XFONTDIR)/xtrek.snf
	
lint:
	lint -abchp ${R_FILES}

clean:
	-rm -f *.o core a.out xtrek daemon robot xtrek.snf

# DO NOT DELETE THIS LINE -- make depend depends on it.

colors.o: data.h
coup.o: defs.h xtrekfont.h struct.h data.h
daemon.o: defs.h xtrekfont.h struct.h data.h planets.h
data.o: defs.h xtrekfont.h struct.h data.h
death.o: defs.h xtrekfont.h struct.h data.h
detonate.o: defs.h xtrekfont.h struct.h data.h
dmessage.o: defs.h xtrekfont.h struct.h data.h
enter.o: defs.h xtrekfont.h struct.h data.h
getship.o: defs.h xtrekfont.h struct.h data.h
inform.o: defs.h xtrekfont.h struct.h data.h
input.o: defs.h xtrekfont.h struct.h data.h
interface.o: defs.h xtrekfont.h struct.h data.h
main.o: defs.h xtrekfont.h struct.h data.h
newwin.o: defs.h xtrekfont.h struct.h data.h bitmaps.h clock.bitmap
orbit.o: defs.h xtrekfont.h struct.h data.h
phaser.o: defs.h xtrekfont.h struct.h data.h
playerlist.o: defs.h xtrekfont.h struct.h data.h
pstats.o: defs.h xtrekfont.h struct.h data.h
redraw.o: defs.h xtrekfont.h struct.h data.h bitmaps.h
rmove.o: defs.h xtrekfont.h struct.h data.h
robot.o: defs.h xtrekfont.h struct.h data.h
scores.o: defs.h xtrekfont.h struct.h
smessage.o: defs.h xtrekfont.h struct.h data.h
startdaemon.o: defs.h xtrekfont.h struct.h data.h
stats.o: defs.h xtrekfont.h struct.h data.h
torp.o: defs.h xtrekfont.h struct.h data.h
util.o: defs.h xtrekfont.h struct.h data.h
war.o: defs.h xtrekfont.h struct.h data.h
warning.o: defs.h xtrekfont.h struct.h data.h
x11utils.o: data.h
