gnu: Add r-depecher.
[jackhill/guix/guix.git] / doc / local.mk
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
3 # Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
4 # Copyright © 2013 Andreas Enge <andreas@enge.fr>
5 # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
6 # Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org>
7 # Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
8 #
9 # This file is part of GNU Guix.
10 #
11 # GNU Guix is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or (at
14 # your option) any later version.
15 #
16 # GNU Guix is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 info_TEXINFOS = %D%/guix.texi \
25 %D%/guix.de.texi \
26 %D%/guix.es.texi \
27 %D%/guix.fr.texi \
28 %D%/guix.ru.texi \
29 %D%/guix.zh_CN.texi
30
31 %C%_guix_TEXINFOS = \
32 %D%/contributing.texi \
33 %D%/fdl-1.3.texi
34
35 DOT_FILES = \
36 %D%/images/bootstrap-graph.dot \
37 %D%/images/bootstrap-packages.dot \
38 %D%/images/coreutils-graph.dot \
39 %D%/images/coreutils-bag-graph.dot \
40 %D%/images/service-graph.dot \
41 %D%/images/shepherd-graph.dot
42
43 DOT_VECTOR_GRAPHICS = \
44 $(DOT_FILES:%.dot=%.eps) \
45 $(DOT_FILES:%.dot=%.pdf)
46
47 EXTRA_DIST += \
48 %D%/htmlxref.cnf \
49 $(DOT_FILES) \
50 $(DOT_VECTOR_GRAPHICS) \
51 %D%/images/coreutils-size-map.eps \
52 %D%/environment-gdb.scm \
53 %D%/package-hello.scm
54
55 OS_CONFIG_EXAMPLES_TEXI = \
56 %D%/os-config-bare-bones.texi \
57 %D%/os-config-desktop.texi \
58 %D%/os-config-lightweight-desktop.texi
59
60 TRANSLATED_INFO = \
61 %D%/guix.de.texi \
62 %D%/guix.es.texi \
63 %D%/guix.fr.texi \
64 %D%/guix.ru.texi \
65 %D%/guix.zh_CN.texi \
66 %D%/contributing.de.texi \
67 %D%/contributing.es.texi \
68 %D%/contributing.fr.texi \
69 %D%/contributing.ru.texi \
70 %D%/contributing.zh_CN.texi
71
72 # Bundle this file so that makeinfo finds it in out-of-source-tree builds.
73 BUILT_SOURCES += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
74 EXTRA_DIST += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
75 MAINTAINERCLEANFILES = $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
76
77 PO4A_PARAMS := -M UTF-8 -L UTF-8 #master and localized encoding
78 PO4A_PARAMS += -k 0 # produce an output even if the translation is not complete
79 PO4A_PARAMS += -f texinfo # texinfo format
80
81 # When a change to guix.texi occurs, it is not translated immediately.
82 # Because @pxref and @xref commands are reference to a section by name, they
83 # should be translated. If a modification adds a reference to a section, this
84 # reference is not translated, which means it references a section that does not
85 # exist.
86 # This command loops through the translated files looking for references. For
87 # each of these references, it tries to find the translation and replaces the
88 # reference name, even in untranslated strings.
89 # The last sed is a multiline sed because some references span multiple lines.
90 define xref_command
91 cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \
92 tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \
93 sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \
94 line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\
95 ((line++)) ;\
96 if [ "$$line" != "1" ]; then \
97 translation=$$(head -n $$line "$<" | tail -1 | grep msgstr | sed 's|msgstr "\(.*\)"|\1|') ;\
98 if [ "$$translation" != "" ]; then \
99 sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\
100 fi ;\
101 fi ;\
102 done
103 endef
104
105 $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi
106 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp"
107 -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
108 -$(AM_V_POXREF)$(xref_command)
109 -mv "$@.tmp" "$@"
110
111 $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po
112 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp"
113 -$(AM_V_POXREF)$(xref_command)
114 -mv "$@.tmp" "$@"
115
116 %D%/os-config-%.texi: gnu/system/examples/%.tmpl
117 $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
118 cp "$<" "$@"
119
120 infoimagedir = $(infodir)/images
121 dist_infoimage_DATA = \
122 $(DOT_FILES:%.dot=%.png) \
123 %D%/images/coreutils-size-map.png \
124 %D%/images/installer-network.png \
125 %D%/images/installer-partitions.png \
126 %D%/images/installer-resume.png
127
128 # Ask for warnings about cross-referenced manuals that are not listed in
129 # htmlxref.cnf.
130 AM_MAKEINFOHTMLFLAGS = --set-customization-variable CHECK_HTMLXREF=true
131
132 # Try hard to obtain an image size and aspect that's reasonable for inclusion
133 # in an Info or PDF document.
134 DOT_OPTIONS = \
135 -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \
136 -Nfontsize=9 -Nheight=.1 -Nwidth=.1
137
138 .dot.png:
139 $(AM_V_DOT)$(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
140 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
141
142 .dot.pdf:
143 $(AM_V_DOT)$(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
144 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
145
146 .dot.eps:
147 $(AM_V_DOT)$(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
148 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
149
150 .png.eps:
151 $(AM_V_GEN)convert "$<" "$@-tmp.eps"; \
152 mv "$@-tmp.eps" "$@"
153
154 # We cannot add new dependencies to `%D%/guix.pdf' & co. (info "(automake)
155 # Extending"). Using the `-local' rules is imperfect, because they may be
156 # triggered after the main rule. Oh, well.
157 pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf)
158 info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png)
159 ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
160 $(top_srcdir)/%D%/images/coreutils-size-map.eps
161 dvi-local: ps-local
162
163 ## ----------- ##
164 ## Man pages. ##
165 ## ----------- ##
166
167 # The man pages are generated using GNU Help2man. In makefiles rules they
168 # depend not on the binary, but on the source files. This usage allows a
169 # manual page to be generated by the maintainer and included in the
170 # distribution without requiring the end-user to have 'help2man' installed.
171 # They are built in $(srcdir) like info manuals.
172
173 sub_commands_mans = \
174 $(srcdir)/%D%/guix-archive.1 \
175 $(srcdir)/%D%/guix-build.1 \
176 $(srcdir)/%D%/guix-challenge.1 \
177 $(srcdir)/%D%/guix-download.1 \
178 $(srcdir)/%D%/guix-edit.1 \
179 $(srcdir)/%D%/guix-environment.1 \
180 $(srcdir)/%D%/guix-gc.1 \
181 $(srcdir)/%D%/guix-hash.1 \
182 $(srcdir)/%D%/guix-import.1 \
183 $(srcdir)/%D%/guix-lint.1 \
184 $(srcdir)/%D%/guix-package.1 \
185 $(srcdir)/%D%/guix-publish.1 \
186 $(srcdir)/%D%/guix-pull.1 \
187 $(srcdir)/%D%/guix-refresh.1 \
188 $(srcdir)/%D%/guix-size.1 \
189 $(srcdir)/%D%/guix-system.1
190
191 dist_man1_MANS = \
192 $(srcdir)/%D%/guix.1 \
193 $(sub_commands_mans)
194
195 gen_man = \
196 LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN) \
197 $(HELP2MANFLAGS)
198
199 HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
200
201 $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans)
202 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
203
204 # The 'case' ensures the man pages are only generated if the corresponding
205 # source script (the first prerequisite) has been changed. The $(GOBJECTS)
206 # prerequisite is solely meant to force these docs to be made only after all
207 # Guile modules have been compiled.
208 $(srcdir)/%D%/guix-%.1: guix/scripts/%.scm $(GOBJECTS)
209 -@case '$?' in \
210 *$<*) $(AM_V_P) && set -x || echo " HELP2MAN $@"; \
211 $(gen_man) --output="$@" "guix $*";; \
212 *) : ;; \
213 esac
214
215 if BUILD_DAEMON
216
217 dist_man1_MANS += $(srcdir)/%D%/guix-daemon.1
218
219 $(srcdir)/%D%/guix-daemon.1: nix/nix-daemon/guix-daemon.cc
220 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
221
222 endif