Skip to contentSkip to conversation

*.mk, CONTRIBUTING, INSTALL: lint, build, check: Reorganize some targets

PATCH New Alejandro Colomar 1 participant 1 message Apr 2, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 *.mk, CONTRIBUTING, INSTALL: lint, build, check: Reorganize some targets

Some targets which were under lint-* were really building cat pages, so let's call it build-catman, since it's what it is. As part of the build, it will report warnings, of course, as any other build system, so nothing really changed, except for the target names, and the path in the build tree where the cat pages (and intermediate files) are placed, which is now directly under <.tmp/man/*>.

Some other targets were checking that the cat pages were correct after the build, so those targets have been moved to check-* targets.

Document that contributors should run both the 'lint' and 'check' targets to check the correctness of their patches.

make all, a.k.a. make build, now builds _all_ that can be built, including cat pages, and C programs.

Implementation detail: $LINTMAN has been renamed, since now it's used also for things that are not linters. Call it $NONSO_MAN, since it's a list of the non-'.so' man pages, which are the ones we want to lint, build, and check.

Future directions:

I plan to implement 'build-html' using groff(1), which will reuse part of the build-catman pipeline. That will produce much higher quality HTML manual pages.

Cc G. Branden Robinson <[email protected]>
Cc Elliott Hughes <[email protected]>
Cc Oskari Pirhonen <[email protected]>
---
 CONTRIBUTING        |  22 ++++-----
 INSTALL             |  12 ++---
 Makefile            |  25 ++++++----
 lib/build-catman.mk | 112 ++++++++++++++++++++++++++++++++++++++++++++
 lib/build-src.mk    |   3 +-
 lib/build.mk        |  12 ++++-
 lib/check-catman.mk |  53 +++++++++++++++++++++
 lib/check.mk        |  19 ++++++++
 lib/lint-man.mk     |  56 ++--------------------
 lib/lint.mk         |   7 ---
 10 files changed, 234 insertions(+), 87 deletions(-)
 create mode 100644 lib/build-catman.mk
 create mode 100644 lib/check-catman.mk
 create mode 100644 lib/check.mk
CONTRIBUTING +11 -11
index 30e0bc244..8b03d7563 100644
@@ -2,7 +2,7 @@ Name
        Contributing - instructions for contributing to the project
 
 Synopsis
-       Mailing list, patches, lint, style guide, bug reports, and notes
+       Mailing list, patches, lint & check, style guide, bug reports, and notes
 
 Description
    Mailing list
@@ -129,23 +129,23 @@ Description
        -  Make patches against the latest version of the manual page.  Use
           git(1) for getting the latest version.
 
-   Lint
-       If you plan to patch a manual page, consider running the linters
-       configured in the build system, to make sure your change doesn't add
-       new warnings.  However, you might still get warnings that are not your
-       fault.  To minimize that, do the following steps:
+   Lint & check
+       If you plan to patch a manual page, consider running the linters and
+       checks configured in the build system, to make sure your change doesn't
+       add new warnings.  However, you might still get warnings that are not
+       your fault.  To minimize that, do the following steps:
 
        (1)  First use make(1)'s -t option, so that make(1) knows that it only
-            needs to lint again pages that you will touch.
+            needs to lint & check again pages that you will touch.
 
-                $ make -t lint >/dev/null
+                $ make -t lint check >/dev/null
 
        (2)  Run make(1) again, asking it to imagine that the page wou'll
             modify has been touched, to see which warnings you'll still see
             from that page that are not your fault.
 
                 $ # replace 'man2/membarrier.2' by the page you'll modify
-                $ make -W man2/membarrier.2 -k lint
+                $ make -W man2/membarrier.2 -k lint check
 
        (3)  Apply your changes, and then run make(1) again.  You can ignore
             warnings that you saw in step (2), but if you see any new ones,
@@ -153,11 +153,11 @@ Description
             patch email.
 
                 $ vi man2/membarrier.2  # do your work
-                $ make -k lint
+                $ make -k lint check
 
        See <INSTALL> for a list of dependencies that this feature requires.
        If you can't meet them all, don't worry; it will still run the linters
-       that you have available.
+       and checks that you have available.
 
    Style guide
        For a description of the preferred layout of manual pages, as well as
INSTALL +6 -6
index 2966be22f..402ce53e3 100644
@@ -92,7 +92,7 @@ Description
              -  rm(1)
              -  rmdir(1)
 
-          -  For linting man(7) source:
+          -  For linting/building/checking man(7) source:
              -  eqn(1)
              -  grotty(1)
              -  head(1)
@@ -101,7 +101,7 @@ Description
              -  tbl(1)
              -  troff(1) >= 1.23.0 - GNU troff is required.
 
-          -  For linting C source:
+          -  For linting/building C source:
              -  cc(1) - GCC or Clang
              -  clang-tidy(1)
              -  cpplint(1)
@@ -124,10 +124,10 @@ Description
           -  man(1)
           -  groff(1) | mandoc(1)
 
-   Lint (experimental)
-       You can lint both the manual pages, and the example C programs
-       contained in them.  See 'make help' for a list of targets that can be
-       used.
+   Lint & check
+       You can lint and check both the manual pages, and the example C
+       programs contained in them.  See 'make help' for a list of targets that
+       can be used.
 
 Files
    Makefile, lib/install-man.mk, lib/install.mk
Makefile +16 -9
index 67faeed94..d31d8b710 100644
@@ -50,7 +50,14 @@ help:
 	$(info	)
 	$(info	clean			Remove $$(builddir))
 	$(info	)
-	$(info	build			Alias for "build-html")
+	$(info	build			Wrapper for "build-catman build-html build-src")
+	$(info	)
+	$(info	build-catman		Build cat pages; alias for "build-catman-grotty")
+	$(info	build-catman-preconv	preconv(1) step of "build-catman")
+	$(info	build-catman-tbl	tbl(1) step of "build-catman")
+	$(info	build-catman-eqn	eqn(1) step of "build-catman")
+	$(info	build-catman-troff	troff(1) step of "build-catman")
+	$(info	build-catman-grotty	grotty(1) step of "build-catman")
 	$(info	)
 	$(info	build-html		Build HTML manual pages)
 	$(info	html			Alias for "build-html")
@@ -70,14 +77,11 @@ help:
 	$(info	lint-man		Wrapper for lint-man-* targets)
 	$(info	lint-man-mandoc		Lint man pages with mandoc(1))
 	$(info	lint-man-tbl		Lint man pages about '\" t' comment for tbl(1))
-	$(info	lint-man-groff		Alias for "lint-man-groff-grep")
-	$(info	lint-man-groff-preconv	Lint man pages with preconv(1))
-	$(info	lint-man-groff-tbl	Lint man pages with tbl(1))
-	$(info	lint-man-groff-eqn	Lint man pages with eqn(1))
-	$(info	lint-man-groff-troff	Lint man pages with troff(1))
-	$(info	lint-man-groff-grotty	Lint man pages with grotty(1))
-	$(info	lint-man-groff-col	Lint man pages with col(1))
-	$(info	lint-man-groff-grep	Lint man pages with grep(1))
+	$(info	)
+	$(info	check			Alias for "check-catman")
+	$(info	check-catman		Check cat pages; alias for "check-catman-grep")
+	$(info	check-catman-col	Filter cat pages with col(1))
+	$(info	check-catman-grep	Check cat pages with grep(1))
 	$(info	)
 	$(info	[un]install		Alias for "[un]install-man")
 	$(info	[un]install-man		Wrapper for [un]install-man* targets)
@@ -109,7 +113,10 @@ help:
 .SECONDEXPANSION:
 
 
+include $(srcdir)/lib/check.mk
+include $(srcdir)/lib/check-catman.mk
 include $(srcdir)/lib/build.mk
+include $(srcdir)/lib/build-catman.mk
 include $(srcdir)/lib/build-html.mk
 include $(srcdir)/lib/build-src.mk
 include $(srcdir)/lib/dist.mk
lib/build-catman.mk new file +112 -0

112 lines not on this page · raw message

lib/build-src.mk +1 -2
index 237d663b9..410af3abd 100644
@@ -10,7 +10,6 @@ MAKEFILE_BUILD_SRC_INCLUDED := 1
 
 include $(srcdir)/lib/build.mk
 include $(srcdir)/lib/cmd.mk
-include $(srcdir)/lib/lint.mk
 include $(srcdir)/lib/src.mk
 include $(srcdir)/lib/verbose.mk
 
@@ -56,7 +55,7 @@ LD  := $(CC) $(CFLAGS)
 MAN := man
 
 
-_SRCPAGEDIRS   := $(patsubst $(MANDIR)/%,$(_SRCDIR)/%.d,$(LINTMAN))
+_SRCPAGEDIRS   := $(patsubst $(MANDIR)/%,$(_SRCDIR)/%.d,$(NONSO_MAN))
 
 _UNITS_src_src := $(patsubst $(MANDIR)/%,$(_SRCDIR)/%,$(shell \
 		$(FIND) $(MANDIR)/man*/ -type f \
lib/build.mk +11 -1
index 71a76ba10..aab086981 100644
@@ -8,21 +8,31 @@ ifndef MAKEFILE_BUILD_INCLUDED
 MAKEFILE_BUILD_INCLUDED := 1
 
 
+include $(srcdir)/lib/cmd.mk
 include $(srcdir)/lib/src.mk
 
 
 builddir := .tmp
 
+SYSCONFDIR := $(srcdir)/etc
+
 _SRCDIR := $(builddir)/src
+_MANDIR := $(builddir)/man
 
 
 MKDIR := mkdir -p
 RM    := rm
 
 
+NONSO_MAN := $(shell $(FIND) $(MANDIR)/man*/ -type f \
+		| $(GREP) '$(MANEXT)' \
+		| $(XARGS) $(GREP) -l '^\.TH ' \
+		| $(SORT))
+_MANDIRS := $(patsubst $(MANDIR)/%,$(_MANDIR)/%/,$(MANDIRS))
 _SRCDIRS := $(patsubst $(MANDIR)/%,$(_SRCDIR)/%/,$(MANDIRS))
 
 
+$(_MANDIRS): %/: | $$(dir %) $(_MANDIR)/
 $(_SRCDIRS): %/: | $$(dir %) $(_SRCDIR)/
 
 
@@ -32,7 +42,7 @@ $(builddir)/%/:
 
 
 .PHONY: build
-build: build-html
+build: build-catman build-html build-src
 	@:
 
 .PHONY: clean
lib/check-catman.mk new file +53 -0

53 lines not on this page · raw message

lib/check.mk new file +19 -0
new file mode 100644
index 000000000..90190619e
@@ -0,0 +1,19 @@
+########################################################################
+# Copyright (C) 2023  Alejandro Colomar <[email protected]>
+# SPDX-License-Identifier:  GPL-3.0-or-later  OR  LGPL-3.0-or-later
+########################################################################
+
+
+ifndef MAKEFILE_CHECK_INCLUDED
+MAKEFILE_CHECK_INCLUDED := 1
+
+
+check := check-catman
+
+
+.PHONY: check
+check: $(check)
+	@:
+
+
+endif  # MAKEFILE_CHECK_INCLUDED
lib/lint-man.mk +5 -51

73 lines not on this page · raw message

lib/lint.mk +0 -7
index f287f973c..347e8d12c 100644
@@ -9,19 +9,12 @@ MAKEFILE_LINT_INCLUDED := 1
 
 
 include $(srcdir)/lib/build.mk
-include $(srcdir)/lib/cmd.mk
 include $(srcdir)/lib/src.mk
 
 
-SYSCONFDIR := $(srcdir)/etc
-
 _LINTDIR   := $(builddir)/lint
 
 
-LINTMAN   := $(shell $(FIND) $(MANDIR)/man*/ -type f \
-		| $(GREP) '$(MANEXT)' \
-		| $(XARGS) $(GREP) -l '^\.TH ' \
-		| $(SORT))
 _LINTDIRS := $(patsubst $(MANDIR)/%,$(_LINTDIR)/%/,$(MANDIRS))
 
 
Signature · 1 line
2.39.2