summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-05-02 01:56:52 +0200
committerAlejandro Colomar <alx@kernel.org>2023-05-02 01:57:03 +0200
commit5a0d9ed151e6449d978fabdd654cacc17b20a235 (patch)
tree633cc33e08006c960a1b3f8a60a27c6cbeae7288
parent71b02c050d977e2d1eaf659ccb279819c5a4cf95 (diff)
*.mk, *.grep: Move grep patterns to .grep files
This simplifies the makefiles, and has the benefit that we can edit them without editing the makefile (thus without causing unnecessary rebuilds). Suggested-by: Bjarni Ingi Gislason <bjarniig@simnet.is> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--share/lint/groff/man.ignore.grep4
-rw-r--r--share/lint/mandoc/man.ignore.grep6
-rw-r--r--share/lint/mandoc/mdoc.ignore.grep5
-rw-r--r--share/mk/build/catman.mk9
-rw-r--r--share/mk/lint/man/man.mk11
-rw-r--r--share/mk/lint/man/mdoc.mk10
6 files changed, 27 insertions, 18 deletions
diff --git a/share/lint/groff/man.ignore.grep b/share/lint/groff/man.ignore.grep
new file mode 100644
index 000000000..79682f42f
--- /dev/null
+++ b/share/lint/groff/man.ignore.grep
@@ -0,0 +1,4 @@
+style: .TH missing fifth argument and second argument
+style: blank line in input$
+style: use of deprecated macro: .PD$
+style: use of deprecated macro: .UC$
diff --git a/share/lint/mandoc/man.ignore.grep b/share/lint/mandoc/man.ignore.grep
new file mode 100644
index 000000000..a2f91bcff
--- /dev/null
+++ b/share/lint/mandoc/man.ignore.grep
@@ -0,0 +1,6 @@
+STYLE: lower case character in document title:
+UNSUPP: ignoring macro in table:
+WARNING: cannot parse date, using it verbatim: TH (date)
+WARNING: empty block: UR
+WARNING: missing date, using "": TH
+WARNING: undefined escape, printing literally: \\\\
diff --git a/share/lint/mandoc/mdoc.ignore.grep b/share/lint/mandoc/mdoc.ignore.grep
new file mode 100644
index 000000000..3fe2831d0
--- /dev/null
+++ b/share/lint/mandoc/mdoc.ignore.grep
@@ -0,0 +1,5 @@
+STYLE: legacy man(7) date format: Dd
+STYLE: lower case character in document title: Dt
+STYLE: operating system explicitly specified: Os
+STYLE: referenced manual not found: Xr
+WARNING: cross reference to self: Xr
diff --git a/share/mk/build/catman.mk b/share/mk/build/catman.mk
index 5bc69ce36..34f868ec8 100644
--- a/share/mk/build/catman.mk
+++ b/share/mk/build/catman.mk
@@ -14,6 +14,8 @@ include $(MAKEFILEDIR)/cmd.mk
include $(MAKEFILEDIR)/src.mk
+groff_man_ignore_grep := $(DATAROOTDIR)/lint/groff/man.ignore.grep
+
MANWIDTH ?= 80
TROFF_CHECKSTYLE_LVL := 3
NROFF_LINE_LENGTH := $(shell $(EXPR) $(MANWIDTH) - 2)
@@ -45,13 +47,10 @@ $(_CATMAN_troff): %.cat.troff: %.eqn | $$(@D)/
! ($(EQN) -T$(NROFF_OUT_DEVICE) $(EQNFLAGS) <$< 2>&1 >$@) \
| $(GREP) ^ >&2
-$(_CATMAN_MAN_set): %.cat.set: %.cat.troff | $$(@D)/
+$(_CATMAN_MAN_set): %.cat.set: %.cat.troff $(groff_man_ignore_grep) | $$(@D)/
$(info TROFF $@)
! ($(TROFF) $(TROFFFLAGS_MAN) $(NROFFFLAGS) <$< 2>&1 >$@ \
- | $(GREP) -v 'style: .TH missing fifth argument and second argument' \
- | $(GREP) -v 'style: blank line in input$$' \
- | $(GREP) -v 'style: use of deprecated macro: .PD$$' \
- | $(GREP) -v 'style: use of deprecated macro: .UC$$' \
+ | $(GREP) -v -f '$(groff_man_ignore_grep)' \
||:; \
) \
| $(GREP) ^ >&2
diff --git a/share/mk/lint/man/man.mk b/share/mk/lint/man/man.mk
index 10c8127cd..cb1bf53c9 100644
--- a/share/mk/lint/man/man.mk
+++ b/share/mk/lint/man/man.mk
@@ -15,6 +15,8 @@ include $(MAKEFILEDIR)/lint/man/_.mk
include $(MAKEFILEDIR)/src.mk
+mandoc_man_ignore_grep := $(DATAROOTDIR)/lint/mandoc/man.ignore.grep
+
_LINT_man_mandoc :=$(patsubst $(MANDIR)/%,$(_MANDIR)/%.lint-man.mandoc.touch,$(NONSO_MAN))
_LINT_man_tbl :=$(patsubst $(MANDIR)/%,$(_MANDIR)/%.lint-man.tbl.touch,$(NONSO_MAN))
@@ -23,15 +25,10 @@ linters_man := mandoc tbl
lint_man := $(foreach x,$(linters_man),lint-man-$(x))
-$(_LINT_man_mandoc): $(_MANDIR)/%.lint-man.mandoc.touch: $(MANDIR)/% | $$(@D)/
+$(_LINT_man_mandoc): $(_MANDIR)/%.lint-man.mandoc.touch: $(MANDIR)/% $(mandoc_man_ignore_grep) | $$(@D)/
$(info LINT (mandoc) $@)
! ($(MANDOC) -man $(MANDOCFLAGS) $< 2>&1 \
- | $(GREP) -v 'STYLE: lower case character in document title:' \
- | $(GREP) -v 'UNSUPP: ignoring macro in table:' \
- | $(GREP) -v 'WARNING: cannot parse date, using it verbatim: TH (date)' \
- | $(GREP) -v 'WARNING: empty block: UR' \
- | $(GREP) -v 'WARNING: missing date, using "": TH' \
- | $(GREP) -v 'WARNING: undefined escape, printing literally: \\\\' \
+ | $(GREP) -v -f '$(mandoc_man_ignore_grep)' \
||:; \
) \
| $(GREP) ^ >&2
diff --git a/share/mk/lint/man/mdoc.mk b/share/mk/lint/man/mdoc.mk
index 3b77b2406..9b5f5b4b1 100644
--- a/share/mk/lint/man/mdoc.mk
+++ b/share/mk/lint/man/mdoc.mk
@@ -15,6 +15,8 @@ include $(MAKEFILEDIR)/lint/man/_.mk
include $(MAKEFILEDIR)/src.mk
+mandoc_mdoc_ignore_grep := $(DATAROOTDIR)/lint/mandoc/mdoc.ignore.grep
+
_LINT_mdoc_mandoc:=$(patsubst $(MANDIR)/%,$(_MANDIR)/%.lint-mdoc.mandoc.touch,$(NONSO_MDOC))
@@ -22,14 +24,10 @@ linters_mdoc := mandoc
lint_mdoc := $(foreach x,$(linters_mdoc),lint-mdoc-$(x))
-$(_LINT_mdoc_mandoc): $(_MANDIR)/%.lint-mdoc.mandoc.touch: $(MANDIR)/% | $$(@D)/
+$(_LINT_mdoc_mandoc): $(_MANDIR)/%.lint-mdoc.mandoc.touch: $(MANDIR)/% $(mandoc_mdoc_ignore_grep) | $$(@D)/
$(info LINT (mandoc) $@)
! ($(MANDOC) -mdoc $(MANDOCFLAGS) $< 2>&1 \
- | $(GREP) -v 'STYLE: legacy man(7) date format: Dd ' \
- | $(GREP) -v 'STYLE: lower case character in document title: Dt ' \
- | $(GREP) -v 'STYLE: operating system explicitly specified: Os ' \
- | $(GREP) -v 'STYLE: referenced manual not found: Xr ' \
- | $(GREP) -v 'WARNING: cross reference to self: Xr ' \
+ | $(GREP) -v -f '$(mandoc_mdoc_ignore_grep)' \
||:; \
) \
| $(GREP) ^ >&2