1 ########################################################################
2 # Copyright 2021-2023, Alejandro Colomar <alx@kernel.org>
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 ########################################################################
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
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 ########################################################################
25 .SHELLFLAGS
:= -S bash
-Eeuo pipefail
-c
28 MAKEFLAGS
+= --no-builtin-rules
29 MAKEFLAGS
+= --no-builtin-variables
30 MAKEFLAGS
+= --warn-undefined-variables
34 DATAROOTDIR
:= $(srcdir)/share
35 MAKEFILEDIR
:= $(DATAROOTDIR
)/mk
43 $(info all Alias for
"build")
45 $(info clean Remove
$$(builddir
))
47 $(info build Wrapper for build-
* targets
)
49 $(info build-pre Preprocess man pages
; alias for
"build-pre-tbl")
50 $(info build-pre-preconv Preprocess man pages with preconv
(1))
51 $(info build-pre-tbl Preprocess man pages with tbl
(1))
53 $(info build-catman Build cat pages
; alias for
"build-catman-grotty")
54 $(info build-catman-eqn eqn
(1) step of
"build-catman")
55 $(info build-catman-troff Wrapper for build-catman-troff-
* targets
)
56 $(info build-catman-troff-man troff
(1) step of
"build-catman" for man
(7) pages
)
57 $(info build-catman-troff-mdoc troff
(1) step of
"build-catman" for mdoc
(7) pages
)
58 $(info build-catman-grotty grotty
(1) step of
"build-catman")
60 $(info build-html Build HTML manual pages
)
61 $(info html Alias for
"build-html")
63 $(info build-pdf Build PDF manual pages
; alias for
"build-pdf-grops")
64 $(info build-pdf-eqn eqn
(1) step of
"build-pdf")
65 $(info build-pdf-troff Wrapper for build-pdf-troff-
* targets
)
66 $(info build-pdf-troff-man troff
(1) step of
"build-pdf" for man
(7) pages
)
67 $(info build-pdf-troff-mdoc troff
(1) step of
"build-pdf" for mdoc
(7) pages
)
68 $(info build-pdf-gropdf gropdf
(1) step of
"build-pdf")
70 $(info build-ps Build PostScript manual pages
; alias for
"build-ps-grops")
71 $(info build-ps-eqn eqn
(1) step of
"build-ps")
72 $(info build-ps-troff Wrapper for build-ps-troff-
* targets
)
73 $(info build-ps-troff-man troff
(1) step of
"build-ps" for man
(7) pages
)
74 $(info build-ps-troff-mdoc troff
(1) step of
"build-ps" for mdoc
(7) pages
)
75 $(info build-ps-grops grops
(1) step of
"build-ps")
77 $(info build-src Alias for
"build-src-ld")
78 $(info build-src-c Extract C programs from EXAMPLES
)
79 $(info build-src-cc Compile C programs from EXAMPLES
)
80 $(info build-src-ld Link C programs from EXAMPLES
)
82 $(info lint Wrapper for
"lint-c lint-man lint-mdoc")
83 $(info lint-c Wrapper for lint-c-
* targets
)
84 $(info lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch
(1))
85 $(info lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy
(1))
86 $(info lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck
(1))
87 $(info lint-c-cpplint Lint C programs from EXAMPLES with cpplint
(1))
88 $(info lint-c-iwyu Lint C programs from EXAMPLES with iwyu
(1))
89 $(info lint-man Wrapper for lint-man-
* targets
)
90 $(info lint-man-mandoc Lint man
(7) pages with mandoc
(1))
91 $(info lint-man-tbl Lint man
(7) pages about
'\" t' comment for tbl
(1))
92 $(info lint-mdoc Wrapper for lint-mdoc-
* targets
)
93 $(info lint-mdoc-mandoc Lint mdoc
(7) pages with mandoc
(1))
95 $(info check Alias for
"check-catman")
96 $(info check-catman Check cat pages
; alias for
"check-catman-grep")
97 $(info check-catman-col Filter cat pages with col
(1))
98 $(info check-catman-grep Check cat pages with grep
(1))
100 $(info [un
]install Alias for
"[un]install-man")
101 $(info [un
]install-man Wrapper for
[un
]install-man
* targets
)
102 $(info [un
]install-manintro
[Un
]install intro
(*) man pages
)
103 $(info [un
]install-man
{1,...
} [Un
]install man pages in the corresponding section
)
105 $(info [un
]install-html
[Un
]install HTML manual pages
)
107 $(info dist Wrapper for dist-
* targets
)
108 $(info dist-tar Create a tarball of the repository
)
109 $(info dist-bz2 Create a compressed tarball
(.
tar.bz2
))
110 $(info dist-gz Create a compressed tarball
(.
tar.gz
))
111 $(info dist-lz Create a compressed tarball
(.
tar.lz
))
112 $(info dist-xz Create a compressed tarball
(.
tar.xz
))
114 $(info help Print this help
)
115 $(info help-variables Print
all variables available
, and their default values
)
117 $(info nothing Make nothing. It
's useful for debug purposes)
124 MK_ := $(wildcard $(addprefix $(MAKEFILEDIR)/, *.mk */*.mk */*/*.mk))
125 MK := $(srcdir)/GNUmakefile $(MK_)
130 .PHONY: help-variables
132 $(info LINK_PAGES How to install link pages. [".so", "symlink"])
133 $(info Z Install pages compressed. ["", ".bz2", ".gz", ".lz", ".xz"])
135 $(info DISTNAME $$(git describe))
136 $(info DISTVERSION /$$DISTNAME/s/man-pages-//)
138 $(info HIDE_ERR Define to empty string to debug some errors)
140 $(info # Directory variables:)
142 $(info builddir .tmp)
144 $(info prefix /usr/local)
145 $(info mandir $$(datarootdir)/man)
146 $(info docdir $$(datarootdir)/doc)
148 $(info man{1,...}dir $$(mandir)/man{1,...})
149 $(info man{1,...}ext .{1,...})
151 $(info htmldir $$(docdir))
152 $(info htmlext .html)
154 $(info # Command variables (and flags):)
157 $(info - NROFF_OUT_DEVICE)
158 $(info PRECONV {EXTRA_,}PRECONVFLAGS)
160 $(info EQN {EXTRA_,}EQNFLAGS)
161 $(info TROFF {EXTRA_,}TROFFFLAGS{,_MAN,_MDOC} {EXTRA_,}NROFFFLAGS)
162 $(info GROPDF {EXTRA_,}GROPDFFLAGS)
163 $(info GROPS {EXTRA_,}GROPSFLAGS)
164 $(info GROTTY {EXTRA_,}GROTTYFLAGS)
165 $(info COL {EXTRA_,}COLFLAGS)
167 $(info MANDOC {EXTRA_,}MANDOCFLAGS)
168 $(info MAN2HTML {EXTRA_,}MAN2HTMLFLAGS)
170 $(info BZIP2 {EXTRA_,}BZIP2FLAGS)
176 $(info GZIP {EXTRA_,}GZIPFLAGS)
180 $(info LZIP {EXTRA_,}LZIPFLAGS)
190 $(info XZ {EXTRA_,}XZFLAGS)
197 $(info - {EXTRA_,}CPPFLAGS)
198 $(info CC {EXTRA_,}CFLAGS)
199 $(info LD {EXTRA_,}LDFLAGS {EXTRA_,}LDLIBS)
201 $(info CHECKPATCH {EXTRA_,}CHECKPATCHFLAGS)
202 $(info CLANG-TIDY {EXTRA_,}CLANG-TIDYFLAGS)
203 $(info CPPCHECK {EXTRA_,}CPPCHECKFLAGS)
204 $(info CPPLINT {EXTRA_,}CPPLINTFLAGS)
205 $(info IWYU {EXTRA_,}IWYUFLAGS)