#!/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=kbd-chooser
VERSION=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
ARCH=$(shell dpkg --print-architecture)
FILENAME=$(PACKAGE)_$(VERSION)_$(ARCH).udeb

# Udebs have no postrm file, don't make one
export DH_OPTIONS=-n

configure: configure-stamp
configure-stamp:
	dh_testdir
	touch configure-stamp

build: configure-stamp build-stamp
build-stamp:
	dh_testdir
	$(MAKE)
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	-$(MAKE) clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) install DESTDIR=$(CURDIR)/debian/kbd-chooser
	install -m0755 debian/prebaseconfig  debian/$(PACKAGE)/usr/lib/prebaseconfig.d/70kbd-chooser
	install -m0755 debian/S55kbd-chooser debian/$(PACKAGE)/etc/rcS.d/S55kbd-chooser

# Build architecture-independent files here.
binary-indep: 

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdebconf
	dh_link
	dh_strip
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol -- -n$(FILENAME)
	rm debian/$(PACKAGE)/DEBIAN/conffiles
	dh_builddeb --filename=$(FILENAME)

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