#
# Makefile for Tvi
#
# Copyright (c) 1999  Motomu Nakashima
#

# tvi 本体の場所(パスが通っていること)
TVIBINDIR = /usr/local/bin

# ソース，マニュアルなど一切を置く場所
TVILIBDIR = /usr/local/lib/tvi-0.9.2

# wish の場所
WISH = /usr/local/bin/wish4.2jp

# 以下は通常変更する必要はありません．
MV = /bin/mv
RMF = /bin/rm -f
SED = /usr/bin/sed
LNSF = /bin/ln -s -f
ECHO = /bin/echo
MKDIR = /bin/mkdir -p
RMDIR = /bin/rmdir
CHMOD755 = /bin/chmod 755
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644

install:
	@${ECHO} "Installing all files..."
	${MKDIR} ${TVILIBDIR}
	${INSTALL_DATA} * ${TVILIBDIR}
	@${ECHO} "Configuring tvi..."
	${SED} s!set\ tvi_directory\ .*!set\ tvi_directory\ \"${TVILIBDIR}\"!g ${TVILIBDIR}/tvi > ${TVILIBDIR}/tvi.new
	${MV} ${TVILIBDIR}/tvi.new ${TVILIBDIR}/tvi
	${SED} s_/usr/local/bin/wish4.2jp_${WISH}_g ${TVILIBDIR}/tvi > ${TVILIBDIR}/tvi.new
	${MV} ${TVILIBDIR}/tvi.new ${TVILIBDIR}/tvi

	${CHMOD755} ${TVILIBDIR}/tvi
	@${ECHO} "Linking tvi..."
	${LNSF} ${TVILIBDIR}/tvi ${TVIBINDIR}/tvi
	@${ECHO} "Installing Done."

uninstall:
	@${ECHO} "Removing all files..."
	${RMF} ${TVILIBDIR}/*
	${RMDIR} ${TVILIBDIR}
	${RMF} ${TVIBINDIR}/tvi
	@${ECHO} "Uninstalling Done."
