po: Use "rsync" instead of "wget" for po-update target.
[pspp.git] / po / automake.mk
blobcfb186ab8c2cb5cd97eb2056582eeb143107a6e4
1 # PSPP - a program for statistical analysis.
2 # Copyright (C) 2017 Free Software Foundation, Inc.
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 include $(top_srcdir)/po/Makevars
19 XGETTEXT=xgettext
20 MSGMERGE=msgmerge
21 MSGFMT=msgfmt
23 POFILES = \
24 po/ca.po \
25 po/de.po \
26 po/el.po \
27 po/es.po \
28 po/fr.po \
29 po/gl.po \
30 po/hu.po \
31 po/ja.po \
32 po/lt.po \
33 po/nl.po \
34 po/pl.po \
35 po/pt_BR.po \
36 po/ru.po \
37 po/sl.po \
38 po/tr.po \
39 po/uk.po \
40 po/zh_CN.po
42 LOCALPOFILES = po/cs.po po/en_GB.po
44 POTFILE=po/$(DOMAIN).pot
46 TRANSLATABLE_FILES = $(DIST_SOURCES) $(all_q_sources)
48 XGETTEXT_OPTIONS = \
49 --copyright-holder="$(COPYRIGHT_HOLDER)" \
50 --package-name=$(PACKAGE) \
51 --package-version=$(VERSION) \
52 --msgid-bugs-address=$(MSGID_BUGS_ADDRESS) \
53 --from-code=UTF-8 \
54 --add-comments='TRANSLATORS:'
56 $(POTFILE): $(TRANSLATABLE_FILES) $(UI_FILES) src/ui/gui/gen-dot-desktop.sh
57 @$(MKDIR_P) po
58 $(AM_V_GEN)$(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS) $(TRANSLATABLE_FILES) --language=C --keyword=_ --keyword=N_ -o $@,tmp
59 $(AM_V_at)$(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS) -j $(UI_FILES) --language=glade -o $@,tmp
60 $(AM_V_at)$(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS) -j src/ui/gui/gen-dot-desktop.sh --language=shell --keyword=TRANSLATE -o $@,tmp
61 $(AM_V_at)$(SED) -e '/^"POT-Creation-Date: .*/d' $@,tmp > $@
63 $(LOCALPOFILED) $(POFILES): $(POTFILE)
64 $(AM_V_GEN)$(MSGMERGE) --quiet $(top_srcdir)/$@ $? -o $@,tmp
65 $(AM_V_at)if test -e $(top_srcdir)/$@,aux ; then \
66 touch $@,tmp ; \
67 msgcat --use-first $(top_srcdir)/$@,aux $@,tmp -o $@,tmp; \
68 fi ;
69 $(AM_V_at)$(SED) -e '/^"POT-Creation-Date: /d' $@,tmp > $@,tmp2
70 $(RM) $@,tmp
71 mv $@,tmp2 $@
73 SUFFIXES += .po .gmo
74 .po.gmo:
75 @$(MKDIR_P) `dirname $@`
76 $(AM_V_GEN)$(MSGFMT) $< -o $@
79 GMOFILES = $(LOCALPOFILES:.po=.gmo) $(POFILES:.po=.gmo)
81 ALL_LOCAL += $(GMOFILES)
83 install-data-hook: $(GMOFILES)
84 for f in $(GMOFILES); do \
85 lang=`echo $$f | $(SED) -e 's%po/\(.*\)\.gmo%\1%' ` ; \
86 $(MKDIR_P) $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES; \
87 $(INSTALL_DATA) $$f $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo ; \
88 done
90 uninstall-hook:
91 for f in $(GMOFILES); do \
92 lang=`echo $$f | $(SED) -e 's%po/\(.*\)\.gmo%\1%' ` ; \
93 rm -f $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo ; \
94 done
97 EXTRA_DIST += \
98 $(LOCALPOFILES) \
99 $(POFILES) \
100 $(POTFILE) \
101 po/ChangeLog \
102 po/cs.po,aux
104 CLEANFILES += $(GMOFILES) $(POTFILE)
106 # Clean $(POFILES) from build directory but not if that's the same as
107 # the source directory.
108 po_CLEAN:
109 @if test "$(srcdir)" != .; then \
110 echo rm -f $(LOCALPOFILES) $(POFILES); \
111 rm -f $(LOCALPOFILES) $(POFILES); \
113 CLEAN_LOCAL += po_CLEAN
115 RSYNC = rsync
116 po-update:
117 $(RSYNC) -Lrtvz translationproject.org::tp/latest/pspp/ $(srcdir)/po