>From 41e44e4c0027784644cf740e8d8dcafe3afc9e14 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@xxxxxxxxx> Date: Sun, 2 Feb 2020 20:23:58 +0900 Subject: [PATCH 2/2] Makefile: grep only .tex files in 'linelabel' and 'lineref' search For the checks added in commit 60c2079f2765 ("Makefile: Check 'linelabel' and 'lineref' used as environment"), it should be sufficient to grep files listed in $(LATEXSOURCES) only. Using this variable rather than the grep option "-R" will reduce the cost of the checks. We can also get rid of "patsubst" and "filter-out" functions in the variable definitions. Also reorder and rephrase error messages in case output of grep gets long. Add .c source file(s) under appendix/styleguide/ to the definition of "LST_SOURCES" to improve coverage of dependencies as well. Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index c1a51bae..efe1add1 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,8 @@ LATEXSOURCES = \ */*.tex \ */*/*.tex -LST_SOURCES := $(wildcard CodeSamples/formal/promela/*.lst) +LST_SOURCES := $(wildcard CodeSamples/formal/promela/*.lst) \ + $(wildcard appendix/styleguide/*.c) LATEXGENERATED = autodate.tex qqz.tex contrib.tex origpub.tex @@ -123,14 +124,13 @@ ifdef A2PING endif endif -LINE_ENV_IGNORE := Makefile perfbook_flat.tex $(LATEXGENERATED)) # following variables are intentionally defined using "=" -LINELABEL_ENV_BEGIN = $(patsubst ./%,%,$(shell grep -R -l -F '\begin{linelabel}' .)) -LINELABEL_ENV_END = $(patsubst ./%,%,$(shell grep -R -l -F '\end{linelabel}' .)) -LINEREF_ENV_BEGIN = $(patsubst ./%,%,$(shell grep -R -l -F '\begin{lineref}' .)) -LINEREF_ENV_END = $(patsubst ./%,%,$(shell grep -R -l -F '\end{lineref}' .)) -LINELABEL_ENV = $(filter-out $(LINE_ENV_IGNORE),$(sort $(LINELABEL_ENV_BEGIN) $(LINELABEL_ENV_END))) -LINEREF_ENV = $(filter-out $(LINE_ENV_IGNORE),$(sort $(LINEREF_ENV_BEGIN) $(LINEREF_ENV_END))) +LINELABEL_ENV_BEGIN = $(shell grep -l -F '\begin{linelabel}' $(LATEXSOURCES)) +LINELABEL_ENV_END = $(shell grep -l -F '\end{linelabel}' $(LATEXSOURCES)) +LINEREF_ENV_BEGIN = $(shell grep -l -F '\begin{lineref}' $(LATEXSOURCES)) +LINEREF_ENV_END = $(shell grep -l -F '\end{lineref}' $(LATEXSOURCES)) +LINELABEL_ENV = $(sort $(LINELABEL_ENV_BEGIN) $(LINELABEL_ENV_END)) +LINEREF_ENV = $(sort $(LINEREF_ENV_BEGIN) $(LINEREF_ENV_END)) OLD_EPIGRAPH := $(shell grep -c '2009/09/02' `kpsewhich epigraph.sty`) TEXLIVE_2015_DEBIAN := $(shell pdftex --version | grep -c 'TeX Live 2015/Debian') @@ -210,18 +210,18 @@ ifndef LATEXPAND endif @if [ ! -z "$(LINELABEL_ENV)" -a "$(LINELABEL_ENV)" != " " ]; then \ echo "'linelabel' used as environment in $(LINELABEL_ENV)." ; \ - echo "Use 'fcvlabel' instead." ; \ echo "------" ; \ grep -n -B 2 -A 2 -F 'linelabel' $(LINELABEL_ENV) ; \ echo "------" ; \ + echo "Substitute 'fcvlabel' for 'linelabel' in $(LINELABEL_ENV)." ; \ exit 1 ; \ fi @if [ ! -z "$(LINEREF_ENV)" -a "$(LINEREF_ENV)" != " " ]; then \ echo "'lineref' used as environment in $(LINEREF_ENV)." ; \ - echo "Use 'fcvref' instead." ; \ echo "------" ; \ grep -n -B 2 -A 2 -F 'lineref' $(LINEREF_ENV) ; \ echo "------" ; \ + echo "Substitute 'fcvref' for 'lineref' in $(LINEREF_ENV)." ; \ exit 1 ; \ fi echo > qqz.tex -- 2.17.1