.SUFFIXES: .idx .ind .tex .dvi .ps .pdf $(.SUFFIXES)

TEX=	cgi-script.tex ftp.tex pdfcond.tex smtp.tex ftpd.tex pop3.tex \
	uri.tex decls.tex httpd.tex netrc.tex rfc822.tex url.tex dns.tex \
	intro.tex nettime.tex skeleton.tex

TEX2PAGE=tex2page

man.dvi: $(TEX) man.ind
man.ind: man.idx
man.pdf: $(TEX) man.ind

.dvi.ps:
	dvips -j0 -o $@ $<

.tex.dvi:
	latex $< && latex $<
	rm $*.log

.tex.pdf:
	pdflatex $< && thumbpdf $@ && pdflatex $<
	rm $*.log

.idx.ind:
	makeindex $<

clean:
	-rm -f *.log *.png man.out man.dvi man.ps man.pdf thumb*.png
	rm -rf ../../web-server/root/htdocs/sunet-manual

INSTALL_DATA= install -c -m 644

tar:
	tar cf - *.tex sty | gzip > man.tar.gz

html: $(TEX)
	$(TEX2PAGE) man && $(TEX2PAGE) man