Makefile: Improve recipe for "check-groff-warnings" target

* Fix race condition (don't remove and re-create $GROFF_LOG repeatedly),
* check for failure to create $GROFF_LOG,
* use $TMPDIR if set instead of hardcoded "/tmp",
* quote variables,
* use clobbering redirection (just in case),
* don't create unnecessary subshells,
* add a semicolon for consistency.

Signed-off-by: Alexander Miller <alex.miller@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Alexander Miller 2016-04-14 01:16:55 +02:00 committed by Michael Kerrisk
parent 23509e5201
commit 851124df28
1 changed files with 7 additions and 7 deletions

View File

@ -64,15 +64,15 @@ install:
# Check if groff reports warnings (may be words of sentences not displayed)
# from http://lintian.debian.org/tags/manpage-has-errors-from-man.html
check-groff-warnings:
GROFF_LOG=$$(mktemp /tmp/manpages-checksXXXX); \
GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)" || exit $$?; \
for i in man?/*.[1-9]; \
do \
if grep -q 'SH.*NAME' $$i; then \
LC_ALL=en_US.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l $$i > /dev/null 2>$$GROFF_LOG; \
[ -s $$GROFF_LOG ] && ( echo "$$i: " ; cat $$GROFF_LOG ; echo "" ); \
rm $$GROFF_LOG 2>/dev/null; \
fi \
done
if grep -q 'SH.*NAME' "$$i"; then \
LC_ALL=en_US.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l "$$i" > /dev/null 2>| "$$GROFF_LOG"; \
[ -s "$$GROFF_LOG" ] && { echo "$$i: "; cat "$$GROFF_LOG"; echo; }; \
fi; \
done; \
rm -f "$$GROFF_LOG"
# someone might also want to look at /var/catman/cat2 or so ...
# a problem is that the location of cat pages varies a lot