]>
Commit | Line | Data |
---|---|---|
336ae0d2 | 1 | ######################################################################## |
6701269b | 2 | # Copyright 2021-2023, Alejandro Colomar <alx@kernel.org> |
dfd35089 | 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). | |
336ae0d2 | 19 | # - Targets of the form '%-rm' remove their corresponding file '%'. |
336ae0d2 AC |
20 | # |
21 | ######################################################################## | |
22 | ||
28a127c5 | 23 | |
1fefa6e9 AC |
24 | SHELL := /usr/bin/env |
25 | .SHELLFLAGS := -S bash -Eeuo pipefail -c | |
a82aaca1 AC |
26 | |
27 | ||
e1ebd693 AC |
28 | MAKEFLAGS += --no-builtin-rules |
29 | MAKEFLAGS += --no-builtin-variables | |
336ae0d2 AC |
30 | MAKEFLAGS += --warn-undefined-variables |
31 | ||
32 | ||
edaa12e6 AC |
33 | srcdir := . |
34 | DATAROOTDIR := $(srcdir)/share | |
35 | MAKEFILEDIR := $(DATAROOTDIR)/mk | |
179d5a07 | 36 | |
ece893c0 | 37 | |
e8116fad | 38 | .PHONY: all |
a28ddbed | 39 | all: build; |
77160b72 AC |
40 | |
41 | .PHONY: help | |
42 | help: | |
43 | $(info all Alias for "build") | |
44 | $(info ) | |
45 | $(info clean Remove $$(builddir)) | |
46 | $(info ) | |
851b01cf | 47 | $(info build Wrapper for build-* targets) |
aa344d4b | 48 | $(info ) |
d080b047 AC |
49 | $(info build-book Build the Linux Man Book (PDF)) |
50 | $(info ) | |
6d6e7065 AC |
51 | $(info build-pre Preprocess man pages; alias for "build-pre-tbl") |
52 | $(info build-pre-preconv Preprocess man pages with preconv(1)) | |
53 | $(info build-pre-tbl Preprocess man pages with tbl(1)) | |
54 | $(info ) | |
aa344d4b | 55 | $(info build-catman Build cat pages; alias for "build-catman-grotty") |
aa344d4b | 56 | $(info build-catman-eqn eqn(1) step of "build-catman") |
3c8198d1 AC |
57 | $(info build-catman-troff Wrapper for build-catman-troff-* targets) |
58 | $(info build-catman-troff-man troff(1) step of "build-catman" for man(7) pages) | |
59 | $(info build-catman-troff-mdoc troff(1) step of "build-catman" for mdoc(7) pages) | |
aa344d4b | 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 ) | |
851b01cf AC |
65 | $(info build-pdf Build PDF manual pages; alias for "build-pdf-grops") |
66 | $(info build-pdf-eqn eqn(1) step of "build-pdf") | |
67 | $(info build-pdf-troff Wrapper for build-pdf-troff-* targets) | |
68 | $(info build-pdf-troff-man troff(1) step of "build-pdf" for man(7) pages) | |
69 | $(info build-pdf-troff-mdoc troff(1) step of "build-pdf" for mdoc(7) pages) | |
70 | $(info build-pdf-gropdf gropdf(1) step of "build-pdf") | |
71 | $(info ) | |
72 | $(info build-ps Build PostScript manual pages; alias for "build-ps-grops") | |
ae60bbe5 AC |
73 | $(info build-ps-eqn eqn(1) step of "build-ps") |
74 | $(info build-ps-troff Wrapper for build-ps-troff-* targets) | |
75 | $(info build-ps-troff-man troff(1) step of "build-ps" for man(7) pages) | |
76 | $(info build-ps-troff-mdoc troff(1) step of "build-ps" for mdoc(7) pages) | |
77 | $(info build-ps-grops grops(1) step of "build-ps") | |
78 | $(info ) | |
77160b72 AC |
79 | $(info build-src Alias for "build-src-ld") |
80 | $(info build-src-c Extract C programs from EXAMPLES) | |
81 | $(info build-src-cc Compile C programs from EXAMPLES) | |
82 | $(info build-src-ld Link C programs from EXAMPLES) | |
83 | $(info ) | |
c76a5871 | 84 | $(info lint Wrapper for "lint-c lint-man lint-mdoc") |
77160b72 AC |
85 | $(info lint-c Wrapper for lint-c-* targets) |
86 | $(info lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch(1)) | |
87 | $(info lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy(1)) | |
d5057f71 | 88 | $(info lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck(1)) |
77160b72 AC |
89 | $(info lint-c-cpplint Lint C programs from EXAMPLES with cpplint(1)) |
90 | $(info lint-c-iwyu Lint C programs from EXAMPLES with iwyu(1)) | |
91 | $(info lint-man Wrapper for lint-man-* targets) | |
c76a5871 AC |
92 | $(info lint-man-mandoc Lint man(7) pages with mandoc(1)) |
93 | $(info lint-man-tbl Lint man(7) pages about '\" t' comment for tbl(1)) | |
94 | $(info lint-mdoc Wrapper for lint-mdoc-* targets) | |
95 | $(info lint-mdoc-mandoc Lint mdoc(7) pages with mandoc(1)) | |
aa344d4b AC |
96 | $(info ) |
97 | $(info check Alias for "check-catman") | |
98 | $(info check-catman Check cat pages; alias for "check-catman-grep") | |
99 | $(info check-catman-col Filter cat pages with col(1)) | |
100 | $(info check-catman-grep Check cat pages with grep(1)) | |
77160b72 AC |
101 | $(info ) |
102 | $(info [un]install Alias for "[un]install-man") | |
103 | $(info [un]install-man Wrapper for [un]install-man* targets) | |
ad0321aa | 104 | $(info [un]install-manintro [Un]install intro(*) man pages) |
482489d5 | 105 | $(info [un]install-man{1,...} [Un]install man pages in the corresponding section) |
77160b72 AC |
106 | $(info ) |
107 | $(info [un]install-html [Un]install HTML manual pages) | |
108 | $(info ) | |
109 | $(info dist Wrapper for dist-* targets) | |
110 | $(info dist-tar Create a tarball of the repository) | |
0dbc1ea9 AC |
111 | $(info dist-z Wrapper for dist-z-* targets) |
112 | $(info dist-z-bz2 Create a compressed tarball (.tar.bz2)) | |
113 | $(info dist-z-gz Create a compressed tarball (.tar.gz)) | |
114 | $(info dist-z-lz Create a compressed tarball (.tar.lz)) | |
115 | $(info dist-z-xz Create a compressed tarball (.tar.xz)) | |
72b372cf | 116 | $(info distcheck Check the distribution tarball) |
77160b72 | 117 | $(info ) |
77160b72 | 118 | $(info help Print this help) |
67950cc6 | 119 | $(info help-variables Print all variables available, and their default values) |
34caa7cd | 120 | $(info ) |
ec60fb83 AC |
121 | $(info nothing Make nothing. It's useful for debug purposes) |
122 | $(info ) | |
34caa7cd | 123 | |
e8116fad | 124 | |
336ae0d2 | 125 | .SECONDEXPANSION: |
336ae0d2 AC |
126 | |
127 | ||
f30c0d9d | 128 | MK_ := $(wildcard $(addprefix $(MAKEFILEDIR)/, *.mk */*.mk */*/*.mk)) |
fdd63de4 | 129 | MK := $(srcdir)/GNUmakefile $(MK_) |
f30c0d9d AC |
130 | include $(MK_) |
131 | $(MK):: ; | |
f60ff4d8 | 132 | |
336ae0d2 | 133 | |
a5918e4a | 134 | .PHONY: help-variables |
67950cc6 | 135 | help-variables: |
bc15c1d7 | 136 | $(info LINK_PAGES How to install link pages. [".so", "symlink"]) |
db579553 | 137 | $(info Z Install pages compressed. ["", ".bz2", ".gz", ".lz", ".xz"]) |
67950cc6 AC |
138 | $(info ) |
139 | $(info DISTNAME $$(git describe)) | |
140 | $(info DISTVERSION /$$DISTNAME/s/man-pages-//) | |
141 | $(info ) | |
aaae5c03 AC |
142 | $(info HIDE_ERR Define to empty string to debug some errors) |
143 | $(info ) | |
67950cc6 AC |
144 | $(info # Directory variables:) |
145 | $(info ) | |
7c90d7d0 | 146 | $(info builddir .tmp) |
67950cc6 AC |
147 | $(info DESTDIR ) |
148 | $(info prefix /usr/local) | |
149 | $(info mandir $$(datarootdir)/man) | |
150 | $(info docdir $$(datarootdir)/doc) | |
151 | $(info ) | |
482489d5 | 152 | $(info man{1,...}dir $$(mandir)/man{1,...}) |
c65c23d9 | 153 | $(info man{1,...}ext .{1,...}) |
67950cc6 AC |
154 | $(info ) |
155 | $(info htmldir $$(docdir)) | |
156 | $(info htmlext .html) | |
157 | $(info ) | |
158 | $(info # Command variables (and flags):) | |
159 | $(info ) | |
50174cce AC |
160 | $(info - MANWIDTH) |
161 | $(info - NROFF_OUT_DEVICE) | |
67950cc6 AC |
162 | $(info PRECONV {EXTRA_,}PRECONVFLAGS) |
163 | $(info TBL) | |
164 | $(info EQN {EXTRA_,}EQNFLAGS) | |
c9cbd326 | 165 | $(info TROFF {EXTRA_,}TROFFFLAGS{,_MAN,_MDOC} {EXTRA_,}NROFFFLAGS) |
851b01cf | 166 | $(info GROPDF {EXTRA_,}GROPDFFLAGS) |
ae60bbe5 | 167 | $(info GROPS {EXTRA_,}GROPSFLAGS) |
67950cc6 AC |
168 | $(info GROTTY {EXTRA_,}GROTTYFLAGS) |
169 | $(info COL {EXTRA_,}COLFLAGS) | |
170 | $(info ) | |
67950cc6 AC |
171 | $(info MANDOC {EXTRA_,}MANDOCFLAGS) |
172 | $(info MAN2HTML {EXTRA_,}MAN2HTMLFLAGS) | |
173 | $(info ) | |
c2fffefb | 174 | $(info BZIP2 {EXTRA_,}BZIP2FLAGS) |
3baab045 | 175 | $(info CP) |
67950cc6 AC |
176 | $(info ECHO) |
177 | $(info EXPR) | |
178 | $(info FIND) | |
179 | $(info GIT) | |
c2fffefb | 180 | $(info GZIP {EXTRA_,}GZIPFLAGS) |
67950cc6 AC |
181 | $(info HEAD) |
182 | $(info LN) | |
183 | $(info LOCALE) | |
c2fffefb | 184 | $(info LZIP {EXTRA_,}LZIPFLAGS) |
67950cc6 AC |
185 | $(info PKGCONF) |
186 | $(info SED) | |
d3408437 | 187 | $(info SORTMAN) |
67950cc6 AC |
188 | $(info SPONGE) |
189 | $(info TAC) | |
190 | $(info TAIL) | |
191 | $(info TAR) | |
192 | $(info TEST) | |
193 | $(info XARGS) | |
c2fffefb | 194 | $(info XZ {EXTRA_,}XZFLAGS) |
67950cc6 AC |
195 | $(info ) |
196 | $(info INSTALL) | |
197 | $(info INSTALL_DATA) | |
198 | $(info MKDIR) | |
199 | $(info RM) | |
200 | $(info ) | |
201 | $(info - {EXTRA_,}CPPFLAGS) | |
202 | $(info CC {EXTRA_,}CFLAGS) | |
203 | $(info LD {EXTRA_,}LDFLAGS {EXTRA_,}LDLIBS) | |
204 | $(info ) | |
546141e1 | 205 | $(info - {EXTRA_,}CLANGFLAGS) |
67950cc6 AC |
206 | $(info CHECKPATCH {EXTRA_,}CHECKPATCHFLAGS) |
207 | $(info CLANG-TIDY {EXTRA_,}CLANG-TIDYFLAGS) | |
208 | $(info CPPCHECK {EXTRA_,}CPPCHECKFLAGS) | |
209 | $(info CPPLINT {EXTRA_,}CPPLINTFLAGS) | |
210 | $(info IWYU {EXTRA_,}IWYUFLAGS) | |
211 | $(info ) | |
212 | ||
213 | ||
ec60fb83 AC |
214 | .PHONY: nothing |
215 | nothing:; | |
216 | ||
217 | ||
250d9062 | 218 | .DELETE_ON_ERROR: |
4ae76c12 | 219 | .SILENT: |