summaryrefslogtreecommitdiffstats
path: root/share/mk/build
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/build')
-rw-r--r--share/mk/build/_.mk4
-rw-r--r--share/mk/build/book.mk42
-rw-r--r--share/mk/build/catman/eqn.mk5
-rw-r--r--share/mk/build/catman/grotty.mk4
-rw-r--r--share/mk/build/catman/troff.mk22
-rw-r--r--share/mk/build/examples/_.mk19
-rw-r--r--share/mk/build/examples/cc.mk14
-rw-r--r--share/mk/build/examples/dir.mk27
-rw-r--r--share/mk/build/examples/ld.mk12
-rw-r--r--share/mk/build/examples/src.mk29
-rw-r--r--share/mk/build/fonts/_.mk19
-rw-r--r--share/mk/build/fonts/devpdf/download1
-rw-r--r--share/mk/build/fonts/download.mk26
-rw-r--r--share/mk/build/fonts/tinos/_.mk20
-rw-r--r--share/mk/build/fonts/tinos/afm.mk22
-rw-r--r--share/mk/build/fonts/tinos/dit.mk22
-rw-r--r--share/mk/build/fonts/tinos/pfa.mk22
-rw-r--r--share/mk/build/html/post-grohtml.mk4
-rw-r--r--share/mk/build/html/troff.mk14
-rw-r--r--share/mk/build/man/_.mk21
-rw-r--r--share/mk/build/man/man.mk32
-rw-r--r--share/mk/build/man/mdoc.mk27
-rw-r--r--share/mk/build/man/so.mk27
-rw-r--r--share/mk/build/pdf/_.mk2
-rw-r--r--share/mk/build/pdf/book/_.mk51
-rw-r--r--share/mk/build/pdf/book/front.roff33
-rwxr-xr-xshare/mk/build/pdf/book/prepare.pl252
-rw-r--r--share/mk/build/pdf/gropdf.mk25
-rw-r--r--share/mk/build/pdf/pages/_.mk13
-rw-r--r--share/mk/build/pdf/pages/eqn.mk (renamed from share/mk/build/pdf/eqn.mk)12
-rw-r--r--share/mk/build/pdf/pages/gropdf.mk25
-rw-r--r--share/mk/build/pdf/pages/troff.mk (renamed from share/mk/build/pdf/troff.mk)30
-rw-r--r--share/mk/build/pre/preconv.mk11
-rw-r--r--share/mk/build/pre/tbl.mk2
-rw-r--r--share/mk/build/ps/eqn.mk4
-rw-r--r--share/mk/build/ps/grops.mk4
-rw-r--r--share/mk/build/ps/troff.mk14
37 files changed, 739 insertions, 174 deletions
diff --git a/share/mk/build/_.mk b/share/mk/build/_.mk
index 8ced940..9bdcbd6 100644
--- a/share/mk/build/_.mk
+++ b/share/mk/build/_.mk
@@ -6,7 +6,7 @@ ifndef MAKEFILE_BUILD_INCLUDED
MAKEFILE_BUILD_INCLUDED := 1
-include $(MAKEFILEDIR)/configure/directory_variables.mk
+include $(MAKEFILEDIR)/configure/directory_variables/build.mk
_MANDIR := $(builddir)/man
@@ -14,9 +14,9 @@ _MANDIR := $(builddir)/man
.PHONY: build
build: \
- build-book \
build-catman \
build-html \
+ build-man \
build-pdf \
build-ps \
build-ex;
diff --git a/share/mk/build/book.mk b/share/mk/build/book.mk
deleted file mode 100644
index a941ced..0000000
--- a/share/mk/build/book.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2023-2024, Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
-
-
-ifndef MAKEFILE_BUILD_BOOK_INCLUDED
-MAKEFILE_BUILD_BOOK_INCLUDED := 1
-
-
-include $(MAKEFILEDIR)/build/_.mk
-include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
-include $(MAKEFILEDIR)/configure/build-depends/moreutils.mk
-include $(MAKEFILEDIR)/configure/src.mk
-include $(MAKEFILEDIR)/src.mk
-
-
-LMBDIR := $(srcdir)/scripts/LinuxManBook
-BUILDLMB := $(LMBDIR)/build.sh
-
-
-_LMB := $(_MANDIR)/man-pages.pdf
-
-
-$(_LMB): $(MANPAGES) $(wildcard $(LMBDIR)/* $(LMBDIR)/*/*) | $$(@D)/
- $(info $(INFO_)Build $@)
- CAT='$(CAT)' \
- PRECONV='$(PRECONV)' \
- PIC='$(PIC)' \
- TBL='$(TBL)' \
- EQN='$(EQN)' \
- TROFF='$(TROFF)' \
- GROPDF='$(GROPDF)' \
- $(BUILDLMB) $(MANDIR) \
- | $(SPONGE) $@
-
-
-.PHONY: build-book
-build-book: $(_LMB);
-
-
-endif # include guard
diff --git a/share/mk/build/catman/eqn.mk b/share/mk/build/catman/eqn.mk
index 48b6e75..d5796a8 100644
--- a/share/mk/build/catman/eqn.mk
+++ b/share/mk/build/catman/eqn.mk
@@ -7,8 +7,9 @@ MAKEFILE_BUILD_CATMAN_EQN_INCLUDED := 1
include $(MAKEFILEDIR)/build/pre/tbl.mk
-include $(MAKEFILEDIR)/configure/build-depends/grep.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/eqn.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/nroff.mk
_CATMAN_troff := $(patsubst %.eqn,%.cat.troff,$(_MAN_eqn))
diff --git a/share/mk/build/catman/grotty.mk b/share/mk/build/catman/grotty.mk
index 7def414..db2ab3d 100644
--- a/share/mk/build/catman/grotty.mk
+++ b/share/mk/build/catman/grotty.mk
@@ -7,10 +7,10 @@ MAKEFILE_BUILD_CATMAN_GROTTY_INCLUDED := 1
include $(MAKEFILEDIR)/build/catman/troff.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/grotty.mk
-_CATMAN := $(patsubst %.cat.set,%.cat,$(_CATMAN_MAN_set) $(_CATMAN_MDOC_set))
+_CATMAN := $(patsubst %.cat.set, %.cat, $(_CATMAN_MAN_set) $(_CATMAN_MDOC_set))
$(_CATMAN): %.cat: %.cat.set $(MK) | $$(@D)/
diff --git a/share/mk/build/catman/troff.mk b/share/mk/build/catman/troff.mk
index c38ba17..d5dd9d5 100644
--- a/share/mk/build/catman/troff.mk
+++ b/share/mk/build/catman/troff.mk
@@ -7,12 +7,13 @@ MAKEFILE_BUILD_CATMAN_TROFF_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/groff-base.mk
-include $(MAKEFILEDIR)/configure/src.mk
+include $(MAKEFILEDIR)/build/man/man.mk
+include $(MAKEFILEDIR)/build/man/mdoc.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/true.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/nroff.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/troff.mk
include $(MAKEFILEDIR)/configure/xfail.mk
-include $(MAKEFILEDIR)/src.mk
_XFAIL_CATMAN_MAN_set := \
@@ -45,12 +46,11 @@ _XFAIL_CATMAN_MAN_set := \
$(_MANDIR)/man8/zic.8.cat.set
+troff_catman_ignore_grep := $(MAKEFILEDIR)/build/catman/troff.ignore.grep
-troff_man_ignore_grep := $(MAKEFILEDIR)/build/catman/troff.ignore.grep
-
-_CATMAN_MAN_set := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.cat.set,$(NONSO_MAN))
-_CATMAN_MDOC_set := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.cat.set,$(NONSO_MDOC))
+_CATMAN_MAN_set := $(patsubst %, %.cat.set, $(_NONSO_MAN))
+_CATMAN_MDOC_set := $(patsubst %, %.cat.set, $(_NONSO_MDOC))
ifeq ($(SKIP_XFAIL),yes)
@@ -58,10 +58,10 @@ _CATMAN_MAN_set := $(filter-out $(_XFAIL_CATMAN_MAN_set), $(_CATMAN_MAN_set))
endif
-$(_CATMAN_MAN_set): %.cat.set: %.cat.troff $(troff_man_ignore_grep) $(MK) | $$(@D)/
+$(_CATMAN_MAN_set): %.cat.set: %.cat.troff $(troff_catman_ignore_grep) $(MK) | $$(@D)/
$(info $(INFO_)TROFF $@)
! ($(TROFF) -man $(TROFFFLAGS) $(NROFFFLAGS) <$< 2>&1 >$@ \
- | $(GREP) -v -f '$(troff_man_ignore_grep)' \
+ | $(GREP) -v -f '$(troff_catman_ignore_grep)' \
|| $(TRUE); \
) \
| $(GREP) ^ >&2
diff --git a/share/mk/build/examples/_.mk b/share/mk/build/examples/_.mk
index c01a952..f1e51e6 100644
--- a/share/mk/build/examples/_.mk
+++ b/share/mk/build/examples/_.mk
@@ -2,23 +2,8 @@
# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
-ifndef MAKEFILE_BUILD_EX_DIR_INCLUDED
-MAKEFILE_BUILD_EX_DIR_INCLUDED := 1
-
-
-include $(MAKEFILEDIR)/build/_.mk
-include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
-include $(MAKEFILEDIR)/configure/src.mk
-include $(MAKEFILEDIR)/src.mk
-
-
-_PAGEEXDIRS := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.d/,$(NONSO_MAN))
-
-
-$(_PAGEEXDIRS):
- +$(info $(INFO_)MKDIR $@)
- +$(MKDIR) -p $@
- +$(TOUCH) $@
+ifndef MAKEFILE_BUILD_EX_INCLUDED
+MAKEFILE_BUILD_EX_INCLUDED := 1
.PHONY: build-ex
diff --git a/share/mk/build/examples/cc.mk b/share/mk/build/examples/cc.mk
index 6513fbe..f1524d4 100644
--- a/share/mk/build/examples/cc.mk
+++ b/share/mk/build/examples/cc.mk
@@ -8,12 +8,12 @@ MAKEFILE_BUILD_EX_CC_INCLUDED := 1
include $(MAKEFILEDIR)/build/_.mk
include $(MAKEFILEDIR)/build/examples/src.mk
-include $(MAKEFILEDIR)/configure/build-depends/cc.mk
-include $(MAKEFILEDIR)/configure/build-depends/cpp.mk
+include $(MAKEFILEDIR)/configure/build-depends/gcc/cc.mk
+include $(MAKEFILEDIR)/configure/build-depends/cpp/cpp.mk
include $(MAKEFILEDIR)/configure/xfail.mk
-_XFAIL_UNITS_ex_o := \
+_XFAIL_EX_TU_o := \
$(_MANDIR)/man2/bpf.2.d/bpf.o \
$(_MANDIR)/man2/seccomp.2.d/seccomp.o \
$(_MANDIR)/man2/sigaction.2.d/sigaction.o \
@@ -36,19 +36,19 @@ _XFAIL_UNITS_ex_o := \
$(_MANDIR)/man3head/printf.h.3head.d/register_printf_specifier.o
-_UNITS_ex_o := $(patsubst %.c,%.o,$(_UNITS_ex_c))
+_EX_TU_o := $(patsubst %.c, %.o, $(_EX_TU_c))
ifeq ($(SKIP_XFAIL),yes)
-_UNITS_ex_o := $(filter-out $(_XFAIL_UNITS_ex_o), $(_UNITS_ex_o))
+_EX_TU_o := $(filter-out $(_XFAIL_EX_TU_o), $(_EX_TU_o))
endif
-$(_UNITS_ex_o): %.o: %.c $(MK)
+$(_EX_TU_o): %.o: %.c $(MK)
$(info $(INFO_)CC $@)
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
.PHONY: build-ex-cc
-build-ex-cc: $(_UNITS_ex_o);
+build-ex-cc: $(_EX_TU_o);
endif # include guard
diff --git a/share/mk/build/examples/dir.mk b/share/mk/build/examples/dir.mk
new file mode 100644
index 0000000..8aaaad3
--- /dev/null
+++ b/share/mk/build/examples/dir.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_BUILD_EX_DIR_INCLUDED
+MAKEFILE_BUILD_EX_DIR_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/man/man.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/mkdir.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/touch.mk
+
+
+_PAGEEXDIRS := $(patsubst %, %.d/, $(_NONSO_MAN))
+
+
+$(_PAGEEXDIRS):
+ +$(info $(INFO_)MKDIR $@)
+ +$(MKDIR) -p $@
+ +$(TOUCH) $@
+
+
+.PHONY: build-ex-dir
+build-ex-dir: $(_PAGEEXDIRS);
+
+
+endif # include guard
diff --git a/share/mk/build/examples/ld.mk b/share/mk/build/examples/ld.mk
index 9d5535d..6d63251 100644
--- a/share/mk/build/examples/ld.mk
+++ b/share/mk/build/examples/ld.mk
@@ -8,11 +8,11 @@ MAKEFILE_BUILD_EX_LD_INCLUDED := 1
include $(MAKEFILEDIR)/build/_.mk
include $(MAKEFILEDIR)/build/examples/cc.mk
-include $(MAKEFILEDIR)/configure/build-depends/ld.mk
+include $(MAKEFILEDIR)/configure/build-depends/binutils/ld.mk
include $(MAKEFILEDIR)/configure/xfail.mk
-_XFAIL_UNITS_ex_bin := \
+_XFAIL_EX_TU_bin := \
$(_MANDIR)/man2/add_key.2.d/add_key \
$(_MANDIR)/man2/keyctl.2.d/key_instantiate \
$(_MANDIR)/man2/request_key.2.d/t_request_key \
@@ -33,19 +33,19 @@ _XFAIL_UNITS_ex_bin := \
$(_MANDIR)/man3/tsearch.3.d/tsearch
-_UNITS_ex_bin := $(patsubst %.o,%,$(_UNITS_ex_o))
+_EX_TU_bin := $(patsubst %.o, %, $(_EX_TU_o))
ifeq ($(SKIP_XFAIL),yes)
-_UNITS_ex_bin := $(filter-out $(_XFAIL_UNITS_ex_bin), $(_UNITS_ex_bin))
+_EX_TU_bin := $(filter-out $(_XFAIL_EX_TU_bin), $(_EX_TU_bin))
endif
-$(_UNITS_ex_bin): %: %.o $(MK)
+$(_EX_TU_bin): %: %.o $(MK)
$(info $(INFO_)LD $@)
$(LD) $(LDFLAGS) -o $@ $< $(LDLIBS)
.PHONY: build-ex-ld
-build-ex-ld: $(_UNITS_ex_bin);
+build-ex-ld: $(_EX_TU_bin);
endif # include guard
diff --git a/share/mk/build/examples/src.mk b/share/mk/build/examples/src.mk
index f47a713..def626c 100644
--- a/share/mk/build/examples/src.mk
+++ b/share/mk/build/examples/src.mk
@@ -7,16 +7,17 @@ MAKEFILE_BUILD_EX_SRC_INCLUDED := 1
include $(MAKEFILEDIR)/build/_.mk
-include $(MAKEFILEDIR)/configure/build-depends/coreutils.mk
-include $(MAKEFILEDIR)/configure/build-depends/findutils.mk
-include $(MAKEFILEDIR)/configure/build-depends/grep.mk
-include $(MAKEFILEDIR)/configure/build-depends/mandoc.mk
-include $(MAKEFILEDIR)/configure/build-depends/sed.mk
-include $(MAKEFILEDIR)/configure/directory_variables.mk
-include $(MAKEFILEDIR)/src.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/head.mk
+include $(MAKEFILEDIR)/configure/build-depends/findutils/find.mk
+include $(MAKEFILEDIR)/configure/build-depends/findutils/xargs.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/mandoc/mandoc.mk
+include $(MAKEFILEDIR)/configure/build-depends/sed/sed.mk
+include $(MAKEFILEDIR)/configure/directory_variables/src.mk
+include $(MAKEFILEDIR)/src/sortman.mk
-_UNITS_ex_src := \
+_EX_TU_src := \
$(patsubst $(MANDIR)/%, $(_MANDIR)/%, \
$(shell \
$(FIND) $(MANDIR)/* -type f \
@@ -28,13 +29,13 @@ _UNITS_ex_src := \
| $(SED) 's,:,\\:,g' \
) \
)
-_UNITS_ex_h := $(filter %.h,$(_UNITS_ex_src))
-_UNITS_ex_c := $(filter %.c,$(_UNITS_ex_src))
+_EX_TU_h := $(filter %.h, $(_EX_TU_src))
+_EX_TU_c := $(filter %.c, $(_EX_TU_src))
-$(_UNITS_ex_src): $$(patsubst $(_MANDIR)/%.d,$(MANDIR)/%,$$(@D)) $(MK) | $$(@D)/
-$(_UNITS_ex_c): $$(filter $$(@D)/%.h,$(_UNITS_ex_h))
-$(_UNITS_ex_src):
+$(_EX_TU_src): $$(patsubst %.d, %, $$(@D)) $(MK) | $$(@D)/
+$(_EX_TU_c): $$(filter $$(@D)/%.h, $(_EX_TU_h))
+$(_EX_TU_src):
$(info $(INFO_)SED $@)
<$< \
$(SED) -n \
@@ -49,7 +50,7 @@ $(_UNITS_ex_src):
.PHONY: build-ex-src
-build-ex-src: $(_UNITS_ex_src);
+build-ex-src: $(_EX_TU_src);
endif # include guard
diff --git a/share/mk/build/fonts/_.mk b/share/mk/build/fonts/_.mk
new file mode 100644
index 0000000..cd5d29e
--- /dev/null
+++ b/share/mk/build/fonts/_.mk
@@ -0,0 +1,19 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_FONTS_INCLUDED
+MAKEFILE_BUILD_FONTS_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/configure/directory_variables/build.mk
+
+
+_FONTSDIR := $(builddir)/fonts
+
+
+.PHONY: build-fonts
+build-fonts: build-fonts-download build-fonts-tinos
+
+
+endif # include guard
diff --git a/share/mk/build/fonts/devpdf/download b/share/mk/build/fonts/devpdf/download
new file mode 100644
index 0000000..e230c82
--- /dev/null
+++ b/share/mk/build/fonts/devpdf/download
@@ -0,0 +1 @@
+ Tinos Tinos.pfa
diff --git a/share/mk/build/fonts/download.mk b/share/mk/build/fonts/download.mk
new file mode 100644
index 0000000..3320c97
--- /dev/null
+++ b/share/mk/build/fonts/download.mk
@@ -0,0 +1,26 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_FONTS_DOWNLOAD_INCLUDED
+MAKEFILE_BUILD_FONTS_DOWNLOAD_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/fonts/_.mk
+
+
+DOWNLOAD := $(MAKEFILEDIR)/build/fonts/devpdf/download
+
+_DOWNLOAD := $(_FONTSDIR)/devpdf/download
+
+
+$(_DOWNLOAD): $(_FONTSDIR)/%: $(MAKEFILEDIR)/build/fonts/% $(MK) | $$(@D)/
+ $(info $(INFO_)CP $@)
+ $(CP) -T $< $@
+
+
+.PHONY: build-fonts-download
+build-fonts-download: $(_DOWNLOAD)
+
+
+endif # include guard
diff --git a/share/mk/build/fonts/tinos/_.mk b/share/mk/build/fonts/tinos/_.mk
new file mode 100644
index 0000000..01bc122
--- /dev/null
+++ b/share/mk/build/fonts/tinos/_.mk
@@ -0,0 +1,20 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_FONTS_TINOS_INCLUDED
+MAKEFILE_BUILD_FONTS_TINOS_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/fonts/tinos/pfa.mk
+include $(MAKEFILEDIR)/build/fonts/tinos/dit.mk
+
+
+_TINOS := $(_TINOS_PFA) $(_TINOSR)
+
+
+.PHONY: build-fonts-tinos
+build-fonts-tinos: $(_TINOS)
+
+
+endif # include guard
diff --git a/share/mk/build/fonts/tinos/afm.mk b/share/mk/build/fonts/tinos/afm.mk
new file mode 100644
index 0000000..0745fea
--- /dev/null
+++ b/share/mk/build/fonts/tinos/afm.mk
@@ -0,0 +1,22 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_FONTS_TINOS_AFM_INCLUDED
+MAKEFILE_BUILD_FONTS_TINOS_AFM_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/fonts/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/texlive-fonts-extra-links/Tinos-Regular.ttf.mk
+include $(MAKEFILEDIR)/configure/build-depends/fontforge/fontforge.mk
+
+
+_TINOSR_AFM := $(_FONTSDIR)/devpdf/TinosR.afm
+
+
+$(_TINOSR_AFM): $(TINOSR_TTF) $(MK) | $$(@D)/
+ $(info $(INFO_)FONTFORGE $@)
+ $(FONTFORGE) $(FONTFORGEFLAGS) -lang=ff -c 'Open("$<");Generate("$@");'
+
+
+endif # include guard
diff --git a/share/mk/build/fonts/tinos/dit.mk b/share/mk/build/fonts/tinos/dit.mk
new file mode 100644
index 0000000..b00a05d
--- /dev/null
+++ b/share/mk/build/fonts/tinos/dit.mk
@@ -0,0 +1,22 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_FONTS_TINOS_DIT_INCLUDED
+MAKEFILE_BUILD_FONTS_TINOS_DIT_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/fonts/_.mk
+include $(MAKEFILEDIR)/build/fonts/tinos/afm.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff/afmtodit.mk
+
+
+_TINOSR := $(_FONTSDIR)/devpdf/TinosR
+
+
+$(_TINOSR): $(_FONTSDIR)/%: $(PDF_TEXT_ENC) $(_TINOSR_AFM) $(PDF_TEXT_MAP) $(MK) | $$(@D)/
+ $(info $(INFO_)AFMTODIT $@)
+ $(AFMTODIT) -e $(PDF_TEXT_ENC) $(_TINOSR_AFM) $(PDF_TEXT_MAP) $@
+
+
+endif # include guard
diff --git a/share/mk/build/fonts/tinos/pfa.mk b/share/mk/build/fonts/tinos/pfa.mk
new file mode 100644
index 0000000..f65b087
--- /dev/null
+++ b/share/mk/build/fonts/tinos/pfa.mk
@@ -0,0 +1,22 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_FONTS_TINOS_PFA_INCLUDED
+MAKEFILE_BUILD_FONTS_TINOS_PFA_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/fonts/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/texlive-fonts-extra/Tinos.pfb.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff/pfbtops.mk
+
+
+_TINOS_PFA := $(_FONTSDIR)/devpdf/Tinos.pfa
+
+
+$(_TINOS_PFA): $(TINOS_PFB) $(MK) | $$(@D)/
+ $(info $(INFO_)PFBTOPS $@)
+ $(PFBTOPS) <$< >$@
+
+
+endif # include guard
diff --git a/share/mk/build/html/post-grohtml.mk b/share/mk/build/html/post-grohtml.mk
index fe77776..26effbb 100644
--- a/share/mk/build/html/post-grohtml.mk
+++ b/share/mk/build/html/post-grohtml.mk
@@ -7,10 +7,10 @@ MAKEFILE_BUILD_HTML_POST_GROHTML_INCLUDED := 1
include $(MAKEFILEDIR)/build/html/troff.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff/post-grohtml.mk
-_HTMLMAN := $(patsubst %.html.set,%.html,$(_HTMLMAN_MAN_set) $(_HTMLMAN_MDOC_set))
+_HTMLMAN := $(patsubst %.html.set, %.html, $(_HTMLMAN_MAN_set) $(_HTMLMAN_MDOC_set))
$(_HTMLMAN): %.html: %.html.set $(MK) | $$(@D)/
diff --git a/share/mk/build/html/troff.mk b/share/mk/build/html/troff.mk
index 010c211..9b6f1fd 100644
--- a/share/mk/build/html/troff.mk
+++ b/share/mk/build/html/troff.mk
@@ -7,16 +7,18 @@ MAKEFILE_BUILD_HTML_TROFF_INCLUDED := 1
include $(MAKEFILEDIR)/build/_.mk
-include $(MAKEFILEDIR)/configure/build-depends/grep.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
-include $(MAKEFILEDIR)/configure/src.mk
+include $(MAKEFILEDIR)/build/man/man.mk
+include $(MAKEFILEDIR)/build/man/mdoc.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/troff.mk
include $(MAKEFILEDIR)/configure/xfail.mk
-include $(MAKEFILEDIR)/src.mk
_XFAIL_HTMLMAN_MAN_set := \
$(_MANDIR)/man2/fanotify_init.2.html.set \
+ $(_MANDIR)/man2/mbind.2.html.set \
$(_MANDIR)/man2/membarrier.2.html.set \
+ $(_MANDIR)/man2/set_mempolicy.2.html.set \
$(_MANDIR)/man5/proc.5.html.set \
$(_MANDIR)/man7/bpf-helpers.7.html.set \
$(_MANDIR)/man7/charsets.7.html.set \
@@ -25,8 +27,8 @@ _XFAIL_HTMLMAN_MAN_set := \
$(_MANDIR)/man8/zic.8.html.set
-_HTMLMAN_MAN_set := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.html.set,$(NONSO_MAN))
-_HTMLMAN_MDOC_set:= $(patsubst $(MANDIR)/%,$(_MANDIR)/%.html.set,$(NONSO_MDOC))
+_HTMLMAN_MAN_set := $(patsubst %, %.html.set, $(_NONSO_MAN))
+_HTMLMAN_MDOC_set := $(patsubst %, %.html.set, $(_NONSO_MDOC))
ifeq ($(SKIP_XFAIL),yes)
diff --git a/share/mk/build/man/_.mk b/share/mk/build/man/_.mk
new file mode 100644
index 0000000..6a7f624
--- /dev/null
+++ b/share/mk/build/man/_.mk
@@ -0,0 +1,21 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_MAN_INCLUDED
+MAKEFILE_BUILD_MAN_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/configure/directory_variables/src.mk
+include $(MAKEFILEDIR)/src/man.mk
+
+
+_MANPAGES := $(patsubst $(MANDIR)/%, $(_MANDIR)/%, $(MANPAGES))
+
+
+.PHONY: build-man
+build-man: build-man-man build-man-mdoc build-man-so;
+
+
+endif # include guard
diff --git a/share/mk/build/man/man.mk b/share/mk/build/man/man.mk
new file mode 100644
index 0000000..b15ea0d
--- /dev/null
+++ b/share/mk/build/man/man.mk
@@ -0,0 +1,32 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_MAN_MAN_INCLUDED
+MAKEFILE_BUILD_MAN_MAN_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/git/git.mk
+include $(MAKEFILEDIR)/configure/build-depends/sed/sed.mk
+include $(MAKEFILEDIR)/configure/directory_variables/src.mk
+include $(MAKEFILEDIR)/configure/verbose.mk
+include $(MAKEFILEDIR)/configure/version.mk
+include $(MAKEFILEDIR)/src/man.mk
+
+
+_NONSO_MAN := $(patsubst $(MANDIR)/%, $(_MANDIR)/%, $(NONSO_MAN))
+
+
+$(_NONSO_MAN): $(_MANDIR)/%: $(MANDIR)/% $(MK) | $$(@D)/
+ $(info $(INFO_)SED $@)
+ <$< \
+ $(SED) "/^\.TH/s/(date)/$$($(MANPAGEDATECMD))/" \
+ | $(SED) '/^\.TH/s/(unreleased)/$(DISTVERSION)/' >$@
+
+
+.PHONY: build-man-man
+build-man-man: $(_NONSO_MAN)
+
+
+endif # include guard
diff --git a/share/mk/build/man/mdoc.mk b/share/mk/build/man/mdoc.mk
new file mode 100644
index 0000000..271a0a6
--- /dev/null
+++ b/share/mk/build/man/mdoc.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_BUILD_MAN_MDOC_INCLUDED
+MAKEFILE_BUILD_MAN_MDOC_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/cp.mk
+include $(MAKEFILEDIR)/configure/directory_variables/src.mk
+include $(MAKEFILEDIR)/src/man.mk
+
+
+_NONSO_MDOC := $(patsubst $(MANDIR)/%, $(_MANDIR)/%, $(NONSO_MDOC))
+
+
+$(_NONSO_MDOC): $(_MANDIR)/%: $(MANDIR)/% $(MK) | $$(@D)/
+ $(info $(INFO_)CP $@)
+ $(CP) -T $< $@
+
+
+.PHONY: build-man-mdoc
+build-man-mdoc: $(_NONSO_MDOC)
+
+
+endif # include guard
diff --git a/share/mk/build/man/so.mk b/share/mk/build/man/so.mk
new file mode 100644
index 0000000..6ff1e90
--- /dev/null
+++ b/share/mk/build/man/so.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_BUILD_MAN_SO_INCLUDED
+MAKEFILE_BUILD_MAN_SO_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/cp.mk
+include $(MAKEFILEDIR)/configure/directory_variables/src.mk
+include $(MAKEFILEDIR)/src/man.mk
+
+
+_SO_MAN := $(patsubst $(MANDIR)/%, $(_MANDIR)/%, $(SO_MAN))
+
+
+$(_SO_MAN): $(_MANDIR)/%: $(MANDIR)/% $(MK) | $$(@D)/
+ $(info $(INFO_)CP $@)
+ $(CP) -T $< $@
+
+
+.PHONY: build-man-so
+build-man-so: $(_SO_MAN)
+
+
+endif # include guard
diff --git a/share/mk/build/pdf/_.mk b/share/mk/build/pdf/_.mk
index f6660aa..65083a0 100644
--- a/share/mk/build/pdf/_.mk
+++ b/share/mk/build/pdf/_.mk
@@ -7,7 +7,7 @@ MAKEFILE_BUILD_PDF_INCLUDED := 1
.PHONY: build-pdf
-build-pdf: build-pdf-gropdf;
+build-pdf: build-pdf-book build-pdf-pages;
endif # include guard
diff --git a/share/mk/build/pdf/book/_.mk b/share/mk/build/pdf/book/_.mk
new file mode 100644
index 0000000..03595f6
--- /dev/null
+++ b/share/mk/build/pdf/book/_.mk
@@ -0,0 +1,51 @@
+# Copyright 2023-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_PDF_BOOK_INCLUDED
+MAKEFILE_BUILD_PDF_BOOK_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/build/man/_.mk
+include $(MAKEFILEDIR)/build/fonts/_.mk
+include $(MAKEFILEDIR)/build/fonts/tinos/_.mk
+include $(MAKEFILEDIR)/configure/build-depends/coreutils/cat.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff/gropdf.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/eqn.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/pic.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/preconv.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/tbl.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/troff.mk
+include $(MAKEFILEDIR)/configure/build-depends/moreutils/sponge.mk
+include $(MAKEFILEDIR)/configure/version.mk
+
+
+MKBOOKDIR := $(MAKEFILEDIR)/build/pdf/book
+MKBOOK := $(wildcard $(MKBOOKDIR)/*)
+
+
+PDF_BOOK := $(DISTNAME).pdf
+_PDFDIR := $(builddir)
+_PDF_BOOK := $(_PDFDIR)/$(PDF_BOOK)
+
+
+$(_PDF_BOOK): $(_MANPAGES) $(_DOWNLOAD) $(_TINOS) $(MKBOOK) $(MK) | $$(@D)/
+ $(info $(INFO_)GROPDF $@)
+ $(MKBOOKDIR)/prepare.pl $(_MANDIR) \
+ | $(CAT) $(MKBOOKDIR)/front.roff /dev/stdin \
+ | $(PRECONV) \
+ | $(PIC) \
+ | $(TBL) \
+ | $(EQN) -Tpdf \
+ | $(TROFF) -mandoc -Tpdf -F$(_FONTSDIR) -dpaper=a4 -rC1 \
+ -ran*bookmark-base-level=1 $(TROFFFLAGS) \
+ | $(GROPDF) -F$(_FONTSDIR) -pa4 $(GROPDFFLAGS) \
+ | $(SPONGE) $@
+
+
+.PHONY: build-pdf-book
+build-pdf-book: $(_PDF_BOOK);
+
+
+endif # include guard
diff --git a/share/mk/build/pdf/book/front.roff b/share/mk/build/pdf/book/front.roff
new file mode 100644
index 0000000..fdf1a98
--- /dev/null
+++ b/share/mk/build/pdf/book/front.roff
@@ -0,0 +1,33 @@
+.de Hl
+.br
+\l'\\n[.l]u-\\n[.i]u\&\\$1'
+.br
+..
+.ps 10
+.vs 12
+.po 2c
+.ll 17c
+.sp 2.5c
+\Z@\D't 8p'@
+.Hl
+\D't 0'
+.sp .6i
+.ad r
+.ps 52
+\m[maroon]GNU/Linux\m[]
+.sp 18p
+.ps 16
+\f[BMB]THE MAN-PAGES BOOK\fP
+.sp 6i
+.ps 12
+\f[HB]Maintainers:\fP
+.sp 2p
+.ps 10
+\f[HB]Alejandro Colomar <alx@kernel.org> 2020 - present (5.09 - HEAD)
+.brp
+Michael Kerrisk <mtk.manpages@gmail.com> 2004 - 2021 (2.00 - 5.13)
+.brp
+Andries Brouwer <aeb@cwi.nl> 1995 - 2004 (1.6 - 1.70)
+.brp
+Rik Faith 1993 - 1995 \0(1.0 - 1.5)\fP
+.bp
diff --git a/share/mk/build/pdf/book/prepare.pl b/share/mk/build/pdf/book/prepare.pl
new file mode 100755
index 0000000..a074082
--- /dev/null
+++ b/share/mk/build/pdf/book/prepare.pl
@@ -0,0 +1,252 @@
+#!/usr/bin/perl -w
+#
+# BuildLinuxMan.pl : Build Linux manpages book
+# Deri James (& Brian Inglis) : 15 Dec 2022
+#
+# Params:-
+#
+# $1 = Directory holding the man pages
+#
+# (C) Copyright 2022, Deri James
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details
+# (http://www.gnu.org/licenses/gpl-2.0.html).
+#
+
+use strict;
+use File::Basename;
+
+my $inTS=0;
+my $inBlock=0;
+
+my %Sections=
+(
+ "1" => "General Commands Manual",
+ "2" => "System Calls Manual",
+ "2type" => "System Calls Manual (types)",
+ "3" => "Library Functions Manual",
+ "3const" => "Library Functions Manual (constants)",
+ "3head" => "Library Functions Manual (headers)",
+ "3type" => "Library Functions Manual (types)",
+ "4" => "Kernel Interfaces Manual",
+ "5" => "File Formats Manual",
+ "6" => "Games Manual",
+ "7" => "Miscellaneous Information Manual",
+ "8" => "System Manager's Manual",
+ "9" => "Kernel Developer's Manual",
+);
+
+my $dir=shift || '.';
+my $dir2=$dir;
+$dir2=~tr[.][_];
+my %files;
+my %aliases;
+
+foreach my $al (`find "$dir"/man*/ -type f \\
+ | grep "\\.[[:digit:]]\\([[:alpha:]][[:alnum:]]*\\)\\?\\>\$" \\
+ | xargs grep '^\\.so' /dev/null;`)
+{
+ #$al=~tr[.][_];
+ $al=~m/^$dir\/man\d[a-z]*\/(.*):\.\s*so\s*man\d[a-z]*\/(.*)/o;
+
+ $aliases{$1}=$2;
+}
+
+while (my ($k,$v)=each %aliases)
+{
+ while (exists($aliases{$v})) {
+ $v=$aliases{$v};
+ }
+}
+
+foreach my $fn (`find "$dir"/man*/ -type f \\
+ | grep "\\.[[:digit:]]\\([[:alpha:]][[:alnum:]]*\\)\\?\\>\$";`)
+{
+ $fn=~s/\n//;
+
+ my ($nm,$sec)=GetNmSec($fn,qr/\.\d[a-z]*/);
+ $files{"${nm}.$sec"}=[$fn,(exists($aliases{"${nm}.$sec"}))?$aliases{"${nm}.$sec"}:"${nm}.$sec"];
+}
+
+my $Section='';
+
+BuildBook();
+
+sub BuildBook
+{
+ print ".pdfpagenumbering D . 1\n.nr PDFOUTLINE.FOLDLEVEL 0\n.defcolor pdf:href.colour rgb 0.00 0.25 0.75\n.pdfinfo /Title \"The Linux man-pages Book\"\n.special TinosR S\n";
+
+ foreach my $bkmark (sort sortman keys %files) {
+ BuildPage($bkmark);
+ }
+}
+
+sub BuildPage
+{
+ my $bkmark=shift;
+
+ my $fn=$files{$bkmark}->[0];
+ my ($nm,$sec,$srt)=GetNmSec($bkmark,qr/\.[\da-z]+/);
+
+ my $title= "$nm\\($sec\\)";
+
+ print ".\\\" >>>>>> $nm($sec) <<<<<<\n.lf 0 $bkmark\n";
+
+ # If this is an alias, just add it to the outline panel.
+
+ # if new section add top level bookmark
+
+ if ($sec ne $Section) {
+ print ".nr PDFOUTLINE.FOLDLEVEL 1\n";
+ print ".pdfbookmark 1 $Sections{$sec}\n";
+ print ".nr PDFOUTLINE.FOLDLEVEL 2\n";
+ $Section=$sec;
+ }
+
+ if (exists($aliases{$bkmark})) {
+ print ".eo\n.device ps:exec [/Dest /$aliases{$bkmark} /Title ($title) /Level 2 /OUT pdfmark\n.ec\n.fl\n";
+ return;
+ }
+
+ if (open(F,'<',$fn)) {
+ while (<F>) {
+ if (m/^\.\\"/) {
+ print $_;
+ next;
+ }
+
+ chomp;
+
+ # This code is to determine whether we are within a tbl block and in a text block
+ # T{ and T}. This is fudge code particularly for the syscalls(7) page.
+
+ $inTS=1 if m/\.TS/;
+ $inTS=0,$inBlock=0 if m/\.TE/;
+
+ next if !$_;
+# s/^\s+//;
+
+ s/\\-/-/g if /^\.[BM]R\s+/;
+
+ if (m/^\.BR\s+([-\w\\.]+)\s+\((.+?)\)(.*)/ or m/^\.MR\s+([-\w\\.]+)\s+(\w+)\s+(.*)/ or m/^\\fB([-\w\\.]+)\\fR\((.+?)\)(.*)$/) {
+ my $bkmark="$1";
+ my $sec=$2;
+ my $after=$3;
+ $after=~s/\s\\".*//;
+ my $dest=$bkmark;
+ $dest=~s/\\-/-/g;
+
+ if (exists($files{"${bkmark}.$sec"})) {
+ my $dest=$files{"${bkmark}.$sec"}->[1];
+ $_=".pdfhref L -D \"$dest\" -A \"$after\" -- \\fI$bkmark\\fP($sec)";
+ } else {
+ $_=".IR $bkmark ($sec)\\c\n$after";
+ }
+ }
+
+ s/^\.BI \\fB/.BI /;
+ s/^\.BR\s+(\S+)\s*$/.B $1/;
+ s/^\.BI\s+(\S+)\s*$/.B $1/;
+ s/^\.IR\s+(\S+)\s*$/.I $1/;
+
+ # Fiddling for syscalls(7) :-(
+
+ if ($inTS) {
+ my @cols=split(/\t/,$_);
+
+ foreach my $c (@cols) {
+ $inBlock+=()=$c=~m/T\{/g;
+ $inBlock-=()=$c=~m/T\}/g;
+
+ my $mtch=$c=~s/\s*\\fB([-\w.]+)\\fP\((\w+)\)/doMR($1,$2)/ge;
+ $c="T{\n${c}\nT}" if $mtch and !$inBlock;
+ }
+
+ $_=join("\t",@cols);
+ s/\n\n/\n/g;
+ }
+
+ s/\\&\././ if m/^.TH /;
+
+ if (m/^\.TH\s+"?([-\w\\.]+)"?\s+"?(\w+)"?/) {
+
+ print "$_\n";
+
+ # Add a level two bookmark. We don't set it in the TH macro since the name passed
+ # may be different from the filename, i.e. file = unimplemented.2, TH = UNIMPLEMENTED 2
+
+ print ".pdfbookmark -T $bkmark 2 $nm($sec)\n";
+
+ next;
+ }
+ print "$_\n";
+ }
+ close(F);
+ }
+}
+
+sub doMR
+{
+ my $nm=shift;
+ my $sec=shift;
+
+ if (exists($files{"${nm}.$sec"})) {
+ return("\n.pdfhref L -D \"$files{\"${nm}.$sec\"}->[1]\" -A \"\\c\" -- \\fI$nm\\fP($sec)\n");
+ } else {
+ return("\\fI$nm\\fP($sec)");
+ }
+}
+
+sub GetNmSec
+{
+ my ($nm,$pth,$sec)=fileparse($_[0],$_[1]);
+ $sec=substr($sec,1);
+ my $srt=$nm;
+ $srt=~s/\..+?$//;
+ $srt=~s/^_+//;
+ $srt=$1.sprintf("%04d",$2) if $srt=~m/^(.+)(\d+)$/;
+ #$srt="$sec/$srt";
+ return($nm,$sec,$srt);
+}
+
+# add rpmvercmp
+#use RPM::VersionSort;
+#use Sort::Versions;
+
+sub sortman
+{
+# Sort - ignore case but frig it so that intro is the first entry.
+
+ my (undef,$s1,$c)=GetNmSec($a,qr/\.\d[a-z]*/);
+ my (undef,$s2,$d)=GetNmSec($b,qr/\.\d[a-z]*/);
+
+ my $cmp=$s1 cmp $s2;
+
+ return $cmp if $cmp;
+ return -1 if ($c=~m/^intro/ and $d!~m/^intro/);
+ return 1 if ($d=~m/^intro/ and $c!~m/^intro/);
+ $c=~tr[-_(][!" ];
+ $d=~tr[-_(][!" ];
+ $cmp=lc($c) cmp lc($d);
+ return($c cmp $d) if $cmp == 0;
+ return($cmp);
+}
+
+sub strhex
+{
+ my $res='';
+
+ foreach my $c (split('',$_[0])) {
+ $res.=sprintf("%02X",ord($c));
+ }
+
+ return($res);
+}
diff --git a/share/mk/build/pdf/gropdf.mk b/share/mk/build/pdf/gropdf.mk
deleted file mode 100644
index 0913122..0000000
--- a/share/mk/build/pdf/gropdf.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
-# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
-
-
-ifndef MAKEFILE_BUILD_PDF_GROPDF_INCLUDED
-MAKEFILE_BUILD_PDF_GROPDF_INCLUDED := 1
-
-
-include $(MAKEFILEDIR)/build/pdf/troff.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff.mk
-
-
-_PDFMAN := $(patsubst %.pdf.set,%.pdf,$(_PDFMAN_MAN_set) $(_PDFMAN_MDOC_set))
-
-
-$(_PDFMAN): %.pdf: %.pdf.set $(MK) | $$(@D)/
- $(info $(INFO_)GROPDF $@)
- $(GROPDF) $(GROPDFFLAGS) <$< >$@
-
-
-.PHONY: build-pdf-gropdf
-build-pdf-gropdf: $(_PDFMAN);
-
-
-endif # include guard
diff --git a/share/mk/build/pdf/pages/_.mk b/share/mk/build/pdf/pages/_.mk
new file mode 100644
index 0000000..0885039
--- /dev/null
+++ b/share/mk/build/pdf/pages/_.mk
@@ -0,0 +1,13 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_PDF_PAGES_INCLUDED
+MAKEFILE_BUILD_PDF_PAGES_INCLUDED := 1
+
+
+.PHONY: build-pdf-pages
+build-pdf-pages: build-pdf-pages-gropdf;
+
+
+endif # include guard
diff --git a/share/mk/build/pdf/eqn.mk b/share/mk/build/pdf/pages/eqn.mk
index bb0598b..aedf4cf 100644
--- a/share/mk/build/pdf/eqn.mk
+++ b/share/mk/build/pdf/pages/eqn.mk
@@ -2,13 +2,13 @@
# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
-ifndef MAKEFILE_BUILD_PDF_EQN_INCLUDED
-MAKEFILE_BUILD_PDF_EQN_INCLUDED := 1
+ifndef MAKEFILE_BUILD_PDF_PAGES_EQN_INCLUDED
+MAKEFILE_BUILD_PDF_PAGES_EQN_INCLUDED := 1
include $(MAKEFILEDIR)/build/pre/tbl.mk
-include $(MAKEFILEDIR)/configure/build-depends/grep.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/eqn.mk
_PDFMAN_troff := $(patsubst %.eqn,%.pdf.troff,$(_MAN_eqn))
@@ -20,8 +20,8 @@ $(_PDFMAN_troff): %.pdf.troff: %.eqn $(MK) | $$(@D)/
| $(GREP) ^ >&2
-.PHONY: build-pdf-eqn
-build-pdf-eqn: $(_PDFMAN_troff);
+.PHONY: build-pdf-pages-eqn
+build-pdf-pages-eqn: $(_PDFMAN_troff);
endif # include guard
diff --git a/share/mk/build/pdf/pages/gropdf.mk b/share/mk/build/pdf/pages/gropdf.mk
new file mode 100644
index 0000000..39aa61a
--- /dev/null
+++ b/share/mk/build/pdf/pages/gropdf.mk
@@ -0,0 +1,25 @@
+# Copyright 2021-2024, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
+
+
+ifndef MAKEFILE_BUILD_PDF_PAGES_GROPDF_INCLUDED
+MAKEFILE_BUILD_PDF_PAGES_GROPDF_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/pdf/pages/troff.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff/gropdf.mk
+
+
+_PDFMAN := $(patsubst %.pdf.set, %.pdf, $(_PDFMAN_MAN_set) $(_PDFMAN_MDOC_set))
+
+
+$(_PDFMAN): %.pdf: %.pdf.set $(MK) | $$(@D)/
+ $(info $(INFO_)GROPDF $@)
+ $(GROPDF) $(GROPDFFLAGS) <$< >$@
+
+
+.PHONY: build-pdf-pages-gropdf
+build-pdf-pages-gropdf: $(_PDFMAN);
+
+
+endif # include guard
diff --git a/share/mk/build/pdf/troff.mk b/share/mk/build/pdf/pages/troff.mk
index 5254d5d..dacfdb0 100644
--- a/share/mk/build/pdf/troff.mk
+++ b/share/mk/build/pdf/pages/troff.mk
@@ -2,21 +2,23 @@
# SPDX-License-Identifier: LGPL-3.0-only WITH LGPL-3.0-linking-exception
-ifndef MAKEFILE_BUILD_PDF_TROFF_INCLUDED
-MAKEFILE_BUILD_PDF_TROFF_INCLUDED := 1
+ifndef MAKEFILE_BUILD_PDF_PAGES_TROFF_INCLUDED
+MAKEFILE_BUILD_PDF_PAGES_TROFF_INCLUDED := 1
include $(MAKEFILEDIR)/build/_.mk
-include $(MAKEFILEDIR)/configure/build-depends/grep.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
-include $(MAKEFILEDIR)/configure/src.mk
+include $(MAKEFILEDIR)/build/man/man.mk
+include $(MAKEFILEDIR)/build/man/mdoc.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/troff.mk
include $(MAKEFILEDIR)/configure/xfail.mk
-include $(MAKEFILEDIR)/src.mk
_XFAIL_PDFMAN_MAN_set := \
$(_MANDIR)/man1/iconv.1.pdf.set \
$(_MANDIR)/man2/fanotify_init.2.pdf.set \
+ $(_MANDIR)/man2/membarrier.2.pdf.set \
+ $(_MANDIR)/man2/statx.2.pdf.set \
$(_MANDIR)/man2/syscall.2.pdf.set \
$(_MANDIR)/man3/newlocale.3.pdf.set \
$(_MANDIR)/man7/address_families.7.pdf.set \
@@ -42,8 +44,8 @@ _XFAIL_PDFMAN_MAN_set := \
$(_MANDIR)/man7/vdso.7.pdf.set
-_PDFMAN_MAN_set := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.pdf.set,$(NONSO_MAN))
-_PDFMAN_MDOC_set := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.pdf.set,$(NONSO_MDOC))
+_PDFMAN_MAN_set := $(patsubst %, %.pdf.set, $(_NONSO_MAN))
+_PDFMAN_MDOC_set := $(patsubst %, %.pdf.set, $(_NONSO_MDOC))
ifeq ($(SKIP_XFAIL),yes)
@@ -62,14 +64,14 @@ $(_PDFMAN_MDOC_set): %.pdf.set: %.pdf.troff $(MK) | $$(@D)/
| $(GREP) ^ >&2
-.PHONY: build-pdf-troff-man
-build-pdf-troff-man: $(_PDFMAN_MAN_set);
+.PHONY: build-pdf-pages-troff-man
+build-pdf-pages-troff-man: $(_PDFMAN_MAN_set);
-.PHONY: build-pdf-troff-mdoc
-build-pdf-troff-mdoc: $(_PDFMAN_MDOC_set);
+.PHONY: build-pdf-pages-troff-mdoc
+build-pdf-pages-troff-mdoc: $(_PDFMAN_MDOC_set);
-.PHONY: build-pdf-troff
-build-pdf-troff: build-pdf-troff-man build-pdf-troff-mdoc;
+.PHONY: build-pdf-pages-troff
+build-pdf-pages-troff: build-pdf-pages-troff-man build-pdf-pages-troff-mdoc;
endif # include guard
diff --git a/share/mk/build/pre/preconv.mk b/share/mk/build/pre/preconv.mk
index 73aa1da..6e8c881 100644
--- a/share/mk/build/pre/preconv.mk
+++ b/share/mk/build/pre/preconv.mk
@@ -6,16 +6,15 @@ ifndef MAKEFILE_BUILD_PRE_PRECONV_INCLUDED
MAKEFILE_BUILD_PRE_PRECONV_INCLUDED := 1
-include $(MAKEFILEDIR)/build/_.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
-include $(MAKEFILEDIR)/configure/src.mk
-include $(MAKEFILEDIR)/src.mk
+include $(MAKEFILEDIR)/build/man/man.mk
+include $(MAKEFILEDIR)/build/man/mdoc.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/preconv.mk
-_MAN_tbl := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.tbl,$(NONSO_MAN) $(NONSO_MDOC))
+_MAN_tbl := $(patsubst %, %.tbl, $(_NONSO_MAN) $(_NONSO_MDOC))
-$(_MAN_tbl): $(_MANDIR)/%.tbl: $(MANDIR)/% $(MK) | $$(@D)/
+$(_MAN_tbl): %.tbl: % $(MK) | $$(@D)/
$(info $(INFO_)PRECONV $@)
$(PRECONV) $(PRECONVFLAGS) $< >$@
diff --git a/share/mk/build/pre/tbl.mk b/share/mk/build/pre/tbl.mk
index 24486f8..0deb42e 100644
--- a/share/mk/build/pre/tbl.mk
+++ b/share/mk/build/pre/tbl.mk
@@ -7,7 +7,7 @@ MAKEFILE_BUILD_PRE_TBL_INCLUDED := 1
include $(MAKEFILEDIR)/build/pre/preconv.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/tbl.mk
_MAN_eqn := $(patsubst %.tbl,%.eqn,$(_MAN_tbl))
diff --git a/share/mk/build/ps/eqn.mk b/share/mk/build/ps/eqn.mk
index a4c921e..c88b202 100644
--- a/share/mk/build/ps/eqn.mk
+++ b/share/mk/build/ps/eqn.mk
@@ -7,8 +7,8 @@ MAKEFILE_BUILD_PS_EQN_INCLUDED := 1
include $(MAKEFILEDIR)/build/pre/tbl.mk
-include $(MAKEFILEDIR)/configure/build-depends/grep.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/eqn.mk
_PSMAN_troff := $(patsubst %.eqn,%.ps.troff,$(_MAN_eqn))
diff --git a/share/mk/build/ps/grops.mk b/share/mk/build/ps/grops.mk
index cca9b44..fae11e1 100644
--- a/share/mk/build/ps/grops.mk
+++ b/share/mk/build/ps/grops.mk
@@ -7,10 +7,10 @@ MAKEFILE_BUILD_PS_GROPS_INCLUDED := 1
include $(MAKEFILEDIR)/build/ps/troff.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/grops.mk
-_PSMAN := $(patsubst %.ps.set,%.ps,$(_PSMAN_MAN_set) $(_PSMAN_MDOC_set))
+_PSMAN := $(patsubst %.ps.set, %.ps, $(_PSMAN_MAN_set) $(_PSMAN_MDOC_set))
$(_PSMAN): %.ps: %.ps.set $(MK) | $$(@D)/
diff --git a/share/mk/build/ps/troff.mk b/share/mk/build/ps/troff.mk
index 1492821..f56783b 100644
--- a/share/mk/build/ps/troff.mk
+++ b/share/mk/build/ps/troff.mk
@@ -7,16 +7,18 @@ MAKEFILE_BUILD_PS_TROFF_INCLUDED := 1
include $(MAKEFILEDIR)/build/_.mk
-include $(MAKEFILEDIR)/configure/build-depends/grep.mk
-include $(MAKEFILEDIR)/configure/build-depends/groff-base.mk
-include $(MAKEFILEDIR)/configure/src.mk
+include $(MAKEFILEDIR)/build/man/man.mk
+include $(MAKEFILEDIR)/build/man/mdoc.mk
+include $(MAKEFILEDIR)/configure/build-depends/grep/grep.mk
+include $(MAKEFILEDIR)/configure/build-depends/groff-base/troff.mk
include $(MAKEFILEDIR)/configure/xfail.mk
-include $(MAKEFILEDIR)/src.mk
_XFAIL_PSMAN_MAN_set := \
$(_MANDIR)/man1/iconv.1.ps.set \
$(_MANDIR)/man2/fanotify_init.2.ps.set \
+ $(_MANDIR)/man2/membarrier.2.ps.set \
+ $(_MANDIR)/man2/statx.2.ps.set \
$(_MANDIR)/man2/syscall.2.ps.set \
$(_MANDIR)/man3/newlocale.3.ps.set \
$(_MANDIR)/man7/address_families.7.ps.set \
@@ -42,8 +44,8 @@ _XFAIL_PSMAN_MAN_set := \
$(_MANDIR)/man7/vdso.7.ps.set
-_PSMAN_MAN_set := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.ps.set,$(NONSO_MAN))
-_PSMAN_MDOC_set:= $(patsubst $(MANDIR)/%,$(_MANDIR)/%.ps.set,$(NONSO_MDOC))
+_PSMAN_MAN_set := $(patsubst %, %.ps.set, $(_NONSO_MAN))
+_PSMAN_MDOC_set := $(patsubst %, %.ps.set, $(_NONSO_MDOC))
ifeq ($(SKIP_XFAIL),yes)