1# Make coreutils man pages. -*-Makefile-*- 2# This is included by the top-level Makefile.am. 3 4# Copyright (C) 2002-2023 Free Software 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 3 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, see <https://www.gnu.org/licenses/>. 18 19EXTRA_DIST += man/help2man man/dummy-man 20 21## Use the distributed man pages if cross compiling or lack perl 22if CROSS_COMPILING 23run_help2man = $(SHELL) $(srcdir)/man/dummy-man 24else 25## Graceful degradation for systems lacking perl. 26if HAVE_PERL 27if BOLD_MAN_REFS 28help2man_OPTS=--bold-refs 29endif 30run_help2man = $(PERL) -- $(srcdir)/man/help2man $(help2man_OPTS) 31else 32run_help2man = $(SHELL) $(srcdir)/man/dummy-man 33endif 34endif 35 36man1_MANS = @man1_MANS@ 37EXTRA_DIST += $(man1_MANS) $(man1_MANS:.1=.x) 38 39EXTRA_MANS = @EXTRA_MANS@ 40EXTRA_DIST += $(EXTRA_MANS) $(EXTRA_MANS:.1=.x) 41 42ALL_MANS = $(man1_MANS) $(EXTRA_MANS) 43 44MAINTAINERCLEANFILES += $(ALL_MANS) 45 46# This is a kludge to remove generated 'man/*.1' from a non-srcdir build. 47# Without this, "make distcheck" might fail. 48distclean-local: 49 test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS) 50 51# Dependencies common to all man pages. Updated below. 52mandeps = 53 54# Depend on this to get version number changes. 55mandeps += .version 56 57# This is required so that changes to e.g., emit_bug_reporting_address 58# provoke regeneration of all the manpages. 59mandeps += $(top_srcdir)/src/system.h 60 61$(ALL_MANS): $(mandeps) 62 63if SINGLE_BINARY 64mandeps += src/coreutils$(EXEEXT) 65else 66# Most prog.1 man pages depend on src/prog. List the exceptions: 67man/install.1: src/ginstall$(EXEEXT) 68man/test.1: src/[$(EXEEXT) 69 70man/arch.1: src/arch$(EXEEXT) 71man/b2sum.1: src/b2sum$(EXEEXT) 72man/base32.1: src/base32$(EXEEXT) 73man/base64.1: src/base64$(EXEEXT) 74man/basename.1: src/basename$(EXEEXT) 75man/basenc.1: src/basenc$(EXEEXT) 76man/cat.1: src/cat$(EXEEXT) 77man/chcon.1: src/chcon$(EXEEXT) 78man/chgrp.1: src/chgrp$(EXEEXT) 79man/chmod.1: src/chmod$(EXEEXT) 80man/chown.1: src/chown$(EXEEXT) 81man/chroot.1: src/chroot$(EXEEXT) 82man/cksum.1: src/cksum$(EXEEXT) 83man/comm.1: src/comm$(EXEEXT) 84man/coreutils.1: src/coreutils$(EXEEXT) 85man/cp.1: src/cp$(EXEEXT) 86man/csplit.1: src/csplit$(EXEEXT) 87man/cut.1: src/cut$(EXEEXT) 88man/date.1: src/date$(EXEEXT) 89man/dd.1: src/dd$(EXEEXT) 90man/df.1: src/df$(EXEEXT) 91man/dir.1: src/dir$(EXEEXT) 92man/dircolors.1: src/dircolors$(EXEEXT) 93man/dirname.1: src/dirname$(EXEEXT) 94man/du.1: src/du$(EXEEXT) 95man/echo.1: src/echo$(EXEEXT) 96man/env.1: src/env$(EXEEXT) 97man/expand.1: src/expand$(EXEEXT) 98man/expr.1: src/expr$(EXEEXT) 99man/factor.1: src/factor$(EXEEXT) 100man/false.1: src/false$(EXEEXT) 101man/fmt.1: src/fmt$(EXEEXT) 102man/fold.1: src/fold$(EXEEXT) 103man/groups.1: src/groups$(EXEEXT) 104man/head.1: src/head$(EXEEXT) 105man/hostid.1: src/hostid$(EXEEXT) 106man/hostname.1: src/hostname$(EXEEXT) 107man/id.1: src/id$(EXEEXT) 108man/join.1: src/join$(EXEEXT) 109man/kill.1: src/kill$(EXEEXT) 110man/link.1: src/link$(EXEEXT) 111man/ln.1: src/ln$(EXEEXT) 112man/logname.1: src/logname$(EXEEXT) 113man/ls.1: src/ls$(EXEEXT) 114man/md5sum.1: src/md5sum$(EXEEXT) 115man/mkdir.1: src/mkdir$(EXEEXT) 116man/mkfifo.1: src/mkfifo$(EXEEXT) 117man/mknod.1: src/mknod$(EXEEXT) 118man/mktemp.1: src/mktemp$(EXEEXT) 119man/mv.1: src/mv$(EXEEXT) 120man/nice.1: src/nice$(EXEEXT) 121man/nl.1: src/nl$(EXEEXT) 122man/nohup.1: src/nohup$(EXEEXT) 123man/nproc.1: src/nproc$(EXEEXT) 124man/numfmt.1: src/numfmt$(EXEEXT) 125man/od.1: src/od$(EXEEXT) 126man/paste.1: src/paste$(EXEEXT) 127man/pathchk.1: src/pathchk$(EXEEXT) 128man/pinky.1: src/pinky$(EXEEXT) 129man/pr.1: src/pr$(EXEEXT) 130man/printenv.1: src/printenv$(EXEEXT) 131man/printf.1: src/printf$(EXEEXT) 132man/ptx.1: src/ptx$(EXEEXT) 133man/pwd.1: src/pwd$(EXEEXT) 134man/readlink.1: src/readlink$(EXEEXT) 135man/realpath.1: src/realpath$(EXEEXT) 136man/rm.1: src/rm$(EXEEXT) 137man/rmdir.1: src/rmdir$(EXEEXT) 138man/runcon.1: src/runcon$(EXEEXT) 139man/seq.1: src/seq$(EXEEXT) 140man/sha1sum.1: src/sha1sum$(EXEEXT) 141man/sha224sum.1: src/sha224sum$(EXEEXT) 142man/sha256sum.1: src/sha256sum$(EXEEXT) 143man/sha384sum.1: src/sha384sum$(EXEEXT) 144man/sha512sum.1: src/sha512sum$(EXEEXT) 145man/shred.1: src/shred$(EXEEXT) 146man/shuf.1: src/shuf$(EXEEXT) 147man/sleep.1: src/sleep$(EXEEXT) 148man/sort.1: src/sort$(EXEEXT) 149man/split.1: src/split$(EXEEXT) 150man/stat.1: src/stat$(EXEEXT) 151man/stdbuf.1: src/stdbuf$(EXEEXT) 152man/stty.1: src/stty$(EXEEXT) 153man/sum.1: src/sum$(EXEEXT) 154man/sync.1: src/sync$(EXEEXT) 155man/tac.1: src/tac$(EXEEXT) 156man/tail.1: src/tail$(EXEEXT) 157man/tee.1: src/tee$(EXEEXT) 158man/timeout.1: src/timeout$(EXEEXT) 159man/touch.1: src/touch$(EXEEXT) 160man/tr.1: src/tr$(EXEEXT) 161man/true.1: src/true$(EXEEXT) 162man/truncate.1: src/truncate$(EXEEXT) 163man/tsort.1: src/tsort$(EXEEXT) 164man/tty.1: src/tty$(EXEEXT) 165man/uname.1: src/uname$(EXEEXT) 166man/unexpand.1: src/unexpand$(EXEEXT) 167man/uniq.1: src/uniq$(EXEEXT) 168man/unlink.1: src/unlink$(EXEEXT) 169man/uptime.1: src/uptime$(EXEEXT) 170man/users.1: src/users$(EXEEXT) 171man/vdir.1: src/vdir$(EXEEXT) 172man/wc.1: src/wc$(EXEEXT) 173man/who.1: src/who$(EXEEXT) 174man/whoami.1: src/whoami$(EXEEXT) 175man/yes.1: src/yes$(EXEEXT) 176endif 177 178.x.1: 179 $(AM_V_GEN)name=`echo $@ | sed 's|.*/||; s|\.1$$||'` || exit 1; \ 180## Ensure that help2man runs the 'src/ginstall' binary as 'install' when 181## creating 'install.1'. Similarly, ensure that it uses the 'src/[' binary 182## to create 'test.1'. 183 case $$name in \ 184 install) prog='ginstall'; argv=$$name;; \ 185 test) prog='['; argv='[';; \ 186 *) prog=$$name; argv=$$prog;; \ 187 esac; \ 188## Note the use of $$t/$*, rather than just '$*' as in other packages. 189## That is necessary to avoid failures for programs that are also shell 190## built-in functions like echo, false, printf, pwd. 191 rm -f $@-t \ 192 && t=$*.td \ 193 && rm -rf $$t \ 194 && $(MKDIR_P) $$t \ 195 && (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog$(EXEEXT) \ 196 $$argv$(EXEEXT)) \ 197 && : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \ 198 && : $${TZ=UTC0} && export TZ \ 199 && export SOURCE_DATE_EPOCH && $(run_help2man) \ 200 --source='$(PACKAGE_STRING)' \ 201 --include=$(srcdir)/man/$$name.x \ 202 --output=$$t/$$name.1 \ 203 --info-page='\(aq(coreutils) '$$name' invocation\(aq' \ 204 $$t/$$argv$(EXEEXT) \ 205 && sed \ 206 -e 's|$*\.td/||g' \ 207 -e '/For complete documentation/d' \ 208 $$t/$$name.1 > $@-t \ 209 && rm -rf $$t \ 210 && chmod a-w $@-t \ 211 && rm -f $@ && mv $@-t $@ 212