#
# $Id: Makefile,v 1.1.1.1 1998/01/04 22:47:29 abm Exp $
#
SHELL = /bin/sh

### EDIT THE NEXT FIVE LINES ONLY ###
# The directory where the tkhylafax library will be installed
TCLLIB_DEST = /usr/local/lib/tkhylafax-3.1

# The directory where the tkhylafax command will be installed
TCLPRG_DEST = /usr/local/bin

# The directory where the man page will be installed
TCLMAN_DEST = /usr/local/man/man1

# The full path to tclsh
TCLSH = /usr/local/bin/tclsh

# The full path to wish.
WISH = /usr/local/bin/wish
### DON'T EDIT ANYTHING BELOW THIS LINE ###

TCLLIB_FILES =  \
    entryDialog.t \
    extract.t \
    faxIt.t \
    fileSelect.t \
    listBatches.t \
    mkCover.t \
    mkWidgets.t \
    options.t \
    preferences.t \
    rolodex.t \
    searchEntries.t \
    sendBatch.t \
    svrStatus.t \
    tkhylafax.xbm \
    trace.t \
    viewBatch.t

TCLPRG_FILE = tkhylafax
TCLMAN_FILE = tkhylafax

all: lib install.man tkhylafax
	echo 'auto_mkindex $(TCLLIB_DEST) *.tcl *.t' | $(TCLSH);

$(TCLLIB_DEST):
	if [ ! -d $(TCLLIB_DEST) ]; then mkdir -p $(TCLLIB_DEST); fi
	chmod 775 $(TCLLIB_DEST)

lib: $(TCLLIB_DEST)
	@echo "Installing tkhylafax library..." 
	-for i in $(TCLLIB_FILES) ; do \
	    cp $$i $(TCLLIB_DEST)/$$i ; \
	    chmod 664 $(TCLLIB_DEST)/$$i ; \
	done
	@echo "Done" 

$(TCLPRG_DEST):
	if [ ! -d $(TCLPRG_DEST) ]; then mkdir -p $(TCLPRG_DEST); fi
	chmod 775 $(TCLPRG_DEST)

tkhylafax: $(TCLPRG_DEST) Makefile
	@echo "Patching tkhylafax..." 
	sed -e 's|XXX_TKHYLAFAX_XXX|$(TCLLIB_DEST)|g' \
	    -e 's|XXX_WISH_XXX|$(WISH)|g' \
	    tkhylafax.unpatched > $(TCLPRG_FILE)
	@echo "Done" 
	@echo "Installing tkhylafax command..." 
	cp $(TCLPRG_FILE) $(TCLPRG_DEST)/$@
	chmod 775 $(TCLPRG_DEST)/$@
	@echo "Done" 

install.man:
	cp $(TCLMAN_FILE).man $(TCLMAN_DEST)/$(TCLMAN_FILE).1

clean:
	-rm -f $(TCLLIB_DEST)/*.t
	-rm -f $(TCLMAN_DEST)/tkhylafax* 
	-rm -f $(TCLPRG_DEST)/tkhylafax 
