]> git.ipfire.org Git - thirdparty/man-pages.git/blob - Makefile
*.mk: $Z: Support installing lzip(1) compressed pages
[thirdparty/man-pages.git] / Makefile
1 ########################################################################
2 # Copyright (C) 2021, 2022 Alejandro Colomar <alx@kernel.org>
3 # SPDX-License-Identifier: GPL-2.0 OR LGPL-2.0
4 ########################################################################
5 # Conventions:
6 #
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 # - Variables ending in '_rmdir' refer to dirs that can be removed (exist).
20 # - Targets of the form '%-rm' remove their corresponding file '%'.
21 # - Targets of the form '%/.-rmdir' remove their corresponding dir '%/'.
22 # - Targets of the form '%/.' create their corresponding directory '%/'.
23 # - Every file or directory to be created depends on its parent directory.
24 # This avoids race conditions caused by `mkdir -p`. Only the root
25 # directories are created with parents.
26 # - The 'FORCE' target is used to make phony some variables that can't be
27 # .PHONY to avoid some optimizations.
28 #
29 ########################################################################
30
31 SHELL := /usr/bin/env bash -Eeuo pipefail
32
33
34 MAKEFLAGS += --no-builtin-rules
35 MAKEFLAGS += --no-builtin-variables
36 MAKEFLAGS += --no-print-directory
37 MAKEFLAGS += --warn-undefined-variables
38
39
40 srcdir := .
41
42
43 .PHONY: all
44 all: build
45 @:
46
47 .PHONY: help
48 help:
49 $(info all Alias for "build")
50 $(info )
51 $(info clean Remove $$(builddir))
52 $(info )
53 $(info build Wrapper for "build-catman build-html build-src")
54 $(info )
55 $(info build-catman Build cat pages; alias for "build-catman-grotty")
56 $(info build-catman-preconv preconv(1) step of "build-catman")
57 $(info build-catman-tbl tbl(1) step of "build-catman")
58 $(info build-catman-eqn eqn(1) step of "build-catman")
59 $(info build-catman-troff troff(1) step of "build-catman")
60 $(info build-catman-grotty grotty(1) step of "build-catman")
61 $(info )
62 $(info build-html Build HTML manual pages)
63 $(info html Alias for "build-html")
64 $(info )
65 $(info build-src Alias for "build-src-ld")
66 $(info build-src-c Extract C programs from EXAMPLES)
67 $(info build-src-cc Compile C programs from EXAMPLES)
68 $(info build-src-ld Link C programs from EXAMPLES)
69 $(info )
70 $(info lint Wrapper for "lint-c lint-man")
71 $(info lint-c Wrapper for lint-c-* targets)
72 $(info lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch(1))
73 $(info lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy(1))
74 $(info lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck(1))
75 $(info lint-c-cpplint Lint C programs from EXAMPLES with cpplint(1))
76 $(info lint-c-iwyu Lint C programs from EXAMPLES with iwyu(1))
77 $(info lint-man Wrapper for lint-man-* targets)
78 $(info lint-man-mandoc Lint man pages with mandoc(1))
79 $(info lint-man-tbl Lint man pages about '\" t' comment for tbl(1))
80 $(info )
81 $(info check Alias for "check-catman")
82 $(info check-catman Check cat pages; alias for "check-catman-grep")
83 $(info check-catman-col Filter cat pages with col(1))
84 $(info check-catman-grep Check cat pages with grep(1))
85 $(info )
86 $(info [un]install Alias for "[un]install-man")
87 $(info [un]install-man Wrapper for [un]install-man* targets)
88 $(info [un]install-man1 [Un]install man pages in section 1)
89 $(info [un]install-man2 [Un]install man pages in section 2)
90 $(info [un]install-man2type [Un]install man pages in section 2type)
91 $(info [un]install-man3 [Un]install man pages in section 3)
92 $(info [un]install-man3const [Un]install man pages in section 3const)
93 $(info [un]install-man3head [Un]install man pages in section 3head)
94 $(info [un]install-man3type [Un]install man pages in section 3type)
95 $(info [un]install-man4 [Un]install man pages in section 4)
96 $(info [un]install-man5 [Un]install man pages in section 5)
97 $(info [un]install-man6 [Un]install man pages in section 6)
98 $(info [un]install-man7 [Un]install man pages in section 7)
99 $(info [un]install-man8 [Un]install man pages in section 8)
100 $(info )
101 $(info [un]install-html [Un]install HTML manual pages)
102 $(info )
103 $(info dist Wrapper for dist-* targets)
104 $(info dist-tar Create a tarball of the repository)
105 $(info dist-bz2 Create a compressed tarball (.tar.bz2))
106 $(info dist-gz Create a compressed tarball (.tar.gz))
107 $(info dist-lz Create a compressed tarball (.tar.lz))
108 $(info dist-xz Create a compressed tarball (.tar.xz))
109 $(info )
110 $(info help Print this help)
111 $(info help-variables Print all variables available, and their default values)
112 $(info )
113
114
115 .SECONDEXPANSION:
116
117
118 include $(srcdir)/lib/check.mk
119 include $(srcdir)/lib/check-catman.mk
120 include $(srcdir)/lib/build.mk
121 include $(srcdir)/lib/build-catman.mk
122 include $(srcdir)/lib/build-html.mk
123 include $(srcdir)/lib/build-src.mk
124 include $(srcdir)/lib/dist.mk
125 include $(srcdir)/lib/install.mk
126 include $(srcdir)/lib/install-html.mk
127 include $(srcdir)/lib/install-man.mk
128 include $(srcdir)/lib/lint.mk
129 include $(srcdir)/lib/lint-c.mk
130 include $(srcdir)/lib/lint-man.mk
131 include $(srcdir)/lib/verbose.mk
132
133
134 help-variables:
135 $(info V Define to non-empty string for verbose output)
136 $(info )
137 $(info LINK_PAGES How to install link pages. ["so", "symlink"])
138 $(info Z Install pages compressed. ["", ".bz2", ".gz", ".lz"])
139 $(info )
140 $(info DISTNAME $$(git describe))
141 $(info DISTVERSION /$$DISTNAME/s/man-pages-//)
142 $(info )
143 $(info # Directory variables:)
144 $(info )
145 $(info builddir .tmp)
146 $(info DESTDIR )
147 $(info prefix /usr/local)
148 $(info mandir $$(datarootdir)/man)
149 $(info docdir $$(datarootdir)/doc)
150 $(info )
151 $(info man1dir $$(mandir)/man1)
152 $(info man2dir $$(mandir)/man2)
153 $(info man2typedir $$(mandir)/man2type)
154 $(info man3dir $$(mandir)/man3)
155 $(info man3constdir $$(mandir)/man3const)
156 $(info man3headdir $$(mandir)/man3head)
157 $(info man3typedir $$(mandir)/man3type)
158 $(info man4dir $$(mandir)/man4)
159 $(info man5dir $$(mandir)/man5)
160 $(info man6dir $$(mandir)/man6)
161 $(info man7dir $$(mandir)/man7)
162 $(info man8dir $$(mandir)/man8)
163 $(info )
164 $(info htmldir $$(docdir))
165 $(info htmlext .html)
166 $(info )
167 $(info # Command variables (and flags):)
168 $(info )
169 $(info PRECONV {EXTRA_,}PRECONVFLAGS)
170 $(info TBL)
171 $(info EQN {EXTRA_,}EQNFLAGS)
172 $(info TROFF {EXTRA_,}TROFFFLAGS)
173 $(info GROTTY {EXTRA_,}GROTTYFLAGS)
174 $(info COL {EXTRA_,}COLFLAGS)
175 $(info )
176 $(info MAN)
177 $(info MANDOC {EXTRA_,}MANDOCFLAGS)
178 $(info MAN2HTML {EXTRA_,}MAN2HTMLFLAGS)
179 $(info )
180 $(info BZIP2)
181 $(info CP)
182 $(info ECHO)
183 $(info EXPR)
184 $(info FIND)
185 $(info GIT)
186 $(info GZIP)
187 $(info HEAD)
188 $(info LN)
189 $(info LOCALE)
190 $(info PKGCONF)
191 $(info SED)
192 $(info SORT)
193 $(info SPONGE)
194 $(info TAC)
195 $(info TAIL)
196 $(info TAR)
197 $(info TEST)
198 $(info XARGS)
199 $(info XZ)
200 $(info )
201 $(info INSTALL)
202 $(info INSTALL_DATA)
203 $(info MKDIR)
204 $(info RM)
205 $(info )
206 $(info - {EXTRA_,}CPPFLAGS)
207 $(info CC {EXTRA_,}CFLAGS)
208 $(info LD {EXTRA_,}LDFLAGS {EXTRA_,}LDLIBS)
209 $(info )
210 $(info CHECKPATCH {EXTRA_,}CHECKPATCHFLAGS)
211 $(info CLANG-TIDY {EXTRA_,}CLANG-TIDYFLAGS)
212 $(info CPPCHECK {EXTRA_,}CPPCHECKFLAGS)
213 $(info CPPLINT {EXTRA_,}CPPLINTFLAGS)
214 $(info IWYU {EXTRA_,}IWYUFLAGS)
215 $(info )
216
217
218 .DELETE_ON_ERROR:
219 FORCE: