From b9a8a2c61c2084acd09b3d3b8260d01dbe3ede28 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Mon, 8 Apr 2024 14:03:53 +0200 Subject: [PATCH] Makefile: fix annoying errors in docs generation Currently when we run make docs we will see 100+ lines of `grep: docs/build/man/links: Is a directory` printed. This makes no sense as we should only try to validate the man page. The manpage target is structured in a way that it runs the generation for each file individually. As such the current way of grep'ing the entire directory for each page is wrong. It should only validate the on page that was created by the command above. To fix this first define a OUTFILE var for the target to not have to call the substitution every time we use the path and then only grep this one file and not everything in the dir. Signed-off-by: Paul Holzinger --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 7057e9d91a..a8691b1d2c 100644 --- a/Makefile +++ b/Makefile @@ -489,6 +489,7 @@ pkg/api/swagger.yaml: $(MANPAGES_MD_GENERATED): %.md: %.md.in $(MANPAGES_SOURCE_DIR)/options/*.md hack/markdown-preprocess +$(MANPAGES): OUTFILE=$(subst source/markdown,build/man,$@) $(MANPAGES): %: %.md .install.md2man docdir # This does a bunch of filtering needed for man pages: @@ -515,12 +516,12 @@ $(MANPAGES): %: %.md .install.md2man docdir -e 's/\[\([^]]*\)](http[^)]\+)/\1/g' \ -e 's;<\(/\)\?\(a\|a\s\+[^>]*\|sup\)>;;g' \ -e 's/\\$$/ /g' $< |\ - $(GOMD2MAN) -out $(subst source/markdown,build/man,$@) - @if grep 'included file options/' docs/build/man/*; then \ - echo "FATAL: man pages must not contain ^^^^"; exit 1; \ + $(GOMD2MAN) -out $(OUTFILE) + @if grep 'included file options/' $(OUTFILE); then \ + echo "FATAL: man pages must not contain ^^^^ in $(OUTFILE)"; exit 1; \ fi - @if $(MAN_L) $(subst source/markdown,build/man,$@) | $(GREP) -Pazoq '│\s+│\n\s+├─+┼─+┤\n\s+│\s+│'; then \ - echo "FATAL: $< has a too-long table column; use 'man -l $(subst source/markdown,build/man,$@)' and look for empty table cells."; exit 1; \ + @if $(MAN_L) $(OUTFILE)| $(GREP) -Pazoq '│\s+│\n\s+├─+┼─+┤\n\s+│\s+│'; then \ + echo "FATAL: $< has a too-long table column; use 'man -l $(OUTFILE)' and look for empty table cells."; exit 1; \ fi .PHONY: docdir