### Convert cvsbook texinfo files to Info, HTML, PostScript, etc.


VERSION = 1.12
NAME = j-cvsbook
DISTFILES = README j-Makefile cvsbook.el TODO gpl.texi

all: version ps pdf info html

version:
	echo "@set VERSION ${VERSION}" > version.texi

info: version
	makeinfo j-main.texi

html: version html-monolithic html-distributed

html-monolithic: version
	makeinfo --html j-main.texi

html-distributed: version
	@echo Non-monolithic HTML is not supported by makeinfo yet.

dvi: version
	tex j-main.texi

ps: dvi
	dvips j-main.dvi -o j-cvsbook.ps

pdf: ps
	ps2pdf j-cvsbook.ps j-cvsbook.pdf

log:
	cvs2cl.pl -r -t

dist: log info-dist html-dist ps-dist pdf-dist texi-dist big-dist

html-dist: 
	gzip -c --best ${NAME}.html > ${NAME}.html.gz
	zip ${NAME}.html.zip ${NAME}.html

ps-dist: 
	gzip -c --best ${NAME}.ps > ${NAME}.ps.gz
	zip ${NAME}.ps.zip ${NAME}.ps

pdf-dist: 
	gzip -c --best ${NAME}.pdf > ${NAME}.pdf.gz
	zip ${NAME}.pdf.zip ${NAME}.pdf

info-dist: 
	mkdir ${NAME}-${VERSION}
	cp *.info* ${DISTFILES} ${NAME}-${VERSION}
	tar cvf ${NAME}-${VERSION}-info.tar ${NAME}-${VERSION}
	gzip --best ${NAME}-${VERSION}-info.tar
	zip ${NAME}-${VERSION}-info.zip ${NAME}-${VERSION}/*
	rm -rf ${NAME}-${VERSION}

texi-dist: 
	mkdir ${NAME}-${VERSION}
	cp j-*.texi ${DISTFILES} ${NAME}-${VERSION}
	tar cvf ${NAME}-${VERSION}-texi.tar ${NAME}-${VERSION}
	gzip --best ${NAME}-${VERSION}-texi.tar
	zip ${NAME}-${VERSION}-texi.zip ${NAME}-${VERSION}/*
	rm -rf ${NAME}-${VERSION}

big-dist: 
	mkdir ${NAME}-${VERSION}
	cp ${DISTFILES} *.texi *.info* *.html *.ps *.pdf *.sh \
           ${NAME}-${VERSION}
	if [ -f ${NAME}-${VERSION}/${NAME}.html ]; then        \
             rm -f ${NAME}-${VERSION}/${NAME}-${VERSION}.html; \
        fi
	if [ -f ${NAME}-${VERSION}/${NAME}.ps ]; then          \
             rm -f ${NAME}-${VERSION}/${NAME}-${VERSION}.ps;   \
        fi
	tar cvf ${NAME}-${VERSION}-all.tar ${NAME}-${VERSION}
	gzip --best ${NAME}-${VERSION}-all.tar
	zip ${NAME}-${VERSION}-all.zip ${NAME}-${VERSION}/*
	rm -rf ${NAME}-${VERSION}

texclean: 
	rm -f *~ *.aux *.cp *.cps *.dvi *.fn *.ky *.log *.pg *.toc *.tp *.vr

clean: texclean
	rm -f j-cvsbook*.info* j-cvsbook*.html j-cvsbook*.ps *.pdf *.tar *.gz *.zip
	rm -rf ${NAME}-${VERSION}
