#!/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)
	#sed -i -e 's/^prefix=.*/prefix=\/usr/' $(CURDIR)/libseccomp.pc \
	#  -e 's/^libdir=.*/libdir=$${prefix}\/lib\/$(DEB_HOST_MULTIARCH)/' \
	#  $(CURDIR)/libseccomp.pc

override_dh_auto_test:
	cd tests && ./regression 2>&1 | tee regression.out && \
	  grep -q "^ tests failed: 0" regression.out
