#!/usr/bin/make -f

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

# This is the debhelper compatibility version to use.
export DH_COMPAT=4

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

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE       ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE      ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

INSTALL= /usr/bin/install -p -m 644

DESTDIR=$(CURDIR)/debian/`dh_listpackages`

clean:
	dh_testdir
	dh_testroot

	rm -f build-stamp

	$(MAKE) clean

	dh_clean

build: build-stamp
build-stamp: 
	dh_testdir

	$(MAKE)

	touch build-stamp

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	install -D build-env $(DESTDIR)/usr/bin/build-env
	install -D use-env $(DESTDIR)/usr/bin/use-env

	dh_install

binary-indep: 
binary-arch: build install
	dh_installdebconf
	dh_installdeb
	dh_installdocs
	dh_installchangelogs
	dh_shlibdeps
	dh_gencontrol
	dh_strip
	dh_fixperms
	dh_compress
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch

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