#
# 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 7.4/Tk 4.0 or later
WISH = /usr/local/bin/wish

# 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-4.0beta9 or greater, you can use the same library
# if you have tkmail-2.0 or less, you must use the included lib files
# LIBDIR = /usr/local/lib/tkmail

# directory where the tkBindExtended files are (OPTIONAL)
BINDDIR = /usr/local/lib/tkispell

# 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

# name of ispell binary ( use full pathname if not in your PATH )
BINARY = ispell


# Whether your ispell requires an adjustment to returned offsets.
# Otherwise, mispelled words will be highlighted wrong. To test for
# this type at the command line
#       ispell -a
#       !
#       ^What is not Waht
# If you get the output '& Waht 10 12: ...', you need no adjustment
# If you get the output '& Waht 12 13: ...', you do need the adjustment
OFFADJ = 1

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

version = 4.0
src = tkispell 
libs =  utils.tk ispell.tk
aux =  README 
support =  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
	echo 'set tkisp_ed(bindlib) $(BINDDIR)' >> tkispell
	echo 'set tkisp_ed(version) $(version)' >> tkispell
	tail +6 tkispell.src >> tkispell
	chmod +x tkispell
	rm tkispell.src

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
	echo 'set tkisp(binary) $(BINARY)' >> ispell.tk
	echo 'set tkisp(adj_offset) $(OFFADJ)' >> ispell.tk
	echo 'set tkisp(version) $(version)' >> ispell.tk
	tail +7 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 $(libs) $(aux) Makefile
	@if [ -d $(LIBDIR) ]; then set +x; \
	else (set -x; mkdir $(LIBDIR)); fi
	cp $(libs) $(aux) $(LIBDIR)

install:
	echo Use either install.bin or install.all

libclean:
	rm -rf $(libs)

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)
	gzip 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
