# tkxpilots Version 2.0pl0 - funky interface to xpilots
# Copyright (C) 1993-1994 Richard Oak.
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Makefile for tkxpilots-2.0
#

# Where is wish installed?
WISH = /local/kavern/bin/wish

# Where is perl installed?
PERL = /local/bin/perl

# Common prefix for installation.
PREFIX = /local/kavern

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

# Directory for the tkxpilots library files
LIBDIR = $(PREFIX)/X11/lib/tkxpilots

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

# Where are the xpilots library files kept?
XPILOT = $(PREFIX)/X11/lib/xpilot

# Where are the xpilot maps?
MAPDIR = $(XPILOT)/maps

# Where is the message of the day?
MOTD = $(XPILOT)/motd

# Where is the defaults file?
DEFAULTS = $(XPILOT)/defaults

# Full path to default map.
MAPNAME = $(MAPDIR)/globe.map.gz

# Temp directory for the map images to be stored. Set this to something other
# than tmp to keep the images.
TMPDIR = /tmp

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

all: tkxpilots maptoxbm

tkxpilots: src/tkxpilots
	(sed -e 's;WISH;$(WISH);' \
        -e 's;DEFAULTS;$(DEFAULTS);' \
        -e 's;MAPDIR;$(MAPDIR);' \
        -e 's;MOTD;$(MOTD);' \
        -e 's;MAPNAME;$(MAPNAME);' \
	-e 's;LIBDIR;$(LIBDIR);' \
        -e 's;TMPDIR;$(TMPDIR);' \
	-e 's;MAPDIR;$(MAPDIR);' src/tkxpilots > tkxpilots;\
	chmod ugo+x tkxpilots)

maptoxbm: src/maptoxbm
	(sed -e 's;PERL;$(PERL);' src/maptoxbm > lib/maptoxbm; \
	chmod ugo+x lib/maptoxbm)

install: install.tkxpilots install.man install.lib

install.lib::
	@if [ ! -d $(LIBDIR) ]; then \
	mkdir $(LIBDIR) ; \
	fi
	@cd lib/; cp -r * $(LIBDIR);

install.tkxpilots: tkxpilots
	$(INSTALL) tkxpilots $(BINDIR)

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

clean:
	rm -f tkxpilots lib/maptoxbm
