guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 06/13] build: Generate man pages after compiling guile objects.


From: Mathieu Lirzin
Subject: [PATCH 06/13] build: Generate man pages after compiling guile objects.
Date: Sun, 24 Jan 2016 21:19:24 +0100

This improves compilation speed since scripts are not compiled twice.
When building with ‘make -j4‘ from a clean repository on an Intel
i5-2540M, the time of compilation gets from:

real    5m7.220s
user    18m49.788s
sys     0m12.964s

down to:

real    2m20.820s
user    7m25.992s
sys     0m7.464s

* configure.ac (BUILD_FROM_GIT): New Automake conditional.
* doc.am (SUBCOMMANDS): Delete variable.
(dist_man1_MANS): List all subcommands man pages.
(doc/guix.1): Build only if BUILD_FROM_GIT.  Depend on 'scripts/guix'
instead of all subcommands.
[BUILD_DAEMON] (doc/guix-daemon): Likewise.  Replace the
'nix/nix-daemon/guix-daemon.cc' prerequisite with 'guix-daemon'.
[BUILD_FROM_GIT] (gen_man): New variable.
[BUILD_FROM_GIT] (doc/guix-%.1): New target.
(CLEANFILES) [BUILD_FROM_GIT]: Add $(dist_man1_MANS).
---
 configure.ac |  4 +++
 doc.am       | 90 +++++++++++++++++++++++++++++-------------------------------
 2 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/configure.ac b/configure.ac
index f61c04c..0bd9144 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,10 @@ AC_CACHE_SAVE
 
 m4_include([config-daemon.ac])
 
+dnl Are we building from git checked-out sources, or a tarball ?  This allows
+dnl specifying some rules used only when bootstrapping.
+AM_CONDITIONAL([BUILD_FROM_GIT], [test -d "$srcdir/.git"])
+
 dnl `dot' (from the Graphviz package) is only needed for maintainers.
 dnl See `Building from Git' in the manual for more info.
 AM_MISSING_PROG([DOT], [dot])
diff --git a/doc.am b/doc.am
index f15efcc..9214405 100644
--- a/doc.am
+++ b/doc.am
@@ -2,6 +2,7 @@
 # Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <address@hidden>
 # Copyright © 2013 Andreas Enge <address@hidden>
 # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <address@hidden>
+# Copyright © 2016 Mathieu Lirzin <address@hidden>
 #
 # This file is part of GNU Guix.
 #
@@ -91,55 +92,50 @@ 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)
-       -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
-       -LANGUAGE= $(top_builddir)/pre-inst-env \
-         $(HELP2MAN) --output="$@" guix-daemon
-
-define subcommand-manual-target
-
-doc/guix-$(1).1: guix/scripts/$(1).scm
-       -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))))
-
-dist_man1_MANS =                               \
-  doc/guix.1                                   \
-  $(SUBCOMMANDS:%=doc/guix-%.1)
+## ------------ ##
+##  Man pages.  ##
+## ------------ ##
+
+# The man pages are generated using 'help2man'.
+dist_man1_MANS =                       \
+  doc/guix.1                           \
+  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
 
 if BUILD_DAEMON
+dist_man1_MANS += doc/guix-daemon.1
+endif
+
+# Avoid re-generating the man pages when building from tarballs.
+if BUILD_FROM_GIT
+
+gen_man = LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN)
+
+doc/guix.1: scripts/guix
+         $(gen_man) --output="$@" `basename $<`
 
-dist_man1_MANS +=                              \
-  doc/guix-daemon.1
+doc/guix-%.1: guix/scripts/%.go
+         $(gen_man) --output="$@"  "guix `basename $< .go`"
 
+if BUILD_DAEMON
+doc/guix-daemon.1: guix-daemon
+         $(gen_man) --output="$@" "$<"
 endif
+
+CLEANFILES += $(dist_man1_MANS)
+
+endif BUILD_FROM_GIT

reply via email to

[Prev in Thread] Current Thread [Next in Thread]