all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mathieu Lirzin <mthl@gnu.org>
To: Eric Bavier <ericbavier@openmailbox.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 06/13] build: Generate man pages after compiling guile objects.
Date: Fri, 29 Jan 2016 17:17:13 +0100	[thread overview]
Message-ID: <87y4b8nywm.fsf@gnu.org> (raw)
In-Reply-To: <20160128182733.5291643b@openmailbox.org> (Eric Bavier's message of "Thu, 28 Jan 2016 18:27:33 -0600")

[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]

Eric Bavier <ericbavier@openmailbox.org> writes:

> On Thu, 28 Jan 2016 18:00:35 +0100
> Mathieu Lirzin <mthl@gnu.org> wrote:
>
>> 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.  :)
>
> I sympathize with the concerns for maintainability.  In this case, it
> seems to me that a few lines of make/shell would be preferable to 20k
> lines of perl.  Perhaps the simpler attached patch is better?

A few lines of Make/Shell seems more maintainable than a full perl
program.  But in this case the maintenance is handled upstream, so it
only consists in updating the script periodically (which is still not
ideal).

Your patch is definitely better now since the hack is localized to a
specific target.  Let's use this solution!  I have attached an updated
version which simplifies how silent rules are handled and integrates
changes from my initial patch.  


[-- Attachment #2: 0001-build-Generate-man-pages-after-compiling-Guile-objec.patch --]
[-- Type: text/x-diff, Size: 4744 bytes --]

From ab46507a6c2ddcfb3113ed31b1d38bc96c2f1679 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Wed, 27 Jan 2016 20:31:04 -0600
Subject: [PATCH] build: Generate man pages after compiling Guile objects.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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	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>
---
 doc.am | 91 ++++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 47 insertions(+), 44 deletions(-)

diff --git a/doc.am b/doc.am
index ad59aa5..d1fd096 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,56 @@ ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps)		\
 	  $(top_srcdir)/doc/images/coreutils-size-map.eps
 dvi-local: ps-local
 
-\f
-# 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 to force these docs to be made only
+# after all guile modules have been compiled.  The 'case' ensures the manpages
+# are only generated if the corresponding script source has been changed.
+doc/guix-%.1: guix/scripts/%.scm $(GOBJECTS)
+	-$(AM_V_HELP2MAN)case '$?' in \
+	  *$<*) $(gen_man) --output="$@" "guix `basename "$<" .scm`";; \
+	  *)    : ;; \
+	esac
 
 if BUILD_DAEMON
 
-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`
+
+dist_man1_MANS += doc/guix-daemon.1
 
 endif
-- 
2.6.3


[-- Attachment #3: Type: text/plain, Size: 122 bytes --]

Are you OK with it?

Thanks,

--
Mathieu Lirzin

ps: I was speaking of 20KB (790 lines of perl) not 20K lines of code.
:)

  reply	other threads:[~2016-01-29 16:17 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-24 20:19 [PATCH 00/13] New syntax 'package@version' and compilation improvements Mathieu Lirzin
2016-01-24 20:19 ` [PATCH 01/13] tests: Use 'dummy-origin' for lint tests when possible Mathieu Lirzin
2016-01-26 15:58   ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 02/13] lint: Remove an unneeded clause in 'check-patch-file-names' Mathieu Lirzin
2016-01-26 16:00   ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 03/13] lint: Rewrite 'check-patch-file-names' Mathieu Lirzin
2016-01-26 16:01   ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 04/13] utils: Use '@' for separating package names and version numbers Mathieu Lirzin
2016-01-25 11:37   ` Alex Kost
2016-01-25 20:56     ` Mathieu Lirzin
2016-01-26 16:22       ` Ludovic Courtès
2016-01-26 20:52         ` Mathieu Lirzin
2016-01-26 21:08           ` Ludovic Courtès
2016-02-19 20:49         ` Mathieu Lirzin
2016-02-23 11:11           ` Ludovic Courtès
2016-02-29  0:28             ` Mathieu Lirzin
2016-02-29 16:00               ` Ludovic Courtès
2016-03-02 21:35                 ` Mathieu Lirzin
2016-03-05  1:28                 ` Nils Gillmann
2016-03-05  9:24                   ` Alex Kost
2016-03-05  9:36                   ` Mathieu Lirzin
2016-03-03 10:29               ` Alex Kost
2016-03-03 16:55                 ` Ludovic Courtès
2016-03-04 10:19                   ` Alex Kost
2016-03-04 23:03                 ` Mathieu Lirzin
2016-03-04 23:25                   ` Ludovic Courtès
2016-03-05  1:08                     ` Mathieu Lirzin
2016-03-05  9:16                   ` Alex Kost
2016-01-25 14:04   ` Thompson, David
2016-01-25 21:41     ` Mathieu Lirzin
2016-01-25 23:33       ` Alex Kost
2016-01-26 17:57         ` Mathieu Lirzin
2016-01-24 20:19 ` [PATCH 05/13] packages: Use '@' in package record printers Mathieu Lirzin
2016-01-26 16:22   ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 06/13] build: Generate man pages after compiling guile objects Mathieu Lirzin
2016-01-26 16:52   ` Ludovic Courtès
2016-01-26 20:08     ` Mathieu Lirzin
2016-01-28  2:37       ` Eric Bavier
2016-01-28 15:44         ` Mathieu Lirzin
2016-01-28 15:59           ` Eric Bavier
2016-01-28 17:00             ` Mathieu Lirzin
2016-01-29  0:27               ` Eric Bavier
2016-01-29 16:17                 ` Mathieu Lirzin [this message]
2016-01-29 16:46                   ` Eric Bavier
2016-01-29 22:56                     ` Mathieu Lirzin
2016-01-31  9:17                       ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 07/13] build: Add 'DL' silent rule Mathieu Lirzin
2016-01-26 16:28   ` Ludovic Courtès
2016-01-26 17:44     ` Mathieu Lirzin
2016-01-26 19:22       ` Taylan Ulrich Bayırlı/Kammer
2016-01-26 21:06       ` Ludovic Courtès
2016-01-26 21:14         ` Mathieu Lirzin
2016-01-24 20:19 ` [PATCH 08/13] build: Add 'DOT' " Mathieu Lirzin
2016-01-26 16:28   ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 09/13] build: Add 'EMACS' " Mathieu Lirzin
2016-01-26 16:28   ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 10/13] build: Add 'HELP2MAN' " Mathieu Lirzin
2016-01-26 16:29   ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 11/13] build: Delete emacs/guix-autoloads.el when 'make clean' Mathieu Lirzin
2016-01-26 16:33   ` Ludovic Courtès
2016-01-26 22:55     ` Mathieu Lirzin
2016-01-24 20:19 ` [PATCH 12/13] build: Use 'GEN' and 'at' silent rules Mathieu Lirzin
2016-01-26 16:34   ` Ludovic Courtès
2016-01-24 20:19 ` [PATCH 13/13] Update .gitignore Mathieu Lirzin
2016-01-26 16:34   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4b8nywm.fsf@gnu.org \
    --to=mthl@gnu.org \
    --cc=ericbavier@openmailbox.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.