doc/Makefile
changeset 811 66a8812457d6
parent 810 707e2be17a43
child 812 d7251818be37
--- a/doc/Makefile	Thu Sep 06 00:32:45 2012 +0200
+++ b/doc/Makefile	Sat Sep 08 01:24:36 2012 +0200
@@ -16,6 +16,23 @@
 
 .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
 
+mofiles :=
+langs = fr kr
+rstfiles = $(shell find * -name '*.rst')
+define by_lang
+mos = $$(rstfiles:%.rst=locale/$(1)/LC_MESSAGES/%.mo)
+$$(mos):locale/$(1)/LC_MESSAGES/%.mo: %_$(1).po
+	mkdir -p `dirname $$@`
+	msgfmt $$^ -o $$@
+mofiles += $$(mos)
+pos = $$(rstfiles:%.rst=%_$(1).po)
+$$(pos):%_$(1).po: $(BUILDDIR)/locale/%.pot 
+	if [ -e $$@ ] ; then msgmerge -U $$@ $$<; else cat $$< > $$@; fi
+endef
+$(foreach lang, $(langs), $(eval $(call by_lang,$(lang))))
+
+mofiles: $(mofiles)
+
 help:
 	@echo "Please use \`make <target>' where <target> is one of"
 	@echo "  html       to make standalone HTML files"
@@ -136,6 +153,7 @@
 	@echo
 	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
 
+
 changes:
 	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
 	@echo