Update.
[man-pages.git] / GNUmakefile
blob0d80842968bfb13a9cae912fd4c5a5e13abaf4d2
1 ########################################################################
2 # Copyright 2021-2023, Alejandro Colomar <alx@kernel.org>
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 ########################################################################
5 # Conventions:
7 # - Follow "Makefile Conventions" from the "GNU Coding Standards" closely.
8 # However, when something could be improved, don't follow those.
9 # - Uppercase variables, when referring files, refer to files in this repo.
10 # - Lowercase variables, when referring files, refer to system files.
11 # - Lowercase variables starting with '_' refer to absolute paths,
12 # including $(DESTDIR).
13 # - Uppercase variables starting with '_' refer to temporary files produced
14 # in $builddir.
15 # - Variables ending with '_' refer to a subdir of their parent dir, which
16 # is in a variable of the same name but without the '_'. The subdir is
17 # named after this project: <*/man>.
18 # - Variables ending in '_rm' refer to files that can be removed (exist).
19 # - Targets of the form '%-rm' remove their corresponding file '%'.
21 ########################################################################
24 SHELL := /usr/bin/env
25 .SHELLFLAGS := -S bash -Eeuo pipefail -c
28 MAKEFLAGS += --no-builtin-rules
29 MAKEFLAGS += --no-builtin-variables
30 MAKEFLAGS += --warn-undefined-variables
33 srcdir := .
34 DATAROOTDIR := $(srcdir)/share
35 MAKEFILEDIR := $(DATAROOTDIR)/mk
38 .PHONY: all
39 all: build;
41 .PHONY: help
42 help:
43 $(info all Alias for "build")
44 $(info )
45 $(info clean Remove $$(builddir))
46 $(info )
47 $(info build Wrapper for build-* targets)
48 $(info )
49 $(info build-pre Preprocess man pages; alias for "build-pre-tbl")
50 $(info build-pre-preconv Preprocess man pages with preconv(1))
51 $(info build-pre-tbl Preprocess man pages with tbl(1))
52 $(info )
53 $(info build-catman Build cat pages; alias for "build-catman-grotty")
54 $(info build-catman-eqn eqn(1) step of "build-catman")
55 $(info build-catman-troff Wrapper for build-catman-troff-* targets)
56 $(info build-catman-troff-man troff(1) step of "build-catman" for man(7) pages)
57 $(info build-catman-troff-mdoc troff(1) step of "build-catman" for mdoc(7) pages)
58 $(info build-catman-grotty grotty(1) step of "build-catman")
59 $(info )
60 $(info build-html Build HTML manual pages)
61 $(info html Alias for "build-html")
62 $(info )
63 $(info build-pdf Build PDF manual pages; alias for "build-pdf-grops")
64 $(info build-pdf-eqn eqn(1) step of "build-pdf")
65 $(info build-pdf-troff Wrapper for build-pdf-troff-* targets)
66 $(info build-pdf-troff-man troff(1) step of "build-pdf" for man(7) pages)
67 $(info build-pdf-troff-mdoc troff(1) step of "build-pdf" for mdoc(7) pages)
68 $(info build-pdf-gropdf gropdf(1) step of "build-pdf")
69 $(info )
70 $(info build-ps Build PostScript manual pages; alias for "build-ps-grops")
71 $(info build-ps-eqn eqn(1) step of "build-ps")
72 $(info build-ps-troff Wrapper for build-ps-troff-* targets)
73 $(info build-ps-troff-man troff(1) step of "build-ps" for man(7) pages)
74 $(info build-ps-troff-mdoc troff(1) step of "build-ps" for mdoc(7) pages)
75 $(info build-ps-grops grops(1) step of "build-ps")
76 $(info )
77 $(info build-src Alias for "build-src-ld")
78 $(info build-src-c Extract C programs from EXAMPLES)
79 $(info build-src-cc Compile C programs from EXAMPLES)
80 $(info build-src-ld Link C programs from EXAMPLES)
81 $(info )
82 $(info lint Wrapper for "lint-c lint-man lint-mdoc")
83 $(info lint-c Wrapper for lint-c-* targets)
84 $(info lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch(1))
85 $(info lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy(1))
86 $(info lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck(1))
87 $(info lint-c-cpplint Lint C programs from EXAMPLES with cpplint(1))
88 $(info lint-c-iwyu Lint C programs from EXAMPLES with iwyu(1))
89 $(info lint-man Wrapper for lint-man-* targets)
90 $(info lint-man-mandoc Lint man(7) pages with mandoc(1))
91 $(info lint-man-tbl Lint man(7) pages about '\" t' comment for tbl(1))
92 $(info lint-mdoc Wrapper for lint-mdoc-* targets)
93 $(info lint-mdoc-mandoc Lint mdoc(7) pages with mandoc(1))
94 $(info )
95 $(info check Alias for "check-catman")
96 $(info check-catman Check cat pages; alias for "check-catman-grep")
97 $(info check-catman-col Filter cat pages with col(1))
98 $(info check-catman-grep Check cat pages with grep(1))
99 $(info )
100 $(info [un]install Alias for "[un]install-man")
101 $(info [un]install-man Wrapper for [un]install-man* targets)
102 $(info [un]install-manintro [Un]install intro(*) man pages)
103 $(info [un]install-man{1,...} [Un]install man pages in the corresponding section)
104 $(info )
105 $(info [un]install-html [Un]install HTML manual pages)
106 $(info )
107 $(info dist Wrapper for dist-* targets)
108 $(info dist-tar Create a tarball of the repository)
109 $(info dist-bz2 Create a compressed tarball (.tar.bz2))
110 $(info dist-gz Create a compressed tarball (.tar.gz))
111 $(info dist-lz Create a compressed tarball (.tar.lz))
112 $(info dist-xz Create a compressed tarball (.tar.xz))
113 $(info )
114 $(info help Print this help)
115 $(info help-variables Print all variables available, and their default values)
116 $(info )
117 $(info nothing Make nothing. It's useful for debug purposes)
118 $(info )
121 .SECONDEXPANSION:
124 MK_ := $(wildcard $(addprefix $(MAKEFILEDIR)/, *.mk */*.mk */*/*.mk))
125 MK := $(srcdir)/GNUmakefile $(MK_)
126 include $(MK_)
127 $(MK):: ;
130 .PHONY: help-variables
131 help-variables:
132 $(info LINK_PAGES How to install link pages. [".so", "symlink"])
133 $(info Z Install pages compressed. ["", ".bz2", ".gz", ".lz", ".xz"])
134 $(info )
135 $(info DISTNAME $$(git describe))
136 $(info DISTVERSION /$$DISTNAME/s/man-pages-//)
137 $(info )
138 $(info HIDE_ERR Define to empty string to debug some errors)
139 $(info )
140 $(info # Directory variables:)
141 $(info )
142 $(info builddir .tmp)
143 $(info DESTDIR )
144 $(info prefix /usr/local)
145 $(info mandir $$(datarootdir)/man)
146 $(info docdir $$(datarootdir)/doc)
147 $(info )
148 $(info man{1,...}dir $$(mandir)/man{1,...})
149 $(info man{1,...}ext .{1,...})
150 $(info )
151 $(info htmldir $$(docdir))
152 $(info htmlext .html)
153 $(info )
154 $(info # Command variables (and flags):)
155 $(info )
156 $(info - MANWIDTH)
157 $(info - NROFF_OUT_DEVICE)
158 $(info PRECONV {EXTRA_,}PRECONVFLAGS)
159 $(info TBL)
160 $(info EQN {EXTRA_,}EQNFLAGS)
161 $(info TROFF {EXTRA_,}TROFFFLAGS{,_MAN,_MDOC} {EXTRA_,}NROFFFLAGS)
162 $(info GROPDF {EXTRA_,}GROPDFFLAGS)
163 $(info GROPS {EXTRA_,}GROPSFLAGS)
164 $(info GROTTY {EXTRA_,}GROTTYFLAGS)
165 $(info COL {EXTRA_,}COLFLAGS)
166 $(info )
167 $(info MANDOC {EXTRA_,}MANDOCFLAGS)
168 $(info MAN2HTML {EXTRA_,}MAN2HTMLFLAGS)
169 $(info )
170 $(info BZIP2 {EXTRA_,}BZIP2FLAGS)
171 $(info CP)
172 $(info ECHO)
173 $(info EXPR)
174 $(info FIND)
175 $(info GIT)
176 $(info GZIP {EXTRA_,}GZIPFLAGS)
177 $(info HEAD)
178 $(info LN)
179 $(info LOCALE)
180 $(info LZIP {EXTRA_,}LZIPFLAGS)
181 $(info PKGCONF)
182 $(info SED)
183 $(info SORTMAN)
184 $(info SPONGE)
185 $(info TAC)
186 $(info TAIL)
187 $(info TAR)
188 $(info TEST)
189 $(info XARGS)
190 $(info XZ {EXTRA_,}XZFLAGS)
191 $(info )
192 $(info INSTALL)
193 $(info INSTALL_DATA)
194 $(info MKDIR)
195 $(info RM)
196 $(info )
197 $(info - {EXTRA_,}CPPFLAGS)
198 $(info CC {EXTRA_,}CFLAGS)
199 $(info LD {EXTRA_,}LDFLAGS {EXTRA_,}LDLIBS)
200 $(info )
201 $(info CHECKPATCH {EXTRA_,}CHECKPATCHFLAGS)
202 $(info CLANG-TIDY {EXTRA_,}CLANG-TIDYFLAGS)
203 $(info CPPCHECK {EXTRA_,}CPPCHECKFLAGS)
204 $(info CPPLINT {EXTRA_,}CPPLINTFLAGS)
205 $(info IWYU {EXTRA_,}IWYUFLAGS)
206 $(info )
209 .PHONY: nothing
210 nothing:;
213 .DELETE_ON_ERROR: