Commit | Line | Data |
---|---|---|
575ed8d5 | 1 | # GNU Guix --- Functional package management for GNU |
36629097 | 2 | # Copyright © 2016 Eric Bavier <bavier@member.fsf.org> |
62bc3c5b | 3 | # Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> |
575ed8d5 | 4 | # Copyright © 2013 Andreas Enge <andreas@enge.fr> |
ce9a3042 | 5 | # Copyright © 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com> |
523790d1 | 6 | # Copyright © 2016, 2018 Mathieu Lirzin <mthl@gnu.org> |
66072a00 | 7 | # Copyright © 2018, 2021 Julien Lepiller <julien@lepiller.eu> |
575ed8d5 AE |
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 | ||
66072a00 JL |
24 | # If adding a language, update the following variables, and info_TEXINFOS. |
25 | MANUAL_LANGUAGES = de es fa fr it ko pt_BR ru sk zh_CN | |
26 | COOKBOOK_LANGUAGES = de fa fr ko zh_Hans | |
27 | ||
28 | # Arg1: A list of languages codes. | |
29 | # Arg2: The file name stem. | |
30 | lang_to_texinfo = $(foreach lang,$(1),%D%/$(2).$(lang).texi) | |
31 | ||
32 | # Automake does not understand GNU Make non-standard extensions, | |
33 | # unfortunately, so we cannot use the above patsubst-based function here. | |
de712e52 | 34 | info_TEXINFOS = %D%/guix.texi \ |
3bac7e64 | 35 | %D%/guix.de.texi \ |
de712e52 | 36 | %D%/guix.es.texi \ |
43fb84da | 37 | %D%/guix.fa.texi \ |
de712e52 | 38 | %D%/guix.fr.texi \ |
d2d6c20f | 39 | %D%/guix.it.texi \ |
0f355124 | 40 | %D%/guix.ko.texi \ |
c3eaff8a | 41 | %D%/guix.pt_BR.texi \ |
3bac7e64 | 42 | %D%/guix.ru.texi \ |
77c6c0aa | 43 | %D%/guix.sk.texi \ |
7bc46ecc | 44 | %D%/guix.zh_CN.texi \ |
f98e83a1 | 45 | %D%/guix-cookbook.texi \ |
58c59116 | 46 | %D%/guix-cookbook.de.texi \ |
43fb84da | 47 | %D%/guix-cookbook.fa.texi \ |
0f355124 | 48 | %D%/guix-cookbook.fr.texi \ |
8830930e JL |
49 | %D%/guix-cookbook.ko.texi \ |
50 | %D%/guix-cookbook.zh_Hans.texi | |
88856916 | 51 | |
523790d1 ML |
52 | %C%_guix_TEXINFOS = \ |
53 | %D%/contributing.texi \ | |
54 | %D%/fdl-1.3.texi | |
55 | ||
88856916 | 56 | DOT_FILES = \ |
c0d2e7b1 ML |
57 | %D%/images/bootstrap-graph.dot \ |
58 | %D%/images/bootstrap-packages.dot \ | |
59 | %D%/images/coreutils-graph.dot \ | |
60 | %D%/images/coreutils-bag-graph.dot \ | |
cd5d5f53 | 61 | %D%/images/gcc-core-mesboot0-graph.dot \ |
c0d2e7b1 ML |
62 | %D%/images/service-graph.dot \ |
63 | %D%/images/shepherd-graph.dot | |
88856916 LC |
64 | |
65 | DOT_VECTOR_GRAPHICS = \ | |
66 | $(DOT_FILES:%.dot=%.eps) \ | |
67 | $(DOT_FILES:%.dot=%.pdf) | |
68 | ||
a9424c08 | 69 | EXTRA_DIST += \ |
c0d2e7b1 | 70 | %D%/htmlxref.cnf \ |
88856916 LC |
71 | $(DOT_FILES) \ |
72 | $(DOT_VECTOR_GRAPHICS) \ | |
c0d2e7b1 ML |
73 | %D%/images/coreutils-size-map.eps \ |
74 | %D%/environment-gdb.scm \ | |
c9f321e5 RW |
75 | %D%/package-hello.scm \ |
76 | %D%/package-hello.json | |
575ed8d5 | 77 | |
dd51caac | 78 | OS_CONFIG_EXAMPLES_TEXI = \ |
c0d2e7b1 ML |
79 | %D%/os-config-bare-bones.texi \ |
80 | %D%/os-config-desktop.texi \ | |
81 | %D%/os-config-lightweight-desktop.texi | |
dd51caac | 82 | |
66072a00 JL |
83 | TRANSLATED_INFO = \ |
84 | $(call lang_to_texinfo,$(MANUAL_LANGUAGES),guix) \ | |
85 | $(call lang_to_texinfo,$(MANUAL_LANGUAGES),contributing) \ | |
86 | $(call lang_to_texinfo,$(COOKBOOK_LANGUAGES),guix-cookbook) | |
b9fe8fd6 | 87 | |
931c132a | 88 | # Bundle this file so that makeinfo finds it in out-of-source-tree builds. |
b9fe8fd6 JL |
89 | BUILT_SOURCES += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO) |
90 | EXTRA_DIST += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO) | |
91 | MAINTAINERCLEANFILES = $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO) | |
92 | ||
93 | PO4A_PARAMS := -M UTF-8 -L UTF-8 #master and localized encoding | |
94 | PO4A_PARAMS += -k 0 # produce an output even if the translation is not complete | |
95 | PO4A_PARAMS += -f texinfo # texinfo format | |
96 | ||
97 | # When a change to guix.texi occurs, it is not translated immediately. | |
98 | # Because @pxref and @xref commands are reference to a section by name, they | |
99 | # should be translated. If a modification adds a reference to a section, this | |
100 | # reference is not translated, which means it references a section that does not | |
101 | # exist. | |
102 | # This command loops through the translated files looking for references. For | |
103 | # each of these references, it tries to find the translation and replaces the | |
104 | # reference name, even in untranslated strings. | |
105 | # The last sed is a multiline sed because some references span multiple lines. | |
106 | define xref_command | |
107 | cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \ | |
108 | tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \ | |
109 | sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \ | |
aa7edc94 LC |
110 | if [ -n "$$e" ]; then \ |
111 | line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\ | |
112 | ((line++)) ;\ | |
113 | if [ "$$line" != "1" ]; then \ | |
0571edc1 | 114 | translation=$$(head -n "$$line" "$<" | tail -1 | grep msgstr | sed 's|msgstr "\([^"]*\)"|\1|') ;\ |
aa7edc94 LC |
115 | if [ "$$translation" != "" ]; then \ |
116 | sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\ | |
117 | fi ;\ | |
118 | fi ;\ | |
119 | fi ;\ | |
b9fe8fd6 JL |
120 | done |
121 | endef | |
122 | ||
39764ef8 | 123 | $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi |
b9fe8fd6 JL |
124 | -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp" |
125 | -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp" | |
06c4778a | 126 | -$(AM_V_POXREF)$(xref_command) |
b9fe8fd6 JL |
127 | -mv "$@.tmp" "$@" |
128 | ||
7bc46ecc RW |
129 | $(srcdir)/%D%/guix-cookbook.%.texi: po/doc/guix-cookbook.%.po |
130 | -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix-cookbook.texi" -p "$<" -l "$@.tmp" | |
131 | -sed -i "s|guix-cookbook\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp" | |
132 | -$(AM_V_POXREF)$(xref_command) | |
133 | -mv "$@.tmp" "$@" | |
134 | ||
39764ef8 JL |
135 | $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po |
136 | -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp" | |
06c4778a | 137 | -$(AM_V_POXREF)$(xref_command) |
b9fe8fd6 | 138 | -mv "$@.tmp" "$@" |
931c132a | 139 | |
c0d2e7b1 | 140 | %D%/os-config-%.texi: gnu/system/examples/%.tmpl |
e71ad29d | 141 | $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ |
931c132a LC |
142 | cp "$<" "$@" |
143 | ||
575ed8d5 | 144 | infoimagedir = $(infodir)/images |
a8f996c6 | 145 | dist_infoimage_DATA = \ |
88856916 | 146 | $(DOT_FILES:%.dot=%.png) \ |
e1c15e8b LC |
147 | %D%/images/coreutils-size-map.png \ |
148 | %D%/images/installer-network.png \ | |
149 | %D%/images/installer-partitions.png \ | |
150 | %D%/images/installer-resume.png | |
575ed8d5 | 151 | |
227ff747 LC |
152 | # Ask for warnings about cross-referenced manuals that are not listed in |
153 | # htmlxref.cnf. | |
154 | AM_MAKEINFOHTMLFLAGS = --set-customization-variable CHECK_HTMLXREF=true | |
155 | ||
575ed8d5 AE |
156 | # Try hard to obtain an image size and aspect that's reasonable for inclusion |
157 | # in an Info or PDF document. | |
54461ce7 LC |
158 | DOT_OPTIONS = \ |
159 | -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \ | |
575ed8d5 AE |
160 | -Nfontsize=9 -Nheight=.1 -Nwidth=.1 |
161 | ||
162 | .dot.png: | |
4c48878d | 163 | $(AM_V_DOT)$(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \ |
ce9a3042 | 164 | mv "$(srcdir)/$@.tmp" "$(srcdir)/$@" |
575ed8d5 | 165 | |
54461ce7 | 166 | .dot.pdf: |
4c48878d | 167 | $(AM_V_DOT)$(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \ |
ce9a3042 | 168 | mv "$(srcdir)/$@.tmp" "$(srcdir)/$@" |
54461ce7 | 169 | |
575ed8d5 | 170 | .dot.eps: |
4c48878d | 171 | $(AM_V_DOT)$(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \ |
ce9a3042 | 172 | mv "$(srcdir)/$@.tmp" "$(srcdir)/$@" |
575ed8d5 | 173 | |
66c8ea47 | 174 | .png.eps: |
e71ad29d | 175 | $(AM_V_GEN)convert "$<" "$@-tmp.eps"; \ |
66c8ea47 LC |
176 | mv "$@-tmp.eps" "$@" |
177 | ||
c0d2e7b1 | 178 | # We cannot add new dependencies to `%D%/guix.pdf' & co. (info "(automake) |
a9424c08 LC |
179 | # Extending"). Using the `-local' rules is imperfect, because they may be |
180 | # triggered after the main rule. Oh, well. | |
88856916 LC |
181 | pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf) |
182 | info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png) | |
183 | ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \ | |
c0d2e7b1 | 184 | $(top_srcdir)/%D%/images/coreutils-size-map.eps |
66c8ea47 | 185 | dvi-local: ps-local |
52eca736 | 186 | |
36629097 EB |
187 | ## ----------- ## |
188 | ## Man pages. ## | |
189 | ## ----------- ## | |
190 | ||
39118b5e ML |
191 | # The man pages are generated using GNU Help2man. In makefiles rules they |
192 | # depend not on the binary, but on the source files. This usage allows a | |
193 | # manual page to be generated by the maintainer and included in the | |
194 | # distribution without requiring the end-user to have 'help2man' installed. | |
195 | # They are built in $(srcdir) like info manuals. | |
196 | ||
36629097 | 197 | sub_commands_mans = \ |
c0d2e7b1 ML |
198 | $(srcdir)/%D%/guix-archive.1 \ |
199 | $(srcdir)/%D%/guix-build.1 \ | |
200 | $(srcdir)/%D%/guix-challenge.1 \ | |
d9e83f2a | 201 | $(srcdir)/%D%/guix-deploy.1 \ |
c0d2e7b1 ML |
202 | $(srcdir)/%D%/guix-download.1 \ |
203 | $(srcdir)/%D%/guix-edit.1 \ | |
204 | $(srcdir)/%D%/guix-environment.1 \ | |
205 | $(srcdir)/%D%/guix-gc.1 \ | |
206 | $(srcdir)/%D%/guix-hash.1 \ | |
207 | $(srcdir)/%D%/guix-import.1 \ | |
208 | $(srcdir)/%D%/guix-lint.1 \ | |
209 | $(srcdir)/%D%/guix-package.1 \ | |
210 | $(srcdir)/%D%/guix-publish.1 \ | |
211 | $(srcdir)/%D%/guix-pull.1 \ | |
212 | $(srcdir)/%D%/guix-refresh.1 \ | |
213 | $(srcdir)/%D%/guix-size.1 \ | |
d9e83f2a LC |
214 | $(srcdir)/%D%/guix-system.1 \ |
215 | $(srcdir)/%D%/guix-time-machine.1 \ | |
216 | $(srcdir)/%D%/guix-weather.1 | |
52eca736 | 217 | |
62bc3c5b LC |
218 | # Assume that cross-compiled commands cannot be executed. |
219 | if !CROSS_COMPILING | |
220 | ||
52eca736 | 221 | dist_man1_MANS = \ |
c0d2e7b1 | 222 | $(srcdir)/%D%/guix.1 \ |
36629097 EB |
223 | $(sub_commands_mans) |
224 | ||
62bc3c5b LC |
225 | endif |
226 | ||
ff853a2a LC |
227 | gen_man = \ |
228 | LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN) \ | |
229 | $(HELP2MANFLAGS) | |
230 | ||
231 | HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME) | |
36629097 | 232 | |
c0d2e7b1 | 233 | $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans) |
92d40a68 | 234 | -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1` |
36629097 | 235 | |
39118b5e ML |
236 | # The 'case' ensures the man pages are only generated if the corresponding |
237 | # source script (the first prerequisite) has been changed. The $(GOBJECTS) | |
238 | # prerequisite is solely meant to force these docs to be made only after all | |
239 | # Guile modules have been compiled. | |
c0d2e7b1 | 240 | $(srcdir)/%D%/guix-%.1: guix/scripts/%.scm $(GOBJECTS) |
36629097 EB |
241 | -@case '$?' in \ |
242 | *$<*) $(AM_V_P) && set -x || echo " HELP2MAN $@"; \ | |
243 | $(gen_man) --output="$@" "guix $*";; \ | |
244 | *) : ;; \ | |
245 | esac | |
acec3beb LC |
246 | |
247 | if BUILD_DAEMON | |
62bc3c5b | 248 | if !CROSS_COMPILING |
acec3beb | 249 | |
c0d2e7b1 | 250 | dist_man1_MANS += $(srcdir)/%D%/guix-daemon.1 |
36629097 | 251 | |
7dd05396 | 252 | $(srcdir)/%D%/guix-daemon.1: guix-daemon$(EXEEXT) |
36629097 | 253 | -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1` |
acec3beb LC |
254 | |
255 | endif | |
62bc3c5b | 256 | endif |