#!/usr/bin/make -f

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ --parallel

DEB_CMAKE_EXTRA_FLAGS += \
        -DCMAKE_BUILD_TYPE:STRING=RELEASE \
        -DCMAKE_SKIP_RPATH:BOOL=ON \
        -DBUILD_DEBIAN:BOOL=ON \
        -DBUILD_TESTING:BOOL=ON

override_dh_auto_configure:
	dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS)

override_dh_auto_test:
#Make the test suit fatal on supported arches
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386 kfreebsd-amd64 kfreebsd-amd64))
	dh_auto_test
else
	dh_auto_test || true
endif


get-orig-source:
	. debian/get-orig-source
