#!/usr/bin/make -f

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

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_CFLAGS_STRIP = -O2
export DEB_CXXFLAGS_STRIP = -O2
export DEB_CFLAGS_MAINT_APPEND = -O1
export DEB_CXXFLAGS_MAINT_APPEND = -O1

arch = $(shell dpkg-architecture -qDEB_BUILD_ARCH)

%:
	dh $@ --buildsystem=cmake+ninja


# Test suite does not support 32 bit architectures at the moment
override_dh_auto_test:
	echo ${arch}
	if [ "${arch}" = "armel" ] || \
	   [ "${arch}" = "armhf" ] || \
	   [ "${arch}" = "mips" ] || \
	   [ "${arch}" = "mipsel" ] || \
	   [ "${arch}" = "x32" ] || \
	   [ "${arch}" = "s390x" ] ; then \
	   echo "Do not care of test result on this architecture" ;\
	else \
	   echo "Do run tests on this architecture" ;\
	   dh_auto_test ;\
	fi
