Update PO files from Transifex.
[tails-persistence-setup.git] / po / Makefile
blob6fb68f1d3f61a76807178f442aab1a1742656967
1 # Makefile for various po files.
3 srcdir = .
4 destdir = $(DESTDIR)$(PREFIX)
6 #CATALOGS = $(addsuffix .po, LINGUAS)
7 CATALOGS = $(LINGUAS)
8 MO_FILES = $(addsuffix .mo, $(LINGUAS))
10 MSGMERGE = msgmerge
11 MSGFMT = msgfmt
12 XGETTEXT = xgettext
13 CATOBJEXT = .po
15 include PACKAGE
17 TD = $(strip $(TEXTDOMAIN))
19 default: help
21 all: $(TD).pot update-po update-mo
23 help:
24 @echo "Available targets:"
25 @echo " pot - remake master catalog"
26 @echo " update-po - merge po files"
27 @echo " update-mo - regenerate mo files"
28 @echo " install - install mo files"
29 @echo " all - all of the above"
31 POTFILES = $(srcdir)/POTFILES.in \
32 $(shell cat $(srcdir)/POTFILES.in)
34 pot: $(TD).pot
36 clean:
37 rm -f *~ *.bak *.mo
39 # FIXME: The parameter --from-code is only needed if your sources contain
40 # any 8 bit data (even in comments). UTF-8 is only a guess here, but it
41 # will at least accept any 8 bit data.
43 # The parameter "--language=perl" is not strictly needed because the
44 # source language of all our files will be auto-detected by xgettext
45 # by their filename extension. You should even avoid this parameter
46 # if you want to extract strings from multiple source languages.
47 $(TD).pot: $(POTFILES)
48 $(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \
49 --add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \
50 --copyright-holder="$(COPYRIGHT_HOLDER)" \
51 --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
52 --language=perl && \
53 rm -f $@ && mv $(TD).pox $@
55 install: $(MO_FILES)
56 cd $(srcdir); \
57 targetdir='$(destdir)/share/locale'; \
58 languages='$(LINGUAS)'; \
59 for lang in $$languages; do \
60 mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \
61 dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \
62 cat="$$lang.mo"; \
63 echo "installing $$cat as $$dest"; \
64 cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \
65 done
67 update-mo: $(MO_FILES)
69 update-po:
70 $(MAKE) $(TD).pot
71 cd $(srcdir); \
72 catalogs='$(CATALOGS)'; \
73 for cat in $$catalogs; do \
74 cat=`basename $$cat`; \
75 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
76 mv $$lang.po $$lang.old.po; \
77 echo "$$lang:"; \
78 if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \
79 rm -f $$lang.old.po; \
80 else \
81 echo "msgmerge for $$cat failed!"; \
82 rm -f $$lang.po; \
83 mv $$lang.old.po $$lang.po; \
84 fi; \
85 done
87 .SUFFIXES:
88 .SUFFIXES: .po .mo
90 .po.mo:
91 $(MSGFMT) --check --statistics --verbose -o $@ $<