From 4a3593bce8a535dd6daa7d35267d2dbe04a7a291 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Tue, 8 Feb 2022 20:50:52 +0100 Subject: [PATCH] doc: Error out properly when a generator fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In make only timestamps and return values matter. And the shell will create a file and update its timestamp when it sees an output redirection. No matter if the program driving the redirected data fails or not. So even if the first generator run fails, rerunning make will work, with things looking like they worked out just fine. This fixes the issue by running the separate steps toward file generation one by one. This issue was brought up by Edward E. (cbrt64 on github) in PR#135 on github¹, including a proof-of-concept implementation, as well as valuable feedback. This implementation was derived from it. See the pull-request log for details. ¹ https://github.com/grml/grml-etc-core/pull/135 --- doc/Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 28a83b8..f1195f9 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -7,18 +7,23 @@ all: $(MANPAGES) $(HTMLPAGES) .SUFFIXES: .t2t .5 .html .t2t.5: - @printf 'TXT2TAGS %s > %s\n' "$<" "$@" - @txt2tags --target man -o- $< | sed -e '/^$$/d' -e 's/^\\e$$//' > $@ + @printf 'TXT2TAGS %s\n' "$@" + @txt2tags --quiet --target man -o$@.pre $< + @sed -e '/^$$/d' -e 's/^\\e$$//' < $@.pre > $@.tmp + @rm $@.pre + @mv $@.tmp $@ .t2t.html: - @printf 'TXT2TAGS %s > %s\n' "$<" "$@" - @txt2tags --target html --style t2t-modern.css -o- $< \ -| sed -e '/^$$/d' -e 's/^\\$$//' > $@ + @printf 'TXT2TAGS %s\n' "$@" + @txt2tags --quiet --target html --style t2t-modern.css -o$@.pre $< + @sed -e '/^$$/d' -e 's/^\\$$//' < $@.pre > $@.tmp + @rm $@.pre + @mv $@.tmp $@ clean: - rm -f *.5 *.html *.gz *~ + rm -f *.5 *.html *.gz *.pre *.tmp *~ online: all scp grmlzshrc.html t2t-modern.css grml:/var/www/grml/zsh/ -.PHONY: all clean +.PHONY: all clean online -- 2.1.4