doc: fix typo referencing RFC 2822
[coreutils.git] / man / local.mk
blobee74d1f9b7c8fadee563002f8ac57443513407b6
1 # Make coreutils man pages. -*-Makefile-*-
2 # This is included by the top-level Makefile.am.
4 # Copyright (C) 2002-2019 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 run_help2man = $(PERL) -- $(srcdir)/man/help2man
28 else
29 run_help2man = $(SHELL) $(srcdir)/man/dummy-man
30 endif
31 endif
33 man1_MANS = @man1_MANS@
34 EXTRA_DIST += $(man1_MANS) $(man1_MANS:.1=.x)
36 EXTRA_MANS = @EXTRA_MANS@
37 EXTRA_DIST += $(EXTRA_MANS) $(EXTRA_MANS:.1=.x)
39 ALL_MANS = $(man1_MANS) $(EXTRA_MANS)
41 MAINTAINERCLEANFILES += $(ALL_MANS)
43 # This is a kludge to remove generated 'man/*.1' from a non-srcdir build.
44 # Without this, "make distcheck" might fail.
45 distclean-local:
46 test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
48 # Dependencies common to all man pages. Updated below.
49 mandeps =
51 # Depend on this to get version number changes.
52 mandeps += .version
54 # This is required so that changes to e.g., emit_bug_reporting_address
55 # provoke regeneration of all the manpages.
56 mandeps += $(top_srcdir)/src/system.h
58 $(ALL_MANS): $(mandeps)
60 if SINGLE_BINARY
61 mandeps += src/coreutils$(EXEEXT)
62 else
63 # Most prog.1 man pages depend on src/prog. List the exceptions:
64 man/install.1: src/ginstall$(EXEEXT)
65 man/test.1: src/[$(EXEEXT)
67 man/arch.1: src/arch$(EXEEXT)
68 man/b2sum.1: src/b2sum$(EXEEXT)
69 man/base32.1: src/base32$(EXEEXT)
70 man/base64.1: src/base64$(EXEEXT)
71 man/basename.1: src/basename$(EXEEXT)
72 man/basenc.1: src/basenc$(EXEEXT)
73 man/cat.1: src/cat$(EXEEXT)
74 man/chcon.1: src/chcon$(EXEEXT)
75 man/chgrp.1: src/chgrp$(EXEEXT)
76 man/chmod.1: src/chmod$(EXEEXT)
77 man/chown.1: src/chown$(EXEEXT)
78 man/chroot.1: src/chroot$(EXEEXT)
79 man/cksum.1: src/cksum$(EXEEXT)
80 man/comm.1: src/comm$(EXEEXT)
81 man/coreutils.1: src/coreutils$(EXEEXT)
82 man/cp.1: src/cp$(EXEEXT)
83 man/csplit.1: src/csplit$(EXEEXT)
84 man/cut.1: src/cut$(EXEEXT)
85 man/date.1: src/date$(EXEEXT)
86 man/dd.1: src/dd$(EXEEXT)
87 man/df.1: src/df$(EXEEXT)
88 man/dir.1: src/dir$(EXEEXT)
89 man/dircolors.1: src/dircolors$(EXEEXT)
90 man/dirname.1: src/dirname$(EXEEXT)
91 man/du.1: src/du$(EXEEXT)
92 man/echo.1: src/echo$(EXEEXT)
93 man/env.1: src/env$(EXEEXT)
94 man/expand.1: src/expand$(EXEEXT)
95 man/expr.1: src/expr$(EXEEXT)
96 man/factor.1: src/factor$(EXEEXT)
97 man/false.1: src/false$(EXEEXT)
98 man/fmt.1: src/fmt$(EXEEXT)
99 man/fold.1: src/fold$(EXEEXT)
100 man/groups.1: src/groups$(EXEEXT)
101 man/head.1: src/head$(EXEEXT)
102 man/hostid.1: src/hostid$(EXEEXT)
103 man/hostname.1: src/hostname$(EXEEXT)
104 man/id.1: src/id$(EXEEXT)
105 man/join.1: src/join$(EXEEXT)
106 man/kill.1: src/kill$(EXEEXT)
107 man/link.1: src/link$(EXEEXT)
108 man/ln.1: src/ln$(EXEEXT)
109 man/logname.1: src/logname$(EXEEXT)
110 man/ls.1: src/ls$(EXEEXT)
111 man/md5sum.1: src/md5sum$(EXEEXT)
112 man/mkdir.1: src/mkdir$(EXEEXT)
113 man/mkfifo.1: src/mkfifo$(EXEEXT)
114 man/mknod.1: src/mknod$(EXEEXT)
115 man/mktemp.1: src/mktemp$(EXEEXT)
116 man/mv.1: src/mv$(EXEEXT)
117 man/nice.1: src/nice$(EXEEXT)
118 man/nl.1: src/nl$(EXEEXT)
119 man/nohup.1: src/nohup$(EXEEXT)
120 man/nproc.1: src/nproc$(EXEEXT)
121 man/numfmt.1: src/numfmt$(EXEEXT)
122 man/od.1: src/od$(EXEEXT)
123 man/paste.1: src/paste$(EXEEXT)
124 man/pathchk.1: src/pathchk$(EXEEXT)
125 man/pinky.1: src/pinky$(EXEEXT)
126 man/pr.1: src/pr$(EXEEXT)
127 man/printenv.1: src/printenv$(EXEEXT)
128 man/printf.1: src/printf$(EXEEXT)
129 man/ptx.1: src/ptx$(EXEEXT)
130 man/pwd.1: src/pwd$(EXEEXT)
131 man/readlink.1: src/readlink$(EXEEXT)
132 man/realpath.1: src/realpath$(EXEEXT)
133 man/rm.1: src/rm$(EXEEXT)
134 man/rmdir.1: src/rmdir$(EXEEXT)
135 man/runcon.1: src/runcon$(EXEEXT)
136 man/seq.1: src/seq$(EXEEXT)
137 man/sha1sum.1: src/sha1sum$(EXEEXT)
138 man/sha224sum.1: src/sha224sum$(EXEEXT)
139 man/sha256sum.1: src/sha256sum$(EXEEXT)
140 man/sha384sum.1: src/sha384sum$(EXEEXT)
141 man/sha512sum.1: src/sha512sum$(EXEEXT)
142 man/shred.1: src/shred$(EXEEXT)
143 man/shuf.1: src/shuf$(EXEEXT)
144 man/sleep.1: src/sleep$(EXEEXT)
145 man/sort.1: src/sort$(EXEEXT)
146 man/split.1: src/split$(EXEEXT)
147 man/stat.1: src/stat$(EXEEXT)
148 man/stdbuf.1: src/stdbuf$(EXEEXT)
149 man/stty.1: src/stty$(EXEEXT)
150 man/sum.1: src/sum$(EXEEXT)
151 man/sync.1: src/sync$(EXEEXT)
152 man/tac.1: src/tac$(EXEEXT)
153 man/tail.1: src/tail$(EXEEXT)
154 man/tee.1: src/tee$(EXEEXT)
155 man/timeout.1: src/timeout$(EXEEXT)
156 man/touch.1: src/touch$(EXEEXT)
157 man/tr.1: src/tr$(EXEEXT)
158 man/true.1: src/true$(EXEEXT)
159 man/truncate.1: src/truncate$(EXEEXT)
160 man/tsort.1: src/tsort$(EXEEXT)
161 man/tty.1: src/tty$(EXEEXT)
162 man/uname.1: src/uname$(EXEEXT)
163 man/unexpand.1: src/unexpand$(EXEEXT)
164 man/uniq.1: src/uniq$(EXEEXT)
165 man/unlink.1: src/unlink$(EXEEXT)
166 man/uptime.1: src/uptime$(EXEEXT)
167 man/users.1: src/users$(EXEEXT)
168 man/vdir.1: src/vdir$(EXEEXT)
169 man/wc.1: src/wc$(EXEEXT)
170 man/who.1: src/who$(EXEEXT)
171 man/whoami.1: src/whoami$(EXEEXT)
172 man/yes.1: src/yes$(EXEEXT)
173 endif
175 .x.1:
176 $(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \
177 ## Ensure that help2man runs the 'src/ginstall' binary as 'install' when
178 ## creating 'install.1'. Similarly, ensure that it uses the 'src/[' binary
179 ## to create 'test.1'.
180 case $$name in \
181 install) prog='ginstall'; argv=$$name;; \
182 test) prog='['; argv='[';; \
183 *) prog=$$name; argv=$$prog;; \
184 esac; \
185 ## Note the use of $$t/$*, rather than just '$*' as in other packages.
186 ## That is necessary to avoid failures for programs that are also shell
187 ## built-in functions like echo, false, printf, pwd.
188 rm -f $@-t \
189 && t=$*.td \
190 && rm -rf $$t \
191 && $(MKDIR_P) $$t \
192 && (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog$(EXEEXT) \
193 $$argv$(EXEEXT)) \
194 || exit 1; \
195 ## Double-check whether the built binary succeeds with --help as the above
196 ## CROSS_COMPILING condition might have been wrong in some cases, e.g. when
197 ## building against an incompatible glibc version on the same platform.
198 $$t/$$argv$(EXEEXT) --help </dev/null >/dev/null \
199 && run_help2man="$(run_help2man)" \
200 || run_help2man="$(srcdir)/man/dummy-man"; \
201 : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \
202 && : $${TZ=UTC0} && export TZ \
203 && export SOURCE_DATE_EPOCH && $${run_help2man} \
204 --source='$(PACKAGE_STRING)' \
205 --include=$(srcdir)/man/$$name.x \
206 --output=$$t/$$name.1 \
207 --info-page='\(aq(coreutils) '$$name' invocation\(aq' \
208 $$t/$$argv$(EXEEXT) \
209 && sed \
210 -e 's|$*\.td/||g' \
211 -e '/For complete documentation/d' \
212 $$t/$$name.1 > $@-t \
213 && rm -rf $$t \
214 && chmod a-w $@-t \
215 && rm -f $@ && mv $@-t $@