summaryrefslogtreecommitdiffstats
path: root/share/mk/lint/man/mdoc.mk
blob: 5c7344114fdc051d6aba4e3b3b866bbbd8634778 (plain) (blame)
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
37
38
39
40
41
42
43
44
45
########################################################################
# Copyright 2023, Alejandro Colomar <alx@kernel.org>
# SPDX-License-Identifier: GPL-3.0-or-later
########################################################################


ifndef MAKEFILE_LINT_MAN_MDOC_INCLUDED
MAKEFILE_LINT_MAN_MDOC_INCLUDED := 1


include $(MAKEFILEDIR)/cmd.mk
include $(MAKEFILEDIR)/build/_.mk
include $(MAKEFILEDIR)/lint/_.mk
include $(MAKEFILEDIR)/lint/man/_.mk
include $(MAKEFILEDIR)/src.mk


_LINT_mdoc_mandoc:=$(patsubst $(MANDIR)/%,$(_MANDIR)/%.lint-mdoc.mandoc.touch,$(NONSO_MDOC))


linters_mdoc := mandoc
lint_mdoc    := $(foreach x,$(linters_mdoc),lint-mdoc-$(x))


$(_LINT_mdoc_mandoc): $(_MANDIR)/%.lint-mdoc.mandoc.touch: $(MANDIR)/% | $$(@D)/
	$(info LINT (mandoc)	$@)
	! ($(MANDOC) -mdoc $(MANDOCFLAGS) $< 2>&1 \
	   | $(GREP) -v 'STYLE: operating system explicitly specified: Os ' \
	   | $(GREP) -v 'WARNING: cross reference to self: Xr ' \
	   ||:; \
	) \
	| $(GREP) '.' >&2
	touch $@


.PHONY: $(lint_mdoc)
$(lint_mdoc): lint-mdoc-%: $$(_LINT_mdoc_%)
	@:

.PHONY: lint-mdoc
lint-mdoc: $(lint_mdoc)
	@:


endif  # include guard