1 # List here all source files with translatable strings.
2 POTFILES=$(sort $(shell find ../IkiWiki -type f -name \*.pm)) \
3 ../ikiwiki.in ../IkiWiki.pm
5 POFILES=$(wildcard *.po)
6 MOFILES=$(POFILES:.po=.mo)
13 for file in $(MOFILES); do \
14 lang=`echo $$file | sed 's/\.mo//'`; \
15 install -d $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/; \
16 install -m 0644 $$file $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/ikiwiki.mo; \
19 ikiwiki.pot: $(POTFILES)
20 @if perl -e '($$ver)=`xgettext -V | head -n 1`=~/.*\s+([0-9]+\.[0-9]+)/; die "gettext $$ver too old, not updating the pot file\n" if $$ver < 0.16'; then \
21 echo "Rebuilding the pot file"; \
22 xgettext $(POTFILES) -o ikiwiki.pot -Lperl --add-comments=translators; \
26 rm -f $(MOFILES) messages messages.mo
32 @echo -n "Merging ikiwiki.pot and $@"
33 @msgmerge $@ ikiwiki.pot -o $@.new 2>&1
34 # Typically all that changes was a date or line number. I'd prefer not to
35 # commit such changes, so detect and ignore them.
36 @if [ "`diff $@ $@.new | grep '[<>]' | grep -v '[<>] #:' | wc -l`" -ne 2 ]; then \
41 @msgfmt --statistics $@ 2>&1
44 @for file in $(POFILES); do \
45 lang=`echo $$file | sed 's/\.po//'`; \
47 msgfmt -o /dev/null -c -v --statistics $$lang.po;\