#!/usr/bin/make -f
control:debian/control

GCC_VER=$(shell dpkg-query -f '$${Version}' -W gcc | sed -e 's/^[0-9]://;s/-.*//')
THIS_VERSION=$(shell dpkg-parsechangelog -SVersion)

build:
build-arch:build
build-indep:build
binary-arch:binary
binary-indep:binary

binary:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_install
	dh_installdocs -A
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol -- "-v$(GCC_VER)-1~exp$(THIS_VERSION)" \
		"-Vhost:gnu-type=`dpkg-architecture -qDEB_HOST_GNU_TYPE | tr _ -`"
	dh_md5sums
	dh_builddeb

clean:
	dh_testdir
	dh_testroot
	dh_clean


debian/control:debian/control.in
	sh $< > $@

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