aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Bavier <bavier@member.fsf.org>2016-01-27 20:31:04 -0600
committerMathieu Lirzin <mthl@gnu.org>2016-01-29 23:45:34 +0100
commit36629097523b0abd89d1b931293150cb9c1f242d (patch)
tree8eb5026fe26997e1d1b3b08a7d69128bd4c82b08
parent171a0a13a4350ac9bbed0f2ed8e9c9777cc57b22 (diff)
downloadguix-36629097523b0abd89d1b931293150cb9c1f242d.tar
guix-36629097523b0abd89d1b931293150cb9c1f242d.tar.gz
build: Generate man pages after compiling Guile objects.
This reduces compilation time since scripts are not compiled twice. When building with 'make -j4' from a clean repository on an Intel i5-2540M, compilation time gets from: real 4m48.708s user 17m29.892s sys 0m9.596s down to: real 2m23.399s user 6m48.604s sys 0m6.420s * doc.am (subcommand-manual-target): Delete function. (SUBCOMMANDS): Delete variable. (sub_command_mans, gen_man): New variables. (dist_man1_MANS): Add $(sub_commands_mans). (doc/guix-%.1): New target for sub-commands man pages. It ensures that man pages are built only after compiling Guile objects. (doc/guix-daemon.1): Use $(gen_man). Build only if BUILD_DAEMON. (doc/guix.1): Use $(gen_man). Add $(sub_command_mans) prerequisite. Co-authored-by: Mathieu Lirzin <mthl@gnu.org>
-rw-r--r--doc.am93
1 files changed, 49 insertions, 44 deletions
diff --git a/doc.am b/doc.am
index 05b42cd860..e542161878 100644
--- a/doc.am
+++ b/doc.am
@@ -1,7 +1,9 @@
# GNU Guix --- Functional package management for GNU
+# Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
# Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2013 Andreas Enge <andreas@enge.fr>
# Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
+# Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -91,55 +93,58 @@ ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
$(top_srcdir)/doc/images/coreutils-size-map.eps
dvi-local: ps-local
-
-# Manual pages.
-
-doc/guix.1: $(SUBCOMMANDS:%=guix/scripts/%.scm)
- -$(AM_V_HELP2MAN)LANGUAGE= $(top_builddir)/pre-inst-env \
- $(HELP2MAN) --output="$@" guix
-
-# Note: Do not depend on 'guix-daemon' since that would trigger a rebuild even
-# for people building from a tarball.
-doc/guix-daemon.1: nix/nix-daemon/guix-daemon.cc
- -$(AM_V_HELP2MAN)LANGUAGE= $(top_builddir)/pre-inst-env \
- $(HELP2MAN) --output="$@" guix-daemon
-
-define subcommand-manual-target
-
-doc/guix-$(1).1: guix/scripts/$(1).scm
- -$$(AM_V_HELP2MAN)LANGUAGE= $(top_builddir)/pre-inst-env \
- $(HELP2MAN) --output="$$@" "guix $(1)"
-
-endef
-
-SUBCOMMANDS := \
- archive \
- build \
- challenge \
- download \
- edit \
- environment \
- gc \
- hash \
- import \
- lint \
- package \
- publish \
- pull \
- refresh \
- size \
- system
-
-$(eval $(foreach subcommand,$(SUBCOMMANDS), \
- $(call subcommand-manual-target,$(subcommand))))
+## ----------- ##
+## Man pages. ##
+## ----------- ##
+
+sub_commands_mans = \
+ doc/guix-archive.1 \
+ doc/guix-build.1 \
+ doc/guix-challenge.1 \
+ doc/guix-download.1 \
+ doc/guix-edit.1 \
+ doc/guix-environment.1 \
+ doc/guix-gc.1 \
+ doc/guix-hash.1 \
+ doc/guix-import.1 \
+ doc/guix-lint.1 \
+ doc/guix-package.1 \
+ doc/guix-publish.1 \
+ doc/guix-pull.1 \
+ doc/guix-refresh.1 \
+ doc/guix-size.1 \
+ doc/guix-system.1
dist_man1_MANS = \
doc/guix.1 \
- $(SUBCOMMANDS:%=doc/guix-%.1)
+ $(sub_commands_mans)
+
+# Man pages are generated using GNU help2man.
+gen_man = LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN)
+
+# Note: Do not depend on 'scripts/guix' since that would trigger a rebuild
+# even for people building from a tarball.
+doc/guix.1: $(sub_commands_mans)
+ -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
+
+# Note: The dependency on $(GOBJECTS) is meant to force these docs to be made
+# only after all Guile modules have been compiled. The 'case' ensures the man
+# pages are only generated if the corresponding script source has been
+# changed.
+doc/guix-%.1: guix/scripts/%.scm $(GOBJECTS)
+ -@case '$?' in \
+ *$<*) $(AM_V_P) && set -x || echo " HELP2MAN $@"; \
+ $(gen_man) --output="$@" "guix $*";; \
+ *) : ;; \
+ esac
if BUILD_DAEMON
-dist_man1_MANS += \
- doc/guix-daemon.1
+dist_man1_MANS += doc/guix-daemon.1
+
+# Note: Do not depend on 'guix-daemon' since that would trigger a rebuild even
+# for people building from a tarball.
+doc/guix-daemon.1: nix/nix-daemon/guix-daemon.cc
+ -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
endif