#!/usr/bin/make -f

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
	    $(if $(findstring $(DEB_BUILD_ARCH),s390 s390x),--disable-pthread) \
	    --enable-devel --enable-off64 --enable-swab \
	    --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)

clean:
	dh $@
	! test -e Makefile || $(MAKE) distclean
	rm -f build-*-stamp

override_dh_strip:
	dh_strip --dbg-package=libtokyocabinet-dbg

