summaryrefslogtreecommitdiffstats
path: root/share/mk/lint/mdoc/mandoc.mk
blob: 3a9e2cc9eed5070c5c90199ab9bacd699ded26f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright 2023-2024, Alejandro Colomar <alx@kernel.org>
# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception


ifndef MAKEFILE_LINT_MDOC_MANDOC_INCLUDED
MAKEFILE_LINT_MDOC_MANDOC_INCLUDED := 1


include $(MAKEFILEDIR)/build/man/mdoc.mk
include $(MAKEFILEDIR)/configure/build-depends/coreutils/touch.mk
include $(MAKEFILEDIR)/configure/build-depends/coreutils/true.mk
include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
include $(MAKEFILEDIR)/configure/build-depends/mandoc/mandoc.mk


_LINT_mdoc_mandoc := $(patsubst %, %.lint-mdoc.mandoc.touch, $(_NONSO_MDOC))


mandoc_mdoc_ignore_grep := $(MAKEFILEDIR)/lint/mdoc/mandoc.ignore.grep


$(_LINT_mdoc_mandoc): %.lint-mdoc.mandoc.touch: % $(mandoc_mdoc_ignore_grep) $(MK) | $$(@D)/
	$(info	$(INFO_)MANDOC		$@)
	! ($(MANDOC) -mdoc $(MANDOCFLAGS) $< 2>&1 \
	   | $(GREP) -v -f '$(mandoc_mdoc_ignore_grep)' \
	   || $(TRUE); \
	) \
	| $(GREP) ^ >&2
	$(TOUCH) $@


.PHONY: lint-mdoc-mandoc
lint-mdoc-mandoc: $(_LINT_mdoc_mandoc);


endif  # include guard