# Makefile for TkTeX, by N. Danner (ndanner@indiana.ed)

# RCS Id:
#	$Id: Makefile,v 1.3 1995/07/18 06:51:54 ndanger Exp $

# Set ROOT_DIR to the root directory for the installation ; usually something
# like /usr/local or maybe /usr/Tcl
ROOT_DIR=/usr/local
BIN_DIR=$(ROOT_DIR)/bin
LIB_DIR=$(ROOT_DIR)/lib/tk/tktex

# The path to your copy of tclsh ; this is needed so that the auto-loading
# index file can be created.
TCLSH=/usr/Tcl/bin/tclsh

# INSTALL should be set to the path of a GNU-style 'install' program; if it
# isn't, then you should also modify the options for INSTALL_... as appropriate
# for your install program.
INSTALL=/usr/bin/install
INSTALL_DIR=$(INSTALL) -m 0755 -d
INSTALL_DATA=$(INSTALL) -m 0644
INSTALL_EXEC=$(INSTALL) -m 0755

# Install tktex.
install :
	$(INSTALL_DIR) $(LIB_DIR)
	$(INSTALL_DIR) $(BIN_DIR)
	(cd ./library ; echo 'auto_mkindex . *.tcl' | $(TCLSH))
	for f in ./library/* ; do \
	  $(INSTALL_DATA) $$f $(LIB_DIR) ; \
	  done
	$(INSTALL_EXEC) ./tktex $(BIN_DIR)

# You shouldn't need anything after this line; this is to make creating the
# distribution easier for me.

VERSION=2.1
TKTEX_FILES=ChangeLog Install Makefile Readme ToDo tktex.rc $(HOME)/src/GPL/GPL

dist :
	(cd ./library ; latex tktex-gen ; latex tktex-vars)
	(cd ./library ; rm -f *.aux *.log)
	$(INSTALL_DIR) ../tktex-$(VERSION)/library
	$(INSTALL_DATA) $(TKTEX_FILES) ../tktex-$(VERSION)
	for f in ./library/* ; do \
	  $(INSTALL_DATA) $$f ../tktex-$(VERSION)/library ; \
	done
	$(INSTALL_EXEC) ./tktex ../tktex-$(VERSION)
	(cd .. ; tar cvf tktex-$(VERSION).tar ./tktex-$(VERSION))
	(cd .. ; rm -f tktex-$(VERSION).tar.gz ; gzip tktex-$(VERSION).tar)
	(cd .. ; rm -rf ./tktex-$(VERSION))
