INSTALL, RELEASE: Add RELEASE file with instructions for releasing
[man-pages.git] / Makefile
blob40b7c05bf08bf8ef48691d01d6fd05d84c8ad023
1 ########################################################################
2 # Copyright (C) 2021, 2022 Alejandro Colomar <alx.manpages@gmail.com>
3 # SPDX-License-Identifier: GPL-2.0 OR LGPL-2.0
4 ########################################################################
5 # Conventions:
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
14 # in $builddir.
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
40 srcdir := .
43 include $(srcdir)/lib/cmd.mk
46 .PHONY: all
47 all: build
50 .PHONY: help
51 help:
52 $(info Targets:)
53 $(info )
54 $(info all Alias for "build")
55 $(info )
56 $(info clean Remove $$(builddir))
57 $(info )
58 $(info build Alias for "build-html")
59 $(info )
60 $(info build-html Build HTML manual pages)
61 $(info html Alias for "build-html")
62 $(info )
63 $(info build-src Alias for "build-src-ld")
64 $(info build-src-c Extract C programs from EXAMPLES)
65 $(info build-src-cc Compile C programs from EXAMPLES)
66 $(info build-src-ld Link C programs from EXAMPLES)
67 $(info )
68 $(info lint Wrapper for "lint-c lint-man")
69 $(info lint-c Wrapper for lint-c-* targets)
70 $(info lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch(1))
71 $(info lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy(1))
72 $(info lint-c-cpplint Lint C programs from EXAMPLES with cpplint(1))
73 $(info lint-c-iwyu Lint C programs from EXAMPLES with iwyu(1))
74 $(info lint-man Wrapper for lint-man-* targets)
75 $(info lint-man-groff Lint man pages with groff(1))
76 $(info lint-man-mandoc Lint man pages with mandoc(1))
77 $(info )
78 $(info [un]install Alias for "[un]install-man")
79 $(info [un]install-man Wrapper for [un]install-man* targets)
80 $(info [un]install-man1 [Un]install man pages in section 1)
81 $(info [un]install-man2 [Un]install man pages in section 2)
82 $(info [un]install-man2type [Un]install man pages in section 2type)
83 $(info [un]install-man3 [Un]install man pages in section 3)
84 $(info [un]install-man3const [Un]install man pages in section 3const)
85 $(info [un]install-man3head [Un]install man pages in section 3head)
86 $(info [un]install-man3type [Un]install man pages in section 3type)
87 $(info [un]install-man4 [Un]install man pages in section 4)
88 $(info [un]install-man5 [Un]install man pages in section 5)
89 $(info [un]install-man6 [Un]install man pages in section 6)
90 $(info [un]install-man7 [Un]install man pages in section 7)
91 $(info [un]install-man8 [Un]install man pages in section 8)
92 $(info )
93 $(info [un]install-html [Un]install HTML manual pages)
94 $(info )
95 $(info dist Wrapper for dist-* targets)
96 $(info dist-tar Create a tarball of the repository)
97 $(info dist-gz Create a compressed tarball (.tar.gz))
98 $(info dist-xz Create a compressed tarball (.tar.xz))
99 $(info )
100 $(info builddirs-dist Create directories needed by "dist")
101 $(info builddirs-html Create directories needed by "build-html")
102 $(info builddirs-src Create directories needed by "build-src")
103 $(info lintdirs Create directories needed by "lint")
104 $(info installdirs Create directories needed by "install")
105 $(info installdirs-html Create directories needed by "install-html")
106 $(info installdirs-man Create directories needed by "install-man")
107 $(info installdirs-man1 Create directories needed by "install-man1")
108 $(info installdirs-man2 Create directories needed by "install-man2")
109 $(info installdirs-man2type Create directories needed by "install-man2type")
110 $(info installdirs-man3 Create directories needed by "install-man3")
111 $(info installdirs-man3const Create directories needed by "install-man3const")
112 $(info installdirs-man3head Create directories needed by "install-man3head")
113 $(info installdirs-man3type Create directories needed by "install-man3type")
114 $(info installdirs-man4 Create directories needed by "install-man4")
115 $(info installdirs-man5 Create directories needed by "install-man5")
116 $(info installdirs-man6 Create directories needed by "install-man6")
117 $(info installdirs-man7 Create directories needed by "install-man7")
118 $(info installdirs-man8 Create directories needed by "install-man8")
119 $(info )
120 $(info help Print this help)
121 $(info )
122 $(info Variables:)
123 $(info )
124 $(info V Define to non-empty string for verbose output)
127 .SECONDEXPANSION:
130 include $(srcdir)/lib/build.mk
131 include $(srcdir)/lib/build-html.mk
132 include $(srcdir)/lib/build-src.mk
133 include $(srcdir)/lib/dist.mk
134 include $(srcdir)/lib/install.mk
135 include $(srcdir)/lib/install-html.mk
136 include $(srcdir)/lib/install-man.mk
137 include $(srcdir)/lib/lint.mk
138 include $(srcdir)/lib/lint-c.mk
139 include $(srcdir)/lib/lint-man.mk
140 include $(srcdir)/lib/verbose.mk
143 FORCE: