#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

include /usr/share/cdbs/1/rules/debhelper.mk
include debian/scripts/cdbs/class/ruby-vars.mk

LINGUAS := ja da fr nb
MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po))

update-po:
	xgettext --language=python apt-listbugs -o po/apt-listbugs.pot
	for po in $(LINGUAS); do \
	  msgmerge -U po/$$po.po po/apt-listbugs.pot; \
	done

%.mo: %.po
	msgfmt -o $@ $<


apt-listbugs.1: apt-listbugs
	rd2 -r rd/rd2man-lib.rb -o apt-listbugs apt-listbugs

common-build-indep:: apt-listbugs.1 $(MOFILES)
	
clean::
	rm -f apt-listbugs.1
	rm -f $(MOFILES)

common-install-indep:: common-build-indep

	dh_installdirs

	# Add here commands to install the package into debian/apt-listbugs.
	install -m 755 apt-listbugs $(DEB_DESTDIR)/usr/sbin/
	install -m 644 10apt-listbugs $(DEB_DESTDIR)/etc/apt/apt.conf.d/
	install -m 644 ignore_bugs $(DEB_DESTDIR)/usr/share/apt-listbugs/
	install -m 755 aptcleanup $(DEB_DESTDIR)/usr/share/apt-listbugs/
	install -m 644 lib/debian/*.rb $(DEB_DESTDIR)/usr/share/apt-listbugs/debian/
	for mo in $(MOFILES); do \
	  install -d $(DEB_DESTDIR)/usr/share/locale/`basename $$mo .mo`/LC_MESSAGES; \
	  install -m644 $$mo $(DEB_DESTDIR)/usr/share/locale/`basename $$mo .mo`/LC_MESSAGES/apt-listbugs.mo; \
	done

