#!/usr/bin/make -f

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


# The magic debhelper  rule
%:
	dh $@

# This has to be exported to make some magic below work.
export DH_OPTIONS

topdir=$(shell pwd)
debdir=${topdir}/debian
tmpdir=${debdir}/tmp

tmplfile=${debdir}/console-common.templates
configfile=${debdir}/console-common.config

override_dh_auto_clean:
	dh_auto_clean
	rm -f build-stamp ${tmplfile} ${configfile} debian/substvars

override_dh_auto_install:
	dh_auto_install
	DH_LCDDIR=${topdir} DH_AUTOSCRIPTDIR=${topdir} DH_OPTIONS= \
		./dh_consoledata -pconsole-common -d

	cp kbd-config debian/console-common/usr/bin

override_dh_fixperms:
	dh_fixperms
	# This alignes permissions to dh-consoledata_0.7.91
	chmod +x debian/dh-consoledata/usr/share/debhelper/dh-consoledata/config.in

override_dh_gencontrol:
	# Don't config in console-common, only console-data
	rm debian/console-common/DEBIAN/config
	dh_gencontrol
