]>
Commit | Line | Data |
---|---|---|
336ae0d2 | 1 | ######################################################################## |
dfd35089 AC |
2 | # Copyright 2021-2022, Alejandro Colomar <alx@kernel.org> |
3 | # SPDX-License-Identifier: GPL-3.0-or-later | |
336ae0d2 AC |
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. | |
179d5a07 | 9 | # - Uppercase variables, when referring files, refer to files in this repo. |
336ae0d2 | 10 | # - Lowercase variables, when referring files, refer to system files. |
179d5a07 AC |
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. | |
336ae0d2 AC |
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 '%'. | |
5f04f185 | 21 | # - Targets of the form '%-rmdir' remove their corresponding dir '%'. |
336ae0d2 AC |
22 | # - The 'FORCE' target is used to make phony some variables that can't be |
23 | # .PHONY to avoid some optimizations. | |
24 | # | |
25 | ######################################################################## | |
26 | ||
26061fbd | 27 | SHELL := /usr/bin/env bash -Eeuo pipefail |
a82aaca1 AC |
28 | |
29 | ||
e1ebd693 AC |
30 | MAKEFLAGS += --no-builtin-rules |
31 | MAKEFLAGS += --no-builtin-variables | |
336ae0d2 AC |
32 | MAKEFLAGS += --warn-undefined-variables |
33 | ||
34 | ||
edaa12e6 AC |
35 | srcdir := . |
36 | DATAROOTDIR := $(srcdir)/share | |
37 | MAKEFILEDIR := $(DATAROOTDIR)/mk | |
179d5a07 | 38 | |
ece893c0 | 39 | |
e8116fad AC |
40 | .PHONY: all |
41 | all: build | |
77160b72 AC |
42 | @: |
43 | ||
44 | .PHONY: help | |
45 | help: | |
46 | $(info all Alias for "build") | |
47 | $(info ) | |
48 | $(info clean Remove $$(builddir)) | |
49 | $(info ) | |
851b01cf | 50 | $(info build Wrapper for build-* targets) |
aa344d4b | 51 | $(info ) |
6d6e7065 AC |
52 | $(info build-pre Preprocess man pages; alias for "build-pre-tbl") |
53 | $(info build-pre-preconv Preprocess man pages with preconv(1)) | |
54 | $(info build-pre-tbl Preprocess man pages with tbl(1)) | |
55 | $(info ) | |
aa344d4b | 56 | $(info build-catman Build cat pages; alias for "build-catman-grotty") |
aa344d4b | 57 | $(info build-catman-eqn eqn(1) step of "build-catman") |
3c8198d1 AC |
58 | $(info build-catman-troff Wrapper for build-catman-troff-* targets) |
59 | $(info build-catman-troff-man troff(1) step of "build-catman" for man(7) pages) | |
60 | $(info build-catman-troff-mdoc troff(1) step of "build-catman" for mdoc(7) pages) | |
aa344d4b | 61 | $(info build-catman-grotty grotty(1) step of "build-catman") |
77160b72 AC |
62 | $(info ) |
63 | $(info build-html Build HTML manual pages) | |
64 | $(info html Alias for "build-html") | |
65 | $(info ) | |
851b01cf AC |
66 | $(info build-pdf Build PDF manual pages; alias for "build-pdf-grops") |
67 | $(info build-pdf-eqn eqn(1) step of "build-pdf") | |
68 | $(info build-pdf-troff Wrapper for build-pdf-troff-* targets) | |
69 | $(info build-pdf-troff-man troff(1) step of "build-pdf" for man(7) pages) | |
70 | $(info build-pdf-troff-mdoc troff(1) step of "build-pdf" for mdoc(7) pages) | |
71 | $(info build-pdf-gropdf gropdf(1) step of "build-pdf") | |
72 | $(info ) | |
73 | $(info build-ps Build PostScript manual pages; alias for "build-ps-grops") | |
ae60bbe5 AC |
74 | $(info build-ps-eqn eqn(1) step of "build-ps") |
75 | $(info build-ps-troff Wrapper for build-ps-troff-* targets) | |
76 | $(info build-ps-troff-man troff(1) step of "build-ps" for man(7) pages) | |
77 | $(info build-ps-troff-mdoc troff(1) step of "build-ps" for mdoc(7) pages) | |
78 | $(info build-ps-grops grops(1) step of "build-ps") | |
79 | $(info ) | |
77160b72 AC |
80 | $(info build-src Alias for "build-src-ld") |
81 | $(info build-src-c Extract C programs from EXAMPLES) | |
82 | $(info build-src-cc Compile C programs from EXAMPLES) | |
83 | $(info build-src-ld Link C programs from EXAMPLES) | |
84 | $(info ) | |
c76a5871 | 85 | $(info lint Wrapper for "lint-c lint-man lint-mdoc") |
77160b72 AC |
86 | $(info lint-c Wrapper for lint-c-* targets) |
87 | $(info lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch(1)) | |
88 | $(info lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy(1)) | |
d5057f71 | 89 | $(info lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck(1)) |
77160b72 AC |
90 | $(info lint-c-cpplint Lint C programs from EXAMPLES with cpplint(1)) |
91 | $(info lint-c-iwyu Lint C programs from EXAMPLES with iwyu(1)) | |
92 | $(info lint-man Wrapper for lint-man-* targets) | |
c76a5871 AC |
93 | $(info lint-man-mandoc Lint man(7) pages with mandoc(1)) |
94 | $(info lint-man-tbl Lint man(7) pages about '\" t' comment for tbl(1)) | |
95 | $(info lint-mdoc Wrapper for lint-mdoc-* targets) | |
96 | $(info lint-mdoc-mandoc Lint mdoc(7) pages with mandoc(1)) | |
aa344d4b AC |
97 | $(info ) |
98 | $(info check Alias for "check-catman") | |
99 | $(info check-catman Check cat pages; alias for "check-catman-grep") | |
100 | $(info check-catman-col Filter cat pages with col(1)) | |
101 | $(info check-catman-grep Check cat pages with grep(1)) | |
77160b72 AC |
102 | $(info ) |
103 | $(info [un]install Alias for "[un]install-man") | |
104 | $(info [un]install-man Wrapper for [un]install-man* targets) | |
77160b72 AC |
105 | $(info [un]install-man1 [Un]install man pages in section 1) |
106 | $(info [un]install-man2 [Un]install man pages in section 2) | |
451a27a7 | 107 | $(info [un]install-man2type [Un]install man pages in section 2type) |
77160b72 | 108 | $(info [un]install-man3 [Un]install man pages in section 3) |
23461f53 | 109 | $(info [un]install-man3const [Un]install man pages in section 3const) |
5f836211 | 110 | $(info [un]install-man3head [Un]install man pages in section 3head) |
451a27a7 | 111 | $(info [un]install-man3type [Un]install man pages in section 3type) |
77160b72 AC |
112 | $(info [un]install-man4 [Un]install man pages in section 4) |
113 | $(info [un]install-man5 [Un]install man pages in section 5) | |
114 | $(info [un]install-man6 [Un]install man pages in section 6) | |
115 | $(info [un]install-man7 [Un]install man pages in section 7) | |
116 | $(info [un]install-man8 [Un]install man pages in section 8) | |
117 | $(info ) | |
118 | $(info [un]install-html [Un]install HTML manual pages) | |
119 | $(info ) | |
120 | $(info dist Wrapper for dist-* targets) | |
121 | $(info dist-tar Create a tarball of the repository) | |
e5b23b9c | 122 | $(info dist-bz2 Create a compressed tarball (.tar.bz2)) |
77160b72 | 123 | $(info dist-gz Create a compressed tarball (.tar.gz)) |
69ad9598 | 124 | $(info dist-lz Create a compressed tarball (.tar.lz)) |
77160b72 AC |
125 | $(info dist-xz Create a compressed tarball (.tar.xz)) |
126 | $(info ) | |
77160b72 | 127 | $(info help Print this help) |
67950cc6 | 128 | $(info help-variables Print all variables available, and their default values) |
34caa7cd | 129 | $(info ) |
34caa7cd | 130 | |
e8116fad | 131 | |
336ae0d2 | 132 | .SECONDEXPANSION: |
336ae0d2 AC |
133 | |
134 | ||
edaa12e6 AC |
135 | include $(MAKEFILEDIR)/check/_.mk |
136 | include $(MAKEFILEDIR)/check/catman.mk | |
137 | include $(MAKEFILEDIR)/build/_.mk | |
138 | include $(MAKEFILEDIR)/build/catman.mk | |
139 | include $(MAKEFILEDIR)/build/html.mk | |
851b01cf | 140 | include $(MAKEFILEDIR)/build/pdf.mk |
6d6e7065 | 141 | include $(MAKEFILEDIR)/build/pre.mk |
ae60bbe5 | 142 | include $(MAKEFILEDIR)/build/ps.mk |
edaa12e6 AC |
143 | include $(MAKEFILEDIR)/build/src.mk |
144 | include $(MAKEFILEDIR)/dist.mk | |
145 | include $(MAKEFILEDIR)/install/_.mk | |
146 | include $(MAKEFILEDIR)/install/html.mk | |
147 | include $(MAKEFILEDIR)/install/man.mk | |
148 | include $(MAKEFILEDIR)/lint/_.mk | |
149 | include $(MAKEFILEDIR)/lint/c.mk | |
c76a5871 AC |
150 | include $(MAKEFILEDIR)/lint/man/_.mk |
151 | include $(MAKEFILEDIR)/lint/man/man.mk | |
152 | include $(MAKEFILEDIR)/lint/man/mdoc.mk | |
edaa12e6 | 153 | include $(MAKEFILEDIR)/verbose.mk |
f60ff4d8 | 154 | |
336ae0d2 | 155 | |
a5918e4a | 156 | .PHONY: help-variables |
67950cc6 AC |
157 | help-variables: |
158 | $(info V Define to non-empty string for verbose output) | |
159 | $(info ) | |
bc15c1d7 | 160 | $(info LINK_PAGES How to install link pages. [".so", "symlink"]) |
db579553 | 161 | $(info Z Install pages compressed. ["", ".bz2", ".gz", ".lz", ".xz"]) |
67950cc6 AC |
162 | $(info ) |
163 | $(info DISTNAME $$(git describe)) | |
164 | $(info DISTVERSION /$$DISTNAME/s/man-pages-//) | |
165 | $(info ) | |
166 | $(info # Directory variables:) | |
167 | $(info ) | |
7c90d7d0 | 168 | $(info builddir .tmp) |
67950cc6 AC |
169 | $(info DESTDIR ) |
170 | $(info prefix /usr/local) | |
171 | $(info mandir $$(datarootdir)/man) | |
172 | $(info docdir $$(datarootdir)/doc) | |
173 | $(info ) | |
174 | $(info man1dir $$(mandir)/man1) | |
175 | $(info man2dir $$(mandir)/man2) | |
176 | $(info man2typedir $$(mandir)/man2type) | |
177 | $(info man3dir $$(mandir)/man3) | |
178 | $(info man3constdir $$(mandir)/man3const) | |
179 | $(info man3headdir $$(mandir)/man3head) | |
180 | $(info man3typedir $$(mandir)/man3type) | |
181 | $(info man4dir $$(mandir)/man4) | |
182 | $(info man5dir $$(mandir)/man5) | |
183 | $(info man6dir $$(mandir)/man6) | |
184 | $(info man7dir $$(mandir)/man7) | |
185 | $(info man8dir $$(mandir)/man8) | |
186 | $(info ) | |
187 | $(info htmldir $$(docdir)) | |
188 | $(info htmlext .html) | |
189 | $(info ) | |
190 | $(info # Command variables (and flags):) | |
191 | $(info ) | |
50174cce AC |
192 | $(info - MANWIDTH) |
193 | $(info - NROFF_OUT_DEVICE) | |
67950cc6 AC |
194 | $(info PRECONV {EXTRA_,}PRECONVFLAGS) |
195 | $(info TBL) | |
196 | $(info EQN {EXTRA_,}EQNFLAGS) | |
c9cbd326 | 197 | $(info TROFF {EXTRA_,}TROFFFLAGS{,_MAN,_MDOC} {EXTRA_,}NROFFFLAGS) |
851b01cf | 198 | $(info GROPDF {EXTRA_,}GROPDFFLAGS) |
ae60bbe5 | 199 | $(info GROPS {EXTRA_,}GROPSFLAGS) |
67950cc6 AC |
200 | $(info GROTTY {EXTRA_,}GROTTYFLAGS) |
201 | $(info COL {EXTRA_,}COLFLAGS) | |
202 | $(info ) | |
67950cc6 AC |
203 | $(info MANDOC {EXTRA_,}MANDOCFLAGS) |
204 | $(info MAN2HTML {EXTRA_,}MAN2HTMLFLAGS) | |
205 | $(info ) | |
c2fffefb | 206 | $(info BZIP2 {EXTRA_,}BZIP2FLAGS) |
3baab045 | 207 | $(info CP) |
67950cc6 AC |
208 | $(info ECHO) |
209 | $(info EXPR) | |
210 | $(info FIND) | |
211 | $(info GIT) | |
c2fffefb | 212 | $(info GZIP {EXTRA_,}GZIPFLAGS) |
67950cc6 AC |
213 | $(info HEAD) |
214 | $(info LN) | |
215 | $(info LOCALE) | |
c2fffefb | 216 | $(info LZIP {EXTRA_,}LZIPFLAGS) |
67950cc6 AC |
217 | $(info PKGCONF) |
218 | $(info SED) | |
219 | $(info SORT) | |
220 | $(info SPONGE) | |
221 | $(info TAC) | |
222 | $(info TAIL) | |
223 | $(info TAR) | |
224 | $(info TEST) | |
225 | $(info XARGS) | |
c2fffefb | 226 | $(info XZ {EXTRA_,}XZFLAGS) |
67950cc6 AC |
227 | $(info ) |
228 | $(info INSTALL) | |
229 | $(info INSTALL_DATA) | |
230 | $(info MKDIR) | |
231 | $(info RM) | |
232 | $(info ) | |
233 | $(info - {EXTRA_,}CPPFLAGS) | |
234 | $(info CC {EXTRA_,}CFLAGS) | |
235 | $(info LD {EXTRA_,}LDFLAGS {EXTRA_,}LDLIBS) | |
236 | $(info ) | |
237 | $(info CHECKPATCH {EXTRA_,}CHECKPATCHFLAGS) | |
238 | $(info CLANG-TIDY {EXTRA_,}CLANG-TIDYFLAGS) | |
239 | $(info CPPCHECK {EXTRA_,}CPPCHECKFLAGS) | |
240 | $(info CPPLINT {EXTRA_,}CPPLINTFLAGS) | |
241 | $(info IWYU {EXTRA_,}IWYUFLAGS) | |
242 | $(info ) | |
243 | ||
244 | ||
250d9062 | 245 | .DELETE_ON_ERROR: |
336ae0d2 | 246 | FORCE: |