doc: Fix build of German Cookbook translation.
[jackhill/guix/guix.git] / po / doc / local.mk
1 # GNU Guix --- Functional package management for GNU
2 # Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
3 #
4 # This file is part of GNU Guix.
5 #
6 # GNU Guix is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or (at
9 # your option) any later version.
10 #
11 # GNU Guix is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 DOC_PO_FILES= \
20 %D%/guix-manual.es.po \
21 %D%/guix-manual.de.po \
22 %D%/guix-manual.fr.po \
23 %D%/guix-manual.ru.po \
24 %D%/guix-manual.zh_CN.po
25
26 DOC_COOKBOOK_PO_FILES= \
27 %D%/guix-cookbook.de.po
28
29 EXTRA_DIST = \
30 %D%/guix-manual.pot \
31 %D%/guix-cookbook.pot \
32 $(DOC_PO_FILES) \
33 $(DOC_COOKBOOK_PO_FILES)
34
35 POT_OPTIONS = --package-name "guix" --package-version "$(VERSION)" \
36 --copyright-holder "Ludovic Courtès" \
37 --msgid-bugs-address "ludo@gnu.org"
38
39 doc-po-update-%:
40 @lang=`echo "$@" | sed -e's/^doc-po-update-//'` ; \
41 output="$(srcdir)/po/doc/guix-manual.$$lang.po" ; \
42 input="$(srcdir)/po/doc/guix-manual.pot" ; \
43 if test -f "$$output"; then \
44 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
45 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $$output $$input"; \
46 cd $(srcdir) \
47 && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
48 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
49 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) "$$output" "$$input";; \
50 *) \
51 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} "$$output" "$$input";; \
52 esac; \
53 }; \
54 touch "$$output"; \
55 else \
56 echo "File $$output does not exist. If you are a translator, you can create it with 'msginit'." 1>&2; \
57 exit 1; \
58 fi
59
60 doc-po-update-cookbook-%:
61 @lang=`echo "$@" | sed -e's/^doc-po-update-cookbook-//'` ; \
62 output="$(srcdir)/po/doc/guix-cookbook.$$lang.po" ; \
63 input="$(srcdir)/po/doc/guix-cookbook.pot" ; \
64 if test -f "$$output"; then \
65 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
66 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $$output $$input"; \
67 cd $(srcdir) \
68 && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
69 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
70 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) "$$output" "$$input";; \
71 *) \
72 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} "$$output" "$$input";; \
73 esac; \
74 }; \
75 touch "$$output"; \
76 else \
77 echo "File $$output does not exist. If you are a translator, you can create it with 'msginit'." 1>&2; \
78 exit 1; \
79 fi
80
81 $(srcdir)/po/doc/%.pot-update: doc/%.texi
82 $(AM_V_PO4A)$(PO4A_UPDATEPO) -M UTF-8 -f texinfo -m "$<" \
83 -p "$$(echo $@ | sed 's|-update||')" $(POT_OPTIONS)
84 @touch "$$(echo $@ | sed 's|-update||')"
85
86 TMP_POT_FILES = contributing.pot guix.pot
87
88 doc-pot-update:
89 for f in $(TMP_POT_FILES); do \
90 $(MAKE) $(srcdir)/po/doc/guix.pot-update; \
91 $(MAKE) $(srcdir)/po/doc/contributing.pot-update; \
92 done
93 $(MAKE) $(srcdir)/po/doc/guix-cookbook.pot-update;
94 msgcat $(addprefix $(srcdir)/po/doc/, $(TMP_POT_FILES)) > $(srcdir)/po/doc/guix-manual.pot
95 rm -f $(addprefix $(srcdir)/po/doc/, $(TMP_POT_FILES))
96
97 doc-po-update: doc-pot-update
98 for f in $(DOC_PO_FILES); do \
99 lang="`echo "$$f" | $(SED) -es'|.*/guix-manual\.\(.*\)\.po$$|\1|g'`"; \
100 $(MAKE) "doc-po-update-$$lang"; \
101 done
102 for f in $(DOC_COOKBOOK_PO_FILES); do \
103 lang="`echo "$$f" | $(SED) -es'|.*/guix-cookbook\.\(.*\)\.po$$|\1|g'`"; \
104 $(MAKE) "doc-po-update-cookbook-$$lang"; \
105 done
106
107
108 .PHONY: doc-po-update doc-pot-update