Consolidate translatable strings
[pspp-builds.git] / po / automake.mk
1 include $(top_srcdir)/po/Makevars
2
3 XGETTEXT=xgettext
4 MSGMERGE=msgmerge
5 MSGFMT=msgfmt
6
7 POFILES=po/ca.po po/en_GB.po po/es.po po/nl.po po/pt_BR.po
8
9 POTFILE=po/$(DOMAIN).pot
10
11 TRANSLATABLE_FILES = $(DIST_SOURCES) $(all_q_sources)
12
13 XGETTEXT_OPTIONS = \
14         --copyright-holder="$(COPYRIGHT_HOLDER)" \
15         --package-name=$(PACKAGE) \
16         --package-version=$(VERSION) \
17         --msgid-bugs-address=$(MSGID_BUGS_ADDRESS) \
18         --add-comments='TRANSLATORS:'
19
20 $(POTFILE): $(TRANSLATABLE_FILES) $(UI_FILES)
21         @$(MKDIR_P) po
22         $(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS)    $(TRANSLATABLE_FILES) --language=C --keyword=_ --keyword=N_ -o $@
23         $(XGETTEXT) --directory=$(top_srcdir) $(XGETTEXT_OPTIONS) -j $(UI_FILES) --language=glade -o $@
24
25
26 $(POFILES): $(POTFILE)
27         $(MSGMERGE) $(top_srcdir)/$@ $? -o $@
28
29
30 SUFFIXES += .po .gmo
31 .po.gmo:
32         @$(MKDIR_P) `dirname $@`
33         $(MSGFMT) $< -o $@
34
35
36 GMOFILES = $(POFILES:.po=.gmo)
37
38 ALL_LOCAL += $(GMOFILES)
39
40 install-data-hook: $(GMOFILES)
41         for f in $(GMOFILES); do \
42           lang=`echo $$f | sed -e 's%po/\(.*\)\.gmo%\1%' ` ; \
43           $(MKDIR_P) $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES; \
44           $(INSTALL_DATA) $$f $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo ; \
45         done
46
47 uninstall-hook:
48         for f in $(GMOFILES); do \
49           lang=`echo $$f | sed -e 's%po/\(.*\)\.gmo%\1%' ` ; \
50           rm -f $(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/$(DOMAIN).mo ; \
51         done
52
53
54 EXTRA_DIST += $(POFILES) $(POTFILE)
55
56 CLEANFILES += $(GMOFILES) $(POTFILE)
57
58 # Clean $(POFILES) from build directory but not if that's the same as
59 # the source directory.
60 po_CLEAN:
61         @if test "$(srcdir)" != .; then \
62                 echo rm -f $(POFILES); \
63                 rm -f $(POFILES); \
64         fi
65 CLEAN_LOCAL += po_CLEAN