#!/usr/bin/make -f
# -*- makefile -*-
#
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif

%:
	dh $@

override_dh_strip:
	/bin/true

override_dh_autoreconf:
	/bin/true

override_sh_clean:
	rm -f config.sub config.guess
	dh $@

override_dh_auto_configure:
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
	cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
	cp -f /usr/share/misc/config.guess config.guess
endif
	./configure $(CROSS) \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--sysconfdir=/etc \
		--localstatedir=/var/lib \
		--with-default-user=mfs \
		--with-default-group=mfs \
		$(shell if dpkg-buildflags --export=configure > /dev/null 2> /dev/null; then dpkg-buildflags --export=configure ; fi)

