#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# Enable verbose build details.
export V=1

%:
	dh $@ --parallel

override_dh_auto_clean:
	$(MAKE) dist-clean
	rm -f tests/regression.out

override_dh_auto_configure:
	./configure --prefix=/usr \
	  --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	cd tests && ./regression 2>&1 | tee regression.out && \
	  grep -q "^ tests failed: 0" regression.out || true
endif
