summaryrefslogtreecommitdiffstats
path: root/share/mk/lint
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/lint')
-rw-r--r--share/mk/lint/_.mk11
-rw-r--r--share/mk/lint/c.mk102
-rw-r--r--share/mk/lint/c/_.mk18
-rw-r--r--share/mk/lint/c/checkpatch.mk35
-rw-r--r--share/mk/lint/c/clang-tidy.mk188
-rw-r--r--share/mk/lint/c/cppcheck.mk74
-rw-r--r--share/mk/lint/c/cpplint.mk27
-rw-r--r--share/mk/lint/c/iwyu.mk109
-rw-r--r--share/mk/lint/man/_.mk11
-rw-r--r--share/mk/lint/man/man.mk69
-rw-r--r--share/mk/lint/man/mandoc.ignore.grep6
-rw-r--r--share/mk/lint/man/mandoc.mk53
-rw-r--r--share/mk/lint/man/mdoc.mk44
-rw-r--r--share/mk/lint/man/tbl.mk48
-rw-r--r--share/mk/lint/mdoc/_.mk31
-rw-r--r--share/mk/lint/mdoc/mandoc.ignore.grep5
-rw-r--r--share/mk/lint/mdoc/mandoc.mk30
17 files changed, 631 insertions, 230 deletions
diff --git a/share/mk/lint/_.mk b/share/mk/lint/_.mk
index 9d93bd3..48d02fa 100644
--- a/share/mk/lint/_.mk
+++ b/share/mk/lint/_.mk
@@ -1,18 +1,13 @@
-########################################################################
-# Copyright 2021-2023, Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier: GPL-3.0-or-later
-########################################################################
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
ifndef MAKEFILE_LINT_INCLUDED
MAKEFILE_LINT_INCLUDED := 1
-lint := lint-c lint-man lint-mdoc
-
-
.PHONY: lint
-lint: $(lint);
+lint: lint-c lint-man lint-mdoc;
endif # include guard
diff --git a/share/mk/lint/c.mk b/share/mk/lint/c.mk
deleted file mode 100644
index b7d80a9..0000000
--- a/share/mk/lint/c.mk
+++ /dev/null
@@ -1,102 +0,0 @@
-########################################################################
-# Copyright 2021-2022, Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier: GPL-3.0-or-later
-########################################################################
-
-
-ifndef MAKEFILE_LINT_C_INCLUDED
-MAKEFILE_LINT_C_INCLUDED := 1
-
-
-include $(MAKEFILEDIR)/build/src.mk
-include $(MAKEFILEDIR)/cmd.mk
-include $(MAKEFILEDIR)/lint/_.mk
-
-
-DEFAULT_CHECKPATCHFLAGS :=
-EXTRA_CHECKPATCHFLAGS :=
-CHECKPATCHFLAGS := $(DEFAULT_CHECKPATCHFLAGS) $(EXTRA_CHECKPATCHFLAGS)
-CHECKPATCH := checkpatch
-
-clang-tidy_config := $(SYSCONFDIR)/clang-tidy/config.yaml
-DEFAULT_CLANG-TIDYFLAGS := \
- --config-file=$(clang-tidy_config) \
- --quiet \
- --use-color
-EXTRA_CLANG-TIDYFLAGS :=
-CLANG-TIDYFLAGS := $(DEFAULT_CLANG-TIDYFLAGS) $(EXTRA_CLANG-TIDYFLAGS)
-CLANG-TIDY := clang-tidy
-
-CPPCHECK_SUPPRESS := $(SYSCONFDIR)/cppcheck/cppcheck.suppress
-DEFAULT_CPPCHECKFLAGS := \
- --enable=all \
- --error-exitcode=2 \
- --inconclusive \
- --quiet \
- --suppressions-list=$(CPPCHECK_SUPPRESS)
-EXTRA_CPPCHECKFLAGS :=
-CPPCHECKFLAGS := $(DEFAULT_CPPCHECKFLAGS) $(EXTRA_CPPCHECKFLAGS)
-CPPCHECK := cppcheck
-
-DEFAULT_CPPLINTFLAGS :=
-EXTRA_CPPLINTFLAGS :=
-CPPLINTFLAGS := $(DEFAULT_CPPLINTFLAGS) $(EXTRA_CPPLINTFLAGS)
-CPPLINT := cpplint
-
-DEFAULT_IWYUFLAGS := \
- -Xiwyu --no_fwd_decls \
- -Xiwyu --error
-EXTRA_IWYUFLAGS :=
-IWYUFLAGS := $(DEFAULT_IWYUFLAGS) $(EXTRA_IWYUFLAGS)
-IWYU := iwyu
-
-
-_LINT_c_checkpatch := $(patsubst %.c,%.lint-c.checkpatch.touch,$(_UNITS_src_c))
-_LINT_c_clang-tidy := $(patsubst %.c,%.lint-c.clang-tidy.touch,$(_UNITS_src_c))
-_LINT_c_cppcheck := $(patsubst %.c,%.lint-c.cppcheck.touch,$(_UNITS_src_c))
-_LINT_c_cpplint := $(patsubst %.c,%.lint-c.cpplint.touch,$(_UNITS_src_c))
-_LINT_c_iwyu := $(patsubst %.c,%.lint-c.iwyu.touch,$(_UNITS_src_c))
-
-
-linters_c := checkpatch clang-tidy cppcheck cpplint iwyu
-lint_c := $(foreach x,$(linters_c),lint-c-$(x))
-
-
-$(_LINT_c_checkpatch): %.lint-c.checkpatch.touch: %.c
- $(info LINT (checkpatch) $@)
- $(CHECKPATCH) $(CHECKPATCHFLAGS) -f $<
- touch $@
-
-$(_LINT_c_clang-tidy): %.lint-c.clang-tidy.touch: %.c
- $(info LINT (clang-tidy) $@)
- $(CLANG-TIDY) $(CLANG-TIDYFLAGS) $< -- $(CPPFLAGS) $(CFLAGS) 2>&1 \
- | $(SED) '/generated\.$$/d'
- touch $@
-
-$(_LINT_c_cppcheck): %.lint-c.cppcheck.touch: %.c
- $(info LINT (cppcheck) $@)
- $(CPPCHECK) $(CPPCHECKFLAGS) $<
- touch $@
-
-$(_LINT_c_cpplint): %.lint-c.cpplint.touch: %.c
- $(info LINT (cpplint) $@)
- $(CPPLINT) $(CPPLINTFLAGS) $< >/dev/null
- touch $@
-
-$(_LINT_c_iwyu): %.lint-c.iwyu.touch: %.c
- $(info LINT (iwyu) $@)
- $(IWYU) $(IWYUFLAGS) $(CPPFLAGS) $(CFLAGS) $< 2>&1 \
- | $(TAC) \
- | $(SED) '/correct/{N;d}' \
- | $(TAC)
- touch $@
-
-
-.PHONY: $(lint_c)
-$(lint_c): lint-c-%: $$(_LINT_c_%);
-
-.PHONY: lint-c
-lint-c: $(lint_c);
-
-
-endif # include guard
diff --git a/share/mk/lint/c/_.mk b/share/mk/lint/c/_.mk
new file mode 100644
index 0000000..dc2f3e2
--- /dev/null
+++ b/share/mk/lint/c/_.mk
@@ -0,0 +1,18 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_C_INCLUDED
+MAKEFILE_LINT_C_INCLUDED := 1
+
+
+.PHONY: lint-c
+lint-c: \
+ lint-c-checkpatch \
+ lint-c-clang-tidy \
+ lint-c-cppcheck \
+ lint-c-cpplint \
+ lint-c-iwyu
+
+
+endif # include guard
diff --git a/share/mk/lint/c/checkpatch.mk b/share/mk/lint/c/checkpatch.mk
new file mode 100644
index 0000000..7777a10
--- /dev/null
+++ b/share/mk/lint/c/checkpatch.mk
@@ -0,0 +1,35 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_C_CHECKPATCH_INCLUDED
+MAKEFILE_LINT_C_CHECKPATCH_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/build/examples/src.mk
+include $(MAKEFILEDIR)/configure/build-depends/checkpatch.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
+include $(MAKEFILEDIR)/configure/xfail.mk
+
+
+_XFAIL_LINT_c_checkpatch := $(_MANDIR)/man2/bpf.2.d/bpf.lint-c.checkpatch.touch
+
+
+_LINT_c_checkpatch := $(patsubst %.c, %.lint-c.checkpatch.touch, $(_UNITS_ex_c))
+ifeq ($(SKIP_XFAIL),yes)
+_LINT_c_checkpatch := $(filter-out $(_XFAIL_LINT_c_checkpatch), $(_LINT_c_checkpatch))
+endif
+
+
+$(_LINT_c_checkpatch): %.lint-c.checkpatch.touch: %.c $(CHECKPATCH_CONF) $(MK)
+ $(info $(INFO_)CHECKPATCH $@)
+ $(CHECKPATCH) $(CHECKPATCHFLAGS) -f $< >&2
+ $(TOUCH) $@
+
+
+.PHONY: lint-c-checkpatch
+lint-c-checkpatch: $(_LINT_c_checkpatch);
+
+
+endif # include guard
diff --git a/share/mk/lint/c/clang-tidy.mk b/share/mk/lint/c/clang-tidy.mk
new file mode 100644
index 0000000..fd2e536
--- /dev/null
+++ b/share/mk/lint/c/clang-tidy.mk
@@ -0,0 +1,188 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_C_CLANG_TIDY_INCLUDED
+MAKEFILE_LINT_C_CLANG_TIDY_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/build/examples/src.mk
+include $(MAKEFILEDIR)/configure/build-depends/clang.mk
+include $(MAKEFILEDIR)/configure/build-depends/clang-tidy.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
+include $(MAKEFILEDIR)/configure/build-depends/cpp.mk
+include $(MAKEFILEDIR)/configure/build-depends/sed.mk
+include $(MAKEFILEDIR)/configure/xfail.mk
+
+
+_XFAIL_LINT_c_clang_tidy := \
+ $(_MANDIR)/man2/add_key.2.d/add_key.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/bpf.2.d/bpf.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/chown.2.d/chown.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/clone.2.d/clone.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/close_range.2.d/close_range.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/copy_file_range.2.d/copy_file_range.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/eventfd.2.d/eventfd.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/execve.2.d/execve.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/execve.2.d/myecho.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/futex.2.d/futex.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/getdents.2.d/getdents.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/getrlimit.2.d/getrlimit.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/ioctl_fat.2.d/display_fat_volume_id.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/ioctl_fat.2.d/ioctl_fat.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/ioctl_fat.2.d/toggle_fat_archive_flag.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/ioctl_ns.2.d/ns_show.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/ioctl_tty.2.d/tcgets.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/kcmp.2.d/kcmp.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/keyctl.2.d/key_instantiate.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/listxattr.2.d/listxattr.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/membarrier.2.d/membarrier.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/memfd_create.2.d/t_get_seals.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/memfd_create.2.d/t_memfd_create.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/mmap.2.d/mmap.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/mount_setattr.2.d/mount_setattr.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/mprotect.2.d/mprotect.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/msgop.2.d/msgop.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/open_by_handle_at.2.d/t_name_to_handle_at.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/open_by_handle_at.2.d/t_open_by_handle_at.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/perf_event_open.2.d/perf_event_open.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/pidfd_open.2.d/pidfd_open.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/pidfd_send_signal.2.d/pidfd_send_signal.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/pipe.2.d/pipe.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/pivot_root.2.d/pivot_root.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/poll.2.d/poll_input.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/process_vm_readv.2.d/process_vm_readv.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/readlink.2.d/readlink.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/recvmmsg.2.d/recvmmsg.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/request_key.2.d/t_request_key.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/sched_setaffinity.2.d/sched_setaffinity.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/seccomp.2.d/seccomp.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/seccomp_unotify.2.d/seccomp_unotify.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/select_tut.2.d/select.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/semget.2.d/t_semget.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/sendmmsg.2.d/sendmmsg.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/setns.2.d/setns.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/shmop.2.d/svshm_string_read.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/shmop.2.d/svshm_string_write.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/sigaction.2.d/sigaction.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/spu_run.2.d/spu_run.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/stat.2.d/stat.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/_syscall.2.d/_syscall.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/syscall.2.d/syscall.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/sysctl.2.d/sysctl.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/tee.2.d/tee.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/timer_create.2.d/timer_create.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/timerfd_create.2.d/timerfd_create.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/unshare.2.d/unshare.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/userfaultfd.2.d/userfaultfd.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man2/wait.2.d/wait.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/atexit.3.d/atexit.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/backtrace.3.d/backtrace.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/bsearch.3.d/bsearch.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/bswap.3.d/bswap.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/cacos.3.d/cacos.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/cacosh.3.d/cacosh.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/catan.3.d/catan.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/catanh.3.d/catanh.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/circleq.3.d/circleq.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/clock_getcpuclockid.3.d/clock_getcpuclockid.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/CPU_SET.3.d/CPU_SET.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/dl_iterate_phdr.3.d/dl_iterate_phdr.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/dlinfo.3.d/dlinfo.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/duplocale.3.d/duplocale.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/encrypt.3.d/encrypt.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/end.3.d/end.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/endian.3.d/endian.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/envz_add.3.d/envz_add.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/fmemopen.3.d/fmemopen.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/fopencookie.3.d/fopencookie.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/fread.3.d/fread.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/frexp.3.d/frexp.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/ftw.3.d/ftw.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/_Generic.3.d/_Generic.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getaddrinfo.3.d/client.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getaddrinfo.3.d/server.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getaddrinfo_a.3.d/async.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getaddrinfo_a.3.d/sync.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getdate.3.d/getdate.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getgrent_r.3.d/getgrent_r.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getgrouplist.3.d/getgrouplist.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getline.3.d/getline.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getopt.3.d/getopt.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getopt.3.d/getopt_long.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getprotoent_r.3.d/getprotoent_r.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getpwnam.3.d/getpwnam.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getservent_r.3.d/getservent_r.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getsubopt.3.d/getsubopt.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/getutent.3.d/getutent.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/hsearch.3.d/hsearch.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/if_nameindex.3.d/if_nameindex.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/inet.3.d/inet.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/inet_net_pton.3.d/inet_net_pton.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/inet_pton.3.d/inet_pton.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/insque.3.d/insque.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/list.3.d/list.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/mallinfo.3.d/mallinfo.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/malloc_info.3.d/malloc_info.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/mallopt.3.d/mallopt.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/matherr.3.d/matherr.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/MAX.3.d/MAX.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/mbstowcs.3.d/mbstowcs.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/mq_getattr.3.d/mq_getattr.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/mq_notify.3.d/mq_notify.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/newlocale.3.d/newlocale.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/offsetof.3.d/offsetof.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/posix_spawn.3.d/posix_spawn.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/__ppc_get_timebase.3.d/__ppc_get_timebase.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/pthread_attr_init.3.d/pthread_attr_init.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/pthread_cleanup_push.3.d/pthread_cleanup_push.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/pthread_create.3.d/pthread_create.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/pthread_getattr_np.3.d/pthread_getattr_np.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/pthread_setname_np.3.d/pthread_setname_np.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/pthread_setschedparam.3.d/pthreads_sched_test.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/qsort.3.d/qsort.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/rand.3.d/rand.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/rpmatch.3.d/rpmatch.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/rtime.3.d/rtime.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/scandir.3.d/scandir.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/sem_wait.3.d/sem_wait.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/setbuf.3.d/setbuf.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/shm_open.3.d/pshm_ucase_bounce.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/shm_open.3.d/pshm_ucase_send.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/slist.3.d/slist.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/stailq.3.d/stailq.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/static_assert.3.d/must_be.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/stpncpy.3.d/stpncpy.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/strcmp.3.d/string_comp.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/strcpy.3.d/strcpy.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/strftime.3.d/strftime.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/strsep.3.d/strsep.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/strtok.3.d/strtok.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/strtol.3.d/strtol.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/strverscmp.3.d/strverscmp.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/tailq.3.d/tailq.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/tsearch.3.d/tsearch.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3/wordexp.3.d/wordexp.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3const/EXIT_SUCCESS.3const.d/EXIT_SUCCESS.lint-c.clang-tidy.touch \
+ $(_MANDIR)/man3head/printf.h.3head.d/register_printf_specifier.lint-c.clang-tidy.touch
+
+
+_LINT_c_clang_tidy := $(patsubst %.c, %.lint-c.clang-tidy.touch, $(_UNITS_ex_c))
+ifeq ($(SKIP_XFAIL),yes)
+_LINT_c_clang_tidy := $(filter-out $(_XFAIL_LINT_c_clang_tidy), $(_LINT_c_clang_tidy))
+endif
+
+
+$(_LINT_c_clang_tidy): %.lint-c.clang-tidy.touch: %.c $(CLANG_TIDY_CONF) $(MK)
+ $(info $(INFO_)CLANG_TIDY $@)
+ $(CLANG_TIDY) $(CLANG_TIDYFLAGS) $< -- $(CPPFLAGS) $(CLANGFLAGS) 2>&1 \
+ | $(SED) '/generated\.$$/d' >&2
+ $(TOUCH) $@
+
+
+.PHONY: lint-c-clang-tidy
+lint-c-clang-tidy: $(_LINT_c_clang_tidy);
+
+
+endif # include guard
diff --git a/share/mk/lint/c/cppcheck.mk b/share/mk/lint/c/cppcheck.mk
new file mode 100644
index 0000000..5fa74ac
--- /dev/null
+++ b/share/mk/lint/c/cppcheck.mk
@@ -0,0 +1,74 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_C_CPPCHECK_INCLUDED
+MAKEFILE_LINT_C_CPPCHECK_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/build/examples/src.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
+include $(MAKEFILEDIR)/configure/build-depends/cppcheck.mk
+include $(MAKEFILEDIR)/configure/xfail.mk
+
+
+_XFAIL_LINT_c_cppcheck := \
+ $(_MANDIR)/man2/chown.2.d/chown.lint-c.cppcheck.touch \
+ $(_MANDIR)/man2/close_range.2.d/close_range.lint-c.cppcheck.touch \
+ $(_MANDIR)/man2/kcmp.2.d/kcmp.lint-c.cppcheck.touch \
+ $(_MANDIR)/man2/keyctl.2.d/key_instantiate.lint-c.cppcheck.touch \
+ $(_MANDIR)/man2/memfd_create.2.d/t_memfd_create.lint-c.cppcheck.touch \
+ $(_MANDIR)/man2/msgop.2.d/msgop.lint-c.cppcheck.touch \
+ $(_MANDIR)/man2/open_by_handle_at.2.d/t_open_by_handle_at.lint-c.cppcheck.touch \
+ $(_MANDIR)/man2/shmop.2.d/svshm_string_read.lint-c.cppcheck.touch \
+ $(_MANDIR)/man2/unshare.2.d/unshare.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/bsearch.3.d/bsearch.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/dl_iterate_phdr.3.d/dl_iterate_phdr.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/dlopen.3.d/dlopen.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/encrypt.3.d/encrypt.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/envz_add.3.d/envz_add.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/getaddrinfo_a.3.d/async.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/getdate.3.d/getdate.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/getgrouplist.3.d/getgrouplist.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/hsearch.3.d/hsearch.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/malloc_info.3.d/malloc_info.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/mallopt.3.d/mallopt.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/matherr.3.d/matherr.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/mcheck.3.d/mcheck.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/mtrace.3.d/t_mtrace.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/newlocale.3.d/newlocale.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/pthread_attr_init.3.d/pthread_attr_init.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/pthread_create.3.d/pthread_create.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/pthread_getattr_np.3.d/pthread_getattr_np.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/pthread_getcpuclockid.3.d/pthread_getcpuclockid.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/pthread_setschedparam.3.d/pthreads_sched_test.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/setaliasent.3.d/setaliasent.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/setbuf.3.d/setbuf.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/shm_open.3.d/pshm_ucase_send.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/stpncpy.3.d/stpncpy.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/strftime.3.d/strftime.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/strncat.3.d/strncat.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/strsep.3.d/strsep.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/strtok.3.d/strtok.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/strtol.3.d/strtol.lint-c.cppcheck.touch \
+ $(_MANDIR)/man3/tsearch.3.d/tsearch.lint-c.cppcheck.touch
+
+
+_LINT_c_cppcheck := $(patsubst %.c, %.lint-c.cppcheck.touch, $(_UNITS_ex_c))
+ifeq ($(SKIP_XFAIL),yes)
+_LINT_c_cppcheck := $(filter-out $(_XFAIL_LINT_c_cppcheck), $(_LINT_c_cppcheck))
+endif
+
+
+$(_LINT_c_cppcheck): %.lint-c.cppcheck.touch: %.c $(CPPCHECK_SUPPRESS) $(MK)
+ $(info $(INFO_)CPPCHECK $@)
+ $(CPPCHECK) $(CPPCHECKFLAGS) $<
+ $(TOUCH) $@
+
+
+.PHONY: lint-c-cppcheck
+lint-c-cppcheck: $(_LINT_c_cppcheck);
+
+
+endif # include guard
diff --git a/share/mk/lint/c/cpplint.mk b/share/mk/lint/c/cpplint.mk
new file mode 100644
index 0000000..8eb3984
--- /dev/null
+++ b/share/mk/lint/c/cpplint.mk
@@ -0,0 +1,27 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_C_CPPLINT_INCLUDED
+MAKEFILE_LINT_C_CPPLINT_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/examples/src.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
+include $(MAKEFILEDIR)/configure/build-depends/cpplint.mk
+
+
+_LINT_c_cpplint := $(patsubst %.c, %.lint-c.cpplint.touch, $(_UNITS_ex_c))
+
+
+$(_LINT_c_cpplint): %.lint-c.cpplint.touch: %.c $(CPPLINT_CONF) $(MK)
+ $(info $(INFO_)CPPLINT $@)
+ $(CPPLINT) $(CPPLINTFLAGS) $< >/dev/null
+ $(TOUCH) $@
+
+
+.PHONY: lint-c-cpplint
+lint-c-cpplint: $(_LINT_c_cpplint);
+
+
+endif # include guard
diff --git a/share/mk/lint/c/iwyu.mk b/share/mk/lint/c/iwyu.mk
new file mode 100644
index 0000000..32c2c07
--- /dev/null
+++ b/share/mk/lint/c/iwyu.mk
@@ -0,0 +1,109 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_C_IWYU_INCLUDED
+MAKEFILE_LINT_C_IWYU_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/build/examples/src.mk
+include $(MAKEFILEDIR)/configure/build-depends/clang.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
+include $(MAKEFILEDIR)/configure/build-depends/cpp.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/iwyu.mk
+include $(MAKEFILEDIR)/configure/build-depends/sed.mk
+include $(MAKEFILEDIR)/configure/xfail.mk
+
+
+_XFAIL_LINT_c_iwyu := \
+ $(_MANDIR)/man2/clock_getres.2.d/clock_getres.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/getrlimit.2.d/getrlimit.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/listxattr.2.d/listxattr.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/mount_setattr.2.d/mount_setattr.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/recvmmsg.2.d/recvmmsg.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/seccomp.2.d/seccomp.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/seccomp_unotify.2.d/seccomp_unotify.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/select.2.d/select.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/semget.2.d/t_semget.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/sendmmsg.2.d/sendmmsg.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/_syscall.2.d/_syscall.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/timer_create.2.d/timer_create.lint-c.iwyu.touch \
+ $(_MANDIR)/man2/userfaultfd.2.d/userfaultfd.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/backtrace.3.d/backtrace.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/bsearch.3.d/bsearch.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/bswap.3.d/bswap.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/cacos.3.d/cacos.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/cacosh.3.d/cacosh.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/catan.3.d/catan.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/catanh.3.d/catanh.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/clock_getcpuclockid.3.d/clock_getcpuclockid.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/CPU_SET.3.d/CPU_SET.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/dl_iterate_phdr.3.d/dl_iterate_phdr.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/dlinfo.3.d/dlinfo.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/duplocale.3.d/duplocale.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/endian.3.d/endian.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/envz_add.3.d/envz_add.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/fopencookie.3.d/fopencookie.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/frexp.3.d/frexp.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/ftw.3.d/ftw.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/_Generic.3.d/_Generic.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/getaddrinfo.3.d/client.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/getaddrinfo.3.d/server.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/getgrouplist.3.d/getgrouplist.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/getline.3.d/getline.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/getopt.3.d/getopt_long.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/getprotoent_r.3.d/getprotoent_r.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/getservent_r.3.d/getservent_r.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/getsubopt.3.d/getsubopt.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/if_nameindex.3.d/if_nameindex.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/inet.3.d/inet.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/inet_net_pton.3.d/inet_net_pton.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/inet_pton.3.d/inet_pton.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/mallinfo.3.d/mallinfo.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/malloc_info.3.d/malloc_info.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/mbstowcs.3.d/mbstowcs.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/mq_getattr.3.d/mq_getattr.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/mq_notify.3.d/mq_notify.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/mtrace.3.d/t_mtrace.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/newlocale.3.d/newlocale.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/posix_spawn.3.d/posix_spawn.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/pthread_attr_init.3.d/pthread_attr_init.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/pthread_cleanup_push.3.d/pthread_cleanup_push.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/pthread_getattr_default_np.3.d/pthread_getattr_default_np.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/pthread_getattr_np.3.d/pthread_getattr_np.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/pthread_getcpuclockid.3.d/pthread_getcpuclockid.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/pthread_setaffinity_np.3.d/pthread_setaffinity_np.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/pthread_setname_np.3.d/pthread_setname_np.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/pthread_setschedparam.3.d/pthreads_sched_test.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/sem_wait.3.d/sem_wait.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/shm_open.3.d/pshm_ucase_bounce.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/shm_open.3.d/pshm_ucase_send.lint-c.iwyu.touch \
+ $(_MANDIR)/man3/slist.3.d/slist.lint-c.iwyu.touch
+
+
+_LINT_c_iwyu := $(patsubst %.c, %.lint-c.iwyu.touch, $(_UNITS_ex_c))
+ifeq ($(SKIP_XFAIL),yes)
+_LINT_c_iwyu := $(filter-out $(_XFAIL_LINT_c_iwyu), $(_LINT_c_iwyu))
+endif
+
+
+$(_LINT_c_iwyu): %.lint-c.iwyu.touch: %.c $(MK)
+ $(info $(INFO_)IWYU $@)
+ ! ($(IWYU) $(IWYUFLAGS) $(CPPFLAGS) $(CLANGFLAGS) $< 2>&1 \
+ | $(SED) -n '/should add these lines:/,$$p' \
+ | $(TAC) \
+ | $(SED) '/correct/{N;d}' \
+ | $(TAC) \
+ || $(TRUE); \
+ ) \
+ | $(GREP) ^ >&2
+ $(TOUCH) $@
+
+
+.PHONY: lint-c-iwyu
+lint-c-iwyu: $(_LINT_c_iwyu);
+
+
+endif # include guard
diff --git a/share/mk/lint/man/_.mk b/share/mk/lint/man/_.mk
index 8bbc01c..67ff4b8 100644
--- a/share/mk/lint/man/_.mk
+++ b/share/mk/lint/man/_.mk
@@ -1,16 +1,13 @@
-########################################################################
-# Copyright 2021-2023, Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier: GPL-3.0-or-later
-########################################################################
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
ifndef MAKEFILE_LINT_MAN_INCLUDED
MAKEFILE_LINT_MAN_INCLUDED := 1
-DEFAULT_MANDOCFLAGS := -Tlint
-EXTRA_MANDOCFLAGS :=
-MANDOCFLAGS := $(DEFAULT_MANDOCFLAGS) $(EXTRA_MANDOCFLAGS)
+.PHONY: lint-man
+lint-man: lint-man-mandoc lint-man-tbl;
endif # include guard
diff --git a/share/mk/lint/man/man.mk b/share/mk/lint/man/man.mk
deleted file mode 100644
index cb1bf53..0000000
--- a/share/mk/lint/man/man.mk
+++ /dev/null
@@ -1,69 +0,0 @@
-########################################################################
-# Copyright 2021-2023, Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier: GPL-3.0-or-later
-########################################################################
-
-
-ifndef MAKEFILE_LINT_MAN_MAN_INCLUDED
-MAKEFILE_LINT_MAN_MAN_INCLUDED := 1
-
-
-include $(MAKEFILEDIR)/cmd.mk
-include $(MAKEFILEDIR)/build/_.mk
-include $(MAKEFILEDIR)/lint/_.mk
-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))
-
-
-linters_man := mandoc tbl
-lint_man := $(foreach x,$(linters_man),lint-man-$(x))
-
-
-$(_LINT_man_mandoc): $(_MANDIR)/%.lint-man.mandoc.touch: $(MANDIR)/% $(mandoc_man_ignore_grep) | $$(@D)/
- $(info LINT (mandoc) $@)
- ! ($(MANDOC) -man $(MANDOCFLAGS) $< 2>&1 \
- | $(GREP) -v -f '$(mandoc_man_ignore_grep)' \
- ||:; \
- ) \
- | $(GREP) ^ >&2
- touch $@
-
-$(_LINT_man_tbl): $(_MANDIR)/%.lint-man.tbl.touch: $(MANDIR)/% | $$(@D)/
- $(info LINT (tbl comment) $@)
- if $(GREP) -q '^\.TS$$' $< && ! $(HEAD) -n1 $< | $(GREP) -q '\\" t$$'; \
- then \
- >&2 $(ECHO) "$<:1: missing '\\\" t' comment:"; \
- >&2 $(HEAD) -n1 <$<; \
- exit 1; \
- fi
- if $(HEAD) -n1 $< | $(GREP) -q '\\" t$$' && ! $(GREP) -q '^\.TS$$' $<; \
- then \
- >&2 $(ECHO) "$<:1: spurious '\\\" t' comment:"; \
- >&2 $(HEAD) -n1 <$<; \
- exit 1; \
- fi
- if $(TAIL) -n+2 <$< | $(GREP) -q '\\" t$$'; \
- then \
- >&2 $(ECHO) "$<: spurious '\\\" t' not in first line:"; \
- >&2 $(GREP) -n '\\" t$$' $< /dev/null; \
- exit 1; \
- fi
- touch $@
-
-
-.PHONY: lint-man-mandoc
-lint-man-mandoc: $(_LINT_man_mandoc);
-.PHONY: lint-man-tbl
-lint-man-tbl: $(_LINT_man_tbl);
-
-.PHONY: lint-man
-lint-man: $(lint_man);
-
-
-endif # include guard
diff --git a/share/mk/lint/man/mandoc.ignore.grep b/share/mk/lint/man/mandoc.ignore.grep
new file mode 100644
index 0000000..a2f91bc
--- /dev/null
+++ b/share/mk/lint/man/mandoc.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/mk/lint/man/mandoc.mk b/share/mk/lint/man/mandoc.mk
new file mode 100644
index 0000000..efa69ab
--- /dev/null
+++ b/share/mk/lint/man/mandoc.mk
@@ -0,0 +1,53 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_MAN_MANDOC_INCLUDED
+MAKEFILE_LINT_MAN_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)/configure/src.mk
+include $(MAKEFILEDIR)/configure/xfail.mk
+include $(MAKEFILEDIR)/lint/man/_.mk
+include $(MAKEFILEDIR)/src.mk
+
+
+_XFAIL_LINT_man_mandoc := \
+ $(_MANDIR)/man3/pthread_cond_init.3.lint-man.mandoc.touch \
+ $(_MANDIR)/man3/pthread_key_create.3.lint-man.mandoc.touch \
+ $(_MANDIR)/man3/pthread_mutex_init.3.lint-man.mandoc.touch \
+ $(_MANDIR)/man5/dir_colors.5.lint-man.mandoc.touch \
+ $(_MANDIR)/man7/bpf-helpers.7.lint-man.mandoc.touch \
+ $(_MANDIR)/man7/uri.7.lint-man.mandoc.touch \
+ $(_MANDIR)/man8/zic.8.lint-man.mandoc.touch
+
+
+_LINT_man_mandoc := \
+ $(patsubst $(MANDIR)/%, $(_MANDIR)/%.lint-man.mandoc.touch, $(NONSO_MAN))
+ifeq ($(SKIP_XFAIL),yes)
+_LINT_man_mandoc := $(filter-out $(_XFAIL_LINT_man_mandoc), $(_LINT_man_mandoc))
+endif
+
+
+mandoc_man_ignore_grep := $(MAKEFILEDIR)/lint/man/mandoc.ignore.grep
+
+
+$(_LINT_man_mandoc): $(_MANDIR)/%.lint-man.mandoc.touch: $(MANDIR)/% $(mandoc_man_ignore_grep) $(MK) | $$(@D)/
+ $(info $(INFO_)MANDOC $@)
+ ! ($(MANDOC) -man $(MANDOCFLAGS) $< 2>&1 \
+ | $(GREP) -v -f '$(mandoc_man_ignore_grep)' \
+ || $(TRUE); \
+ ) \
+ | $(GREP) ^ >&2
+ $(TOUCH) $@
+
+
+.PHONY: lint-man-mandoc
+lint-man-mandoc: $(_LINT_man_mandoc);
+
+
+endif # include guard
diff --git a/share/mk/lint/man/mdoc.mk b/share/mk/lint/man/mdoc.mk
deleted file mode 100644
index 9b5f5b4..0000000
--- a/share/mk/lint/man/mdoc.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-########################################################################
-# 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
-
-
-mandoc_mdoc_ignore_grep := $(DATAROOTDIR)/lint/mandoc/mdoc.ignore.grep
-
-_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)/% $(mandoc_mdoc_ignore_grep) | $$(@D)/
- $(info LINT (mandoc) $@)
- ! ($(MANDOC) -mdoc $(MANDOCFLAGS) $< 2>&1 \
- | $(GREP) -v -f '$(mandoc_mdoc_ignore_grep)' \
- ||:; \
- ) \
- | $(GREP) ^ >&2
- touch $@
-
-
-.PHONY: $(lint_mdoc)
-$(lint_mdoc): lint-mdoc-%: $$(_LINT_mdoc_%);
-
-.PHONY: lint-mdoc
-lint-mdoc: $(lint_mdoc);
-
-
-endif # include guard
diff --git a/share/mk/lint/man/tbl.mk b/share/mk/lint/man/tbl.mk
new file mode 100644
index 0000000..23e6eda
--- /dev/null
+++ b/share/mk/lint/man/tbl.mk
@@ -0,0 +1,48 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_LINT_MAN_TBL_INCLUDED
+MAKEFILE_LINT_MAN_TBL_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep.mk
+include $(MAKEFILEDIR)/configure/src.mk
+include $(MAKEFILEDIR)/lint/man/_.mk
+include $(MAKEFILEDIR)/src.mk
+
+
+_LINT_man_tbl := \
+ $(patsubst $(MANDIR)/%, $(_MANDIR)/%.lint-man.tbl.touch, $(NONSO_MAN))
+
+
+$(_LINT_man_tbl): $(_MANDIR)/%.lint-man.tbl.touch: $(MANDIR)/% $(MK) | $$(@D)/
+ $(info $(INFO_)GREP $@)
+ if $(GREP) -q '^\.TS$$' $< && ! $(HEAD) -n1 $< | $(GREP) -q '\\" t$$'; \
+ then \
+ >&2 $(ECHO) "$<:1: missing '\\\" t' comment:"; \
+ >&2 $(HEAD) -n1 <$<; \
+ exit 1; \
+ fi
+ if $(HEAD) -n1 $< | $(GREP) -q '\\" t$$' && ! $(GREP) -q '^\.TS$$' $<; \
+ then \
+ >&2 $(ECHO) "$<:1: spurious '\\\" t' comment:"; \
+ >&2 $(HEAD) -n1 <$<; \
+ exit 1; \
+ fi
+ if $(TAIL) -n+2 <$< | $(GREP) -q '\\" t$$'; \
+ then \
+ >&2 $(ECHO) "$<: spurious '\\\" t' not in first line:"; \
+ >&2 $(GREP) -n '\\" t$$' $< /dev/null; \
+ exit 1; \
+ fi
+ $(TOUCH) $@
+
+
+.PHONY: lint-man-tbl
+lint-man-tbl: $(_LINT_man_tbl);
+
+
+endif # include guard
diff --git a/share/mk/lint/mdoc/_.mk b/share/mk/lint/mdoc/_.mk
new file mode 100644
index 0000000..0f51ee2
--- /dev/null
+++ b/share/mk/lint/mdoc/_.mk
@@ -0,0 +1,31 @@
+# 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_INCLUDED
+MAKEFILE_LINT_MDOC_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/configure/directory_variables.mk
+include $(MAKEFILEDIR)/src.mk
+
+
+linters_mdoc := mandoc
+
+
+$(foreach l, $(linters_mdoc), \
+ $(eval _LINT_mdoc_$(l) := \
+ $(patsubst $(MANDIR)/%, $(_MANDIR)/%.lint-mdoc.$(l).touch, \
+ $(NONSO_MDOC))))
+
+
+$(foreach l, $(linters_mdoc), \
+ $(eval .PHONY: lint-mdoc-$(l)))
+$(foreach l, $(linters_mdoc), \
+ $(eval lint-mdoc-$(l): $(_LINT_mdoc_$(l));))
+.PHONY: lint-mdoc
+lint-mdoc: $(foreach l, $(linters_mdoc), lint-mdoc-$(l));
+
+
+endif # include guard
diff --git a/share/mk/lint/mdoc/mandoc.ignore.grep b/share/mk/lint/mdoc/mandoc.ignore.grep
new file mode 100644
index 0000000..4c73c59
--- /dev/null
+++ b/share/mk/lint/mdoc/mandoc.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/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