+docs := ctsim.tex texhelp.sty psbox.tex logo.eps logo.gif ctsim-sgp.tex ctsim-concepts.tex ctsim-gui.tex ctsim-install.tex ctsim-textui.tex ctsim-web.tex alphacalc.eps alphacalc.gif divergent.eps divergent.gif equiangular.eps equiangular.gif equilinear.eps equilinear.gif scangeometry.eps scangeometry.gif tex2rtf.ini ctsim.hpj bullet.bmp verbatim.sty mytitle.sty makeidx.sty mysober.sty fancyhea.sty ctsim-latex.bib ctsim-tex2rtf.bib
+
+pkg=ctsim
+
+EXTRA_DIST = $(docs) html
+
+CLEANFILES=$(pkg).ps $(pkg)*.html $(pkg).hhc $(pkg).hhp $(pkg).hhk $(pkg).bib $(pkg).zip \*.aux \*.log $(pkg).ilg $(pkg).ind $(pkg).dvi \*~ \#\*~ \#\*\# \.\*~
+
+all-local: htmlhelp html pdf
+
+install-data-hook: $(pkg).htb
+ install -g root -o root -m 0644 $(pkg).htb $(datadir)
+
+.PHONY: pdf
+pdf: $(pkg).pdf
+$(pkg).pdf: $(pkg).dvi
+ dvipdfm $(pkg)
+
+.PHONY: ps
+ps: $(pkg).ps
+$(pkg).ps: $(pkg).pdf
+ pdftops $(pkg).pdf $(pkg).ps
+
+.PHONY: dvi
+dvi: $(pkg).dvi
+$(pkg).dvi: $(docs)
+ cp $(pkg)-latex.bib $(pkg).bib
+ latex $(pkg)
+ bibtex $(pkg) > /dev/null
+ latex $(pkg)
+ makeindex $(pkg) > /dev/null
+ latex $(pkg)
+
+.PHONY: winhelp
+winhelp: $(docs)
+ rm -f $(pkg).rtf $(pkg).cnt
+ cp $(pkg)-tex2rtf.bib $(pkg).bib
+ tex2rtf $(pkg).tex $(pkg).rtf -winhelp
+ hcw /c /m /e $(pkg).hpj
+ mv $(PKG).HLP $(pkg).hlp
+ cp $(pkg).hlp $(pkg).cnt ../msvc/$(pkg)/
+
+.PHONY: htmlhelp
+htmlhelp: $(docs)
+ rm -f $(pkg)*.html $(pkg).hhp $(pkg).hhc $(pkg).hhk $(pkg).zip
+ cp $(pkg)-tex2rtf.bib $(pkg).bib
+ tex2rtf $(pkg).tex $(pkg).html -html > /dev/null
+ zip -q $(pkg).zip *.html *.gif $(pkg).hh[pck]
+ mv $(pkg).zip $(pkg).htb
+
+html: htmlhelp
+ rm -rf html
+ mkdir html
+ cp *.gif html
+ mv *.html html
+