Merge branch 'core-updates'
[jackhill/guix/guix.git] / doc.am
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 # Copyright © 2013 Andreas Enge <andreas@enge.fr>
4 # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
5 #
6 # This file is part of GNU Guix.
7 #
8 # GNU Guix is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or (at
11 # your option) any later version.
12 #
13 # GNU Guix is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 info_TEXINFOS = doc/guix.texi
22
23 DOT_FILES = \
24 doc/images/bootstrap-graph.dot \
25 doc/images/bootstrap-packages.dot \
26 doc/images/coreutils-graph.dot \
27 doc/images/coreutils-bag-graph.dot \
28 doc/images/service-graph.dot \
29 doc/images/dmd-graph.dot
30
31 DOT_VECTOR_GRAPHICS = \
32 $(DOT_FILES:%.dot=%.eps) \
33 $(DOT_FILES:%.dot=%.pdf)
34
35 EXTRA_DIST += \
36 doc/contributing.texi \
37 doc/emacs.texi \
38 doc/fdl-1.3.texi \
39 $(DOT_FILES) \
40 $(DOT_VECTOR_GRAPHICS) \
41 doc/images/coreutils-size-map.eps \
42 doc/environment-gdb.scm \
43 doc/package-hello.scm
44
45 OS_CONFIG_EXAMPLES_TEXI = \
46 doc/os-config-bare-bones.texi \
47 doc/os-config-desktop.texi
48
49 # Bundle this file so that makeinfo finds it in out-of-source-tree builds.
50 BUILT_SOURCES += $(OS_CONFIG_EXAMPLES_TEXI)
51 EXTRA_DIST += $(OS_CONFIG_EXAMPLES_TEXI)
52 MAINTAINERCLEANFILES = $(OS_CONFIG_EXAMPLES_TEXI)
53
54 doc/os-config-%.texi: gnu/system/examples/%.tmpl
55 $(MKDIR_P) "`dirname "$@"`"
56 cp "$<" "$@"
57
58 infoimagedir = $(infodir)/images
59 dist_infoimage_DATA = \
60 $(DOT_FILES:%.dot=%.png) \
61 doc/images/coreutils-size-map.png
62
63 # Try hard to obtain an image size and aspect that's reasonable for inclusion
64 # in an Info or PDF document.
65 DOT_OPTIONS = \
66 -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \
67 -Nfontsize=9 -Nheight=.1 -Nwidth=.1
68
69 .dot.png:
70 $(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"
71 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
72
73 .dot.pdf:
74 $(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"
75 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
76
77 .dot.eps:
78 $(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"
79 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
80
81 .png.eps:
82 convert "$<" "$@-tmp.eps"
83 mv "$@-tmp.eps" "$@"
84
85 # We cannot add new dependencies to `doc/guix.pdf' & co. (info "(automake)
86 # Extending"). Using the `-local' rules is imperfect, because they may be
87 # triggered after the main rule. Oh, well.
88 pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf)
89 info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png)
90 ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
91 $(top_srcdir)/doc/images/coreutils-size-map.eps
92 dvi-local: ps-local
93
94 \f
95 # Manual pages.
96
97 doc/guix.1: $(SUBCOMMANDS:%=guix/scripts/%.scm)
98 -LANGUAGE= $(top_builddir)/pre-inst-env \
99 $(HELP2MAN) --output="$@" guix
100
101 # Note: Do not depend on 'guix-daemon' since that would trigger a rebuild even
102 # for people building from a tarball.
103 doc/guix-daemon.1: nix/nix-daemon/guix-daemon.cc
104 -LANGUAGE= $(top_builddir)/pre-inst-env \
105 $(HELP2MAN) --output="$@" guix-daemon
106
107 define subcommand-manual-target
108
109 doc/guix-$(1).1: guix/scripts/$(1).scm
110 -LANGUAGE= $(top_builddir)/pre-inst-env \
111 $(HELP2MAN) --output="$$@" "guix $(1)"
112
113 endef
114
115 SUBCOMMANDS := \
116 archive \
117 build \
118 challenge \
119 download \
120 edit \
121 environment \
122 gc \
123 hash \
124 import \
125 lint \
126 package \
127 publish \
128 pull \
129 refresh \
130 size \
131 system
132
133 $(eval $(foreach subcommand,$(SUBCOMMANDS), \
134 $(call subcommand-manual-target,$(subcommand))))
135
136 dist_man1_MANS = \
137 doc/guix.1 \
138 $(SUBCOMMANDS:%=doc/guix-%.1)
139
140 if BUILD_DAEMON
141
142 dist_man1_MANS += \
143 doc/guix-daemon.1
144
145 endif