#
# Makefile for TkIspell
#
# Paul Raines (raines@bohr.physics.upenn.edu)
# 		Hacked from Makefile for TkMan from Tom Phelps
#

# This Makefile includes the most critical and site specific
# settings needed to run TkIspell. 

# # # SITE SETTINGS # # #

# wish must be compiled with Tcl 6.7/Tk 3.2 or later
WISH = /usr/local/bin/wish

# You can get this by typing 'info tclversion' in wish
TCLVERSION = 6.7
#TCLVERSION = 7.0

# directory to put *.tk support scripts
# this path will be added to the auto_path variable
LIBDIR = /usr/local/lib/tkispell
# if you have tkmail-1.6 or greater, you can use the same library
# LIBDIR = /usr/local/lib/tkmail

# directory to put tkispell executable script
BINDIR = /usr/local/bin

# Location of ispell hash files
ISPELLLIB = /usr/local/lib/ispell

# whether your version of ispell puts out an initial version line
# when you start it with 'ispell -a'. Set to 1 if you do, 0 if not.
ISPELLNEW = 1

#--------------------------------------------------
#
# you shouldn't modify anything below here
#
#--------------------------------------------------

version = 1.6
src = tkispell 
objs = tclIndex
libs =  utils.tk ispell.tk bindings.tk topgetopt.tcl
aux =  README 
support =  tclIndex.6.7 tclIndex.7.0 Makefile
bitmaps = 
distrib = $(src) $(libs) $(bitmaps) $(aux) $(support) 


all: ispell main


main:  $(libs) Makefile
	mv tkispell tkispell.src
	echo '#!$(WISH) -f' > tkispell
	echo 'global tkisp_ed' >> tkispell
	echo 'set tkisp_ed(lib) $(LIBDIR)' >> tkispell
	tail +4 tkispell.src >> tkispell
	chmod +x tkispell
	rm tkispell.src
	cp tclIndex.$(TCLVERSION) tclIndex

ispell: Makefile
	mv ispell.tk ispell.tk.src
	echo 'global tkisp' > ispell.tk
	echo 'set tkisp(ispell_lib) $(ISPELLLIB)' >> ispell.tk
	echo 'set tkisp(have_new) $(ISPELLNEW)' >> ispell.tk
	tail +4 ispell.tk.src >> ispell.tk
	rm ispell.tk.src

install.bin: $(src) Makefile
	@if [ -d $(BINDIR) ]; then set +x; \
	else (set -x; mkdir $(BINDIR)); fi
	cp tkispell $(BINDIR)

install.all: install.bin $(objs) $(libs) $(aux) Makefile
	@if [ -d $(LIBDIR) ]; then set +x; \
	else (set -x; mkdir $(LIBDIR)); fi
	cp $(objs) $(libs) $(aux) $(LIBDIR)

lib: ../tkmail
	cp ../tkmail/ispell.tk .
	cp ../tkmail/utils.tk .
	cp ../tkmail/bindings.tk .
	cp ../tkmail/topgetopt.tcl .
	tcl -c "source #work#/auto_mkindex.7.0; auto_mkindex . {*.{tk,tcl}}"
	mv tclIndex tclIndex.7.0
	tcl -c "source #work#/auto_mkindex.6.7; auto_mkindex . {*.{tk,tcl}}"
	mv tclIndex tclIndex.6.7

libclean:
	rm -rf $(libs) tclIndex.6.7 tclIndex.7.0

tar:
	rm -f tkispell*.tar.[zZ]*
	mkdir tkispell-$(version)
	cp -R $(distrib) tkispell-$(version)
	rm -rf tkispell-$(version)/test/CVS
	tar chvf tkispell-$(version).tar tkispell-$(version)
	compress tkispell-$(version).tar
#	gzip -9v tkispell-$(version).tar
	rm -rf tkispell-$(version)
	@echo "*** Did you remember to cvs commit first?"

uu: tar
	uuencode tkispell-$(version).tar.Z tkispell-$(version).tar.Z > tkispell-$(version).tar.Z.uu
