]>
Commit | Line | Data |
---|---|---|
336ae0d2 | 1 | ######################################################################## |
60e13483 | 2 | # Copyright (C) 2021, 2022 Alejandro Colomar <alx.manpages@gmail.com> |
336ae0d2 AC |
3 | # SPDX-License-Identifier: GPL-2.0 OR LGPL-2.0 |
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). | |
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. | |
28 | # | |
29 | ######################################################################## | |
30 | ||
26061fbd | 31 | SHELL := /usr/bin/env bash -Eeuo pipefail |
a82aaca1 AC |
32 | |
33 | ||
e4b890cd | 34 | MAKEFLAGS += --no-print-directory |
336ae0d2 AC |
35 | MAKEFLAGS += --warn-undefined-variables |
36 | ||
37 | ||
8bb88d5f | 38 | srcdir := . |
179d5a07 | 39 | |
ece893c0 AC |
40 | |
41 | include $(srcdir)/lib/cmd.mk | |
42 | ||
43 | ||
e8116fad AC |
44 | .PHONY: all |
45 | all: build | |
77160b72 AC |
46 | @: |
47 | ||
48 | .PHONY: help | |
49 | help: | |
50 | $(info all Alias for "build") | |
51 | $(info ) | |
52 | $(info clean Remove $$(builddir)) | |
53 | $(info ) | |
54 | $(info build Alias for "build-html") | |
55 | $(info ) | |
56 | $(info build-html Build HTML manual pages) | |
57 | $(info html Alias for "build-html") | |
58 | $(info ) | |
59 | $(info build-src Alias for "build-src-ld") | |
60 | $(info build-src-c Extract C programs from EXAMPLES) | |
61 | $(info build-src-cc Compile C programs from EXAMPLES) | |
62 | $(info build-src-ld Link C programs from EXAMPLES) | |
63 | $(info ) | |
64 | $(info lint Wrapper for "lint-c lint-man") | |
65 | $(info lint-c Wrapper for lint-c-* targets) | |
66 | $(info lint-c-checkpatch Lint C programs from EXAMPLES with checkpatch(1)) | |
67 | $(info lint-c-clang-tidy Lint C programs from EXAMPLES with clang-tidy(1)) | |
68 | $(info lint-c-cpplint Lint C programs from EXAMPLES with cpplint(1)) | |
69 | $(info lint-c-iwyu Lint C programs from EXAMPLES with iwyu(1)) | |
70 | $(info lint-man Wrapper for lint-man-* targets) | |
71 | $(info lint-man-groff Lint man pages with groff(1)) | |
72 | $(info lint-man-mandoc Lint man pages with mandoc(1)) | |
73 | $(info ) | |
74 | $(info [un]install Alias for "[un]install-man") | |
75 | $(info [un]install-man Wrapper for [un]install-man* targets) | |
77160b72 AC |
76 | $(info [un]install-man1 [Un]install man pages in section 1) |
77 | $(info [un]install-man2 [Un]install man pages in section 2) | |
451a27a7 | 78 | $(info [un]install-man2type [Un]install man pages in section 2type) |
77160b72 | 79 | $(info [un]install-man3 [Un]install man pages in section 3) |
5f836211 | 80 | $(info [un]install-man3head [Un]install man pages in section 3head) |
451a27a7 | 81 | $(info [un]install-man3type [Un]install man pages in section 3type) |
77160b72 AC |
82 | $(info [un]install-man4 [Un]install man pages in section 4) |
83 | $(info [un]install-man5 [Un]install man pages in section 5) | |
84 | $(info [un]install-man6 [Un]install man pages in section 6) | |
85 | $(info [un]install-man7 [Un]install man pages in section 7) | |
86 | $(info [un]install-man8 [Un]install man pages in section 8) | |
87 | $(info ) | |
88 | $(info [un]install-html [Un]install HTML manual pages) | |
89 | $(info ) | |
90 | $(info dist Wrapper for dist-* targets) | |
91 | $(info dist-tar Create a tarball of the repository) | |
92 | $(info dist-gz Create a compressed tarball (.tar.gz)) | |
93 | $(info dist-xz Create a compressed tarball (.tar.xz)) | |
94 | $(info ) | |
95 | $(info builddirs-dist Create directories needed by "dist") | |
96 | $(info builddirs-html Create directories needed by "build-html") | |
97 | $(info builddirs-src Create directories needed by "build-src") | |
98 | $(info lintdirs Create directories needed by "lint") | |
99 | $(info installdirs Create directories needed by "install") | |
100 | $(info installdirs-html Create directories needed by "install-html") | |
101 | $(info installdirs-man Create directories needed by "install-man") | |
77160b72 AC |
102 | $(info installdirs-man1 Create directories needed by "install-man1") |
103 | $(info installdirs-man2 Create directories needed by "install-man2") | |
451a27a7 | 104 | $(info installdirs-man2type Create directories needed by "install-man2type") |
77160b72 | 105 | $(info installdirs-man3 Create directories needed by "install-man3") |
5f836211 | 106 | $(info installdirs-man3head Create directories needed by "install-man3head") |
451a27a7 | 107 | $(info installdirs-man3type Create directories needed by "install-man3type") |
77160b72 AC |
108 | $(info installdirs-man4 Create directories needed by "install-man4") |
109 | $(info installdirs-man5 Create directories needed by "install-man5") | |
110 | $(info installdirs-man6 Create directories needed by "install-man6") | |
111 | $(info installdirs-man7 Create directories needed by "install-man7") | |
112 | $(info installdirs-man8 Create directories needed by "install-man8") | |
113 | $(info ) | |
114 | $(info help Print this help) | |
e8116fad | 115 | |
336ae0d2 | 116 | .SECONDEXPANSION: |
336ae0d2 AC |
117 | |
118 | ||
86c39272 | 119 | include $(srcdir)/lib/build.mk |
8ef21b8e | 120 | include $(srcdir)/lib/build-html.mk |
8894c537 | 121 | include $(srcdir)/lib/build-src.mk |
d951f315 | 122 | include $(srcdir)/lib/dist.mk |
8bb88d5f | 123 | include $(srcdir)/lib/install.mk |
c1e5f4b4 | 124 | include $(srcdir)/lib/install-html.mk |
0110da57 | 125 | include $(srcdir)/lib/install-man.mk |
66747a37 | 126 | include $(srcdir)/lib/lint.mk |
f60ff4d8 | 127 | include $(srcdir)/lib/lint-c.mk |
60e13483 | 128 | include $(srcdir)/lib/lint-man.mk |
f60ff4d8 | 129 | |
336ae0d2 | 130 | |
854126bb | 131 | $(V).SILENT: |
336ae0d2 | 132 | FORCE: |