# Generated automatically from Makefile.in by configure.
#
# Makefile for TkMail 4.0
#
# Paul Raines (raines@slac.stanford.edu)
# 		Hacked from Makefile for TkMan from Tom Phelps
#
SHELL = /bin/sh

#----------------------------------------------------------------------
# Basic compiler and installation (as found by configure script)

# Default top-level directories in which to install architecture-
# specific files (exec_prefix) and machine-independent files such
# as scripts (prefix).  The values specified here may be overridden
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.

prefix =                /usr
exec_prefix =           ${prefix}

# A "-I" switch that can be used when compiling to make all of the
# X11 include files accessible (the configure script will try to
# set this value, and will cause it to be an empty string if the
# include files are accessible via /usr/include).
X11_INCLUDES =          -I/usr/X11R6/include


#----------------------------------------------------------------
# The information below is modified by the configure script when
# Makefile is generated from Makefile.in.  You shouldn't normally
# modify any of this stuff by hand.
#----------------------------------------------------------------

SRC_DIR =               .
TOP_DIR =               ./..
INSTALL = 		$(TOP_DIR)/install-sh -c

#------------------------------------------------------------------------------
# Include user-editable defines.
#------------------------------------------------------------------------------

include ${TOP_DIR}/Config.mk

#------------------------------------------------------------------------------
# Support Programs
#------------------------------------------------------------------------------

# Location of wish binary with the mfv extension.
# Most systems seem to require a fully qualified pathname
WISH = $(BIN_DIR)/mfv_wish

# Location of dotlock binary
DOTLOCK = $(BIN_DIR)/dotlock

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

srcs = tkmail
objs = settings
libs = compose.tk mail.tk ispell.tk help.txt file.tcl \
	altedit.tk fancylb.tk pen.xbm list.xbm note.xbm \
	mime.tk viewer.tcl utils.tk options.tk \
	options2.tk tclIndex
aux = example.tkmail4rc 
support = ../README Makefile ChangeLog newvar.sed
distrib = $(srcs) $(libs) $(aux) $(support)
work = TAGS 

tcllibs = compose.tk mail.tk ispell.tk file.tcl \
	altedit.tk fancylb.tk mime.tk viewer.tcl utils.tk \
	options.tk options2.tk

ndxlibs = mail.tk compose.tk ispell.tk mime.tk options.tk \
	options2.tk utils.tk file.tcl

tkbindfiles = ChangeLog README bindxtnd.tcl dsearch.tcl emacs.list \
	entry.tcl example.tkbindrc isearch.tcl prompt.tcl \
	rectangle.tcl text.tcl tkBindTest text/base.tcl text/emacs.tcl \
	entry/base.tcl entry/emacs.tcl

all: ispell.tk altedit.tk settings tkmail

tags:
	tcltags $(tcllibs)

tkmail: Makefile
	mv tkmail tkmail.src
	echo '#! $(WISH)' > tkmail
	echo ' ' >> tkmail
	echo 'set mfp(tkmaillib) $(TKMAIL_DIR)' >> tkmail
	echo 'set mfp(bindlib) $(TKBIND_DIR)' >> tkmail
	echo 'set mfp(version) $(VERSION)' >> tkmail
	echo 'set mfp(dotlock) $(DOTLOCK)' >> tkmail
	tail +7 tkmail.src >> tkmail
	chmod +x tkmail
	rm tkmail.src

altedit.tk: Makefile
	mv altedit.tk altedit.tk.src
	echo '#! $(WISH)' > altedit.tk
	tail +2 altedit.tk.src >> altedit.tk
	chmod +x altedit.tk
	rm altedit.tk.src

ispell.tk: Makefile
	mv ispell.tk ispell.tk.src
	echo 'global tkisp' > ispell.tk
	echo 'set tkisp(ispell_lib) $(ISPELLLIB)' >> ispell.tk
	echo 'set tkisp(binary) $(ISPELLPROG)' >> ispell.tk
	echo 'set tkisp(version) $(VERSION)' >> ispell.tk
	tail +5 ispell.tk.src >> ispell.tk
	rm ispell.tk.src

settings: Makefile
	rm -f settings
	echo '# TkMail global settings file' > settings
	echo 'global mf mfp env' >> settings
	echo '' >> settings
	echo '# name of mail delivery command' >> settings
	echo 'set mf(mail-deliver) "$(DELIVER)"' >> settings
	echo '' >> settings
	echo '# whether or not you have ispell' >> settings
	echo 'set mf(ispell-present) $(HAVEISPELL)' >> settings
	echo '# print command (%F is file placeholder)' >> settings
	echo 'set mf(viewer-print) "$(PRINTCMD)"' >> settings
	echo '# temporary directory' >> settings
	echo 'set mf(mail-tmpdir) $(TMPDIR)' >> settings
	echo '# bitmaps' >> settings
	echo 'set mf(viewer-bitmap-nomail) $(BITMAPDIR)/flagdown' >> settings
	echo 'set mf(viewer-bitmap-mail) $(BITMAPDIR)/flagup' >> settings
	echo 'set mf(compose-icon-bitmap) $(BITMAPDIR)/letters' >> settings

install: install.tkmail install.tkbind

install.tkmail: settings tkmail $(libs) $(aux) Makefile
# WARNING: the following "if" clause will move any existing TKMAIL_DIR to ${TKMAIL_DIR}.old
	@if [ -d $(TKMAIL_DIR) ]; then \
	  rm -rf $(TKMAIL_DIR).old; \
	  mv -f $(TKMAIL_DIR) $(TKMAIL_DIR).old; \
	  mkdir $(TKMAIL_DIR); \
	else (set -x; mkdir $(TKMAIL_DIR)); fi
	chmod 755 $(TKMAIL_DIR)
	for f in $(libs) $(aux) $(objs) ; do \
	  $(INSTALL) $$f $(TKMAIL_DIR) ; \
	done
	chmod 755 $(TKMAIL_DIR)/altedit.tk
	if [ -r $(BIN_INSTALL_DIR)/$(TKMAIL) ]; then \
	  mv -f $(BIN_INSTALL_DIR)/$(TKMAIL) $(BIN_INSTALL_DIR)/$(TKMAIL).old; \
        fi
	$(INSTALL) tkmail $(BIN_INSTALL_DIR)/$(TKMAIL)
	chmod 755 $(BIN_INSTALL_DIR)/$(TKMAIL)

install.tkbind:
	@if [ -d $(TKBIND_DIR) ]; then \
	  rm -rf $(TKBIND_DIR).old; mv -f $(TKBIND_DIR) $(TKBIND_DIR).old; \
	  mkdir $(TKBIND_DIR); \
	else (set -x; mkdir $(TKBIND_DIR)); fi
	chmod 755 $(TKBIND_DIR)
	@if [ ! -d $(TKBIND_DIR)/text ]; then \
	  mkdir $(TKBIND_DIR)/text; \
	fi
	chmod 755 $(TKBIND_DIR)/text
	@if [ ! -d $(TKBIND_DIR)/entry ]; then \
	  mkdir $(TKBIND_DIR)/entry; \
	fi
	chmod 755 $(TKBIND_DIR)/entry
	for f in $(tkbindfiles) ; do \
	  $(INSTALL) ../tkbind/$$f $(TKBIND_DIR)/$$f ; \
	done

index:
	tclndx . $(ndxlibs)

clean:
	rm -rf settings

distclean: clean
	rm -rf Makefile

