c0675944bc7762c6ca2aaf2107c25536660eb917
[platform/upstream/coreutils.git] / man / Makefile.am
1 # Make coreutils man pages.                             -*-Makefile-*-
2
3 # Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software
4 # Foundation, Inc.
5
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 2 of the License, or
9 # (at your option) any later version.
10
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.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
20
21 dist_man_MANS = \
22   base64.1 basename.1 cat.1 chgrp.1 chmod.1 chown.1 chroot.1 cksum.1 comm.1 \
23   cp.1 csplit.1 cut.1 date.1 dd.1 df.1 dir.1 dircolors.1 dirname.1 du.1 \
24   echo.1 env.1 expand.1 expr.1 factor.1 false.1 fmt.1 fold.1 groups.1 \
25   head.1 hostid.1 hostname.1 id.1 install.1 join.1 kill.1 \
26   link.1 ln.1 logname.1 \
27   ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nice.1 nl.1 nohup.1 od.1 \
28   paste.1 pathchk.1 pinky.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
29   rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
30   shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 stty.1 \
31   su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
32   tty.1 uname.1 unexpand.1 uniq.1 unlink.1 uptime.1 users.1 vdir.1 wc.1 \
33   who.1 whoami.1 yes.1
34
35 man_aux = $(dist_man_MANS:.1=.x)
36
37 EXTRA_DIST = $(man_aux) help2man
38 MAINTAINERCLEANFILES = $(man_MANS)
39
40 # Depend on configure.ac to get version number changes.
41 common_dep = $(top_srcdir)/configure.ac
42
43 base64.1:       $(common_dep)   $(srcdir)/base64.x      ../src/base64.c
44 basename.1:     $(common_dep)   $(srcdir)/basename.x    ../src/basename.c
45 cat.1:          $(common_dep)   $(srcdir)/cat.x         ../src/cat.c
46 chgrp.1:        $(common_dep)   $(srcdir)/chgrp.x       ../src/chgrp.c
47 chmod.1:        $(common_dep)   $(srcdir)/chmod.x       ../src/chmod.c
48 chown.1:        $(common_dep)   $(srcdir)/chown.x       ../src/chown.c
49 chroot.1:       $(common_dep)   $(srcdir)/chroot.x      ../src/chroot.c
50 cksum.1:        $(common_dep)   $(srcdir)/cksum.x       ../src/cksum.c
51 comm.1:         $(common_dep)   $(srcdir)/comm.x        ../src/comm.c
52 cp.1:           $(common_dep)   $(srcdir)/cp.x          ../src/cp.c
53 csplit.1:       $(common_dep)   $(srcdir)/csplit.x      ../src/csplit.c
54 cut.1:          $(common_dep)   $(srcdir)/cut.x         ../src/cut.c
55 date.1:         $(common_dep)   $(srcdir)/date.x        ../src/date.c
56 dd.1:           $(common_dep)   $(srcdir)/dd.x          ../src/dd.c
57 df.1:           $(common_dep)   $(srcdir)/df.x          ../src/df.c
58
59 # Note that dir depends on ls.c, since that's where it's --help text is.
60 dir.1:          $(common_dep)   $(srcdir)/dir.x         ../src/ls.c
61
62 dircolors.1:    $(common_dep)   $(srcdir)/dircolors.x   ../src/dircolors.c
63 dirname.1:      $(common_dep)   $(srcdir)/dirname.x     ../src/dirname.c
64 du.1:           $(common_dep)   $(srcdir)/du.x          ../src/du.c
65 echo.1:         $(common_dep)   $(srcdir)/echo.x        ../src/echo.c
66 env.1:          $(common_dep)   $(srcdir)/env.x         ../src/env.c
67 expand.1:       $(common_dep)   $(srcdir)/expand.x      ../src/expand.c
68 expr.1:         $(common_dep)   $(srcdir)/expr.x        ../src/expr.c
69 factor.1:       $(common_dep)   $(srcdir)/factor.x      ../src/factor.c
70 false.1:        $(common_dep)   $(srcdir)/false.x       ../src/false.c
71 fmt.1:          $(common_dep)   $(srcdir)/fmt.x         ../src/fmt.c
72 fold.1:         $(common_dep)   $(srcdir)/fold.x        ../src/fold.c
73 groups.1:       $(common_dep)   $(srcdir)/groups.x      ../src/groups.sh
74 head.1:         $(common_dep)   $(srcdir)/head.x        ../src/head.c
75 hostid.1:       $(common_dep)   $(srcdir)/hostid.x      ../src/hostid.c
76 hostname.1:     $(common_dep)   $(srcdir)/hostname.x    ../src/hostname.c
77 id.1:           $(common_dep)   $(srcdir)/id.x          ../src/id.c
78 install.1:      $(common_dep)   $(srcdir)/install.x     ../src/install.c
79 join.1:         $(common_dep)   $(srcdir)/join.x        ../src/join.c
80 kill.1:         $(common_dep)   $(srcdir)/kill.x        ../src/kill.c
81 link.1:         $(common_dep)   $(srcdir)/link.x        ../src/link.c
82 ln.1:           $(common_dep)   $(srcdir)/ln.x          ../src/ln.c
83 logname.1:      $(common_dep)   $(srcdir)/logname.x     ../src/logname.c
84 ls.1:           $(common_dep)   $(srcdir)/ls.x          ../src/ls.c
85 md5sum.1:       $(common_dep)   $(srcdir)/md5sum.x      ../src/md5sum.c
86 mkdir.1:        $(common_dep)   $(srcdir)/mkdir.x       ../src/mkdir.c
87 mkfifo.1:       $(common_dep)   $(srcdir)/mkfifo.x      ../src/mkfifo.c
88 mknod.1:        $(common_dep)   $(srcdir)/mknod.x       ../src/mknod.c
89 mv.1:           $(common_dep)   $(srcdir)/mv.x          ../src/mv.c
90 nice.1:         $(common_dep)   $(srcdir)/nice.x        ../src/nice.c
91 nl.1:           $(common_dep)   $(srcdir)/nl.x          ../src/nl.c
92 nohup.1:        $(common_dep)   $(srcdir)/nohup.x       ../src/nohup.c
93 od.1:           $(common_dep)   $(srcdir)/od.x          ../src/od.c
94 paste.1:        $(common_dep)   $(srcdir)/paste.x       ../src/paste.c
95 pathchk.1:      $(common_dep)   $(srcdir)/pathchk.x     ../src/pathchk.c
96 pinky.1:        $(common_dep)   $(srcdir)/pinky.x       ../src/pinky.c
97 pr.1:           $(common_dep)   $(srcdir)/pr.x          ../src/pr.c
98 printenv.1:     $(common_dep)   $(srcdir)/printenv.x    ../src/printenv.c
99 printf.1:       $(common_dep)   $(srcdir)/printf.x      ../src/printf.c
100 ptx.1:          $(common_dep)   $(srcdir)/ptx.x         ../src/ptx.c
101 pwd.1:          $(common_dep)   $(srcdir)/pwd.x         ../src/pwd.c
102 readlink.1:     $(common_dep)   $(srcdir)/readlink.x    ../src/readlink.c
103 rm.1:           $(common_dep)   $(srcdir)/rm.x          ../src/rm.c
104 rmdir.1:        $(common_dep)   $(srcdir)/rmdir.x       ../src/rmdir.c
105 seq.1:          $(common_dep)   $(srcdir)/seq.x         ../src/seq.c
106 sha1sum.1:      $(common_dep)   $(srcdir)/sha1sum.x     ../src/md5sum.c
107 sha224sum.1:    $(common_dep)   $(srcdir)/sha224sum.x   ../src/md5sum.c
108 sha256sum.1:    $(common_dep)   $(srcdir)/sha256sum.x   ../src/md5sum.c
109 sha384sum.1:    $(common_dep)   $(srcdir)/sha384sum.x   ../src/md5sum.c
110 sha512sum.1:    $(common_dep)   $(srcdir)/sha512sum.x   ../src/md5sum.c
111 shred.1:        $(common_dep)   $(srcdir)/shred.x       ../src/shred.c
112 shuf.1:         $(common_dep)   $(srcdir)/shuf.x        ../src/shuf.c
113 sleep.1:        $(common_dep)   $(srcdir)/sleep.x       ../src/sleep.c
114 sort.1:         $(common_dep)   $(srcdir)/sort.x        ../src/sort.c
115 split.1:        $(common_dep)   $(srcdir)/split.x       ../src/split.c
116 stat.1:         $(common_dep)   $(srcdir)/stat.x        ../src/stat.c
117 stty.1:         $(common_dep)   $(srcdir)/stty.x        ../src/stty.c
118 su.1:           $(common_dep)   $(srcdir)/su.x          ../src/su.c
119 sum.1:          $(common_dep)   $(srcdir)/sum.x         ../src/sum.c
120 sync.1:         $(common_dep)   $(srcdir)/sync.x        ../src/sync.c
121 tac.1:          $(common_dep)   $(srcdir)/tac.x         ../src/tac.c
122 tail.1:         $(common_dep)   $(srcdir)/tail.x        ../src/tail.c
123 tee.1:          $(common_dep)   $(srcdir)/tee.x         ../src/tee.c
124 test.1:         $(common_dep)   $(srcdir)/test.x        ../src/test.c
125 touch.1:        $(common_dep)   $(srcdir)/touch.x       ../src/touch.c
126 tr.1:           $(common_dep)   $(srcdir)/tr.x          ../src/tr.c
127 true.1:         $(common_dep)   $(srcdir)/true.x        ../src/true.c
128 tsort.1:        $(common_dep)   $(srcdir)/tsort.x       ../src/tsort.c
129 tty.1:          $(common_dep)   $(srcdir)/tty.x         ../src/tty.c
130 uname.1:        $(common_dep)   $(srcdir)/uname.x       ../src/uname.c
131 unexpand.1:     $(common_dep)   $(srcdir)/unexpand.x    ../src/unexpand.c
132 uniq.1:         $(common_dep)   $(srcdir)/uniq.x        ../src/uniq.c
133 unlink.1:       $(common_dep)   $(srcdir)/unlink.x      ../src/unlink.c
134 uptime.1:       $(common_dep)   $(srcdir)/uptime.x      ../src/uptime.c
135 users.1:        $(common_dep)   $(srcdir)/users.x       ../src/users.c
136 vdir.1:         $(common_dep)   $(srcdir)/vdir.x        ../src/ls.c
137 wc.1:           $(common_dep)   $(srcdir)/wc.x          ../src/wc.c
138 who.1:          $(common_dep)   $(srcdir)/who.x         ../src/who.c
139 whoami.1:       $(common_dep)   $(srcdir)/whoami.x      ../src/whoami.c
140 yes.1:          $(common_dep)   $(srcdir)/yes.x         ../src/yes.c
141
142 SUFFIXES = .x .1
143
144 # Ensure that help2man runs the ../src/ginstall binary as
145 # `install' when creating install.1.
146 # Similarly, ensure that it uses the ../src/[ binary to create test.1.
147 t = $*.td
148 mapped_name = `echo $*|sed 's/install/ginstall/; s/test/[/'`
149
150 # Note the use of $t/$*, rather than just `$*' as in other packages.
151 # That is necessary to avoid failures for programs that are also shell built-in
152 # functions like echo, false, printf, pwd.
153 .x.1:
154         @rm -f $@
155         @echo "Updating man page $@";           \
156         rm -rf $t;                              \
157         mkdir $t;                               \
158         (cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
159         $(PERL) -- $(srcdir)/help2man           \
160             --include=$(srcdir)/$*.x            \
161             --output=$t/$@ $t/$*
162         @sed 's|$*\.td/||g' $t/$@ > $@
163         @chmod a-w $@
164         @rm -rf $t
165
166 check-local: check-x-vs-1 check-programs-vs-x
167
168 # Sort in traditional ASCII order, regardless of the current locale;
169 # otherwise we may get into trouble with distinct strings that the
170 # current locale considers to be equal.
171 ASSORT = LC_ALL=C sort
172
173 # Ensure that for each .x file in this directory, there is a
174 # corresponding .1 file in the definition of $(dist_man_MANS) above.
175 .PHONY: check-x-vs-1
176 check-x-vs-1:
177         PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH;                \
178         t=ls-files.$$$$;                                                \
179         (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\
180         echo $(dist_man_MANS) | tr -s ' ' '\n' | sed 's/\.1$$//'        \
181           | $(ASSORT) | diff - $$t || { rm $$t; exit 1; };              \
182         rm $$t
183
184 all_programs =                                                          \
185       (cd ../src && MAKEFLAGS= $(MAKE) -s all_programs.list)            \
186        | grep -v '\['
187
188 .PHONY: check-programs-vs-x
189 check-programs-vs-x:
190         status=0;                                       \
191         for p in dummy `$(all_programs)`; do            \
192           test $$p = dummy && continue;                 \
193           test $$p = ginstall && p=install || : ;       \
194           test -f $(srcdir)/$$p.x                       \
195             || { echo missing $$p.x 1>&2; status=1; };  \
196         done;                                           \
197         exit $$status