df: add --output=file to directly output specified arguments
[coreutils.git] / man / local.mk
blob45dbcb9559c9b8e9de4915ea5d7c1fa815d863c2
1 # Make coreutils man pages. -*-Makefile-*-
2 # This is included by the top-level Makefile.am.
4 # Copyright (C) 2002-2013 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 <http://www.gnu.org/licenses/>.
19 EXTRA_DIST += man/help2man man/dummy-man
21 ## Graceful degradation for systems lacking perl.
22 if HAVE_PERL
23 run_help2man = $(PERL) -- $(srcdir)/man/help2man
24 else
25 run_help2man = $(SHELL) $(srcdir)/man/dummy-man
26 endif
28 man1_MANS = @man1_MANS@
29 EXTRA_DIST += $(man1_MANS:.1=.x)
31 EXTRA_MANS = @EXTRA_MANS@
32 EXTRA_DIST += $(EXTRA_MANS:.1=.x)
34 ALL_MANS = $(man1_MANS) $(EXTRA_MANS)
36 CLEANFILES += $(ALL_MANS)
38 # This is required because we have subtle inter-directory dependencies:
39 # in order to generate all man pages, even those for which we don't
40 # install a binary, require that all programs be built at distribution
41 # time. We can't use 'dist-hook' for this, since it would run too late:
42 # the manpages must be generated before the distdir is created and filled.
43 $(EXTRA_MANS): $(all_programs)
45 # This is a kludge to remove generated 'man/*.1' from a non-srcdir build.
46 # Without this, "make distcheck" might fail.
47 distclean-local:
48 test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
50 # Dependencies common to all man pages. Updated below.
51 mandeps =
53 # Depend on this to get version number changes.
54 mandeps += .version
56 # This is required so that changes to e.g., emit_bug_reporting_address
57 # provoke regeneration of all the manpages.
58 mandeps += $(top_srcdir)/src/system.h
60 $(ALL_MANS): $(mandeps)
62 # Most prog.1 man pages depend on src/prog. List the exceptions:
63 # Note that dir and vdir are exceptions only if you consider the name
64 # of the .c file upon which they depend: ls.c.
65 man/arch.1: src/uname
66 man/dir.1: src/dir
67 man/install.1: src/ginstall
68 man/vdir.1: src/vdir
70 man/base64.1: src/base64
71 man/basename.1: src/basename
72 man/cat.1: src/cat
73 man/chcon.1: src/chcon
74 man/chgrp.1: src/chgrp
75 man/chmod.1: src/chmod
76 man/chown.1: src/chown
77 man/chroot.1: src/chroot
78 man/cksum.1: src/cksum
79 man/comm.1: src/comm
80 man/cp.1: src/cp
81 man/csplit.1: src/csplit
82 man/cut.1: src/cut
83 man/date.1: src/date
84 man/dd.1: src/dd
85 man/df.1: src/df
86 man/dircolors.1: src/dircolors
87 man/dirname.1: src/dirname
88 man/du.1: src/du
89 man/echo.1: src/echo
90 man/env.1: src/env
91 man/expand.1: src/expand
92 man/expr.1: src/expr
93 man/factor.1: src/factor
94 man/false.1: src/false
95 man/fmt.1: src/fmt
96 man/fold.1: src/fold
97 man/groups.1: src/groups
98 man/head.1: src/head
99 man/hostid.1: src/hostid
100 man/hostname.1: src/hostname
101 man/id.1: src/id
102 man/join.1: src/join
103 man/kill.1: src/kill
104 man/link.1: src/link
105 man/ln.1: src/ln
106 man/logname.1: src/logname
107 man/ls.1: src/ls
108 man/md5sum.1: src/md5sum
109 man/mkdir.1: src/mkdir
110 man/mkfifo.1: src/mkfifo
111 man/mknod.1: src/mknod
112 man/mktemp.1: src/mktemp
113 man/mv.1: src/mv
114 man/nice.1: src/nice
115 man/nl.1: src/nl
116 man/nohup.1: src/nohup
117 man/nproc.1: src/nproc
118 man/numfmt.1: src/numfmt
119 man/od.1: src/od
120 man/paste.1: src/paste
121 man/pathchk.1: src/pathchk
122 man/pinky.1: src/pinky
123 man/pr.1: src/pr
124 man/printenv.1: src/printenv
125 man/printf.1: src/printf
126 man/ptx.1: src/ptx
127 man/pwd.1: src/pwd
128 man/readlink.1: src/readlink
129 man/realpath.1: src/realpath
130 man/rm.1: src/rm
131 man/rmdir.1: src/rmdir
132 man/runcon.1: src/runcon
133 man/seq.1: src/seq
134 man/sha1sum.1: src/sha1sum
135 man/sha224sum.1: src/sha224sum
136 man/sha256sum.1: src/sha256sum
137 man/sha384sum.1: src/sha384sum
138 man/sha512sum.1: src/sha512sum
139 man/shred.1: src/shred
140 man/shuf.1: src/shuf
141 man/sleep.1: src/sleep
142 man/sort.1: src/sort
143 man/split.1: src/split
144 man/stat.1: src/stat
145 man/stdbuf.1: src/stdbuf
146 man/stty.1: src/stty
147 man/sum.1: src/sum
148 man/sync.1: src/sync
149 man/tac.1: src/tac
150 man/tail.1: src/tail
151 man/tee.1: src/tee
152 man/test.1: src/test
153 man/timeout.1: src/timeout
154 man/touch.1: src/touch
155 man/tr.1: src/tr
156 man/true.1: src/true
157 man/truncate.1: src/truncate
158 man/tsort.1: src/tsort
159 man/tty.1: src/tty
160 man/uname.1: src/uname
161 man/unexpand.1: src/unexpand
162 man/uniq.1: src/uniq
163 man/unlink.1: src/unlink
164 man/uptime.1: src/uptime
165 man/users.1: src/users
166 man/wc.1: src/wc
167 man/who.1: src/who
168 man/whoami.1: src/whoami
169 man/yes.1: src/yes
171 .x.1:
172 $(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \
173 ## Ensure that help2man runs the 'src/ginstall' binary as 'install' when
174 ## creating 'install.1'. Similarly, ensure that it uses the 'src/[' binary
175 ## to create 'test.1'.
176 case $$name in \
177 install) prog='ginstall';; \
178 test) prog='[';; \
179 *) prog=$$name;; \
180 esac; \
181 ## Note the use of $$t/$*, rather than just '$*' as in other packages.
182 ## That is necessary to avoid failures for programs that are also shell
183 ## built-in functions like echo, false, printf, pwd.
184 rm -f $@ $@-t \
185 && t=$*.td \
186 && rm -rf $$t \
187 && $(MKDIR_P) $$t \
188 && (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog $$name) \
189 && $(run_help2man) \
190 --source='$(PACKAGE_STRING)' \
191 --include=$(srcdir)/man/$$name.x \
192 --output=$$t/$$name.1 $$t/$$name \
193 --info-page='coreutils \(aq'$$name' invocation\(aq' \
194 && sed \
195 -e 's|$*\.td/||g' \
196 -e '/For complete documentation/d' \
197 $$t/$$name.1 > $@-t \
198 && rm -rf $$t \
199 && chmod a-w $@-t \
200 && mv $@-t $@