From 412325bd35c084c7e9bea62801774516a0baf0a9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Wed, 18 Mar 2009 15:22:10 +0100 Subject: added check and merge po targets --- makefiles/gmake/help.mk | 2 +- makefiles/gmake/i18n.mk | 88 +++++++++++++++++++------------------------------ makefiles/gmake/top.mk | 15 +++++++++ 3 files changed, 49 insertions(+), 56 deletions(-) (limited to 'makefiles') diff --git a/makefiles/gmake/help.mk b/makefiles/gmake/help.mk index aaf311a..324ff04 100644 --- a/makefiles/gmake/help.mk +++ b/makefiles/gmake/help.mk @@ -10,5 +10,5 @@ make install install (set 'DESTDIR' and 'prefix' at will) make dist[-Z|-gz|-bz2] create tarball containing all sources make help show this very help page make init-po create initial version of the gettext files -make update-po update the gettext files after changes +make merge-po merge the gettext files after changes make check-po check sanity of gettext files diff --git a/makefiles/gmake/i18n.mk b/makefiles/gmake/i18n.mk index 660f62a..c5fa314 100644 --- a/makefiles/gmake/i18n.mk +++ b/makefiles/gmake/i18n.mk @@ -11,7 +11,7 @@ # # provides: # - target: init-po -# - target: update-po +# - target: merge-po # - taget: check-po .PHONY: init-po update-po all_po clean_po install_po @@ -29,7 +29,35 @@ po/$(CATALOG_NAME).pot: $(GETTEXT_FILES) $(addprefix -k, $(GETTEXT_TRIGGERS)) --flag=_:1:pass-c-format \ -d $(CATALOG_NAME) -n -F $(GETTEXT_FILES) +ifneq "$(GETTEXT_FILES)" "" init-po: po/$(CATALOG_NAME).pot +else +init-po: +endif + +ifneq "$(GETTEXT_FILES)" "" +merge-po: po/$(CATALOG_NAME).pot + @test -z "$(GETTEXT_LANGUAGES)" || \ + for lang in $(GETTEXT_LANGUAGES)""; do ( \ + echo "merging po/$$lang.mo and $<.." && \ + if $(MSGMERGE) -F -o po/$$lang.po.new po/$$lang.po $<; then \ + cp po/$$lang.po po/$$lang.po.bak && \ + mv po/$$lang.po.new po/$$lang.po; \ + else \ + echo "Please check, msgmerge for po/$$lang.po failed!"; \ + rm -f po/$$lang.po.new; \ + fi \ + ) done +else +merge-po: +endif + +check-po: $(PO_FILES) + @test -z "$^" || \ + for file in $^""; do ( \ + echo "checking gettext file $$file of catalog $(CATALOG_NAME).." && \ + $(MSGFMT) -c -v -o /dev/null $$file || exit 1 \ + ) done clean_po: @-rm -f $(MO_FILES) @@ -47,64 +75,14 @@ install_po: $(INSTALL) -m 644 po/$$lang.mo $(localedir)/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo || exit 1 \ ) done -# TODO: sort out below - -# merge the changes into the translation tables keeping existing -# translations -# msgmerge -s -U test_gettext_de_CH.po test_gettext.pot -# -# compile message files into binary format: -# msgfmt -c -v -o test_gettext_de.mo test_gettext_de.po - -#test_gettext_de.po: test_gettext.pot -# msgmerge -s -U $@ -i $< -# touch $@ - -#test_gettext_de_CH.po: test_gettext.pot -# msgmerge -s -U $@ -i $< -# touch $@ - -# TODO: big cleanup for GCC compilation flags -# in older gcc (before 4.2.1) we can't switch off warnings selectivly with a -# prage. So gettext misses a format attribute which results in a warning -# test_gettext.c:81: warning: format not a string literal, argument types not checked -# (Solaris 8, NetBSD) -# on Solaris 10 we get a system header conflict if we don't specify -std=c99 -#test_gettext.o : test_gettext.c -# $(CC) -c -g -o $@ $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $< - -# LANG setting differs from platform to platform a little bit :-( -#ifeq "$(PLATFORM)" "LINUX" -#TEST_LANG = de_CH -#endif -#ifeq "$(PLATFORM)" "FREEBSD" -#TEST_LANG = de_CH.ISO8859-1 -#endif -#ifeq "$(PLATFORM)" "OPENBSD" -#TEST_LANG = de_CH.ISO8859-1 -#endif -#ifeq "$(PLATFORM)" "SUNOS" -#TEST_LANG = de_CH.iso_8859_1 -#endif -#ifeq "$(PLATFORM)" "CYGWIN" -#TEST_LANG = de -#endif -#ifeq "$(PLATFORM)" "NETBSD" -#TEST_LANG = de -#endif - -#local_test: test_gettext_de.mo test_gettext_de_CH.mo -# @echo "Testing gettext.." -# @mkdir -p locale/de_CH/LC_MESSAGES -# @mkdir -p locale/de/LC_MESSAGES -# @cp test_gettext_de.mo locale/de_CH/LC_MESSAGES/test_gettext.mo -# @cp test_gettext_de.mo locale/de/LC_MESSAGES/test_gettext.mo -# @LANG=$(TEST_LANG) ./test_gettext >/dev/null 2>&1 - else # No NLS supported wanted, provide dummy targets +init-po: +merge-po: +check-po: + all_po: clean_po: install_po: diff --git a/makefiles/gmake/top.mk b/makefiles/gmake/top.mk index 037c37f..c276758 100644 --- a/makefiles/gmake/top.mk +++ b/makefiles/gmake/top.mk @@ -49,4 +49,19 @@ doc: help: @cat $(TOPDIR)/makefiles/gmake/help.mk +.PHONY: init-po +init-po: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d init-po || exit 1); done) + +.PHONY: merge-po +merge-po: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d merge-po || exit 1); done) + +.PHONY: check-po +check-po: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d check-po || exit 1); done) + -include $(TOPDIR)/makefiles/gmake/dist.mk -- cgit v1.2.3-54-g00ecf