1 ########################################################################
2 # Copyright 2021-2022, 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 # - 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 # - The 'FORCE' target is used to make phony some variables that can't be
23 # .PHONY to avoid some optimizations.
25 ########################################################################
27 SHELL
:= /usr
/bin
/env bash
-Eeuo pipefail
30 MAKEFLAGS
+= --no-builtin-rules
31 MAKEFLAGS
+= --no-builtin-variables
32 MAKEFLAGS
+= --no-print-directory
33 MAKEFLAGS
+= --warn-undefined-variables
37 DATAROOTDIR
:= $(srcdir)/share
38 MAKEFILEDIR
:= $(DATAROOTDIR
)/mk
47 $(info all Alias for
"build")
49 $(info clean Remove
$$(builddir
))
51 $(info build Wrapper for
"build-catman build-html build-src")
53 $(info build-pre Preprocess man pages
; alias for
"build-pre-tbl")
54 $(info build-pre-preconv Preprocess man pages with preconv
(1))
55 $(info build-pre-tbl Preprocess man pages with tbl
(1))
57 $(info build-catman Build cat pages
; alias for
"build-catman-grotty")
58 $(info build-catman-eqn eqn
(1) step of
"build-catman")
59 $(info build-catman-troff Wrapper for build-catman-troff-
* targets
)
60 $(info build-catman-troff-man troff
(1) step of
"build-catman" for man
(7) pages
)
61 $(info build-catman-troff-mdoc troff
(1) step of
"build-catman" for mdoc
(7) pages
)
62 $(info build-catman-grotty grotty
(1) step of
"build-catman")
64 $(info build-html Build HTML manual pages
)
65 $(info html Alias for
"build-html")
67 $(info build-src Alias for
"build-src-ld")
68 $(info build-src-c Extract C programs from EXAMPLES
)
69 $(info build-src-cc Compile C programs from EXAMPLES
)
70 $(info build-src-ld Link C programs from EXAMPLES
)
72 $(info lint Wrapper for
"lint-c lint-man lint-mdoc")
73 $(info lint-c Wrapper for lint-c-
* targets
)
74 $(info lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch
(1))
75 $(info lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy
(1))
76 $(info lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck
(1))
77 $(info lint-c-cpplint Lint C programs from EXAMPLES with cpplint
(1))
78 $(info lint-c-iwyu Lint C programs from EXAMPLES with iwyu
(1))
79 $(info lint-man Wrapper for lint-man-
* targets
)
80 $(info lint-man-mandoc Lint man
(7) pages with mandoc
(1))
81 $(info lint-man-tbl Lint man
(7) pages about
'\" t' comment for tbl
(1))
82 $(info lint-mdoc Wrapper for lint-mdoc-
* targets
)
83 $(info lint-mdoc-mandoc Lint mdoc
(7) pages with mandoc
(1))
85 $(info check Alias for
"check-catman")
86 $(info check-catman Check cat pages
; alias for
"check-catman-grep")
87 $(info check-catman-col Filter cat pages with col
(1))
88 $(info check-catman-grep Check cat pages with grep
(1))
90 $(info [un
]install Alias for
"[un]install-man")
91 $(info [un
]install-man Wrapper for
[un
]install-man
* targets
)
92 $(info [un
]install-man1
[Un
]install man pages in section
1)
93 $(info [un
]install-man2
[Un
]install man pages in section
2)
94 $(info [un
]install-man2type
[Un
]install man pages in section
2type
)
95 $(info [un
]install-man3
[Un
]install man pages in section
3)
96 $(info [un
]install-man3const
[Un
]install man pages in section
3const
)
97 $(info [un
]install-man3head
[Un
]install man pages in section
3head
)
98 $(info [un
]install-man3type
[Un
]install man pages in section
3type
)
99 $(info [un
]install-man4
[Un
]install man pages in section
4)
100 $(info [un
]install-man5
[Un
]install man pages in section
5)
101 $(info [un
]install-man6
[Un
]install man pages in section
6)
102 $(info [un
]install-man7
[Un
]install man pages in section
7)
103 $(info [un
]install-man8
[Un
]install man pages in section
8)
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
)
122 include $(MAKEFILEDIR
)/check/_.mk
123 include $(MAKEFILEDIR
)/check/catman.mk
124 include $(MAKEFILEDIR
)/build
/_.mk
125 include $(MAKEFILEDIR
)/build
/catman.mk
126 include $(MAKEFILEDIR
)/build
/html.mk
127 include $(MAKEFILEDIR
)/build
/pre.mk
128 include $(MAKEFILEDIR
)/build
/src.mk
129 include $(MAKEFILEDIR
)/dist.mk
130 include $(MAKEFILEDIR
)/install/_.mk
131 include $(MAKEFILEDIR
)/install/html.mk
132 include $(MAKEFILEDIR
)/install/man.mk
133 include $(MAKEFILEDIR
)/lint
/_.mk
134 include $(MAKEFILEDIR
)/lint
/c.mk
135 include $(MAKEFILEDIR
)/lint
/man
/_.mk
136 include $(MAKEFILEDIR
)/lint
/man
/man.mk
137 include $(MAKEFILEDIR
)/lint
/man
/mdoc.mk
138 include $(MAKEFILEDIR
)/verbose.mk
141 .PHONY
: help-variables
143 $(info V Define to non-empty string for verbose output
)
145 $(info LINK_PAGES How to
install link pages.
[".so", "symlink"])
146 $(info Z Install pages compressed.
["", ".bz2", ".gz", ".lz", ".xz"])
148 $(info DISTNAME
$$(git describe
))
149 $(info DISTVERSION
/$$DISTNAME/s
/man-pages-
//)
151 $(info # Directory variables:)
153 $(info builddir .tmp
)
155 $(info prefix /usr
/local
)
156 $(info mandir $$(datarootdir
)/man
)
157 $(info docdir
$$(datarootdir
)/doc
)
159 $(info man1dir $$(mandir)/man1
)
160 $(info man2dir $$(mandir)/man2
)
161 $(info man2typedir
$$(mandir)/man2type
)
162 $(info man3dir $$(mandir)/man3
)
163 $(info man3constdir
$$(mandir)/man3const
)
164 $(info man3headdir
$$(mandir)/man3head
)
165 $(info man3typedir
$$(mandir)/man3type
)
166 $(info man4dir $$(mandir)/man4
)
167 $(info man5dir $$(mandir)/man5
)
168 $(info man6dir $$(mandir)/man6
)
169 $(info man7dir $$(mandir)/man7
)
170 $(info man8dir $$(mandir)/man8
)
172 $(info htmldir
$$(docdir
))
173 $(info htmlext .html
)
175 $(info # Command variables (and flags):)
177 $(info PRECONV
{EXTRA_
,}PRECONVFLAGS
)
179 $(info EQN
{EXTRA_
,}EQNFLAGS
)
180 $(info TROFF
{EXTRA_
,}TROFFFLAGS
{,_MAN
,_MDOC
} {EXTRA_
,}NROFFFLAGS
)
181 $(info GROTTY
{EXTRA_
,}GROTTYFLAGS
)
182 $(info COL
{EXTRA_
,}COLFLAGS
)
184 $(info MANDOC
{EXTRA_
,}MANDOCFLAGS
)
185 $(info MAN2HTML
{EXTRA_
,}MAN2HTMLFLAGS
)
187 $(info BZIP2
{EXTRA_
,}BZIP2FLAGS
)
193 $(info GZIP
{EXTRA_
,}GZIPFLAGS
)
197 $(info LZIP
{EXTRA_
,}LZIPFLAGS
)
207 $(info XZ
{EXTRA_
,}XZFLAGS
)
214 $(info - {EXTRA_
,}CPPFLAGS
)
215 $(info CC
{EXTRA_
,}CFLAGS
)
216 $(info LD
{EXTRA_
,}LDFLAGS
{EXTRA_
,}LDLIBS
)
218 $(info CHECKPATCH
{EXTRA_
,}CHECKPATCHFLAGS
)
219 $(info CLANG-TIDY
{EXTRA_
,}CLANG-TIDYFLAGS
)
220 $(info CPPCHECK
{EXTRA_
,}CPPCHECKFLAGS
)
221 $(info CPPLINT
{EXTRA_
,}CPPLINTFLAGS
)
222 $(info IWYU
{EXTRA_
,}IWYUFLAGS
)