TIMESPEC_TO_TIMEVAL.3, TIMEVAL_TO_TIMESPEC.3: Document these macros
[man-pages.git] / GNUmakefile
blob2efa51bec98ad3beca98f9df6965808ab0aa59c6
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 INFO_ :=
41 .PHONY: all
42 all: build;
44 .PHONY: help
45 help:
46 $(info $(INFO_)all Alias for "build")
47 $(info )
48 $(info $(INFO_)clean Remove $$(builddir))
49 $(info )
50 $(info $(INFO_)build Wrapper for build-* targets)
51 $(info )
52 $(info $(INFO_)build-book Build the Linux Man Book (PDF))
53 $(info )
54 $(info $(INFO_)build-pre Preprocess man pages; alias for "build-pre-tbl")
55 $(info $(INFO_)build-pre-preconv Preprocess man pages with preconv(1))
56 $(info $(INFO_)build-pre-tbl Preprocess man pages with tbl(1))
57 $(info )
58 $(info $(INFO_)build-catman Build cat pages; alias for "build-catman-grotty")
59 $(info $(INFO_)build-catman-eqn eqn(1) step of "build-catman")
60 $(info $(INFO_)build-catman-troff Wrapper for build-catman-troff-* targets)
61 $(info $(INFO_)build-catman-troff-man troff(1) step of "build-catman" for man(7) pages)
62 $(info $(INFO_)build-catman-troff-mdoc troff(1) step of "build-catman" for mdoc(7) pages)
63 $(info $(INFO_)build-catman-grotty grotty(1) step of "build-catman")
64 $(info )
65 $(info $(INFO_)build-html Build HTML manual pages)
66 $(info $(INFO_)html Alias for "build-html")
67 $(info )
68 $(info $(INFO_)build-pdf Build PDF manual pages; alias for "build-pdf-grops")
69 $(info $(INFO_)build-pdf-eqn eqn(1) step of "build-pdf")
70 $(info $(INFO_)build-pdf-troff Wrapper for build-pdf-troff-* targets)
71 $(info $(INFO_)build-pdf-troff-man troff(1) step of "build-pdf" for man(7) pages)
72 $(info $(INFO_)build-pdf-troff-mdoc troff(1) step of "build-pdf" for mdoc(7) pages)
73 $(info $(INFO_)build-pdf-gropdf gropdf(1) step of "build-pdf")
74 $(info )
75 $(info $(INFO_)build-ps Build PostScript manual pages; alias for "build-ps-grops")
76 $(info $(INFO_)build-ps-eqn eqn(1) step of "build-ps")
77 $(info $(INFO_)build-ps-troff Wrapper for build-ps-troff-* targets)
78 $(info $(INFO_)build-ps-troff-man troff(1) step of "build-ps" for man(7) pages)
79 $(info $(INFO_)build-ps-troff-mdoc troff(1) step of "build-ps" for mdoc(7) pages)
80 $(info $(INFO_)build-ps-grops grops(1) step of "build-ps")
81 $(info )
82 $(info $(INFO_)build-src Alias for "build-src-ld")
83 $(info $(INFO_)build-src-c Extract C programs from EXAMPLES)
84 $(info $(INFO_)build-src-cc Compile C programs from EXAMPLES)
85 $(info $(INFO_)build-src-ld Link C programs from EXAMPLES)
86 $(info )
87 $(info $(INFO_)lint Wrapper for "lint-c lint-man lint-mdoc")
88 $(info $(INFO_)lint-c Wrapper for lint-c-* targets)
89 $(info $(INFO_)lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch(1))
90 $(info $(INFO_)lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy(1))
91 $(info $(INFO_)lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck(1))
92 $(info $(INFO_)lint-c-cpplint Lint C programs from EXAMPLES with cpplint(1))
93 $(info $(INFO_)lint-c-iwyu Lint C programs from EXAMPLES with iwyu(1))
94 $(info $(INFO_)lint-man Wrapper for lint-man-* targets)
95 $(info $(INFO_)lint-man-mandoc Lint man(7) pages with mandoc(1))
96 $(info $(INFO_)lint-man-tbl Lint man(7) pages about '\" t' comment for tbl(1))
97 $(info $(INFO_)lint-mdoc Wrapper for lint-mdoc-* targets)
98 $(info $(INFO_)lint-mdoc-mandoc Lint mdoc(7) pages with mandoc(1))
99 $(info )
100 $(info $(INFO_)check Alias for "check-catman")
101 $(info $(INFO_)check-catman Check cat pages; alias for "check-catman-grep")
102 $(info $(INFO_)check-catman-col Filter cat pages with col(1))
103 $(info $(INFO_)check-catman-grep Check cat pages with grep(1))
104 $(info )
105 $(info $(INFO_)[un]install Alias for "[un]install-man")
106 $(info $(INFO_)[un]install-man Wrapper for [un]install-man* targets)
107 $(info $(INFO_)[un]install-manintro [Un]install intro(*) man pages)
108 $(info $(INFO_)[un]install-man{1,...} [Un]install man pages in the corresponding section)
109 $(info )
110 $(info $(INFO_)[un]install-html [Un]install HTML manual pages)
111 $(info )
112 $(info $(INFO_)dist Wrapper for dist-* targets)
113 $(info $(INFO_)dist-tar Create a tarball of the repository)
114 $(info $(INFO_)dist-z Wrapper for dist-z-* targets)
115 $(info $(INFO_)dist-z-bz2 Create a compressed tarball (.tar.bz2))
116 $(info $(INFO_)dist-z-gz Create a compressed tarball (.tar.gz))
117 $(info $(INFO_)dist-z-lz Create a compressed tarball (.tar.lz))
118 $(info $(INFO_)dist-z-xz Create a compressed tarball (.tar.xz))
119 $(info $(INFO_)distcheck Check the distribution tarball)
120 $(info )
121 $(info $(INFO_)help Print this help)
122 $(info $(INFO_)help-variables Print all variables available, and their default values)
123 $(info )
124 $(info $(INFO_)nothing Make nothing. It's useful for debug purposes)
125 $(info )
128 .SECONDEXPANSION:
131 MK_ := $(wildcard $(addprefix $(MAKEFILEDIR)/, *.mk */*.mk */*/*.mk))
132 MK := $(srcdir)/GNUmakefile $(MK_)
133 include $(MK_)
134 $(MK):: ;
137 .PHONY: help-variables
138 help-variables:
139 $(info $(INFO_)LINK_PAGES How to install link pages. [".so", "symlink"])
140 $(info $(INFO_)Z Install pages compressed. ["", ".bz2", ".gz", ".lz", ".xz"])
141 $(info $(INFO_)SKIP_XFAIL Skip expected failures. ["yes", "no"])
142 $(info )
143 $(info $(INFO_)DISTNAME $$(git describe))
144 $(info $(INFO_)DISTVERSION /$$DISTNAME/s/man-pages-//)
145 $(info )
146 $(info $(INFO_)HIDE_ERR Define to empty string to debug some errors)
147 $(info )
148 $(info $(INFO_)# Directory variables:)
149 $(info )
150 $(info $(INFO_)builddir .tmp)
151 $(info $(INFO_)DESTDIR )
152 $(info $(INFO_)prefix /usr/local)
153 $(info $(INFO_)mandir $$(datarootdir)/man)
154 $(info $(INFO_)docdir $$(datarootdir)/doc)
155 $(info )
156 $(info $(INFO_)man{1,...}dir $$(mandir)/man{1,...})
157 $(info $(INFO_)man{1,...}ext .{1,...})
158 $(info )
159 $(info $(INFO_)htmldir $$(docdir))
160 $(info $(INFO_)htmlext .html)
161 $(info )
162 $(info $(INFO_)# Command variables (and flags):)
163 $(info )
164 $(info $(INFO_)- MANWIDTH)
165 $(info $(INFO_)- NROFF_OUT_DEVICE)
166 $(info $(INFO_)PRECONV {EXTRA_,}PRECONVFLAGS)
167 $(info $(INFO_)TBL)
168 $(info $(INFO_)EQN {EXTRA_,}EQNFLAGS)
169 $(info $(INFO_)TROFF {EXTRA_,}TROFFFLAGS{,_MAN,_MDOC} {EXTRA_,}NROFFFLAGS)
170 $(info $(INFO_)GROPDF {EXTRA_,}GROPDFFLAGS)
171 $(info $(INFO_)GROPS {EXTRA_,}GROPSFLAGS)
172 $(info $(INFO_)GROTTY {EXTRA_,}GROTTYFLAGS)
173 $(info $(INFO_)COL {EXTRA_,}COLFLAGS)
174 $(info )
175 $(info $(INFO_)MANDOC {EXTRA_,}MANDOCFLAGS)
176 $(info $(INFO_)MAN2HTML {EXTRA_,}MAN2HTMLFLAGS)
177 $(info )
178 $(info $(INFO_)BZIP2 {EXTRA_,}BZIP2FLAGS)
179 $(info $(INFO_)CP)
180 $(info $(INFO_)ECHO)
181 $(info $(INFO_)EXPR)
182 $(info $(INFO_)FIND)
183 $(info $(INFO_)GIT)
184 $(info $(INFO_)GZIP {EXTRA_,}GZIPFLAGS)
185 $(info $(INFO_)HEAD)
186 $(info $(INFO_)LN)
187 $(info $(INFO_)LOCALE)
188 $(info $(INFO_)LZIP {EXTRA_,}LZIPFLAGS)
189 $(info $(INFO_)PKGCONF)
190 $(info $(INFO_)SED)
191 $(info $(INFO_)SORTMAN)
192 $(info $(INFO_)SPONGE)
193 $(info $(INFO_)TAC)
194 $(info $(INFO_)TAIL)
195 $(info $(INFO_)TAR)
196 $(info $(INFO_)TEST)
197 $(info $(INFO_)XARGS)
198 $(info $(INFO_)XZ {EXTRA_,}XZFLAGS)
199 $(info )
200 $(info $(INFO_)INSTALL)
201 $(info $(INFO_)INSTALL_DATA)
202 $(info $(INFO_)MKDIR)
203 $(info $(INFO_)RM)
204 $(info )
205 $(info $(INFO_)- {EXTRA_,}CPPFLAGS)
206 $(info $(INFO_)CC {EXTRA_,}CFLAGS)
207 $(info $(INFO_)LD {EXTRA_,}LDFLAGS {EXTRA_,}LDLIBS)
208 $(info )
209 $(info $(INFO_)- {EXTRA_,}CLANGFLAGS)
210 $(info $(INFO_)CHECKPATCH {EXTRA_,}CHECKPATCHFLAGS)
211 $(info $(INFO_)CLANG-TIDY {EXTRA_,}CLANG-TIDYFLAGS)
212 $(info $(INFO_)CPPCHECK {EXTRA_,}CPPCHECKFLAGS)
213 $(info $(INFO_)CPPLINT {EXTRA_,}CPPLINTFLAGS)
214 $(info $(INFO_)IWYU {EXTRA_,}IWYUFLAGS)
215 $(info )
218 .PHONY: nothing
219 nothing:;
222 .DELETE_ON_ERROR:
223 .SILENT:
224 FORCE: