From: Alejandro Colomar Date: Sat, 23 Aug 2025 18:41:35 +0000 (+0200) Subject: share/mk/: lint-man-ws: Diagnose spurious use of white space X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a472a0f677f72886f65ca7162be1af85d3c559c7;p=thirdparty%2Fman-pages.git share/mk/: lint-man-ws: Diagnose spurious use of white space Signed-off-by: Alejandro Colomar --- diff --git a/share/mk/lint/man/_.mk b/share/mk/lint/man/_.mk index e17ee9a5a..a15b50399 100644 --- a/share/mk/lint/man/_.mk +++ b/share/mk/lint/man/_.mk @@ -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 index 000000000..fdac8b240 --- /dev/null +++ b/share/mk/lint/man/ws.egrep @@ -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 index 000000000..81134197e --- /dev/null +++ b/share/mk/lint/man/ws.mk @@ -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