#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

%:
	dh $@

# the tests want to link with -lubsan
UBSAN_ARCHS=amd64 arm64 armel armhf i386 ppc64el s390x
UBSAN_ARCHS += powerpc
ifeq (nocheck,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
ENABLE_TESTS=n
else
ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),$(UBSAN_ARCHS)))
ENABLE_TESTS=y
else
ENABLE_TESTS=n
endif
endif

ifeq ($(ENABLE_TESTS),y)
override_dh_auto_configure:
	dh_auto_configure
else
override_dh_auto_configure:
	dh_auto_configure -- -DENABLE_TESTS=OFF

override_dh_auto_test:

endif
