# $Id$

PKG       = tvctl
VER       = 0.1
PYTHON    = python
prefix    = /usr/local
bindir    = $(DESTDIR)$(prefix)/bin
docdir    = $(DESTDIR)$(prefix)/share/doc/$(PKG)-$(VER)
localedir = $(DESTDIR)$(prefix)/share/locale

PROG      = src/tvctl.py
DOCS      = doc/COPYING doc/dot.tvctl.sample
PO        = $(shell find po -name "*.po")
MO        = $(PO:.po=.mo)

all: $(MO)

$(MO): %.mo: %.po
	msgfmt $< -o po/`basename $< .po`.mo

install-doc:
	install -m0755 -d $(docdir)
	for d in $(DOCS); do \
		install -m0644 $$d $(docdir); \
	done

install-mo:
	for mo in $(MO); do \
		dir=$(localedir)/`basename $$mo .mo`/LC_MESSAGES; \
		install -m0755 -d $$dir; \
		install -m0644 $$mo $$dir/$(PKG).mo; \
	done

install: all install-doc install-mo
	install -m0755 -d $(bindir)
	install -m0755 $(PROG) $(bindir)

clean:
	rm -f $(MO)
