From 523d69c6653033c2b1fadc25c8c81c6264446c16 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Mon, 9 Dec 2013 09:52:52 +0900 Subject: [PATCH] =?utf8?q?*.d=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=B8?= =?utf8?q?=E5=87=BA=E5=8A=9B=E3=81=99=E3=82=8B$(COMPILES.tex)=E3=81=AE?= =?utf8?q?=E5=86=85=E5=AE=B9=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- latex_mk/latex.mk | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/latex_mk/latex.mk b/latex_mk/latex.mk index 780e238..c04cadf 100644 --- a/latex_mk/latex.mk +++ b/latex_mk/latex.mk @@ -159,7 +159,7 @@ BIBDBre = $(eval BIBDB := \ $(ECHO) '# LaTeX Intermediate Files'; \ $(ECHO) '#'; \ $(ECHO) '# $$(COMPILE.tex) := $(LATEXCMD)'; \ - $(ECHO) '# $$(COMPILES.tex) := $(subst $(COMPILE.tex),$(LATEXCMD),$(COMPILES.tex))'; \ + $(ECHO) '# $$(COMPILES.tex) := $(subst $(EXITWARN),exit 1,$(subst $(EXITNOWARN),exit 0,$(subst $(COMPILE.tex),$(LATEXCMD),$(COMPILES.tex))))'; \ $(ECHO) '#'; \ $(ECHO) '$(BASE).dvi:: $(sort $(LATEXINTFILES_PREV) $(if $(BIBDB),$(BASE).bbl_prev))'; \ $(ECHO) ' @$$(COMPILE.tex)'; \ @@ -229,23 +229,29 @@ WARN_UNDEFREF := There were undefined references. CNT := 3 CNTMSG := $(LATEX) is run $(CNT) times, but there are still undefined references. +EXITNOWARN = \ + if test $$? -eq 1; then \ + exit 0; \ + else \ + exit $$?; \ + fi + +EXITWARN = \ + $(ECHO) "$(CNTMSG)" 1>&2; \ + $(SED) -n -e "/^LaTeX Warning:/,/^$$/p" $(BASE).log | \ + $(SED) -e "s/.*\s*line \([0-9]*\)\s*.*/$(BASE).tex:\1: &/" 1>&2; \ + exit 1 + COMPILES.tex = \ for i in `$(SEQ) 0 $(CNT)`; do \ if test $$i -lt $(CNT); then \ if $(GREP) -F "$(WARN_UNDEFREF)" $(BASE).log; then \ $(COMPILE.tex); \ else \ - if test $$? -eq 1; then \ - exit 0; \ - else \ - exit $$?; \ - fi \ + $(EXITNOWARN); \ fi; \ else \ - $(ECHO) "$(CNTMSG)"; \ - $(SED) -n -e "/^LaTeX Warning:/,/^$$/p" $(BASE).log | \ - $(SED) -e "s/.*\s*line \([0-9]*\)\s*.*/$(BASE).tex:\1: &/" 1>&2; \ - exit 1; \ + $(EXITWARN); \ fi; \ done; -- 2.18.0