aboutsummaryrefslogtreecommitdiffstats
path: root/po/Makefile
diff options
context:
space:
mode:
authorastokes <astokes@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-03-26 20:25:37 +0000
committerastokes <astokes@ef72aa8b-4018-0410-8976-d6e080ef94d8>2010-03-26 20:25:37 +0000
commit1be8e807cbe690b82298fa7572795b55051c13e1 (patch)
tree516ae8696ce53c7e6f891d724ad8fc7cf73f5b93 /po/Makefile
parent66cd754dcddf039e454934231f6662d5bb49959d (diff)
downloadsos-1be8e807cbe690b82298fa7572795b55051c13e1.tar.gz
makefile
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@873 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'po/Makefile')
-rw-r--r--po/Makefile60
1 files changed, 60 insertions, 0 deletions
diff --git a/po/Makefile b/po/Makefile
new file mode 100644
index 00000000..e79a4a3b
--- /dev/null
+++ b/po/Makefile
@@ -0,0 +1,60 @@
+# What is this package?
+NLSPACKAGE = sos
+POTFILE = $(NLSPACKAGE).pot
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_DIR = /usr/bin/install -d
+
+# destination directory
+INSTALL_NLS_DIR = $(DESTDIR)/usr/share/locale
+
+# PO catalog handling
+MSGMERGE = msgmerge -v
+XGETTEXT = xgettext --default-domain=$(NLSPACKAGE) \
+ --add-comments --language=python
+MSGFMT = msgfmt --statistics --verbose
+
+# What do we need to do
+POFILES = $(wildcard *.po)
+MOFILES = $(patsubst %.po,%.mo,$(POFILES))
+PYSRC = $(wildcard ../sos/*.py)
+SRCFILES = $(PYSRC)
+
+all:: update-po $(MOFILES)
+
+$(POTFILE):
+ $(XGETTEXT) --keyword=_ --keyword=N_ $(SRCFILES)
+ @if cmp -s $(NLSPACKAGE).po $(POTFILE); then \
+ rm -f $(NLSPACKAGE).po; \
+ else \
+ mv -f $(NLSPACKAGE).po $(POTFILE); \
+ fi; \
+
+update-po: Makefile $(POTFILE) refresh-po
+
+refresh-po: Makefile
+ for cat in $(POFILES); do \
+ lang=`basename $$cat .po`; \
+ if $(MSGMERGE) $$lang.po $(POTFILE) > $$lang.pot ; then \
+ mv -f $$lang.pot $$lang.po ; \
+ echo "$(MSGMERGE) of $$lang succeeded" ; \
+ else \
+ echo "$(MSGMERGE) of $$lang failed" ; \
+ rm -f $$lang.pot ; \
+ fi \
+ done
+
+clean:
+ @rm -fv *mo *~ .depend
+
+install: $(MOFILES)
+ @for n in $(MOFILES); do \
+ l=`basename $$n .mo`; \
+ $(INSTALL_DIR) $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \
+ $(INSTALL_DATA) --verbose $$n $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \
+ done
+
+%.mo: %.po
+ $(MSGFMT) -o $@ $<
+
+.PHONY: missing depend $(POTFILE)