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