doc: printf %b: clarify octal processing
[coreutils.git] / man / local.mk
blob1acd73fe79b5bcd82fdc087ec4e1bf6dc7a73571
1 # Make coreutils man pages. -*-Makefile-*-
2 # This is included by the top-level Makefile.am.
4 # Copyright (C) 2002-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 EXTRA_DIST += man/help2man man/dummy-man
21 ## Use the distributed man pages if cross compiling or lack perl
22 if CROSS_COMPILING
23 run_help2man = $(SHELL) $(srcdir)/man/dummy-man
24 else
25 ## Graceful degradation for systems lacking perl.
26 if HAVE_PERL
27 if BOLD_MAN_REFS
28 help2man_OPTS=--bold-refs
29 endif
30 run_help2man = $(PERL) -- $(srcdir)/man/help2man $(help2man_OPTS)
31 else
32 run_help2man = $(SHELL) $(srcdir)/man/dummy-man
33 endif
34 endif
36 man1_MANS = @man1_MANS@
37 EXTRA_DIST += $(man1_MANS) $(man1_MANS:.1=.x)
39 EXTRA_MANS = @EXTRA_MANS@
40 EXTRA_DIST += $(EXTRA_MANS) $(EXTRA_MANS:.1=.x)
42 ALL_MANS = $(man1_MANS) $(EXTRA_MANS)
44 MAINTAINERCLEANFILES += $(ALL_MANS)
46 # This is a kludge to remove generated 'man/*.1' from a non-srcdir build.
47 # Without this, "make distcheck" might fail.
48 distclean-local:
49 test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
51 # Dependencies common to all man pages. Updated below.
52 mandeps =
54 # Depend on this to get version number changes.
55 mandeps += .version
57 # This is required so that changes to e.g., emit_bug_reporting_address
58 # provoke regeneration of all the manpages.
59 mandeps += $(top_srcdir)/src/system.h
61 $(ALL_MANS): $(mandeps)
63 if SINGLE_BINARY
64 mandeps += src/coreutils$(EXEEXT)
65 else
66 # Most prog.1 man pages depend on src/prog. List the exceptions:
67 man/install.1: src/ginstall$(EXEEXT)
68 man/test.1: src/[$(EXEEXT)
70 man/arch.1: src/arch$(EXEEXT)
71 man/b2sum.1: src/b2sum$(EXEEXT)
72 man/base32.1: src/base32$(EXEEXT)
73 man/base64.1: src/base64$(EXEEXT)
74 man/basename.1: src/basename$(EXEEXT)
75 man/basenc.1: src/basenc$(EXEEXT)
76 man/cat.1: src/cat$(EXEEXT)
77 man/chcon.1: src/chcon$(EXEEXT)
78 man/chgrp.1: src/chgrp$(EXEEXT)
79 man/chmod.1: src/chmod$(EXEEXT)
80 man/chown.1: src/chown$(EXEEXT)
81 man/chroot.1: src/chroot$(EXEEXT)
82 man/cksum.1: src/cksum$(EXEEXT)
83 man/comm.1: src/comm$(EXEEXT)
84 man/coreutils.1: src/coreutils$(EXEEXT)
85 man/cp.1: src/cp$(EXEEXT)
86 man/csplit.1: src/csplit$(EXEEXT)
87 man/cut.1: src/cut$(EXEEXT)
88 man/date.1: src/date$(EXEEXT)
89 man/dd.1: src/dd$(EXEEXT)
90 man/df.1: src/df$(EXEEXT)
91 man/dir.1: src/dir$(EXEEXT)
92 man/dircolors.1: src/dircolors$(EXEEXT)
93 man/dirname.1: src/dirname$(EXEEXT)
94 man/du.1: src/du$(EXEEXT)
95 man/echo.1: src/echo$(EXEEXT)
96 man/env.1: src/env$(EXEEXT)
97 man/expand.1: src/expand$(EXEEXT)
98 man/expr.1: src/expr$(EXEEXT)
99 man/factor.1: src/factor$(EXEEXT)
100 man/false.1: src/false$(EXEEXT)
101 man/fmt.1: src/fmt$(EXEEXT)
102 man/fold.1: src/fold$(EXEEXT)
103 man/groups.1: src/groups$(EXEEXT)
104 man/head.1: src/head$(EXEEXT)
105 man/hostid.1: src/hostid$(EXEEXT)
106 man/hostname.1: src/hostname$(EXEEXT)
107 man/id.1: src/id$(EXEEXT)
108 man/join.1: src/join$(EXEEXT)
109 man/kill.1: src/kill$(EXEEXT)
110 man/link.1: src/link$(EXEEXT)
111 man/ln.1: src/ln$(EXEEXT)
112 man/logname.1: src/logname$(EXEEXT)
113 man/ls.1: src/ls$(EXEEXT)
114 man/md5sum.1: src/md5sum$(EXEEXT)
115 man/mkdir.1: src/mkdir$(EXEEXT)
116 man/mkfifo.1: src/mkfifo$(EXEEXT)
117 man/mknod.1: src/mknod$(EXEEXT)
118 man/mktemp.1: src/mktemp$(EXEEXT)
119 man/mv.1: src/mv$(EXEEXT)
120 man/nice.1: src/nice$(EXEEXT)
121 man/nl.1: src/nl$(EXEEXT)
122 man/nohup.1: src/nohup$(EXEEXT)
123 man/nproc.1: src/nproc$(EXEEXT)
124 man/numfmt.1: src/numfmt$(EXEEXT)
125 man/od.1: src/od$(EXEEXT)
126 man/paste.1: src/paste$(EXEEXT)
127 man/pathchk.1: src/pathchk$(EXEEXT)
128 man/pinky.1: src/pinky$(EXEEXT)
129 man/pr.1: src/pr$(EXEEXT)
130 man/printenv.1: src/printenv$(EXEEXT)
131 man/printf.1: src/printf$(EXEEXT)
132 man/ptx.1: src/ptx$(EXEEXT)
133 man/pwd.1: src/pwd$(EXEEXT)
134 man/readlink.1: src/readlink$(EXEEXT)
135 man/realpath.1: src/realpath$(EXEEXT)
136 man/rm.1: src/rm$(EXEEXT)
137 man/rmdir.1: src/rmdir$(EXEEXT)
138 man/runcon.1: src/runcon$(EXEEXT)
139 man/seq.1: src/seq$(EXEEXT)
140 man/sha1sum.1: src/sha1sum$(EXEEXT)
141 man/sha224sum.1: src/sha224sum$(EXEEXT)
142 man/sha256sum.1: src/sha256sum$(EXEEXT)
143 man/sha384sum.1: src/sha384sum$(EXEEXT)
144 man/sha512sum.1: src/sha512sum$(EXEEXT)
145 man/shred.1: src/shred$(EXEEXT)
146 man/shuf.1: src/shuf$(EXEEXT)
147 man/sleep.1: src/sleep$(EXEEXT)
148 man/sort.1: src/sort$(EXEEXT)
149 man/split.1: src/split$(EXEEXT)
150 man/stat.1: src/stat$(EXEEXT)
151 man/stdbuf.1: src/stdbuf$(EXEEXT)
152 man/stty.1: src/stty$(EXEEXT)
153 man/sum.1: src/sum$(EXEEXT)
154 man/sync.1: src/sync$(EXEEXT)
155 man/tac.1: src/tac$(EXEEXT)
156 man/tail.1: src/tail$(EXEEXT)
157 man/tee.1: src/tee$(EXEEXT)
158 man/timeout.1: src/timeout$(EXEEXT)
159 man/touch.1: src/touch$(EXEEXT)
160 man/tr.1: src/tr$(EXEEXT)
161 man/true.1: src/true$(EXEEXT)
162 man/truncate.1: src/truncate$(EXEEXT)
163 man/tsort.1: src/tsort$(EXEEXT)
164 man/tty.1: src/tty$(EXEEXT)
165 man/uname.1: src/uname$(EXEEXT)
166 man/unexpand.1: src/unexpand$(EXEEXT)
167 man/uniq.1: src/uniq$(EXEEXT)
168 man/unlink.1: src/unlink$(EXEEXT)
169 man/uptime.1: src/uptime$(EXEEXT)
170 man/users.1: src/users$(EXEEXT)
171 man/vdir.1: src/vdir$(EXEEXT)
172 man/wc.1: src/wc$(EXEEXT)
173 man/who.1: src/who$(EXEEXT)
174 man/whoami.1: src/whoami$(EXEEXT)
175 man/yes.1: src/yes$(EXEEXT)
176 endif
178 .x.1:
179 $(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \
180 ## Ensure that help2man runs the 'src/ginstall' binary as 'install' when
181 ## creating 'install.1'. Similarly, ensure that it uses the 'src/[' binary
182 ## to create 'test.1'.
183 case $$name in \
184 install) prog='ginstall'; argv=$$name;; \
185 test) prog='['; argv='[';; \
186 *) prog=$$name; argv=$$prog;; \
187 esac; \
188 ## Note the use of $$t/$*, rather than just '$*' as in other packages.
189 ## That is necessary to avoid failures for programs that are also shell
190 ## built-in functions like echo, false, printf, pwd.
191 rm -f $@-t \
192 && t=$*.td \
193 && rm -rf $$t \
194 && $(MKDIR_P) $$t \
195 && (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog$(EXEEXT) \
196 $$argv$(EXEEXT)) \
197 && : $${SOURCE_DATE_EPOCH=`date -r $(srcdir)/.tarball-version +%s \
198 2>/dev/null || :`} \
199 && : $${TZ=UTC0} && export TZ \
200 && export SOURCE_DATE_EPOCH && $(run_help2man) \
201 --source='$(PACKAGE_STRING)' \
202 --include=$(srcdir)/man/$$name.x \
203 --output=$$t/$$name.1 \
204 --info-page='\(aq(coreutils) '$$name' invocation\(aq' \
205 $$t/$$argv$(EXEEXT) \
206 && sed \
207 -e 's|$*\.td/||g' \
208 -e '/For complete documentation/d' \
209 $$t/$$name.1 > $@-t \
210 && rm -rf $$t \
211 && chmod a-w $@-t \
212 && rm -f $@ && mv $@-t $@