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)
8 all: ikiwiki.pot $(MOFILES)
11 for file in $(MOFILES); do \
12 lang=`echo $$file | sed 's/\.mo//'`; \
13 install -d $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/; \
14 install -m 0644 $$file $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/ikiwiki.mo; \
17 ikiwiki.pot: $(POTFILES)
18 @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 \
19 echo "Rebuilding the pot file"; \
20 xgettext $(POTFILES) -o ikiwiki.pot -Lperl --add-comments=translators; \
24 rm -f $(MOFILES) messages messages.mo
30 @echo -n "Merging ikiwiki.pot and $@"
31 @msgmerge $@ ikiwiki.pot -o $@.new 2>&1
32 # Typically all that changes was a date or line number. I'd prefer not to
33 # commit such changes, so detect and ignore them.
34 @if [ "`diff $@ $@.new | grep '[<>]' | grep -v '[<>] #:' | wc -l`" -ne 2 ]; then \
39 @msgfmt --statistics $@ 2>&1
42 @for file in $(POFILES); do \
43 lang=`echo $$file | sed 's/\.po//'`; \
45 msgfmt -o /dev/null -c -v --statistics $$lang.po;\