
# Makefile for tkxpilots-2.0

# Where is wish installed (path and filename) ?
WISH = /usr/local/bin/wish

# Common prefix for installation.
PREFIX = /users/avatar

# Directory where tkxpilots and maps2image is to be installed.
BINDIR = $(PREFIX)/bin

# Where do you want the manpage?
# Assuming that someone is actually going to bother reading it. ;-)
MANDIR = $(PREFIX)/man/man1

# Where are the xpilot maps on this system?
MAPDIR = /usr/local/bin/xpilot/maps

# What is the default frames per second that you run your server at?
FRAMES = 16

# Directory to put the temporary file of list server  ?
TEMPDIR = /users/avatar

# Adress of the non-interactive meta-server (with port number)
METASERVER = xpilot.cs.uit.no 4401

# Path and filename of the xpilot default file
DEFAULT = /usr/local/bin/xpilot/defaults

# Map to charge by default
MAP = globe.map

# Which flavour install program do we like best. If all else fails try cp.
INSTALL = cp

all: tkxpilots tkxpilots.1 maps2image

tkxpilots: src/tkxpilots
	(sed -e 's;WISH;$(WISH);' \
        -e 's;FRAMES;$(FRAMES);' \
	-e 's;MAPDIR;$(MAPDIR);' \
	-e 's;TEMPDIR;$(TEMPDIR);' \
	-e 's;DEFAULT;$(DEFAULT);' \
	-e 's;MAP;$(MAP);' \
	-e 's;METASERVER;$(METASERVER);' src/tkxpilots > tkxpilots;\
	chmod u+x tkxpilots)

tkxpilots.1: src/tkxpilots.1
	(sed -e 's;MAPDIR;$(MAPDIR);' src/tkxpilots.1 > tkxpilots.1)

maps2image :
	cd map2image; make all

install: install.tkxpilots install.man install.maps2image

install.tkxpilots: tkxpilots
	$(INSTALL) tkxpilots $(BINDIR) ; chmod 700 $(BINDIR)/tkxpilots

install.man: tkxpilots.1
	$(INSTALL) tkxpilots.1 $(MANDIR)

install.maps2image: map2image/maps2image
	$(INSTALL) map2image/maps2image $(BINDIR) ; chmod 700 $(BINDIR)/maps2image

clean:
	rm -f tkxpilots tkxpilots.1
	cd map2image ; make clean
