#
# Copyright (c) 2001 Tama Communications Corporation
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
TMP_DOC=/tmp/bokin/doc
SERVER=chiota.tamacom.com
DIST=${SERVER}:/usr/local/apache/htdocs/bokin
MANUAL=	bokindoc

FILES=	bokin.in \
	whatsnew.in \
	${MANUAL}_toc.in \
	license.in \
	links.in \
	plans.in \
	contribute.in \
	maillist.in \
	download.in \
	model.in \
	donation.in \

HTMLS=	bokin.html \
	whatsnew.html \
	${MANUAL}_toc.html \
	license.html \
	links.html \
	plans.html \
	contribute.html \
	maillist.html \
	download.html \
	model.html \
	donation.html \

ICONS= bokin.png sbokin.png kanji_boki.png kanji_bokin.png
TEXI=	bokin.texi version.texi reference.texi fdl.texi define.texi faq.texi
REFS=	bknconfig.ref bknparse.ref bknsort.ref bknapply.ref bknfind.ref \
	bknprint.ref bkntrans.ref bknstate.ref slip.ref account.ref 

TUTOR=	${MANUAL}_toc.in ${MANUAL}.html ${MANUAL}_foot.html

all: ${HTMLS} ${MANUAL}.html

doc:
	(cd /tmp && build bokin && cd bokin && sh tools/reconf.sh --make)
	d=`pwd`; cd ${TMP_DOC}; cp ${TEXI} ${REFS} $$d
${HTMLS}: makehtml.pl ${FILES} ${TUTOR}
	@./makehtml.pl -v ${FILES}
model.in: model.m4 define.html.in faq.html.in
	m4 model.m4 >model.in
${TUTOR}: ${TEXI} ${REFS}
	@echo "Generating ${MANUAL}.html and ${MANUAL}_toc.html ..."
	@cp bokin.texi ${MANUAL}.texi
	@./texi2html -number ${MANUAL}.texi
	@echo "Generating ${MANUAL}_toc.in ..."
	@echo "@title Tutorial" > ${MANUAL}_toc.in
	@echo "@link Tutorial" >> ${MANUAL}_toc.in
	@echo "@body" >> ${MANUAL}_toc.in
	@sed -e '1,/^<BODY.*>/d' -e '/<\/BODY.*>/,$$d' < ${MANUAL}_toc.html >> ${MANUAL}_toc.in
	@rm -f ${MANUAL}.texi
dist: disticon disthtml distmanual
disticon:
	scp2 ${ICONS} ${DIST}
disthtml:
	scp2 ${HTMLS} ${DIST}
distmanual:
	scp2 ${MANUAL}*.html ${DIST}
clean:
	rm -f ${HTMLS} ${TUTOR} model.in
