summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-08-18 15:46:02 -0400
committerZack Weinberg <zackw@panix.com>2020-08-18 16:32:33 -0400
commit5d3c99e56247d5a6496729931774cff08cf8dc0f (patch)
treefe4208c411b4767faf38ecc91bca249745eac2d3
parent924ba17398344659e2f238e8464323679598ad8d (diff)
downloadautoconf-5d3c99e56247d5a6496729931774cff08cf8dc0f.tar.gz
Generate manpages in build directory.
It is not necessary to generate the manpages in the source directory during a split build; ‘make dist’ can still find them in the build directory and put them in the tarball. Also add some defensive logic to the .x.1 rule to ensure that bin/command and tests/command exist before generating man/command.1. Without this, if you do a sufficiently parallel build, help2man may generate the manpage from an older installed copy of ‘command’. (Ideally, we wouldn’t have to run ‘command’ at all and this would not be an issue, but ‘help2man’ doesn’t appear to support that.) After this patch, the only files written to the source directory during the ‘make’ phase of a split build (starting from a clean Git checkout) are doc/version.texi doc/stamp-vti doc/autoconf.info doc/standards.info These are not under our control, they’re being created by automake’s built-in rules for Texinfo documentation. * man/local.mk: Replace all instances of $(mansrcdir) with literal ‘man’. (.x.1): Ensure that bin/command, tests/command, and the man directory exist before creating man/command.1.
-rw-r--r--man/local.mk41
1 files changed, 25 insertions, 16 deletions
diff --git a/man/local.mk b/man/local.mk
index 2416f393..05bf84a2 100644
--- a/man/local.mk
+++ b/man/local.mk
@@ -16,29 +16,34 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
binsrcdir = $(srcdir)/bin
-mansrcdir = $(srcdir)/man
dist_man_MANS = \
- $(mansrcdir)/autoconf.1 \
- $(mansrcdir)/autoheader.1 \
- $(mansrcdir)/autom4te.1 \
- $(mansrcdir)/autoreconf.1 \
- $(mansrcdir)/autoscan.1 \
- $(mansrcdir)/autoupdate.1 \
- $(mansrcdir)/ifnames.1
+ man/autoconf.1 \
+ man/autoheader.1 \
+ man/autom4te.1 \
+ man/autoreconf.1 \
+ man/autoscan.1 \
+ man/autoupdate.1 \
+ man/ifnames.1
EXTRA_DIST += $(dist_man_MANS:.1=.x) man/common.x
MAINTAINERCLEANFILES += $(dist_man_MANS)
# Depend on .version to get version number changes.
+# Don't depend on the generated scripts, because then we would try to
+# regenerate the manpages after building the scripts, which would
+# defeat the purpose of shipping the manpages in the tarball.
+# (Instead we have recursive makes in the .x.1 rule below, which is
+# not ideal, but at least it prevents us from generating a manpage
+# from the *installed* utility.)
common_dep = $(srcdir)/.version $(srcdir)/man/common.x
-$(mansrcdir)/autoconf.1: $(common_dep) $(binsrcdir)/autoconf.as
-$(mansrcdir)/autoheader.1: $(common_dep) $(binsrcdir)/autoheader.in
-$(mansrcdir)/autom4te.1: $(common_dep) $(binsrcdir)/autom4te.in
-$(mansrcdir)/autoreconf.1: $(common_dep) $(binsrcdir)/autoreconf.in
-$(mansrcdir)/autoscan.1: $(common_dep) $(binsrcdir)/autoscan.in
-$(mansrcdir)/autoupdate.1: $(common_dep) $(binsrcdir)/autoupdate.in
-$(mansrcdir)/ifnames.1: $(common_dep) $(binsrcdir)/ifnames.in
+man/autoconf.1: $(common_dep) $(binsrcdir)/autoconf.as
+man/autoheader.1: $(common_dep) $(binsrcdir)/autoheader.in
+man/autom4te.1: $(common_dep) $(binsrcdir)/autom4te.in
+man/autoreconf.1: $(common_dep) $(binsrcdir)/autoreconf.in
+man/autoscan.1: $(common_dep) $(binsrcdir)/autoscan.in
+man/autoupdate.1: $(common_dep) $(binsrcdir)/autoupdate.in
+man/ifnames.1: $(common_dep) $(binsrcdir)/ifnames.in
remove_time_stamp = 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
@@ -47,11 +52,15 @@ MOSTLYCLEANFILES += $(srcdir)/man/*.t
SUFFIXES += .x .1
.x.1:
+ @set -e; cmd=`basename $*`; \
+ test -x bin/$$cmd || $(MAKE) bin/$$cmd; \
+ test -x tests/$$cmd || $(MAKE) tests/$$cmd;
@echo "Updating man page $@"
+ @test -d $(@D) || mkdir $(@D)
PATH="./tests$(PATH_SEPARATOR)$(top_srcdir)/build-aux$(PATH_SEPARATOR)$$PATH"; \
export PATH; \
$(HELP2MAN) \
- --include=$*.x \
+ --include=$(srcdir)/$*.x \
--include=$(srcdir)/man/common.x \
--source='$(PACKAGE_STRING)' \
--output=$@.t `echo '$*' | sed 's,.*/,,'`