enhance Makefile for language translators
authorTobias Bell <tobias.bell@gmail.com>
Thu, 26 Mar 2009 08:07:28 +0100
changeset 7893 606723f4a327
parent 7892 67e59a9886d5
child 7894 caef5fdf1375
enhance Makefile for language translators To update a po-file just do 'make i18n/xx.po'. No other po-file will be touched.
Makefile
--- a/Makefile	Thu Mar 26 19:01:06 2009 +0900
+++ b/Makefile	Thu Mar 26 08:07:28 2009 +0100
@@ -2,6 +2,7 @@
 export PREFIX
 PYTHON=python
 PURE=
+PYTHON_FILES:=$(shell find mercurial hgext doc -name '*.py')
 
 help:
 	@echo 'Commonly used make targets:'
@@ -76,7 +77,9 @@
 test-%:
 	cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
 
-update-pot:
+update-pot: i18n/hg.pot
+
+i18n/hg.pot: $(PYTHON_FILES)
 	mkdir -p i18n
 	pygettext -d hg -p i18n --docstrings \
 	  mercurial/commands.py hgext/*.py hgext/*/__init__.py
@@ -86,10 +89,13 @@
         # parse these them even though they are not marked for
         # translation. Extracting with an explicit encoding of
         # ISO-8859-1 will make xgettext "parse" and ignore them.
-	find mercurial hgext doc -name '*.py' | xargs \
+	echo $^ | xargs \
 	  xgettext --from-code ISO-8859-1 --join --sort-by-file \
 	  -d hg -p i18n -o hg.pot
 
+%.po: i18n/hg.pot
+	msgmerge --no-location --update $@ $^
+
 .PHONY: help all local build doc clean install install-bin install-doc \
 	install-home install-home-bin install-home-doc dist dist-notests tests \
 	update-pot