maint: append many lib/ and m4/ names to .gitignore
[coreutils/ericb.git] / man / Makefile.am
blob8733a359193c24e60905e5376fec55913b448c71
1 # Make coreutils man pages.                             -*-Makefile-*-
3 # Copyright (C) 2002-2011 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         $(NO_INSTALL_PROGS_DEFAULT:%=%.1)
24 MAINTAINERCLEANFILES = $(dist_man1_MANS)
26 # Depend on ../.version to get version number changes.
27 common_dep = ../.version
29 # Note that arch depends on uname.c
30 arch.1:         $(common_dep)   $(srcdir)/arch.x        ../src/uname.c
32 base64.1:       $(common_dep)   $(srcdir)/base64.x      ../src/base64.c
33 basename.1:     $(common_dep)   $(srcdir)/basename.x    ../src/basename.c
34 cat.1:          $(common_dep)   $(srcdir)/cat.x         ../src/cat.c
35 chcon.1:        $(common_dep)   $(srcdir)/chcon.x       ../src/chcon.c
36 chgrp.1:        $(common_dep)   $(srcdir)/chgrp.x       ../src/chgrp.c
37 chmod.1:        $(common_dep)   $(srcdir)/chmod.x       ../src/chmod.c
38 chown.1:        $(common_dep)   $(srcdir)/chown.x       ../src/chown.c
39 chroot.1:       $(common_dep)   $(srcdir)/chroot.x      ../src/chroot.c
40 cksum.1:        $(common_dep)   $(srcdir)/cksum.x       ../src/cksum.c
41 comm.1:         $(common_dep)   $(srcdir)/comm.x        ../src/comm.c
42 cp.1:           $(common_dep)   $(srcdir)/cp.x          ../src/cp.c
43 csplit.1:       $(common_dep)   $(srcdir)/csplit.x      ../src/csplit.c
44 cut.1:          $(common_dep)   $(srcdir)/cut.x         ../src/cut.c
45 date.1:         $(common_dep)   $(srcdir)/date.x        ../src/date.c
46 dd.1:           $(common_dep)   $(srcdir)/dd.x          ../src/dd.c
47 df.1:           $(common_dep)   $(srcdir)/df.x          ../src/df.c
49 # Note that dir depends on ls.c, since that's where it's --help text is.
50 dir.1:          $(common_dep)   $(srcdir)/dir.x         ../src/ls.c
52 dircolors.1:    $(common_dep)   $(srcdir)/dircolors.x   ../src/dircolors.c
53 dirname.1:      $(common_dep)   $(srcdir)/dirname.x     ../src/dirname.c
54 du.1:           $(common_dep)   $(srcdir)/du.x          ../src/du.c
55 echo.1:         $(common_dep)   $(srcdir)/echo.x        ../src/echo.c
56 env.1:          $(common_dep)   $(srcdir)/env.x         ../src/env.c
57 expand.1:       $(common_dep)   $(srcdir)/expand.x      ../src/expand.c
58 expr.1:         $(common_dep)   $(srcdir)/expr.x        ../src/expr.c
59 factor.1:       $(common_dep)   $(srcdir)/factor.x      ../src/factor.c
60 false.1:        $(common_dep)   $(srcdir)/false.x       ../src/false.c
61 fmt.1:          $(common_dep)   $(srcdir)/fmt.x         ../src/fmt.c
62 fold.1:         $(common_dep)   $(srcdir)/fold.x        ../src/fold.c
63 groups.1:       $(common_dep)   $(srcdir)/groups.x      ../src/groups.c
64 head.1:         $(common_dep)   $(srcdir)/head.x        ../src/head.c
65 hostid.1:       $(common_dep)   $(srcdir)/hostid.x      ../src/hostid.c
66 hostname.1:     $(common_dep)   $(srcdir)/hostname.x    ../src/hostname.c
67 id.1:           $(common_dep)   $(srcdir)/id.x          ../src/id.c
68 install.1:      $(common_dep)   $(srcdir)/install.x     ../src/install.c
69 join.1:         $(common_dep)   $(srcdir)/join.x        ../src/join.c
70 kill.1:         $(common_dep)   $(srcdir)/kill.x        ../src/kill.c
71 link.1:         $(common_dep)   $(srcdir)/link.x        ../src/link.c
72 ln.1:           $(common_dep)   $(srcdir)/ln.x          ../src/ln.c
73 logname.1:      $(common_dep)   $(srcdir)/logname.x     ../src/logname.c
74 ls.1:           $(common_dep)   $(srcdir)/ls.x          ../src/ls.c
75 md5sum.1:       $(common_dep)   $(srcdir)/md5sum.x      ../src/md5sum.c
76 mkdir.1:        $(common_dep)   $(srcdir)/mkdir.x       ../src/mkdir.c
77 mkfifo.1:       $(common_dep)   $(srcdir)/mkfifo.x      ../src/mkfifo.c
78 mknod.1:        $(common_dep)   $(srcdir)/mknod.x       ../src/mknod.c
79 mktemp.1:       $(common_dep)   $(srcdir)/mktemp.x      ../src/mktemp.c
80 mv.1:           $(common_dep)   $(srcdir)/mv.x          ../src/mv.c
81 nice.1:         $(common_dep)   $(srcdir)/nice.x        ../src/nice.c
82 nl.1:           $(common_dep)   $(srcdir)/nl.x          ../src/nl.c
83 nohup.1:        $(common_dep)   $(srcdir)/nohup.x       ../src/nohup.c
84 nproc.1:        $(common_dep)   $(srcdir)/nproc.x       ../src/nproc.c
85 od.1:           $(common_dep)   $(srcdir)/od.x          ../src/od.c
86 paste.1:        $(common_dep)   $(srcdir)/paste.x       ../src/paste.c
87 pathchk.1:      $(common_dep)   $(srcdir)/pathchk.x     ../src/pathchk.c
88 pinky.1:        $(common_dep)   $(srcdir)/pinky.x       ../src/pinky.c
89 pr.1:           $(common_dep)   $(srcdir)/pr.x          ../src/pr.c
90 printenv.1:     $(common_dep)   $(srcdir)/printenv.x    ../src/printenv.c
91 printf.1:       $(common_dep)   $(srcdir)/printf.x      ../src/printf.c
92 ptx.1:          $(common_dep)   $(srcdir)/ptx.x         ../src/ptx.c
93 pwd.1:          $(common_dep)   $(srcdir)/pwd.x         ../src/pwd.c
94 readlink.1:     $(common_dep)   $(srcdir)/readlink.x    ../src/readlink.c
95 rm.1:           $(common_dep)   $(srcdir)/rm.x          ../src/rm.c
96 rmdir.1:        $(common_dep)   $(srcdir)/rmdir.x       ../src/rmdir.c
97 runcon.1:       $(common_dep)   $(srcdir)/runcon.x      ../src/runcon.c
98 seq.1:          $(common_dep)   $(srcdir)/seq.x         ../src/seq.c
99 sha1sum.1:      $(common_dep)   $(srcdir)/sha1sum.x     ../src/md5sum.c
100 sha224sum.1:    $(common_dep)   $(srcdir)/sha224sum.x   ../src/md5sum.c
101 sha256sum.1:    $(common_dep)   $(srcdir)/sha256sum.x   ../src/md5sum.c
102 sha384sum.1:    $(common_dep)   $(srcdir)/sha384sum.x   ../src/md5sum.c
103 sha512sum.1:    $(common_dep)   $(srcdir)/sha512sum.x   ../src/md5sum.c
104 shred.1:        $(common_dep)   $(srcdir)/shred.x       ../src/shred.c
105 shuf.1:         $(common_dep)   $(srcdir)/shuf.x        ../src/shuf.c
106 sleep.1:        $(common_dep)   $(srcdir)/sleep.x       ../src/sleep.c
107 sort.1:         $(common_dep)   $(srcdir)/sort.x        ../src/sort.c
108 split.1:        $(common_dep)   $(srcdir)/split.x       ../src/split.c
109 stat.1:         $(common_dep)   $(srcdir)/stat.x        ../src/stat.c
110 stdbuf.1:       $(common_dep)   $(srcdir)/stdbuf.x      ../src/stdbuf.c
111 stty.1:         $(common_dep)   $(srcdir)/stty.x        ../src/stty.c
112 su.1:           $(common_dep)   $(srcdir)/su.x          ../src/su.c
113 sum.1:          $(common_dep)   $(srcdir)/sum.x         ../src/sum.c
114 sync.1:         $(common_dep)   $(srcdir)/sync.x        ../src/sync.c
115 tac.1:          $(common_dep)   $(srcdir)/tac.x         ../src/tac.c
116 tail.1:         $(common_dep)   $(srcdir)/tail.x        ../src/tail.c
117 tee.1:          $(common_dep)   $(srcdir)/tee.x         ../src/tee.c
118 test.1:         $(common_dep)   $(srcdir)/test.x        ../src/test.c
119 timeout.1:      $(common_dep)   $(srcdir)/timeout.x     ../src/timeout.c
120 touch.1:        $(common_dep)   $(srcdir)/touch.x       ../src/touch.c
121 tr.1:           $(common_dep)   $(srcdir)/tr.x          ../src/tr.c
122 true.1:         $(common_dep)   $(srcdir)/true.x        ../src/true.c
123 truncate.1:     $(common_dep)   $(srcdir)/truncate.x    ../src/truncate.c
124 tsort.1:        $(common_dep)   $(srcdir)/tsort.x       ../src/tsort.c
125 tty.1:          $(common_dep)   $(srcdir)/tty.x         ../src/tty.c
126 uname.1:        $(common_dep)   $(srcdir)/uname.x       ../src/uname.c
127 unexpand.1:     $(common_dep)   $(srcdir)/unexpand.x    ../src/unexpand.c
128 uniq.1:         $(common_dep)   $(srcdir)/uniq.x        ../src/uniq.c
129 unlink.1:       $(common_dep)   $(srcdir)/unlink.x      ../src/unlink.c
130 uptime.1:       $(common_dep)   $(srcdir)/uptime.x      ../src/uptime.c
131 users.1:        $(common_dep)   $(srcdir)/users.x       ../src/users.c
132 vdir.1:         $(common_dep)   $(srcdir)/vdir.x        ../src/ls.c
133 wc.1:           $(common_dep)   $(srcdir)/wc.x          ../src/wc.c
134 who.1:          $(common_dep)   $(srcdir)/who.x         ../src/who.c
135 whoami.1:       $(common_dep)   $(srcdir)/whoami.x      ../src/whoami.c
136 yes.1:          $(common_dep)   $(srcdir)/yes.x         ../src/yes.c
138 # This is required so that changes to e.g., emit_bug_reporting_address
139 # provoke regeneration of all $(MAN) files.
140 $(MAN): $(top_srcdir)/src/system.h
142 SUFFIXES = .x .1
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$$/[/'`
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         $(AM_V_GEN)case '$(PERL)' in                            \
155           *"/missing "*)                                        \
156             echo 'WARNING: cannot update man page $@ since perl is missing' \
157               'or inadequate' 1>&2                              \
158             ;;                                                  \
159           *)                                                    \
160             rm -f $@ $@-t                                       \
161             && {                                                \
162                  rm -rf $t;                                     \
163                  mkdir $t;                                      \
164                  (cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
165                     $(PERL) -- $(srcdir)/help2man               \
166                      --source='$(PACKAGE_STRING)'               \
167                      --include=$(srcdir)/$*.x                   \
168                      --output=$t/$@ $t/$*;                      \
169                }                                                \
170             && sed 's|$*\.td/||g' $t/$@ > $@-t                  \
171             && rm -rf $t                                        \
172             && chmod -w $@-t                                    \
173             && mv $@-t $@                                       \
174             ;;                                                  \
175         esac
177 # Option descriptions should not start with a capital letter
178 .PHONY: sc_option_desc_uppercase
179 sc_option_desc_uppercase: $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT:%=%.1)
180         @grep '^\\fB\\-' -A1 *.1 | LC_ALL=C grep '\.1.[A-Z][a-z]' && \
181             { echo 1>&2 '$(ME): found initial capitals in --help';   \
182               exit 1; } || :;
184 .PHONY: sc_man_file_correlation
185 sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
187 # Sort in traditional ASCII order, regardless of the current locale;
188 # otherwise we may get into trouble with distinct strings that the
189 # current locale considers to be equal.
190 ASSORT = LC_ALL=C sort
192 # Ensure that for each .x file in this directory, there is a
193 # corresponding .1 file in the definition of $(dist_man1_MANS) above.
194 # But since that expansion usually lacks programs like su and arch,
195 # add them here manually.
196 .PHONY: check-x-vs-1
197 check-x-vs-1:
198         @PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH;               \
199         t=$@-t;                                                         \
200         (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\
201         (echo $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT)             \
202           | tr -s ' ' '\n' | sed 's/\.1$$//')                           \
203           | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; };           \
204         rm $$t
206 all_programs =                                                          \
207       (cd ../src && MAKEFLAGS= $(MAKE) -s all_programs.list)            \
208        | grep -v '\['
210 .PHONY: check-programs-vs-x
211 check-programs-vs-x:
212         @status=0;                                      \
213         for p in dummy `$(all_programs)`; do            \
214           test $$p = dummy && continue;                 \
215           test $$p = ginstall && p=install || : ;       \
216           test -f $(srcdir)/$$p.x                       \
217             || { echo missing $$p.x 1>&2; status=1; };  \
218         done;                                           \
219         exit $$status