summaryrefslogtreecommitdiffstats
path: root/share/mk/lint/mdoc/mandoc.mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/lint/mdoc/mandoc.mk')
-rw-r--r--share/mk/lint/mdoc/mandoc.mk30
1 files changed, 30 insertions, 0 deletions
diff --git a/share/mk/lint/mdoc/mandoc.mk b/share/mk/lint/mdoc/mandoc.mk
new file mode 100644
index 0000000..8b209b8
--- /dev/null
+++ b/share/mk/lint/mdoc/mandoc.mk
@@ -0,0 +1,30 @@
+# 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/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/mandoc.mk
+include $(MAKEFILEDIR)/lint/mdoc/_.mk
+include $(MAKEFILEDIR)/src.mk
+
+
+mandoc_mdoc_ignore_grep := $(MAKEFILEDIR)/lint/mdoc/mandoc.ignore.grep
+
+
+$(_LINT_mdoc_mandoc): $(_MANDIR)/%.lint-mdoc.mandoc.touch: $(MANDIR)/% $(mandoc_mdoc_ignore_grep) | $$(@D)/
+ $(info $(INFO_)MANDOC $@)
+ ! ($(MANDOC) -mdoc $(MANDOCFLAGS) $< 2>&1 \
+ | $(GREP) -v -f '$(mandoc_mdoc_ignore_grep)' \
+ || $(TRUE); \
+ ) \
+ | $(GREP) ^ >&2
+ $(TOUCH) $@
+
+
+endif # include guard