From 038645a3d14cd10fdb37f94703e463d8f7a3241a Mon Sep 17 00:00:00 2001 From: Eric Bavier 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/Makefile.am b/Makefile.am index 1ede6d4..f97a2a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -368,15 +368,21 @@ CLEANFILES = \ # user ran 'make install' recently). When that happens, we end up loading # those previously-installed .go files, which may be stale, thereby breaking # the whole thing. -%.go: make-go ; @: -make-go: $(MODULES) guix/config.scm guix/tests.scm +%.go: make-go.stamp ; @: +make-go.stamp: $(MODULES) guix/config.scm guix/tests.scm $(AM_V_at)echo "Compiling Scheme modules..." ; \ unset GUILE_LOAD_COMPILED_PATH ; \ host=$(host) srcdir="$(top_srcdir)" \ $(top_builddir)/pre-inst-env \ $(GUILE) -L "$(top_builddir)" -L "$(top_srcdir)" \ --no-auto-compile \ - -s "$(top_srcdir)"/build-aux/compile-all.scm $^ + -s "$(top_srcdir)"/build-aux/compile-all.scm $^; \ + status=$$?; \ + case $$status in \ + 77) : ;; \ + 0) touch $@ ;; \ + *) exit $$status ;; \ + esac SUFFIXES = .go diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm index e0877db..c8ccbd1 100644 --- a/build-aux/compile-all.scm +++ b/build-aux/compile-all.scm @@ -75,6 +75,7 @@ (match (command-line) ((_ . files) (let ((files (filter file-needs-compilation? files))) + (when (null? files) (primitive-exit 77)) ;skip (for-each load-module-file files) (let ((mutex (make-mutex))) (par-for-each (lambda (file) 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 endef -- 2.5.0