On 2016-01-28 09:44, Mathieu Lirzin wrote:
Hi Eric,
Eric Bavier <ericbav...@openmailbox.org> writes:
Here's my rough first take at this. It uses the status 77 convention
to update a sentinel file and selectively run help2man.
I realize the silent rule output isn't yet polished.
I have pushed the reviewed patches. So now it is polished. :)
From 038645a3d14cd10fdb37f94703e463d8f7a3241a Mon Sep 17 00:00:00 2001
From: Eric Bavier <bav...@member.fsf.org>
Date: Wed, 27 Jan 2016 20:31:04 -0600
Subject: [PATCH] doc: Generate manpages after .go are compiled.
* build-aux/compile-all.scm: Exit 77 if no files to compile.
* Makefile.am (make-go): Rename target to make-go.stamp. Update if
any
files were successfully compiled.
* doc.am (subcommand-manual-target): Add dependency on make-go.stamp.
Run help2man only if script input is changed.
---
Makefile.am | 12 +++++++++---
build-aux/compile-all.scm | 1 +
doc.am | 15 ++++++++++++---
3 files changed, 22 insertions(+), 6 deletions(-)
[...]
diff --git a/doc.am b/doc.am
index f15efcc..b3996d1 100644
--- a/doc.am
+++ b/doc.am
@@ -106,9 +106,18 @@ doc/guix-daemon.1: nix/nix-daemon/guix-daemon.cc
define subcommand-manual-target
-doc/guix-$(1).1: guix/scripts/$(1).scm
- -LANGUAGE= $(top_builddir)/pre-inst-env \
- $(HELP2MAN) --output="$$@" "guix $(1)"
+# Note: The dependency on make-go.stamp is to force these docs to be
made only
+# after all guile modules have been compiled, so that they are not
compiled
+# during this rule. But we only want to actually generate the
manpages if the
+# corresponding script source has been changed.
+doc/guix-$(1).1: guix/scripts/$(1).scm make-go.stamp
+ -$(AM_V_at)case '$$?' in \
+ *$$<*) \
+ echo " GEN $$@"; \
+ LANGUAGE= $(top_builddir)/pre-inst-env \
+ $(HELP2MAN) --output="$$@" "guix $(1)" ;; \
+ *) : ;; \
+ esac
IIUC, there is a problem with adding ‘make-go.stamp’ as a prerequisite
here. Since building ‘.go’ files from the tarball will trigger the
rebuild of man pages.
That's what the case statement is for, it skips the invocation of
help2man if the script source was not among the dependents updated. A
'touch' could be run on $@ in that case, rather than just exiting, so
that the rule in not run repeatedly.
--
`~Eric