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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PACKAGE=$(shell dh_listpackages)

build: build-stamp
build-stamp:
	dh_testdir
	# Grab ISO codes from iso-codes package
	chmod u+x ./get-iso-codes
	./get-iso-codes
	# Pick up SUPPORTED list of locales and keep only relevant information
	chmod u+x ./get-SUPPORTED
	./get-SUPPORTED
	# Build the templates
	chmod u+x ./mktemplates ./mkshort
	./mktemplates
	./mkshort
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -rf debian/pobuild debian/iso-codes debian/short-tmp debian/locales
	dh_clean debian/templates.tmp debian/templates debian/SUPPORTED-short

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs etc
	# The following while we have no other way to get SUPPORTED
	# Should become useless when we will have it
	install -m644 debian/SUPPORTED-short debian/$(PACKAGE)/etc/SUPPORTED-short
	install -m644 debian/short-tmp/shortlists debian/$(PACKAGE)/etc/shortlists

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
#
# Note that this builds a .udeb, which is not policy compliant or anything.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
