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