processes: Gracefully handle daemons without clients.
[guix.git] / doc / local.mk
blob51800bb35b72aaf1772205191e2b7c544e336fa8
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>
9 # This file is part of GNU Guix.
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.
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.
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/>.
24 info_TEXINFOS = %D%/guix.texi \
25 %D%/guix.es.texi \
26 %D%/guix.fr.texi \
27 %D%/guix.de.texi \
28 %D%/guix.zh_CN.texi
30 %C%_guix_TEXINFOS = \
31 %D%/contributing.texi \
32 %D%/fdl-1.3.texi
34 DOT_FILES = \
35 %D%/images/bootstrap-graph.dot \
36 %D%/images/bootstrap-packages.dot \
37 %D%/images/coreutils-graph.dot \
38 %D%/images/coreutils-bag-graph.dot \
39 %D%/images/service-graph.dot \
40 %D%/images/shepherd-graph.dot
42 DOT_VECTOR_GRAPHICS = \
43 $(DOT_FILES:%.dot=%.eps) \
44 $(DOT_FILES:%.dot=%.pdf)
46 EXTRA_DIST += \
47 %D%/htmlxref.cnf \
48 $(DOT_FILES) \
49 $(DOT_VECTOR_GRAPHICS) \
50 %D%/images/coreutils-size-map.eps \
51 %D%/environment-gdb.scm \
52 %D%/package-hello.scm
54 OS_CONFIG_EXAMPLES_TEXI = \
55 %D%/os-config-bare-bones.texi \
56 %D%/os-config-desktop.texi \
57 %D%/os-config-lightweight-desktop.texi
59 TRANSLATED_INFO = \
60 %D%/guix.de.texi \
61 %D%/guix.es.texi \
62 %D%/guix.fr.texi \
63 %D%/guix.zh_CN.texi \
64 %D%/contributing.de.texi \
65 %D%/contributing.es.texi \
66 %D%/contributing.fr.texi \
67 %D%/contributing.zh_CN.texi
69 # Bundle this file so that makeinfo finds it in out-of-source-tree builds.
70 BUILT_SOURCES += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
71 EXTRA_DIST += $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
72 MAINTAINERCLEANFILES = $(OS_CONFIG_EXAMPLES_TEXI) $(TRANSLATED_INFO)
74 PO4A_PARAMS := -M UTF-8 -L UTF-8 #master and localized encoding
75 PO4A_PARAMS += -k 0 # produce an output even if the translation is not complete
76 PO4A_PARAMS += -f texinfo # texinfo format
78 # When a change to guix.texi occurs, it is not translated immediately.
79 # Because @pxref and @xref commands are reference to a section by name, they
80 # should be translated. If a modification adds a reference to a section, this
81 # reference is not translated, which means it references a section that does not
82 # exist.
83 # This command loops through the translated files looking for references. For
84 # each of these references, it tries to find the translation and replaces the
85 # reference name, even in untranslated strings.
86 # The last sed is a multiline sed because some references span multiple lines.
87 define xref_command
88 cat "$@.tmp" | egrep '@p?x?ref' -A1 | sed 'N;s|--\n||g;P;D' | sed 's|^| |g' | \
89 tr -d '\012' | sed 's|\(@p\?x\?ref\)|\n\1|g' | egrep '@p?x?ref' | \
90 sed 's|^.*@p\?x\?ref{\([^,}]*\).*$$|\1|g' | sort | uniq | while read e; do \
91 line=$$(grep -n "^msgid \"$$e\"" "$<" | cut -f1 --delimiter=":") ;\
92 ((line++)) ;\
93 if [ "$$line" != "1" ]; then \
94 translation=$$(head -n $$line "$<" | tail -1 | grep msgstr | sed 's|msgstr "\(.*\)"|\1|') ;\
95 if [ "$$translation" != "" ]; then \
96 sed "N;s@\(p\?x\?ref\){$$(echo $$e | sed 's| |[\\n ]|g')\(,\|}\)@\1{$$translation\2@g;P;D" -i "$@.tmp" ;\
97 fi ;\
98 fi ;\
99 done
100 endef
102 $(srcdir)/%D%/guix.%.texi: po/doc/guix-manual.%.po $(srcdir)/%D%/contributing.%.texi
103 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/guix.texi" -p "$<" -l "$@.tmp"
104 -sed -i "s|guix\.info|$$(basename "$@" | sed 's|texi$$|info|')|" "$@.tmp"
105 -$(AM_V_POXREF)$(xref_command)
106 -mv "$@.tmp" "$@"
108 $(srcdir)/%D%/contributing.%.texi: po/doc/guix-manual.%.po
109 -$(AM_V_PO4A)$(PO4A_TRANSLATE) $(PO4A_PARAMS) -m "%D%/contributing.texi" -p "$<" -l "$@.tmp"
110 -$(AM_V_POXREF)$(xref_command)
111 -mv "$@.tmp" "$@"
113 %D%/os-config-%.texi: gnu/system/examples/%.tmpl
114 $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
115 cp "$<" "$@"
117 infoimagedir = $(infodir)/images
118 dist_infoimage_DATA = \
119 $(DOT_FILES:%.dot=%.png) \
120 %D%/images/coreutils-size-map.png \
121 %D%/images/installer-network.png \
122 %D%/images/installer-partitions.png \
123 %D%/images/installer-resume.png
125 # Try hard to obtain an image size and aspect that's reasonable for inclusion
126 # in an Info or PDF document.
127 DOT_OPTIONS = \
128 -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \
129 -Nfontsize=9 -Nheight=.1 -Nwidth=.1
131 .dot.png:
132 $(AM_V_DOT)$(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
133 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
135 .dot.pdf:
136 $(AM_V_DOT)$(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
137 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
139 .dot.eps:
140 $(AM_V_DOT)$(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
141 mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
143 .png.eps:
144 $(AM_V_GEN)convert "$<" "$@-tmp.eps"; \
145 mv "$@-tmp.eps" "$@"
147 # We cannot add new dependencies to `%D%/guix.pdf' & co. (info "(automake)
148 # Extending"). Using the `-local' rules is imperfect, because they may be
149 # triggered after the main rule. Oh, well.
150 pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf)
151 info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png)
152 ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
153 $(top_srcdir)/%D%/images/coreutils-size-map.eps
154 dvi-local: ps-local
156 ## ----------- ##
157 ## Man pages. ##
158 ## ----------- ##
160 # The man pages are generated using GNU Help2man. In makefiles rules they
161 # depend not on the binary, but on the source files. This usage allows a
162 # manual page to be generated by the maintainer and included in the
163 # distribution without requiring the end-user to have 'help2man' installed.
164 # They are built in $(srcdir) like info manuals.
166 sub_commands_mans = \
167 $(srcdir)/%D%/guix-archive.1 \
168 $(srcdir)/%D%/guix-build.1 \
169 $(srcdir)/%D%/guix-challenge.1 \
170 $(srcdir)/%D%/guix-download.1 \
171 $(srcdir)/%D%/guix-edit.1 \
172 $(srcdir)/%D%/guix-environment.1 \
173 $(srcdir)/%D%/guix-gc.1 \
174 $(srcdir)/%D%/guix-hash.1 \
175 $(srcdir)/%D%/guix-import.1 \
176 $(srcdir)/%D%/guix-lint.1 \
177 $(srcdir)/%D%/guix-package.1 \
178 $(srcdir)/%D%/guix-publish.1 \
179 $(srcdir)/%D%/guix-pull.1 \
180 $(srcdir)/%D%/guix-refresh.1 \
181 $(srcdir)/%D%/guix-size.1 \
182 $(srcdir)/%D%/guix-system.1
184 dist_man1_MANS = \
185 $(srcdir)/%D%/guix.1 \
186 $(sub_commands_mans)
188 gen_man = \
189 LANGUAGE= $(top_builddir)/pre-inst-env $(HELP2MAN) \
190 $(HELP2MANFLAGS)
192 HELP2MANFLAGS = --source=GNU --info-page=$(PACKAGE_TARNAME)
194 $(srcdir)/%D%/guix.1: scripts/guix.in $(sub_commands_mans)
195 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
197 # The 'case' ensures the man pages are only generated if the corresponding
198 # source script (the first prerequisite) has been changed. The $(GOBJECTS)
199 # prerequisite is solely meant to force these docs to be made only after all
200 # Guile modules have been compiled.
201 $(srcdir)/%D%/guix-%.1: guix/scripts/%.scm $(GOBJECTS)
202 -@case '$?' in \
203 *$<*) $(AM_V_P) && set -x || echo " HELP2MAN $@"; \
204 $(gen_man) --output="$@" "guix $*";; \
205 *) : ;; \
206 esac
208 if BUILD_DAEMON
210 dist_man1_MANS += $(srcdir)/%D%/guix-daemon.1
212 $(srcdir)/%D%/guix-daemon.1: nix/nix-daemon/guix-daemon.cc
213 -$(AM_V_HELP2MAN)$(gen_man) --output="$@" `basename "$@" .1`
215 endif