2013-01-31 17:09:26 +01:00
|
|
|
SRC := $(wildcard *.tex)
|
|
|
|
OBJPDF := $(SRC:tex=pdf)
|
|
|
|
RM := rm --force
|
|
|
|
TEXPDFPRG := xelatex
|
|
|
|
TEXPDFOPT := -file-line-error
|
|
|
|
DATE := `date +'%d%m%Y-%H%M%S'`
|
|
|
|
BUILDLOG := build-messages-$(DATE).txt
|
|
|
|
LATEXBUILD := $(TEXPDFPRG) $(TEXPDFOPT)
|
|
|
|
|
|
|
|
define latexbuild
|
2013-05-24 23:36:17 +02:00
|
|
|
@echo "Rerun to get cross-references" > `basename $1.log`
|
|
|
|
@while [ `grep -c "Rerun to get cross-references" \`basename $1.log\`` -ne 0 ] ; \
|
2013-01-31 17:09:26 +01:00
|
|
|
do \
|
|
|
|
echo $(TEXPDFPRG) $(TEXPDFOPT) $2 ; \
|
|
|
|
if ! $(TEXPDFPRG) $(TEXPDFOPT) $2 | tee -a ./$(BUILDLOG) ; then \
|
|
|
|
cat $*.log ; \
|
|
|
|
rm $@ > /dev/null 2>&1 ; \
|
|
|
|
echo "ret: $?" ; \
|
|
|
|
exit 255 ; \
|
|
|
|
fi ; \
|
|
|
|
done
|
|
|
|
endef
|
|
|
|
|
|
|
|
all: $(OBJPDF)
|
|
|
|
|
|
|
|
%.pdf: %.tex
|
|
|
|
$(call latexbuild, $*, $< )
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM) *.aux
|
|
|
|
$(RM) *.d
|
|
|
|
$(RM) *.log
|
|
|
|
$(RM) *.nav
|
|
|
|
$(RM) *.out
|
|
|
|
$(RM) *.snm
|
|
|
|
$(RM) *.toc
|
|
|
|
|
|
|
|
fclean: clean
|
|
|
|
$(RM) $(OBJPDF)
|
|
|
|
$(RM) *.txt
|
|
|
|
|
|
|
|
re: fclean all
|