]> sipb.mit.edu Git - ikiwiki.git/blob - po/Makefile
web commit by JeremyReed: initial page to document banned users
[ikiwiki.git] / po / Makefile
1 # List here all source files with translatable strings.
2 POTFILES=$(sort $(shell find ../IkiWiki -type f -name \*.pm)) \
3         ../ikiwiki.in ../IkiWiki.pm
4
5 POFILES=$(wildcard *.po)
6 MOFILES=$(POFILES:.po=.mo)
7
8 all: ikiwiki.pot $(MOFILES)
9
10 install: all
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; \
15         done
16
17 ikiwiki.pot: $(POTFILES)
18         @echo "Rebuilding the pot file"
19         xgettext $(POTFILES) -o ikiwiki.pot -Lperl
20
21 clean:
22         rm -f ikiwiki.pot $(MOFILES) messages messages.mo
23
24 %.mo: %.po
25         msgfmt -o $@ $<
26
27 %.po: ikiwiki.pot
28         @echo -n "Merging ikiwiki.pot and $@"
29         @msgmerge $@ ikiwiki.pot -o $@.new
30 # Typically all that changes was a date. I'd prefer not to commit such
31 # changes, so detect and ignore them.
32         @if [ "`diff $@ $@.new | grep '[<>]' | wc -l`" -ne 2 ]; then \
33                 mv -f $@.new $@; \
34         else \
35                 rm -f $@.new; \
36         fi
37         @msgfmt --statistics $@
38
39 check:
40         @for file in $(POFILES); do \
41                 lang=`echo $$file | sed 's/\.po//'`; \
42                 printf "$$lang: "; \
43                 msgfmt -o /dev/null -c -v --statistics $$lang.po;\
44         done