DOMAIN = gnue-forms

#XGETTEXT = xgettext --language=Python
XGETTEXT = pygettext

POTFILE = $(DOMAIN).pot
POFILES = $(shell ls *.po)
GMOFILES = $(shell ls *.po | sed -e "s/\.po/\.gmo/")

.SUFFIXES:
.SUFFIXES: .po .gmo

gmo: $(GMOFILES)

update-po:
	rm -f STATISTICS $(POTFILE) $(GMOFILES)
	make $(POFILES)

$(POTFILE):
	cd ../src; $(XGETTEXT) --output=../po/$(POTFILE) `find * -name '*.py'`

%.po: $(POTFILE)
	msgmerge --output-file=$@.tmp $@ $(POTFILE) && mv $@.tmp $@

%.gmo:
	echo -n "$*: " >> STATISTICS
	(LANGUAGE=C msgfmt --statistics --output-file=$@ $*.po 2>&1) | grep translated >> STATISTICS

.PHONY: gmo update-po
