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