1 # Make coreutils man pages. -*-Makefile-*-
3 # Copyright (C) 2002-2010 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 dist_man1_MANS = $(MAN)
20 man_aux = $(dist_man1_MANS:.1=.x)
22 EXTRA_DIST = $(man_aux) $(NO_INSTALL_PROGS_DEFAULT:%=%.x) help2man
23 MAINTAINERCLEANFILES = $(dist_man1_MANS)
25 # Depend on ../.version to get version number changes.
26 common_dep = ../.version
28 # Note that arch depends on uname.c
29 arch.1: $(common_dep) $(srcdir)/arch.x ../src/uname.c
31 base64.1: $(common_dep) $(srcdir)/base64.x ../src/base64.c
32 basename.1: $(common_dep) $(srcdir)/basename.x ../src/basename.c
33 cat.1: $(common_dep) $(srcdir)/cat.x ../src/cat.c
34 chcon.1: $(common_dep) $(srcdir)/chcon.x ../src/chcon.c
35 chgrp.1: $(common_dep) $(srcdir)/chgrp.x ../src/chgrp.c
36 chmod.1: $(common_dep) $(srcdir)/chmod.x ../src/chmod.c
37 chown.1: $(common_dep) $(srcdir)/chown.x ../src/chown.c
38 chroot.1: $(common_dep) $(srcdir)/chroot.x ../src/chroot.c
39 cksum.1: $(common_dep) $(srcdir)/cksum.x ../src/cksum.c
40 comm.1: $(common_dep) $(srcdir)/comm.x ../src/comm.c
41 cp.1: $(common_dep) $(srcdir)/cp.x ../src/cp.c
42 csplit.1: $(common_dep) $(srcdir)/csplit.x ../src/csplit.c
43 cut.1: $(common_dep) $(srcdir)/cut.x ../src/cut.c
44 date.1: $(common_dep) $(srcdir)/date.x ../src/date.c
45 dd.1: $(common_dep) $(srcdir)/dd.x ../src/dd.c
46 df.1: $(common_dep) $(srcdir)/df.x ../src/df.c
48 # Note that dir depends on ls.c, since that's where it's --help text is.
49 dir.1: $(common_dep) $(srcdir)/dir.x ../src/ls.c
51 dircolors.1: $(common_dep) $(srcdir)/dircolors.x ../src/dircolors.c
52 dirname.1: $(common_dep) $(srcdir)/dirname.x ../src/dirname.c
53 du.1: $(common_dep) $(srcdir)/du.x ../src/du.c
54 echo.1: $(common_dep) $(srcdir)/echo.x ../src/echo.c
55 env.1: $(common_dep) $(srcdir)/env.x ../src/env.c
56 expand.1: $(common_dep) $(srcdir)/expand.x ../src/expand.c
57 expr.1: $(common_dep) $(srcdir)/expr.x ../src/expr.c
58 factor.1: $(common_dep) $(srcdir)/factor.x ../src/factor.c
59 false.1: $(common_dep) $(srcdir)/false.x ../src/false.c
60 fmt.1: $(common_dep) $(srcdir)/fmt.x ../src/fmt.c
61 fold.1: $(common_dep) $(srcdir)/fold.x ../src/fold.c
62 groups.1: $(common_dep) $(srcdir)/groups.x ../src/groups.c
63 head.1: $(common_dep) $(srcdir)/head.x ../src/head.c
64 hostid.1: $(common_dep) $(srcdir)/hostid.x ../src/hostid.c
65 hostname.1: $(common_dep) $(srcdir)/hostname.x ../src/hostname.c
66 id.1: $(common_dep) $(srcdir)/id.x ../src/id.c
67 install.1: $(common_dep) $(srcdir)/install.x ../src/install.c
68 join.1: $(common_dep) $(srcdir)/join.x ../src/join.c
69 kill.1: $(common_dep) $(srcdir)/kill.x ../src/kill.c
70 link.1: $(common_dep) $(srcdir)/link.x ../src/link.c
71 ln.1: $(common_dep) $(srcdir)/ln.x ../src/ln.c
72 logname.1: $(common_dep) $(srcdir)/logname.x ../src/logname.c
73 ls.1: $(common_dep) $(srcdir)/ls.x ../src/ls.c
74 md5sum.1: $(common_dep) $(srcdir)/md5sum.x ../src/md5sum.c
75 mkdir.1: $(common_dep) $(srcdir)/mkdir.x ../src/mkdir.c
76 mkfifo.1: $(common_dep) $(srcdir)/mkfifo.x ../src/mkfifo.c
77 mknod.1: $(common_dep) $(srcdir)/mknod.x ../src/mknod.c
78 mktemp.1: $(common_dep) $(srcdir)/mktemp.x ../src/mktemp.c
79 mv.1: $(common_dep) $(srcdir)/mv.x ../src/mv.c
80 nice.1: $(common_dep) $(srcdir)/nice.x ../src/nice.c
81 nl.1: $(common_dep) $(srcdir)/nl.x ../src/nl.c
82 nohup.1: $(common_dep) $(srcdir)/nohup.x ../src/nohup.c
83 nproc.1: $(common_dep) $(srcdir)/nproc.x ../src/nproc.c
84 od.1: $(common_dep) $(srcdir)/od.x ../src/od.c
85 paste.1: $(common_dep) $(srcdir)/paste.x ../src/paste.c
86 pathchk.1: $(common_dep) $(srcdir)/pathchk.x ../src/pathchk.c
87 pinky.1: $(common_dep) $(srcdir)/pinky.x ../src/pinky.c
88 pr.1: $(common_dep) $(srcdir)/pr.x ../src/pr.c
89 printenv.1: $(common_dep) $(srcdir)/printenv.x ../src/printenv.c
90 printf.1: $(common_dep) $(srcdir)/printf.x ../src/printf.c
91 ptx.1: $(common_dep) $(srcdir)/ptx.x ../src/ptx.c
92 pwd.1: $(common_dep) $(srcdir)/pwd.x ../src/pwd.c
93 readlink.1: $(common_dep) $(srcdir)/readlink.x ../src/readlink.c
94 rm.1: $(common_dep) $(srcdir)/rm.x ../src/rm.c
95 rmdir.1: $(common_dep) $(srcdir)/rmdir.x ../src/rmdir.c
96 runcon.1: $(common_dep) $(srcdir)/runcon.x ../src/runcon.c
97 seq.1: $(common_dep) $(srcdir)/seq.x ../src/seq.c
98 sha1sum.1: $(common_dep) $(srcdir)/sha1sum.x ../src/md5sum.c
99 sha224sum.1: $(common_dep) $(srcdir)/sha224sum.x ../src/md5sum.c
100 sha256sum.1: $(common_dep) $(srcdir)/sha256sum.x ../src/md5sum.c
101 sha384sum.1: $(common_dep) $(srcdir)/sha384sum.x ../src/md5sum.c
102 sha512sum.1: $(common_dep) $(srcdir)/sha512sum.x ../src/md5sum.c
103 shred.1: $(common_dep) $(srcdir)/shred.x ../src/shred.c
104 shuf.1: $(common_dep) $(srcdir)/shuf.x ../src/shuf.c
105 sleep.1: $(common_dep) $(srcdir)/sleep.x ../src/sleep.c
106 sort.1: $(common_dep) $(srcdir)/sort.x ../src/sort.c
107 split.1: $(common_dep) $(srcdir)/split.x ../src/split.c
108 stat.1: $(common_dep) $(srcdir)/stat.x ../src/stat.c
109 stdbuf.1: $(common_dep) $(srcdir)/stdbuf.x ../src/stdbuf.c
110 stty.1: $(common_dep) $(srcdir)/stty.x ../src/stty.c
111 su.1: $(common_dep) $(srcdir)/su.x ../src/su.c
112 sum.1: $(common_dep) $(srcdir)/sum.x ../src/sum.c
113 sync.1: $(common_dep) $(srcdir)/sync.x ../src/sync.c
114 tac.1: $(common_dep) $(srcdir)/tac.x ../src/tac.c
115 tail.1: $(common_dep) $(srcdir)/tail.x ../src/tail.c
116 tee.1: $(common_dep) $(srcdir)/tee.x ../src/tee.c
117 test.1: $(common_dep) $(srcdir)/test.x ../src/test.c
118 timeout.1: $(common_dep) $(srcdir)/timeout.x ../src/timeout.c
119 touch.1: $(common_dep) $(srcdir)/touch.x ../src/touch.c
120 tr.1: $(common_dep) $(srcdir)/tr.x ../src/tr.c
121 true.1: $(common_dep) $(srcdir)/true.x ../src/true.c
122 truncate.1: $(common_dep) $(srcdir)/truncate.x ../src/truncate.c
123 tsort.1: $(common_dep) $(srcdir)/tsort.x ../src/tsort.c
124 tty.1: $(common_dep) $(srcdir)/tty.x ../src/tty.c
125 uname.1: $(common_dep) $(srcdir)/uname.x ../src/uname.c
126 unexpand.1: $(common_dep) $(srcdir)/unexpand.x ../src/unexpand.c
127 uniq.1: $(common_dep) $(srcdir)/uniq.x ../src/uniq.c
128 unlink.1: $(common_dep) $(srcdir)/unlink.x ../src/unlink.c
129 uptime.1: $(common_dep) $(srcdir)/uptime.x ../src/uptime.c
130 users.1: $(common_dep) $(srcdir)/users.x ../src/users.c
131 vdir.1: $(common_dep) $(srcdir)/vdir.x ../src/ls.c
132 wc.1: $(common_dep) $(srcdir)/wc.x ../src/wc.c
133 who.1: $(common_dep) $(srcdir)/who.x ../src/who.c
134 whoami.1: $(common_dep) $(srcdir)/whoami.x ../src/whoami.c
135 yes.1: $(common_dep) $(srcdir)/yes.x ../src/yes.c
137 # This is required so that changes to e.g., emit_bug_reporting_address
138 # provoke regeneration of all $(MAN) files.
139 $(MAN): $(top_srcdir)/src/system.h
143 # Ensure that help2man runs the ../src/ginstall binary as
144 # `install' when creating install.1.
145 # Similarly, ensure that it uses the ../src/[ binary to create test.1.
147 mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
149 # Note the use of $t/$*, rather than just `$*' as in other packages.
150 # That is necessary to avoid failures for programs that are also shell built-in
151 # functions like echo, false, printf, pwd.
153 $(AM_V_GEN)case '$(PERL)' in \
155 echo 'WARNING: cannot update man page $@ since perl is missing' \
156 'or inadequate' 1>&2 \
163 (cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
164 $(PERL) -- $(srcdir)/help2man \
165 --source='$(PACKAGE_STRING)' \
166 --include=$(srcdir)/$*.x \
167 --output=$t/$@ $t/$*; \
169 && sed 's|$*\.td/||g' $t/$@ > $@-t \
176 distcheck-hook: check-x-vs-1 check-programs-vs-x
178 # Sort in traditional ASCII order, regardless of the current locale;
179 # otherwise we may get into trouble with distinct strings that the
180 # current locale considers to be equal.
181 ASSORT = LC_ALL=C sort
183 # Ensure that for each .x file in this directory, there is a
184 # corresponding .1 file in the definition of $(dist_man1_MANS) above.
185 # But since that expansion usually lacks programs like su and arch,
186 # add them here manually.
189 $(AM_V_GEN)PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \
191 (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\
192 (echo $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT) \
193 | tr -s ' ' '\n' | sed 's/\.1$$//') \
194 | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; }; \
198 (cd ../src && MAKEFLAGS= $(MAKE) -s all_programs.list) \
201 .PHONY: check-programs-vs-x
203 $(AM_V_GEN)status=0; \
204 for p in dummy `$(all_programs)`; do \
205 test $$p = dummy && continue; \
206 test $$p = ginstall && p=install || : ; \
207 test -f $(srcdir)/$$p.x \
208 || { echo missing $$p.x 1>&2; status=1; }; \