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 # Copyright © 2013 Andreas Enge # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer +# Copyright © 2016 Mathieu Lirzin # # 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