Blame po/Makefile

Packit 792a06
#
Packit 792a06
# taken from python-meh sources
Packit 792a06
# Makefile for the PO files (translation) catalog
Packit 792a06
#
Packit 792a06
# $Id$
Packit 792a06
Packit 792a06
TOP	 = ../..
Packit 792a06
Packit 792a06
# What is this package?
Packit 792a06
NLSPACKAGE	= oscap-anaconda-addon
Packit 792a06
POTFILE		= $(NLSPACKAGE).pot
Packit 792a06
INSTALL		= /usr/bin/install -c
Packit 792a06
INSTALL_DATA	= $(INSTALL) -m 644
Packit 792a06
INSTALL_DIR	= /usr/bin/install -d
Packit 792a06
Packit 792a06
# destination directory
Packit 792a06
INSTALL_NLS_DIR = $(RPM_BUILD_ROOT)/usr/share/locale
Packit 792a06
Packit 792a06
# PO catalog handling
Packit 792a06
MSGMERGE	= msgmerge -v
Packit 792a06
XGETTEXT	= xgettext --default-domain=$(NLSPACKAGE) \
Packit 792a06
		  --add-comments
Packit 792a06
MSGFMT		= msgfmt --statistics --verbose
Packit 792a06
Packit 792a06
# What do we need to do
Packit 792a06
POFILES		= $(wildcard *.po)
Packit 792a06
MOFILES		= $(patsubst %.po,%.mo,$(POFILES))
Packit 792a06
PYSRC		= $(wildcard ../org_fedora_oscap/*.py ../org_fedora_oscap/*/*.py ../org_fedora_oscap/*/*/*.py)
Packit 792a06
GLADEFILES = $(wildcard ../org_fedora_oscap/*/*/*.glade)
Packit 792a06
Packit 792a06
all::  update-po $(MOFILES)
Packit 792a06
Packit 792a06
potfile: $(PYSRC) glade-po
Packit 792a06
	$(XGETTEXT) -L Python --keyword=_ --keyword=N_ $(PYSRC) tmp/*.h
Packit 792a06
	@if cmp -s $(NLSPACKAGE).po $(POTFILE); then \
Packit 792a06
	    rm -f $(NLSPACKAGE).po; \
Packit 792a06
	else \
Packit 792a06
	    mv -f $(NLSPACKAGE).po $(POTFILE); \
Packit 792a06
	fi; \
Packit 792a06
	rm -rf tmp/
Packit 792a06
Packit 792a06
glade-po: $(GLADEFILES)
Packit 792a06
	rm -rf tmp/
Packit 792a06
	@which intltool-extract > /dev/null 2>&1 || echo "You may not have the intltool-extract installed, don't be surprised if the operation fails."
Packit 792a06
	for f in $(GLADEFILES); do \
Packit 792a06
		intltool-extract --type=gettext/glade -l $$f ;\
Packit 792a06
	done
Packit 792a06
Packit 792a06
update-po: Makefile refresh-po
Packit 792a06
Packit 792a06
refresh-po: Makefile
Packit 792a06
	for cat in $(POFILES); do \
Packit 792a06
		lang=`basename $$cat .po`; \
Packit 792a06
		if $(MSGMERGE) $$lang.po $(POTFILE) > $$lang.pot ; then \
Packit 792a06
			mv -f $$lang.pot $$lang.po ; \
Packit 792a06
			echo "$(MSGMERGE) of $$lang succeeded" ; \
Packit 792a06
		else \
Packit 792a06
			echo "$(MSGMERGE) of $$lang failed" ; \
Packit 792a06
			rm -f $$lang.pot ; \
Packit 792a06
		fi \
Packit 792a06
	done
Packit 792a06
Packit 792a06
clean:
Packit 792a06
	@rm -fv *mo *~ .depend
Packit 792a06
	@rm -rf tmp
Packit 792a06
Packit 792a06
install: $(MOFILES)
Packit 792a06
	@for n in $(MOFILES); do \
Packit 792a06
	    l=`basename $$n .mo`; \
Packit 792a06
	    $(INSTALL_DIR) $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \
Packit 792a06
	    $(INSTALL_DATA) --verbose $$n $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \
Packit 792a06
	done
Packit 792a06
Packit 792a06
uninstall:
Packit 792a06
	rm -rfv $(INSTALL_NLS_DIR)/*/LC_MESSAGES/$(NLSPACKAGE).mo
Packit 792a06
Packit 792a06
%.mo: %.po
Packit 792a06
	$(MSGFMT) -o $@ $<
Packit 792a06
Packit 792a06
.PHONY: missing depend
Packit 792a06