gnu: kmscon: Open a new keymap-update FIFO once a request has been processed.
[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, 2020 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.fa.texi \
28 %D%/guix.fr.texi \
29 %D%/guix.it.texi \
30 %D%/guix.ko.texi \
31 %D%/guix.pt_BR.texi \
32 %D%/guix.ru.texi \
33 %D%/guix.sk.texi \
34 %D%/guix.zh_CN.texi \
35 %D%/guix-cookbook.texi \
36 %D%/guix-cookbook.de.texi \
37 %D%/guix-cookbook.fa.texi \
38 %D%/guix-cookbook.fr.texi \
39 %D%/guix-cookbook.ko.texi \
40 %D%/guix-cookbook.zh_Hans.texi
41
42 %C%_guix_TEXINFOS = \
43 %D%/contributing.texi \
44 %D%/fdl-1.3.texi
45
46 DOT_FILES = \
47 %D%/images/bootstrap-graph.dot \
48 %D%/images/bootstrap-packages.dot \
49 %D%/images/coreutils-graph.dot \
50 %D%/images/coreutils-bag-graph.dot \
51 %D%/images/gcc-core-mesboot0-graph.dot \
52 %D%/images/service-graph.dot \
53 %D%/images/shepherd-graph.dot
54
55 DOT_VECTOR_GRAPHICS = \
56 $(DOT_FILES:%.dot=%.eps) \
57 $(DOT_FILES:%.dot=%.pdf)
58
59 EXTRA_DIST += \
60 %D%/htmlxref.cnf \
61 $(DOT_FILES) \
62 $(DOT_VECTOR_GRAPHICS) \
63 %D%/images/coreutils-size-map.eps \
64 %D%/environment-gdb.scm \
65 %D%/package-hello.scm \
66 %D%/package-hello.json
67
68 OS_CONFIG_EXAMPLES_TEXI = \
69 %D%/os-config-bare-bones.texi \
70 %D%/os-config-desktop.texi \
71 %D%/os-config-lightweight-desktop.texi
72
73 # Do not forget to update these, when updating info_TEXINFOS
74 TRANSLATED_INFO = \
75 %D%/guix.de.texi \
76 %D%/guix.es.texi \
77 %D%/guix.fa.texi \
78 %D%/guix.fr.texi \
79 %D%/guix.it.texi \
80 %D%/guix.ko.texi \
81 %D%/guix.pt_BR.texi \
82 %D%/guix.ru.texi \
83 %D%/guix.sk.texi \
84 %D%/guix.zh_CN.texi \
85 %D%/contributing.de.texi \
86 %D%/contributing.es.texi \
87 %D%/contributing.fa.texi \
88 %D%/contributing.fr.texi \
89 %D%/contributing.it.texi \
90 %D%/contributing.ko.texi \
91 %D%/contributing.pt_BR.texi \
92 %D%/contributing.ru.texi \
93 %D%/contributing.sk.texi \
94 %D%/contributing.zh_CN.texi \
95 %D%/guix-cookbook.de.texi \
96 %D%/guix-cookbook.fa.texi \
97 %D%/guix-cookbook.fr.texi \
98 %D%/guix-cookbook.ko.texi \
99 %D%/guix-cookbook.zh_Hans.texi
100
101 # Bundle this file so that makeinfo finds it in out-of-source-tree builds.
102 BUILT_SOURCES += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
103 EXTRA_DIST += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
104 MAINTAINERCLEANFILES = $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
105
106 PO4A_PARAMS := -M UTF-8 -L UTF-8 #master and localized encoding
107 PO4A_PARAMS += -k 0 # produce an output even if the translation is not complete
108 PO4A_PARAMS += -f texinfo # texinfo format
109
110 # When a change to guix.texi occurs, it is not translated immediately.
111 # Because @pxref and @xref commands are reference to a section by name, they
112 # should be translated. If a modification adds a reference to a section, this
113 # reference is not translated, which means it references a section that does not
114 # exist.
115 # This command loops through the translated files looking for references. For
116 # each of these references, it tries to find the translation and replaces the
117 # reference name, even in untranslated strings.
118 # The last sed is a multiline sed because some references span multiple lines.
119 define xref_command
120 cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \
121 tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \
122 sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \
123 if [ -n "$$e" ]; then \
124 line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\
125 ((line++)) ;\
126 if [ "$$line" != "1" ]; then \
127 translation=$$(head -n "$$line" "$<" | tail -1 | grep msgstr | sed 's|msgstr "\([^"]*\)"|\1|') ;\
128 if [ "$$translation" != "" ]; then \
129 sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\
130 fi ;\
131 fi ;\
132 fi ;\
133 done
134 endef
135
136 $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi
137 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp"
138 -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
139 -$(AM_V_POXREF)$(xref_command)
140 -mv "$@.tmp" "$@"
141
142 $(srcdir)/%D%/guix-cookbook.%.texi: po/doc/guix-cookbook.%.po
143 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix-cookbook.texi" -p "$<" -l "$@.tmp"
144 -sed -i "s|guix-cookbook\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
145 -$(AM_V_POXREF)$(xref_command)
146 -mv "$@.tmp" "$@"
147
148 $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po
149 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp"
150 -$(AM_V_POXREF)$(xref_command)
151 -mv "$@.tmp" "$@"
152
153 %D%/os-config-%.texi: gnu/system/examples/%.tmpl
154 $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
155 cp "$<" "$@"
156
157 infoimagedir = $(infodir)/images
158 dist_infoimage_DATA = \
159 $(DOT_FILES:%.dot=%.png) \
160 %D%/images/coreutils-size-map.png \
161 %D%/images/installer-network.png \
162 %D%/images/installer-partitions.png \
163 %D%/images/installer-resume.png
164
165 # Ask for warnings about cross-referenced manuals that are not listed in
166 # htmlxref.cnf.
167 AM_MAKEINFOHTMLFLAGS = --set-customization-variable CHECK_HTMLXREF=true
168
169 # Try hard to obtain an image size and aspect that's reasonable for inclusion
170 # in an Info or PDF document.
171 DOT_OPTIONS = \
172 -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \
173 -Nfontsize=9 -Nheight=.1 -Nwidth=.1
174
175 .dot.png:
176 $(AM_V_DOT)$(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
177 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
178
179 .dot.pdf:
180 $(AM_V_DOT)$(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
181 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
182
183 .dot.eps:
184 $(AM_V_DOT)$(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
185 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
186
187 .png.eps:
188 $(AM_V_GEN)convert "$<" "$@-tmp.eps"; \
189 mv "$@-tmp.eps" "$@"
190
191 # We cannot add new dependencies to `%D%/guix.pdf' & co. (info "(automake)
192 # Extending"). Using the `-local' rules is imperfect, because they may be
193 # triggered after the main rule. Oh, well.
194 pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf)
195 info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png)
196 ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
197 $(top_srcdir)/%D%/images/coreutils-size-map.eps
198 dvi-local: ps-local
199
200 ## ----------- ##
201 ## Man pages. ##
202 ## ----------- ##
203
204 # The man pages are generated using GNU Help2man. In makefiles rules they
205 # depend not on the binary, but on the source files. This usage allows a
206 # manual page to be generated by the maintainer and included in the
207 # distribution without requiring the end-user to have 'help2man' installed.
208 # They are built in $(srcdir) like info manuals.
209
210 sub_commands_mans = \
211 $(srcdir)/%D%/guix-archive.1 \
212 $(srcdir)/%D%/guix-build.1 \
213 $(srcdir)/%D%/guix-challenge.1 \
214 $(srcdir)/%D%/guix-deploy.1 \
215 $(srcdir)/%D%/guix-download.1 \
216 $(srcdir)/%D%/guix-edit.1 \
217 $(srcdir)/%D%/guix-environment.1 \
218 $(srcdir)/%D%/guix-gc.1 \
219 $(srcdir)/%D%/guix-hash.1 \
220 $(srcdir)/%D%/guix-import.1 \
221 $(srcdir)/%D%/guix-lint.1 \
222 $(srcdir)/%D%/guix-package.1 \
223 $(srcdir)/%D%/guix-publish.1 \
224 $(srcdir)/%D%/guix-pull.1 \
225 $(srcdir)/%D%/guix-refresh.1 \
226 $(srcdir)/%D%/guix-size.1 \
227 $(srcdir)/%D%/guix-system.1 \
228 $(srcdir)/%D%/guix-time-machine.1 \
229 $(srcdir)/%D%/guix-weather.1
230
231 # Assume that cross-compiled commands cannot be executed.
232 if !CROSS_COMPILING
233
234 dist_man1_MANS = \
235 $(srcdir)/%D%/guix.1 \
236 $(sub_commands_mans)
237
238 endif
239
240 gen_man = \
241 LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN) \
242 $(HELP2MANFLAGS)
243
244 HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
245
246 $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans)
247 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
248
249 # The 'case' ensures the man pages are only generated if the corresponding
250 # source script (the first prerequisite) has been changed. The $(GOBJECTS)
251 # prerequisite is solely meant to force these docs to be made only after all
252 # Guile modules have been compiled.
253 $(srcdir)/%D%/guix-%.1: guix/scripts/%.scm $(GOBJECTS)
254 -@case '$?' in \
255 *$<*) $(AM_V_P) && set -x || echo " HELP2MAN $@"; \
256 $(gen_man) --output="$@" "guix $*";; \
257 *) : ;; \
258 esac
259
260 if BUILD_DAEMON
261 if !CROSS_COMPILING
262
263 dist_man1_MANS += $(srcdir)/%D%/guix-daemon.1
264
265 $(srcdir)/%D%/guix-daemon.1: guix-daemon$(EXEEXT)
266 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
267
268 endif
269 endif