]>
Commit | Line | Data |
---|---|---|
0dbc1ea9 AC |
1 | # Copyright 2021-2024, Alejandro Colomar <alx@kernel.org> |
2 | # SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception | |
3 | ||
4 | ||
5 | ifndef MAKEFILE_LINT_MAN_TBL_INCLUDED | |
6 | MAKEFILE_LINT_MAN_TBL_INCLUDED := 1 | |
7 | ||
8 | ||
79092791 | 9 | include $(MAKEFILEDIR)/build/man/man.mk |
01fe756c | 10 | include $(MAKEFILEDIR)/configure/build-depends/coreutils/cat.mk |
16322535 AC |
11 | include $(MAKEFILEDIR)/configure/build-depends/coreutils/echo.mk |
12 | include $(MAKEFILEDIR)/configure/build-depends/coreutils/head.mk | |
13 | include $(MAKEFILEDIR)/configure/build-depends/coreutils/tail.mk | |
14 | include $(MAKEFILEDIR)/configure/build-depends/coreutils/touch.mk | |
15 | include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk | |
7de1139b AC |
16 | |
17 | ||
79092791 | 18 | _LINT_man_tbl := $(patsubst %, %.lint-man.tbl.touch, $(_NONSO_MAN)) |
0dbc1ea9 AC |
19 | |
20 | ||
79092791 | 21 | $(_LINT_man_tbl): %.lint-man.tbl.touch: % $(MK) | $$(@D)/ |
d965e737 | 22 | $(info $(INFO_)GREP $@) |
01fe756c AC |
23 | $(HEAD) -n1 <$< \ |
24 | | if $(GREP) '\\" t$$' >/dev/null; then \ | |
25 | $(CAT) <$< \ | |
26 | | if ! $(GREP) '^\.TS$$' >/dev/null; then \ | |
27 | >&2 $(ECHO) "$<:1: spurious '\\\" t' comment:"; \ | |
28 | >&2 $(HEAD) -n1 <$<; \ | |
29 | exit 1; \ | |
30 | fi; \ | |
31 | else \ | |
32 | $(CAT) <$< \ | |
33 | | if $(GREP) '^\.TS$$' >/dev/null; then \ | |
34 | >&2 $(ECHO) "$<:1: missing '\\\" t' comment:"; \ | |
35 | >&2 $(HEAD) -n1 <$<; \ | |
36 | exit 1; \ | |
37 | fi; \ | |
0dbc1ea9 | 38 | fi |
01fe756c AC |
39 | $(TAIL) -n+2 <$< \ |
40 | | if $(GREP) '\\" t$$' >/dev/null; then \ | |
0dbc1ea9 AC |
41 | >&2 $(ECHO) "$<: spurious '\\\" t' not in first line:"; \ |
42 | >&2 $(GREP) -n '\\" t$$' $< /dev/null; \ | |
43 | exit 1; \ | |
44 | fi | |
45 | $(TOUCH) $@ | |
46 | ||
47 | ||
7de1139b AC |
48 | .PHONY: lint-man-tbl |
49 | lint-man-tbl: $(_LINT_man_tbl); | |
50 | ||
51 | ||
0dbc1ea9 | 52 | endif # include guard |