From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Lirzin Subject: Re: [PATCH 06/13] build: Generate man pages after compiling guile objects. Date: Fri, 29 Jan 2016 17:17:13 +0100 Message-ID: <87y4b8nywm.fsf@gnu.org> References: <1453666771-16869-1-git-send-email-mthl@gnu.org> <1453666771-16869-7-git-send-email-mthl@gnu.org> <87d1somgfd.fsf@gnu.org> <87zivs2jej.fsf@gnu.org> <20160127203742.52245ef3@openmailbox.org> <87oac5k8sp.fsf@gnu.org> <7bfbfb841466c6889effbd21d089d616@openmailbox.org> <87k2mtk5ak.fsf@gnu.org> <20160128182733.5291643b@openmailbox.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPBjj-0000Fs-Am for guix-devel@gnu.org; Fri, 29 Jan 2016 11:17:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPBjh-0002Aw-SG for guix-devel@gnu.org; Fri, 29 Jan 2016 11:17:27 -0500 In-Reply-To: <20160128182733.5291643b@openmailbox.org> (Eric Bavier's message of "Thu, 28 Jan 2016 18:27:33 -0600") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Eric Bavier Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Eric Bavier writes: > On Thu, 28 Jan 2016 18:00:35 +0100 > Mathieu Lirzin 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. --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-build-Generate-man-pages-after-compiling-Guile-objec.patch Content-Transfer-Encoding: quoted-printable >From ab46507a6c2ddcfb3113ed31b1d38bc96c2f1679 Mon Sep 17 00:00:00 2001 From: Eric Bavier 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=3DUTF-8 Content-Transfer-Encoding: 8bit This improves compilation speed since scripts are not compiled twice. When building with =E2=80=98make -j4=E2=80=98 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 --- 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 =C2=A9 2016 Eric Bavier # Copyright =C2=A9 2012, 2013, 2014, 2015, 2016 Ludovic Court=C3=A8s # Copyright =C2=A9 2013 Andreas Enge # Copyright =C2=A9 2016 Taylan Ulrich Bay=C4=B1rl=C4=B1/Kammer +# Copyright =C2=A9 2016 Mathieu Lirzin # # This file is part of GNU Guix. # @@ -91,55 +93,56 @@ ps-local: $(DOT_FILES=3D%.dot=3D$(top_srcdir)/%.eps) \ $(top_srcdir)/doc/images/coreutils-size-map.eps dvi-local: ps-local =20 - -# Manual pages. - -doc/guix.1: $(SUBCOMMANDS:%=3Dguix/scripts/%.scm) - -$(AM_V_HELP2MAN)LANGUAGE=3D $(top_builddir)/pre-inst-env \ - $(HELP2MAN) --output=3D"$@" 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=3D $(top_builddir)/pre-inst-env \ - $(HELP2MAN) --output=3D"$@" guix-daemon - -define subcommand-manual-target - -doc/guix-$(1).1: guix/scripts/$(1).scm - -$$(AM_V_HELP2MAN)LANGUAGE=3D $(top_builddir)/pre-inst-env \ - $(HELP2MAN) --output=3D"$$@" "guix $(1)" - -endef - -SUBCOMMANDS :=3D \ - 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 =3D \ + 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 =20 dist_man1_MANS =3D \ doc/guix.1 \ - $(SUBCOMMANDS:%=3Ddoc/guix-%.1) + $(sub_commands_mans) + +# Man pages are generated using GNU help2man. +gen_man =3D LANGUAGE=3D $(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=3D"$@" `basename "$@" .1` + +# Note: The dependency on $(GOBJECTS) is to force these docs to be made on= ly +# after all guile modules have been compiled. The 'case' ensures the manp= ages +# 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=3D"$@" "guix `basename "$<" .scm`";; \ + *) : ;; \ + esac =20 if BUILD_DAEMON =20 -dist_man1_MANS +=3D \ - 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=3D"$@" `basename "$@" .1` + +dist_man1_MANS +=3D doc/guix-daemon.1 =20 endif --=20 2.6.3 --=-=-= Content-Type: text/plain Are you OK with it? Thanks, -- Mathieu Lirzin ps: I was speaking of 20KB (790 lines of perl) not 20K lines of code. :) --=-=-=--