]>
Commit | Line | Data |
---|---|---|
336ae0d2 | 1 | ######################################################################## |
cb0f97b2 | 2 | # Copyright (C) 2021, 2022 Alejandro Colomar <alx@kernel.org> |
336ae0d2 AC |
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. | |
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 '%'. | |
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 | ||
26061fbd | 31 | SHELL := /usr/bin/env bash -Eeuo pipefail |
a82aaca1 AC |
32 | |
33 | ||
e1ebd693 AC |
34 | MAKEFLAGS += --no-builtin-rules |
35 | MAKEFLAGS += --no-builtin-variables | |
e4b890cd | 36 | MAKEFLAGS += --no-print-directory |
336ae0d2 AC |
37 | MAKEFLAGS += --warn-undefined-variables |
38 | ||
39 | ||
8bb88d5f | 40 | srcdir := . |
179d5a07 | 41 | |
ece893c0 | 42 | |
e8116fad AC |
43 | .PHONY: all |
44 | all: build | |
77160b72 AC |
45 | @: |
46 | ||
47 | .PHONY: help | |
48 | help: | |
49 | $(info all Alias for "build") | |
50 | $(info ) | |
51 | $(info clean Remove $$(builddir)) | |
52 | $(info ) | |
aa344d4b AC |
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") | |
77160b72 AC |
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)) | |
d5057f71 | 74 | $(info lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck(1)) |
77160b72 AC |
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) | |
77160b72 | 78 | $(info lint-man-mandoc Lint man pages with mandoc(1)) |
b5faeb54 | 79 | $(info lint-man-tbl Lint man pages about '\" t' comment for tbl(1)) |
aa344d4b AC |
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)) | |
77160b72 AC |
85 | $(info ) |
86 | $(info [un]install Alias for "[un]install-man") | |
87 | $(info [un]install-man Wrapper for [un]install-man* targets) | |
77160b72 AC |
88 | $(info [un]install-man1 [Un]install man pages in section 1) |
89 | $(info [un]install-man2 [Un]install man pages in section 2) | |
451a27a7 | 90 | $(info [un]install-man2type [Un]install man pages in section 2type) |
77160b72 | 91 | $(info [un]install-man3 [Un]install man pages in section 3) |
23461f53 | 92 | $(info [un]install-man3const [Un]install man pages in section 3const) |
5f836211 | 93 | $(info [un]install-man3head [Un]install man pages in section 3head) |
451a27a7 | 94 | $(info [un]install-man3type [Un]install man pages in section 3type) |
77160b72 AC |
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-gz Create a compressed tarball (.tar.gz)) | |
106 | $(info dist-xz Create a compressed tarball (.tar.xz)) | |
107 | $(info ) | |
77160b72 | 108 | $(info help Print this help) |
67950cc6 | 109 | $(info help-variables Print all variables available, and their default values) |
34caa7cd | 110 | $(info ) |
34caa7cd | 111 | |
e8116fad | 112 | |
336ae0d2 | 113 | .SECONDEXPANSION: |
336ae0d2 AC |
114 | |
115 | ||
aa344d4b AC |
116 | include $(srcdir)/lib/check.mk |
117 | include $(srcdir)/lib/check-catman.mk | |
86c39272 | 118 | include $(srcdir)/lib/build.mk |
aa344d4b | 119 | include $(srcdir)/lib/build-catman.mk |
8ef21b8e | 120 | include $(srcdir)/lib/build-html.mk |
8894c537 | 121 | include $(srcdir)/lib/build-src.mk |
d951f315 | 122 | include $(srcdir)/lib/dist.mk |
8bb88d5f | 123 | include $(srcdir)/lib/install.mk |
c1e5f4b4 | 124 | include $(srcdir)/lib/install-html.mk |
0110da57 | 125 | include $(srcdir)/lib/install-man.mk |
66747a37 | 126 | include $(srcdir)/lib/lint.mk |
f60ff4d8 | 127 | include $(srcdir)/lib/lint-c.mk |
60e13483 | 128 | include $(srcdir)/lib/lint-man.mk |
8f97613a | 129 | include $(srcdir)/lib/verbose.mk |
f60ff4d8 | 130 | |
336ae0d2 | 131 | |
67950cc6 AC |
132 | help-variables: |
133 | $(info V Define to non-empty string for verbose output) | |
134 | $(info ) | |
135 | $(info LINK_PAGES How to install link pages. ["so", "symlink"]) | |
6a828d5b | 136 | $(info Z Install pages compressed. ["", ".bz2", ".gz"]) |
67950cc6 AC |
137 | $(info ) |
138 | $(info DISTNAME $$(git describe)) | |
139 | $(info DISTVERSION /$$DISTNAME/s/man-pages-//) | |
140 | $(info ) | |
141 | $(info # Directory variables:) | |
142 | $(info ) | |
7c90d7d0 | 143 | $(info builddir .tmp) |
67950cc6 AC |
144 | $(info DESTDIR ) |
145 | $(info prefix /usr/local) | |
146 | $(info mandir $$(datarootdir)/man) | |
147 | $(info docdir $$(datarootdir)/doc) | |
148 | $(info ) | |
149 | $(info man1dir $$(mandir)/man1) | |
150 | $(info man2dir $$(mandir)/man2) | |
151 | $(info man2typedir $$(mandir)/man2type) | |
152 | $(info man3dir $$(mandir)/man3) | |
153 | $(info man3constdir $$(mandir)/man3const) | |
154 | $(info man3headdir $$(mandir)/man3head) | |
155 | $(info man3typedir $$(mandir)/man3type) | |
156 | $(info man4dir $$(mandir)/man4) | |
157 | $(info man5dir $$(mandir)/man5) | |
158 | $(info man6dir $$(mandir)/man6) | |
159 | $(info man7dir $$(mandir)/man7) | |
160 | $(info man8dir $$(mandir)/man8) | |
161 | $(info ) | |
162 | $(info htmldir $$(docdir)) | |
163 | $(info htmlext .html) | |
164 | $(info ) | |
165 | $(info # Command variables (and flags):) | |
166 | $(info ) | |
167 | $(info PRECONV {EXTRA_,}PRECONVFLAGS) | |
168 | $(info TBL) | |
169 | $(info EQN {EXTRA_,}EQNFLAGS) | |
170 | $(info TROFF {EXTRA_,}TROFFFLAGS) | |
171 | $(info GROTTY {EXTRA_,}GROTTYFLAGS) | |
172 | $(info COL {EXTRA_,}COLFLAGS) | |
173 | $(info ) | |
174 | $(info MAN) | |
175 | $(info MANDOC {EXTRA_,}MANDOCFLAGS) | |
176 | $(info MAN2HTML {EXTRA_,}MAN2HTMLFLAGS) | |
177 | $(info ) | |
6a828d5b | 178 | $(info BZIP2) |
3baab045 | 179 | $(info CP) |
67950cc6 AC |
180 | $(info ECHO) |
181 | $(info EXPR) | |
182 | $(info FIND) | |
183 | $(info GIT) | |
184 | $(info GZIP) | |
185 | $(info HEAD) | |
186 | $(info LN) | |
187 | $(info LOCALE) | |
188 | $(info PKGCONF) | |
189 | $(info SED) | |
190 | $(info SORT) | |
191 | $(info SPONGE) | |
192 | $(info TAC) | |
193 | $(info TAIL) | |
194 | $(info TAR) | |
195 | $(info TEST) | |
196 | $(info XARGS) | |
197 | $(info XZ) | |
198 | $(info ) | |
199 | $(info INSTALL) | |
200 | $(info INSTALL_DATA) | |
201 | $(info MKDIR) | |
202 | $(info RM) | |
203 | $(info ) | |
204 | $(info - {EXTRA_,}CPPFLAGS) | |
205 | $(info CC {EXTRA_,}CFLAGS) | |
206 | $(info LD {EXTRA_,}LDFLAGS {EXTRA_,}LDLIBS) | |
207 | $(info ) | |
208 | $(info CHECKPATCH {EXTRA_,}CHECKPATCHFLAGS) | |
209 | $(info CLANG-TIDY {EXTRA_,}CLANG-TIDYFLAGS) | |
210 | $(info CPPCHECK {EXTRA_,}CPPCHECKFLAGS) | |
211 | $(info CPPLINT {EXTRA_,}CPPLINTFLAGS) | |
212 | $(info IWYU {EXTRA_,}IWYUFLAGS) | |
213 | $(info ) | |
214 | ||
215 | ||
250d9062 | 216 | .DELETE_ON_ERROR: |
336ae0d2 | 217 | FORCE: |