1 # Make coreutils man pages. -*-Makefile-*-
3 # Copyright (C) 2002-2009 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 od.1: $(common_dep) $(srcdir)/od.x ../src/od.c
84 paste.1: $(common_dep) $(srcdir)/paste.x ../src/paste.c
85 pathchk.1: $(common_dep) $(srcdir)/pathchk.x ../src/pathchk.c
86 pinky.1: $(common_dep) $(srcdir)/pinky.x ../src/pinky.c
87 pr.1: $(common_dep) $(srcdir)/pr.x ../src/pr.c
88 printenv.1: $(common_dep) $(srcdir)/printenv.x ../src/printenv.c
89 printf.1: $(common_dep) $(srcdir)/printf.x ../src/printf.c
90 ptx.1: $(common_dep) $(srcdir)/ptx.x ../src/ptx.c
91 pwd.1: $(common_dep) $(srcdir)/pwd.x ../src/pwd.c
92 readlink.1: $(common_dep) $(srcdir)/readlink.x ../src/readlink.c
93 rm.1: $(common_dep) $(srcdir)/rm.x ../src/rm.c
94 rmdir.1: $(common_dep) $(srcdir)/rmdir.x ../src/rmdir.c
95 runcon.1: $(common_dep) $(srcdir)/runcon.x ../src/runcon.c
96 seq.1: $(common_dep) $(srcdir)/seq.x ../src/seq.c
97 sha1sum.1: $(common_dep) $(srcdir)/sha1sum.x ../src/md5sum.c
98 sha224sum.1: $(common_dep) $(srcdir)/sha224sum.x ../src/md5sum.c
99 sha256sum.1: $(common_dep) $(srcdir)/sha256sum.x ../src/md5sum.c
100 sha384sum.1: $(common_dep) $(srcdir)/sha384sum.x ../src/md5sum.c
101 sha512sum.1: $(common_dep) $(srcdir)/sha512sum.x ../src/md5sum.c
102 shred.1: $(common_dep) $(srcdir)/shred.x ../src/shred.c
103 shuf.1: $(common_dep) $(srcdir)/shuf.x ../src/shuf.c
104 sleep.1: $(common_dep) $(srcdir)/sleep.x ../src/sleep.c
105 sort.1: $(common_dep) $(srcdir)/sort.x ../src/sort.c
106 split.1: $(common_dep) $(srcdir)/split.x ../src/split.c
107 stat.1: $(common_dep) $(srcdir)/stat.x ../src/stat.c
108 stty.1: $(common_dep) $(srcdir)/stty.x ../src/stty.c
109 su.1: $(common_dep) $(srcdir)/su.x ../src/su.c
110 sum.1: $(common_dep) $(srcdir)/sum.x ../src/sum.c
111 sync.1: $(common_dep) $(srcdir)/sync.x ../src/sync.c
112 tac.1: $(common_dep) $(srcdir)/tac.x ../src/tac.c
113 tail.1: $(common_dep) $(srcdir)/tail.x ../src/tail.c
114 tee.1: $(common_dep) $(srcdir)/tee.x ../src/tee.c
115 test.1: $(common_dep) $(srcdir)/test.x ../src/test.c
116 timeout.1: $(common_dep) $(srcdir)/timeout.x ../src/timeout.c
117 touch.1: $(common_dep) $(srcdir)/touch.x ../src/touch.c
118 tr.1: $(common_dep) $(srcdir)/tr.x ../src/tr.c
119 true.1: $(common_dep) $(srcdir)/true.x ../src/true.c
120 truncate.1: $(common_dep) $(srcdir)/truncate.x ../src/truncate.c
121 tsort.1: $(common_dep) $(srcdir)/tsort.x ../src/tsort.c
122 tty.1: $(common_dep) $(srcdir)/tty.x ../src/tty.c
123 uname.1: $(common_dep) $(srcdir)/uname.x ../src/uname.c
124 unexpand.1: $(common_dep) $(srcdir)/unexpand.x ../src/unexpand.c
125 uniq.1: $(common_dep) $(srcdir)/uniq.x ../src/uniq.c
126 unlink.1: $(common_dep) $(srcdir)/unlink.x ../src/unlink.c
127 uptime.1: $(common_dep) $(srcdir)/uptime.x ../src/uptime.c
128 users.1: $(common_dep) $(srcdir)/users.x ../src/users.c
129 vdir.1: $(common_dep) $(srcdir)/vdir.x ../src/ls.c
130 wc.1: $(common_dep) $(srcdir)/wc.x ../src/wc.c
131 who.1: $(common_dep) $(srcdir)/who.x ../src/who.c
132 whoami.1: $(common_dep) $(srcdir)/whoami.x ../src/whoami.c
133 yes.1: $(common_dep) $(srcdir)/yes.x ../src/yes.c
135 # This is required so that changes to e.g., emit_bug_reporting_address
136 # provoke regeneration of all $(MAN) files.
137 $(MAN): $(top_srcdir)/src/system.h
141 # Ensure that help2man runs the ../src/ginstall binary as
142 # `install' when creating install.1.
143 # Similarly, ensure that it uses the ../src/[ binary to create test.1.
145 mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
147 # Note the use of $t/$*, rather than just `$*' as in other packages.
148 # That is necessary to avoid failures for programs that are also shell built-in
149 # functions like echo, false, printf, pwd.
153 echo 'WARNING: cannot update man page $@ since perl is missing' \
154 'or inadequate' 1>&2 \
158 && { echo "Updating man page $@"; \
161 (cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
162 $(PERL) -- $(srcdir)/help2man \
163 --source='$(PACKAGE_STRING)' \
164 --include=$(srcdir)/$*.x \
165 --output=$t/$@ $t/$*; \
167 && sed 's|$*\.td/||g' $t/$@ > $@ \
171 distcheck-hook: check-x-vs-1 check-programs-vs-x
173 # Sort in traditional ASCII order, regardless of the current locale;
174 # otherwise we may get into trouble with distinct strings that the
175 # current locale considers to be equal.
176 ASSORT = LC_ALL=C sort
178 # Ensure that for each .x file in this directory, there is a
179 # corresponding .1 file in the definition of $(dist_man1_MANS) above.
180 # But since that expansion usually lacks programs like su and arch,
181 # add them here manually.
184 PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \
186 (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\
187 (echo $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT) \
188 | tr -s ' ' '\n' | sed 's/\.1$$//') \
189 | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; }; \
193 (cd ../src && MAKEFLAGS= $(MAKE) -s all_programs.list) \
196 .PHONY: check-programs-vs-x
199 for p in dummy `$(all_programs)`; do \
200 test $$p = dummy && continue; \
201 test $$p = ginstall && p=install || : ; \
202 test -f $(srcdir)/$$p.x \
203 || { echo missing $$p.x 1>&2; status=1; }; \