Blame po/Makefile

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