[Makefile] fixed make chapter target

This commit is contained in:
Jan Benda 2019-12-11 09:04:03 +01:00
parent b7f6abfc94
commit 9cc839de94

View File

@ -34,8 +34,8 @@ chapter : $(BASENAME)-chapter.pdf
$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(wildcard $(BASENAME).aux) $(PYPDFFILES) $(GPTTEXFILES) ../../header.tex
if test -f $(BASENAME).aux; then \
CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p; q}' $(BASENAME).aux) - 1 )); \
PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p; q}' $(BASENAME).aux); \
fi; \
{ echo $${PAGE:=1}; echo $${CHAPTER:=0}; } | pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && { echo $${PAGE:=1}; echo $${CHAPTER:=0}; } | pdflatex -interaction=scrollmode $< || true