# this is a very simple Makefile for installation of purchase.
PURCHASE_VERSION = 1.6
PURCHASE = purchase-$(PURCHASE_VERSION)

# The wish executable: should have the BLT widget linked in if you want nice plots
WISH = /usr/bin/X11/wish

# the command to spool a file for printing
LPRCOMMAND = lpr -P5

# Directories for scripts/binaries and for bitmaps; 
BINDIR = /usr/local/bin
SRCDIR = /usr/local/lib/tk

# The install program. Default  'install' would work except on IRIX, where bsdinst should be used
INSTALL = install -c

default:
	@echo "Edit the Makefile and type 'make install' to install purchase"

install:
	sed -e 's.^#\!/usr/local/bin/wish.#\!$(WISH).' < purchase  | \
	sed -e 's.lpr -P5.$(LPRCOMMAND).'              > purchase.temporary
	$(INSTALL) -m 755 purchase.temporary $(BINDIR)/purchase
	rm -f purchase.temporary
	$(INSTALL) -m 644 fileselector.tcl $(SRCDIR)
	echo Do not forget to append gp_ lines to $(SRCDIR)/tclIndex

purchase.dvi: purchase.tex
	latex purchase.tex
purchase.ps: purchase.dvi
	dvips -o purchase.ps purchase.dvi
printdoc: purchase.ps
	lpr purchase.ps

# this assumes that purchase files are in directory ...../purchase-$(PURCHASE_VERSION)
distribution:
	(cd ..;tar -cvf $(PURCHASE)/$(PURCHASE).tar $(PURCHASE)/{README,INSTALL,purchase{.w,.tex,.ps,},Makefile,fileselector.tcl})
