#!/usr/bin/make -f

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

# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# Remove buildpath from binaries
export DEB_CXXFLAGS_MAINT_APPEND=-DNDEBUG

# Verbose make output
export VERBOSE=1

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

%:
	dh $@ --buildsystem cmake

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_VERBOSE_MAKEFILE=1

override_dh_auto_test:
# Ignore test failures on problematic architectures only
ifneq (,$(filter $(DEB_BUILD_ARCH),mips mips64el mipsel))
	dh_auto_test || echo "Ignoring test failures"
else
	dh_auto_test
endif

override_dh_installchangelogs:
	dh_installchangelogs -k CHANGELOG.md