]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
share/mk/: lint-man-ws: Diagnose spurious use of white space
authorAlejandro Colomar <alx@kernel.org>
Sat, 23 Aug 2025 18:41:35 +0000 (20:41 +0200)
committerAlejandro Colomar <alx@kernel.org>
Sun, 24 Aug 2025 20:21:12 +0000 (22:21 +0200)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
share/mk/lint/man/_.mk
share/mk/lint/man/ws.egrep [new file with mode: 0644]
share/mk/lint/man/ws.mk [new file with mode: 0644]

index e17ee9a5a55cd6670f0e2c85866cd1e5993ed79f..a15b503990b7d597ad26681a21cc2c90256077e5 100644 (file)
@@ -7,7 +7,12 @@ MAKEFILE_LINT_MAN_INCLUDED := 1
 
 
 .PHONY: lint-man
-lint-man: lint-man-blank lint-man-mandoc lint-man-tbl lint-man-so;
+lint-man: \
+       lint-man-blank \
+       lint-man-mandoc \
+       lint-man-so \
+       lint-man-tbl \
+       lint-man-ws;
 
 
 endif  # include guard
diff --git a/share/mk/lint/man/ws.egrep b/share/mk/lint/man/ws.egrep
new file mode 100644 (file)
index 0000000..fdac8b2
--- /dev/null
@@ -0,0 +1,6 @@
+^\.\s+(I|B|IR|RI|BR|RB|IB|BI)\>
+^\.\s+(TH|SH|SS|TP|TQ)\>
+^\.\s+(IP|P|PP|LP)\>
+^\.\s+(UR|UE|RS|RE|EX|EE|MT|ME|SY|YS)\>
+^\.\s+(MR)\>
+^\.\s+(SM|SB)\>
diff --git a/share/mk/lint/man/ws.mk b/share/mk/lint/man/ws.mk
new file mode 100644 (file)
index 0000000..8113419
--- /dev/null
@@ -0,0 +1,45 @@
+# Copyright, the authors of the Linux man-pages project
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_MAN_WS_INCLUDED
+MAKEFILE_LINT_MAN_WS_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/man/man.mk
+include $(MAKEFILEDIR)/build/man/mdoc.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/cat.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/echo.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/touch.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+
+
+_XFAIL_LINT_man_ws := \
+       $(_MANDIR)/man7/bpf-helpers.7.lint-man.ws.touch
+
+
+_LINT_man_ws := $(patsubst %, %.lint-man.ws.touch, $(_NONSO_MAN) $(_NONSO_MDOC))
+ifeq ($(SKIP_XFAIL),yes)
+_LINT_man_ws := $(filter-out $(_XFAIL_LINT_man_ws), $(_LINT_man_ws))
+endif
+
+
+ws_egrep := $(MAKEFILEDIR)/lint/man/ws.egrep
+
+
+$(_LINT_man_ws): %.lint-man.ws.touch: % $(ws_egrep) $(MK) | $$(@D)/
+       $(info  $(INFO_)GREP            $@)
+       $(CAT) <$< \
+       | if $(GREP) -Ef $(ws_egrep) >/dev/null; then \
+               >&2 $(ECHO) "lint-man-ws: $<: Spurious white space:"; \
+               >&2 $(GREP) -ETnf '$(ws_egrep)' <$<; \
+               exit 1; \
+       fi;
+       $(TOUCH) $@
+
+
+.PHONY: lint-man-ws
+lint-man-ws: $(_LINT_man_ws);
+
+
+endif  # include guard