Merge 'master' into 'gtk3'.
[pspp] / po / automake.mk
1 include $(top_srcdir)/po/Makevars
2
3 XGETTEXT=xgettext
4 MSGMERGE=msgmerge
5 MSGFMT=msgfmt
6
7 POFILES = \
8         po/ca.po \
9         po/cs.po \
10         po/de.po \
11         po/en_GB.po \
12         po/es.po \
13         po/fr.po \
14         po/ja.po \
15         po/lt.po \
16         po/nl.po \
17         po/sl.po \
18         po/pt_BR.po \
19         po/uk.po
20
21 POTFILE=po/$(DOMAIN).pot
22
23 TRANSLATABLE_FILES = $(DIST_SOURCES) $(all_q_sources)
24
25 XGETTEXT_OPTIONS = \
26         --copyright-holder="$(COPYRIGHT_HOLDER)" \
27         --package-name=$(PACKAGE) \
28         --package-version=$(VERSION) \
29         --msgid-bugs-address=$(MSGID_BUGS_ADDRESS) \
30         --from-code=UTF-8 \
31         --add-comments='TRANSLATORS:'
32
33 $(POTFILE): $(TRANSLATABLE_FILES) $(UI_FILES) src/ui/gui/gen-dot-desktop.sh
34         @$(MKDIR_P) po
35         $(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS)    $(TRANSLATABLE_FILES) --language=C --keyword=_ --keyword=N_ -o $@
36         $(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS) -j $(UI_FILES) --language=glade -o $@
37         $(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS) -j src/ui/gui/gen-dot-desktop.sh --language=shell --keyword=TRANSLATE -o $@
38
39
40 $(POFILES): $(POTFILE)
41         $(MSGMERGE) $(top_srcdir)/$@ $? -o $@
42         if test -e $(top_srcdir)/$@,aux ; then \
43                  touch $@ ; \
44                  msgcat --use-first $(top_srcdir)/$@,aux $@ -o $@; \
45         fi ;
46
47
48
49 SUFFIXES += .po .gmo
50 .po.gmo:
51         @$(MKDIR_P) `dirname $@`
52         $(MSGFMT) $< -o $@
53
54
55 GMOFILES = $(POFILES:.po=.gmo)
56
57 ALL_LOCAL += $(GMOFILES)
58
59 install-data-hook: $(GMOFILES)
60         for f in $(GMOFILES); do \
61           lang=`echo $$f | sed -e 's%po/\(.*\)\.gmo%\1%' ` ; \
62           $(MKDIR_P) $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES; \
63           $(INSTALL_DATA) $$f $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo ; \
64         done
65
66 uninstall-hook:
67         for f in $(GMOFILES); do \
68           lang=`echo $$f | sed -e 's%po/\(.*\)\.gmo%\1%' ` ; \
69           rm -f $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo ; \
70         done
71
72
73 EXTRA_DIST += $(POFILES) $(POTFILE)
74
75 CLEANFILES += $(GMOFILES) $(POTFILE)
76
77 # Clean $(POFILES) from build directory but not if that's the same as
78 # the source directory.
79 po_CLEAN:
80         @if test "$(srcdir)" != .; then \
81                 echo rm -f $(POFILES); \
82                 rm -f $(POFILES); \
83         fi
84 CLEAN_LOCAL += po_CLEAN