# Makefile for Elements of Style. Standard 'all' and 'clean' targets # plus *.pdf files. Does max 5 passes at a latex source. Reduces LaTeX # output to a "progress bar". (p) Jan-Mark S. Wams all: elos.pdf elos-kindel.pdf base_files=main.tex twirl.tex Makefile pdflatex=pdflatex -shell-escape bar=(while read&&read&&read&&read&&read&&read; do printf "\#"; done) temps=*.log *.aux *.ps *.pdf *.idx *.bbl *.blg out .*finish*_ok \ *.lof *.lot *.toc *.glx *.gxg *.gxs *.ilg *.ind *.out quiet=2>&1 > /dev/null clean: rm -f ${temps} # Dummy file that is touched after a successful run of pdflatex. .finished_ok: rm -f ${temps}; touch .finished_ok # Generic rule to build a .pdf using pdflatex. .SUFFIXES: .pdf .tex %.pdf: %.tex ${base_files} .finished_ok @mv -f .finished_ok .may_finish_ok ${quiet}; true @echo "Building $@, visit file 'out' for full LaTeX output." @echo "LaTeX Rerun" > out @for i in 1 2 3 4 5; do \ if grep 'LaTeX.*Rerun' out > /dev/null; then \ printf "Running LaTeX ($$i) "; \ ${pdflatex} $< | tee out | ${bar}; printf ".\n"; fi; done @-grep -i -e 'warning' -e 'Fatal error' out; true @-if !(grep -e 'LaTeX.*Rerun' -e 'Fatal error' out ${quiet});\ then mv -f .may_finish_ok .finished_ok ${quiet}; fi; true