summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-09-09 19:27:25 +0200
committerJim Meyering <meyering@redhat.com>2012-09-10 09:32:50 +0200
commit57da212a95054cc230ffb00f38ea655c798926f8 (patch)
treee8d689d860f0fbc1197ae7654ffb87c5db895f3f /Makefile.am
parente571cfd9c7f035886182100b7a5e27ad7d48f1ca (diff)
downloadcoreutils-57da212a95054cc230ffb00f38ea655c798926f8.tar.xz
build: do not require help2man at build-from-tarball time
But do retain full dependencies when building from a git clone. We do this by converting the full dependency (of the .1 file on the binary we run with --help) into a dependency on the .c file. * Makefile.am (do-not-require-help2man): New rule. (dist-hook): depend on it.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am20
1 files changed, 19 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 4999ca14d..384b9e937 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,11 +92,29 @@ BUILT_SOURCES = .version
.version:
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
+# In general, we run help2man to build a man page from the binary's --help
+# output, but when building from a just-unpacked distribution tarball, we
+# must not do that, since help2man uses perl. We don't want to depend on
+# perl in that case. In general, the .1 file does indeed depend on the
+# binary. I.e., for cat, we have this Makefile dependency:
+# man/cat.1: src/cat
+# That means that once we build src/cat, we would trigger the .x.1
+# rule which runs help2man. The trick is simply to change the RHS to
+# "src/cat.c" in the $(distdir) that we're about to tar and compress.
+# Also handle the three exceptions corresponding to the three binaries
+# for which there is no like-named .c file: dir, vdir, ginstall.
+.PHONY: do-not-require-help2man
+do-not-require-help2man:
+ perl -pi -e 's,^(man/.+?\.1:\s*src/.+?)$$,$$1.c,;' \
+ -e 's,^(man/.+?\.1:\s*src)/ginstall\.c$$,$$1/install.c,;' \
+ -e 's,^(man/.+?\.1:\s*src)/v?dir\.c$$,$$1/ls.c,;' \
+ $(distdir)/Makefile.in
+
# Arrange so that .tarball-version appears only in the distribution
# tarball, and never in a checked-out repository.
# The perl substitution is to change some key uses of "rm" to "/bin/rm".
# See the rm_subst comment for details.
-dist-hook: gen-ChangeLog
+dist-hook: gen-ChangeLog do-not-require-help2man
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
$(AM_V_at)perl -pi -e '$(rm_subst)' $(distdir)/Makefile.in