# Makefile for Eplain manuals.  This file is public domain.

MAKEINFO   = makeinfo
TEXI2PDF   = texi2pdf
TEXI2DVI   = texi2dvi
LATEX      = latex
BIBTEX     = bibtex
LATEX2HTML = latex2html

.PHONY: all doc dvi pdf html info btxdoc
.PHONY: clean mostlyclean distclean maintainer-clean
.DELETE_ON_ERROR:


all: doc ../INSTALL btxdoc

doc: dvi pdf html info

dvi eplain.dvi: *.texi
	$(TEXI2DVI) eplain.texi

pdf eplain.pdf: *.texi
	$(TEXI2PDF) eplain.texi

html eplain/index.html: *.texi
	$(MAKEINFO) --html eplain.texi

info eplain.info: *.texi
	$(MAKEINFO) --no-split eplain.texi

btxdoc btxdoc/index.html: btxdoc.tex btxdoc.bib
	$(LATEX) btxdoc
	$(BIBTEX) btxdoc
	$(LATEX) btxdoc
	$(LATEX2HTML) -local_icons btxdoc

../INSTALL: install.texi
	$(MAKEINFO) --no-number-section --no-warn --no-headers eplain.texi -o - \
	| sed -n '/^Installation/,/^Invoking/'p \
	| sed '$$d' > ../INSTALL


clean mostlyclean:
	rm -f eplain.?? eplain.{aux,cps,fns,log,toc}
	rm -f btxdoc.{aux,bbl,blg,dvi,log}

distclean: clean
	rm -rf eplain.pdf eplain.dvi eplain btxdoc

maintainer-clean: distclean
	rm -f eplain.info ../INSTALL
