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 --output=dvi 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 19 20 all: pstwocol 21 22 pstwocol: $(PSFILES) 23 24 html: $(HTMLFILES) 25 26 dvi: $(DVIFILES) 27 28 print: $(PSFILES) 29 $(LPR) $(PSFILES) 30 31 %.dvi: %.sgml 32 $(SGML2DVI) $< 33 34 %.dvi: %.tex 35 @set -e; pass=2; echo "Running LaTeX $<"; \ 36 while [ `$(LATEX) $< </dev/null 2>&1 | \ 37 grep -c '^\(LaTeX Warning: Label(s) may\|No file \|! Emergency stop\)'` -ge 1 ]; do \ 38 if [ $$pass -gt 3 ]; then \ 39 echo "Seems, something is wrong. Try by hands." ; exit 1 ; \ 40 fi; \ 41 echo "Re-running LaTeX $<, $${pass}d pass"; pass=$$[$$pass + 1]; \ 42 done 43 44 %.ps: %.dvi 45 $(DVIPS) $< -o $@ 46 47 %.html: %.sgml 48 $(SGML2HTML) $< 49 50 install: 51 install -m 0644 $(shell echo *.tex) $(DESTDIR)$(DOCDIR) 52 install -m 0644 $(shell echo *.sgml) $(DESTDIR)$(DOCDIR) 53 54 clean: 55 rm -f *.aux *.log *.toc $(PSFILES) $(DVIFILES) *.html 56