1 ########################################################################
2 # Copyright (C) 2021, 2022 Alejandro Colomar <alx@kernel.org>
3 # SPDX-License-Identifier: GPL-2.0 OR LGPL-2.0
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 # - 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.
29 ########################################################################
31 SHELL
:= /usr
/bin
/env bash
-Eeuo pipefail
34 MAKEFLAGS
+= --no-builtin-rules
35 MAKEFLAGS
+= --no-builtin-variables
36 MAKEFLAGS
+= --no-print-directory
37 MAKEFLAGS
+= --warn-undefined-variables
49 $(info all Alias for
"build")
51 $(info clean Remove
$$(builddir
))
53 $(info build Wrapper for
"build-catman build-html build-src")
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")
62 $(info build-html Build HTML manual pages
)
63 $(info html Alias for
"build-html")
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
)
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))
74 $(info lint-c-cppcheck Lint C programs from EXAMPLES with cppcheck
(1))
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
)
78 $(info lint-man-mandoc Lint man pages with mandoc
(1))
79 $(info lint-man-tbl Lint man pages about
'\" t' comment for tbl
(1))
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))
86 $(info [un
]install Alias for
"[un]install-man")
87 $(info [un
]install-man Wrapper for
[un
]install-man
* targets
)
88 $(info [un
]install-man1
[Un
]install man pages in section
1)
89 $(info [un
]install-man2
[Un
]install man pages in section
2)
90 $(info [un
]install-man2type
[Un
]install man pages in section
2type
)
91 $(info [un
]install-man3
[Un
]install man pages in section
3)
92 $(info [un
]install-man3const
[Un
]install man pages in section
3const
)
93 $(info [un
]install-man3head
[Un
]install man pages in section
3head
)
94 $(info [un
]install-man3type
[Un
]install man pages in section
3type
)
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)
101 $(info [un
]install-html
[Un
]install HTML manual pages
)
103 $(info dist Wrapper for dist-
* targets
)
104 $(info dist-tar Create a tarball of the repository
)
105 $(info dist-bz2 Create a compressed tarball
(.
tar.bz2
))
106 $(info dist-gz Create a compressed tarball
(.
tar.gz
))
107 $(info dist-lz Create a compressed tarball
(.
tar.lz
))
108 $(info dist-xz Create a compressed tarball
(.
tar.xz
))
110 $(info help Print this help
)
111 $(info help-variables Print
all variables available
, and their default values
)
118 include $(srcdir)/lib
/check.mk
119 include $(srcdir)/lib
/check-catman.mk
120 include $(srcdir)/lib
/build.mk
121 include $(srcdir)/lib
/build-catman.mk
122 include $(srcdir)/lib
/build-html.mk
123 include $(srcdir)/lib
/build-src.mk
124 include $(srcdir)/lib
/dist.mk
125 include $(srcdir)/lib
/install.mk
126 include $(srcdir)/lib
/install-html.mk
127 include $(srcdir)/lib
/install-man.mk
128 include $(srcdir)/lib
/lint.mk
129 include $(srcdir)/lib
/lint-c.mk
130 include $(srcdir)/lib
/lint-man.mk
131 include $(srcdir)/lib
/verbose.mk
134 .PHONY
: help-variables
136 $(info V Define to non-empty string for verbose output
)
138 $(info LINK_PAGES How to
install link pages.
[".so", "symlink"])
139 $(info Z Install pages compressed.
["", ".bz2", ".gz", ".lz", ".xz"])
141 $(info DISTNAME
$$(git describe
))
142 $(info DISTVERSION
/$$DISTNAME/s
/man-pages-
//)
144 $(info # Directory variables:)
146 $(info builddir .tmp
)
148 $(info prefix /usr
/local
)
149 $(info mandir $$(datarootdir
)/man
)
150 $(info docdir
$$(datarootdir
)/doc
)
152 $(info man1dir $$(mandir)/man1
)
153 $(info man2dir $$(mandir)/man2
)
154 $(info man2typedir
$$(mandir)/man2type
)
155 $(info man3dir $$(mandir)/man3
)
156 $(info man3constdir
$$(mandir)/man3const
)
157 $(info man3headdir
$$(mandir)/man3head
)
158 $(info man3typedir
$$(mandir)/man3type
)
159 $(info man4dir $$(mandir)/man4
)
160 $(info man5dir $$(mandir)/man5
)
161 $(info man6dir $$(mandir)/man6
)
162 $(info man7dir $$(mandir)/man7
)
163 $(info man8dir $$(mandir)/man8
)
165 $(info htmldir
$$(docdir
))
166 $(info htmlext .html
)
168 $(info # Command variables (and flags):)
170 $(info PRECONV
{EXTRA_
,}PRECONVFLAGS
)
172 $(info EQN
{EXTRA_
,}EQNFLAGS
)
173 $(info TROFF
{EXTRA_
,}TROFFFLAGS
)
174 $(info GROTTY
{EXTRA_
,}GROTTYFLAGS
)
175 $(info COL
{EXTRA_
,}COLFLAGS
)
178 $(info MANDOC
{EXTRA_
,}MANDOCFLAGS
)
179 $(info MAN2HTML
{EXTRA_
,}MAN2HTMLFLAGS
)
181 $(info BZIP2
{EXTRA_
,}BZIP2FLAGS
)
187 $(info GZIP
{EXTRA_
,}GZIPFLAGS
)
191 $(info LZIP
{EXTRA_
,}LZIPFLAGS
)
201 $(info XZ
{EXTRA_
,}XZFLAGS
)
208 $(info - {EXTRA_
,}CPPFLAGS
)
209 $(info CC
{EXTRA_
,}CFLAGS
)
210 $(info LD
{EXTRA_
,}LDFLAGS
{EXTRA_
,}LDLIBS
)
212 $(info CHECKPATCH
{EXTRA_
,}CHECKPATCHFLAGS
)
213 $(info CLANG-TIDY
{EXTRA_
,}CLANG-TIDYFLAGS
)
214 $(info CPPCHECK
{EXTRA_
,}CPPCHECKFLAGS
)
215 $(info CPPLINT
{EXTRA_
,}CPPLINTFLAGS
)
216 $(info IWYU
{EXTRA_
,}IWYUFLAGS
)