Eric Bavier <ericbav...@openmailbox.org> writes: >>> 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.
Oh, I overlooked that. So the ‘make-go.stamp’ is for Delaying help2man when building from Git, and the ‘case’ is for rebuilding the man pages only when the corresponding ‘.scm’ script file has changed. That's smart and seems to fix the problem perfectly. OTOH I must admit that for maintainability reasons I would prefer avoiding complexity in Makefiles as much as possible. This means using Automake's abstract concepts as much as possible, having a simple dependency graph on top of that, and put things that don't fit well in this scheme in individual "build-aux/" scripts. For that reason I still prefer the embed help2man solution. but otherwise it looks nice. :) Thanks. -- Mathieu Lirzin