#!/usr/bin/make -f
#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 $@ --parallel --with autoreconf

override_dh_auto_configure:
	./configure $(CROSS) \
		--prefix=/usr \
		--bindir=\$${prefix}/games \
		--datarootdir=\$${prefix}/share \
		--datarootdir=\$${prefix}/share/games \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--disable-silent-rules \
		CFLAGS="$(CFLAGS)" \
		LDFLAGS="$(LDFLAGS)"

override_dh_auto_install:
	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
	rm -rfv debian/7kaa/usr/share/games/doc

override_dh_strip:
	dh_strip --dbg-package=7kaa-dbg

override_dh_builddeb:
	dh_builddeb -- -Zxz
