1PSFILES=ip-cref.ps ip-tunnels.ps api-ip6-flowlabels.ps ss.ps nstat.ps arpd.ps rtstat.ps 2# tc-cref.ps 3# api-rtnl.tex api-pmtudisc.tex api-news.tex 4# iki-netdev.ps iki-neighdst.ps 5 6 7LATEX=latex 8DVIPS=dvips 9SGML2DVI=sgml2latex 10SGML2HTML=sgml2html -s 0 11LPR=lpr -Zsduplex 12SHELL=bash 13PAGESIZE=a4 14PAGESPERPAGE=2 15 16HTMLFILES=$(subst .sgml,.html,$(shell echo *.sgml)) 17DVIFILES=$(subst .ps,.dvi,$(PSFILES)) 18PDFFILES=$(subst .ps,.pdf,$(PSFILES)) 19 20 21all: pstwocol 22 23pstwocol: $(PSFILES) 24 25html: $(HTMLFILES) 26 27dvi: $(DVIFILES) 28 29pdf: $(PDFFILES) 30 31print: $(PSFILES) 32 $(LPR) $(PSFILES) 33 34%.tex: %.sgml 35 $(SGML2DVI) --output=tex $< 36 37%.dvi: %.sgml 38 $(SGML2DVI) --output=dvi $< 39 40%.dvi: %.tex 41 @set -e; pass=2; echo "Running LaTeX $<"; \ 42 while [ `$(LATEX) $< </dev/null 2>&1 | \ 43 grep -c '^\(LaTeX Warning: Label(s) may\|No file \|! Emergency stop\)'` -ge 1 ]; do \ 44 if [ $$pass -gt 3 ]; then \ 45 echo "Seems, something is wrong. Try by hands." ; exit 1 ; \ 46 fi; \ 47 echo "Re-running LaTeX $<, $${pass}d pass"; pass=$$[$$pass + 1]; \ 48 done 49 50%.pdf: %.tex 51 @set -e; pass=2; echo "Running pdfLaTeX $<"; \ 52 while [ `pdflatex $< </dev/null 2>&1 | \ 53 grep -c '^\(LaTeX Warning: Label(s) may\|No file \|! Emergency stop\)'` -ge 1 ]; do \ 54 if [ $$pass -gt 3 ]; then \ 55 echo "Seems, something is wrong. Try by hands." ; exit 1 ; \ 56 fi; \ 57 echo "Re-running pdfLaTeX $<, $${pass}d pass"; pass=$$[$$pass + 1]; \ 58 done 59#%.pdf: %.ps 60# ps2pdf $< 61 62%.ps: %.dvi 63 $(DVIPS) $< -o $@ 64 65%.html: %.sgml 66 $(SGML2HTML) $< 67 68install: 69 install -m 0644 $(shell echo *.tex) $(DESTDIR)$(DOCDIR) 70 install -m 0644 $(shell echo *.sgml) $(DESTDIR)$(DOCDIR) 71 72clean: 73 rm -f *.aux *.log *.toc $(PSFILES) $(DVIFILES) *.html *.pdf 74