1 PSFILES=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 7 LATEX=latex 8 DVIPS=dvips 9 SGML2DVI=sgml2latex 10 SGML2HTML=sgml2html -s 0 11 LPR=lpr -Zsduplex 12 SHELL=bash 13 PAGESIZE=a4 14 PAGESPERPAGE=2 15 16 HTMLFILES=$(subst .sgml,.html,$(shell echo *.sgml)) 17 DVIFILES=$(subst .ps,.dvi,$(PSFILES)) 18 PDFFILES=$(subst .ps,.pdf,$(PSFILES)) 19 20 21 all: pstwocol 22 23 pstwocol: $(PSFILES) 24 25 html: $(HTMLFILES) 26 27 dvi: $(DVIFILES) 28 29 pdf: $(PDFFILES) 30 31 print: $(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 68 install: 69 install -m 0644 $(shell echo *.tex) $(DESTDIR)$(DOCDIR) 70 install -m 0644 $(shell echo *.sgml) $(DESTDIR)$(DOCDIR) 71 72 clean: 73 rm -f *.aux *.log *.toc $(PSFILES) $(DVIFILES) *.html *.pdf 74