id: don't call getcon unnecessarily
[coreutils.git] / man / Makefile.am
blobd869f9bcedbe2ecc345727780fbb5d21e3d4a6a3
1 # Make coreutils man pages.                             -*-Makefile-*-
3 # Copyright (C) 2002-2012 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 realpath.1:     $(common_dep)   $(srcdir)/realpath.x    ../src/realpath.c
96 rm.1:           $(common_dep)   $(srcdir)/rm.x          ../src/rm.c
97 rmdir.1:        $(common_dep)   $(srcdir)/rmdir.x       ../src/rmdir.c
98 runcon.1:       $(common_dep)   $(srcdir)/runcon.x      ../src/runcon.c
99 seq.1:          $(common_dep)   $(srcdir)/seq.x         ../src/seq.c
100 sha1sum.1:      $(common_dep)   $(srcdir)/sha1sum.x     ../src/md5sum.c
101 sha224sum.1:    $(common_dep)   $(srcdir)/sha224sum.x   ../src/md5sum.c
102 sha256sum.1:    $(common_dep)   $(srcdir)/sha256sum.x   ../src/md5sum.c
103 sha384sum.1:    $(common_dep)   $(srcdir)/sha384sum.x   ../src/md5sum.c
104 sha512sum.1:    $(common_dep)   $(srcdir)/sha512sum.x   ../src/md5sum.c
105 shred.1:        $(common_dep)   $(srcdir)/shred.x       ../src/shred.c
106 shuf.1:         $(common_dep)   $(srcdir)/shuf.x        ../src/shuf.c
107 sleep.1:        $(common_dep)   $(srcdir)/sleep.x       ../src/sleep.c
108 sort.1:         $(common_dep)   $(srcdir)/sort.x        ../src/sort.c
109 split.1:        $(common_dep)   $(srcdir)/split.x       ../src/split.c
110 stat.1:         $(common_dep)   $(srcdir)/stat.x        ../src/stat.c
111 stdbuf.1:       $(common_dep)   $(srcdir)/stdbuf.x      ../src/stdbuf.c
112 stty.1:         $(common_dep)   $(srcdir)/stty.x        ../src/stty.c
113 su.1:           $(common_dep)   $(srcdir)/su.x          ../src/su.c
114 sum.1:          $(common_dep)   $(srcdir)/sum.x         ../src/sum.c
115 sync.1:         $(common_dep)   $(srcdir)/sync.x        ../src/sync.c
116 tac.1:          $(common_dep)   $(srcdir)/tac.x         ../src/tac.c
117 tail.1:         $(common_dep)   $(srcdir)/tail.x        ../src/tail.c
118 tee.1:          $(common_dep)   $(srcdir)/tee.x         ../src/tee.c
119 test.1:         $(common_dep)   $(srcdir)/test.x        ../src/test.c
120 timeout.1:      $(common_dep)   $(srcdir)/timeout.x     ../src/timeout.c
121 touch.1:        $(common_dep)   $(srcdir)/touch.x       ../src/touch.c
122 tr.1:           $(common_dep)   $(srcdir)/tr.x          ../src/tr.c
123 true.1:         $(common_dep)   $(srcdir)/true.x        ../src/true.c
124 truncate.1:     $(common_dep)   $(srcdir)/truncate.x    ../src/truncate.c
125 tsort.1:        $(common_dep)   $(srcdir)/tsort.x       ../src/tsort.c
126 tty.1:          $(common_dep)   $(srcdir)/tty.x         ../src/tty.c
127 uname.1:        $(common_dep)   $(srcdir)/uname.x       ../src/uname.c
128 unexpand.1:     $(common_dep)   $(srcdir)/unexpand.x    ../src/unexpand.c
129 uniq.1:         $(common_dep)   $(srcdir)/uniq.x        ../src/uniq.c
130 unlink.1:       $(common_dep)   $(srcdir)/unlink.x      ../src/unlink.c
131 uptime.1:       $(common_dep)   $(srcdir)/uptime.x      ../src/uptime.c
132 users.1:        $(common_dep)   $(srcdir)/users.x       ../src/users.c
133 vdir.1:         $(common_dep)   $(srcdir)/vdir.x        ../src/ls.c
134 wc.1:           $(common_dep)   $(srcdir)/wc.x          ../src/wc.c
135 who.1:          $(common_dep)   $(srcdir)/who.x         ../src/who.c
136 whoami.1:       $(common_dep)   $(srcdir)/whoami.x      ../src/whoami.c
137 yes.1:          $(common_dep)   $(srcdir)/yes.x         ../src/yes.c
139 # This is required so that changes to e.g., emit_bug_reporting_address
140 # provoke regeneration of all $(MAN) files.
141 $(MAN): $(top_srcdir)/src/system.h
143 SUFFIXES = .x .1
145 # Ensure that help2man runs the ../src/ginstall binary as
146 # 'install' when creating install.1.
147 # Similarly, ensure that it uses the ../src/[ binary to create test.1.
148 t = $*.td
149 mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
151 # Note the use of $t/$*, rather than just '$*' as in other packages.
152 # That is necessary to avoid failures for programs that are also shell built-in
153 # functions like echo, false, printf, pwd.
154 .x.1:
155         $(AM_V_GEN)case '$(PERL)' in                            \
156           *"/missing "*)                                        \
157             echo 'WARNING: cannot update man page $@ since perl is missing' \
158               'or inadequate' 1>&2                              \
159             ;;                                                  \
160           *)                                                    \
161             rm -f $@ $@-t                                       \
162             && {                                                \
163                  rm -rf $t;                                     \
164                  mkdir $t;                                      \
165                  (cd $t && $(LN_S) ../../src/$(mapped_name) $*); \
166                     $(PERL) -- $(srcdir)/help2man               \
167                      --source='$(PACKAGE_STRING)'               \
168                      --include=$(srcdir)/$*.x                   \
169                      --output=$t/$@ $t/$*;                      \
170                }                                                \
171             && sed 's|$*\.td/||g' $t/$@ > $@-t                  \
172             && rm -rf $t                                        \
173             && chmod -w $@-t                                    \
174             && mv $@-t $@                                       \
175             ;;                                                  \
176         esac
178 # Option descriptions should not start with a capital letter
179 .PHONY: sc_option_desc_uppercase
180 sc_option_desc_uppercase: $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT:%=%.1)
181         @grep '^\\fB\\-' -A1 *.1 | LC_ALL=C grep '\.1.[A-Z][a-z]' && \
182             { echo 1>&2 '$(ME): found initial capitals in --help';   \
183               exit 1; } || :;
185 .PHONY: sc_man_file_correlation
186 sc_man_file_correlation: check-x-vs-1 check-programs-vs-x
188 # Sort in traditional ASCII order, regardless of the current locale;
189 # otherwise we may get into trouble with distinct strings that the
190 # current locale considers to be equal.
191 ASSORT = LC_ALL=C sort
193 # Ensure that for each .x file in this directory, there is a
194 # corresponding .1 file in the definition of $(dist_man1_MANS) above.
195 # But since that expansion usually lacks programs like su and arch,
196 # add them here manually.
197 .PHONY: check-x-vs-1
198 check-x-vs-1:
199         @PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH;               \
200         t=$@-t;                                                         \
201         (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\
202         (echo $(dist_man1_MANS) $(NO_INSTALL_PROGS_DEFAULT)             \
203           | tr -s ' ' '\n' | sed 's/\.1$$//')                           \
204           | $(ASSORT) -u | diff - $$t || { rm $$t; exit 1; };           \
205         rm $$t
207 all_programs =                                                          \
208       (cd ../src && MAKEFLAGS= $(MAKE) -s all_programs.list)            \
209        | grep -v '\['
211 .PHONY: check-programs-vs-x
212 check-programs-vs-x:
213         @status=0;                                      \
214         for p in dummy `$(all_programs)`; do            \
215           test $$p = dummy && continue;                 \
216           test $$p = ginstall && p=install || : ;       \
217           test -f $(srcdir)/$$p.x                       \
218             || { echo missing $$p.x 1>&2; status=1; };  \
219         done;                                           \
220         exit $$status