#!/usr/bin/make -f
# -*- makefile -*-

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

export DPKG_GENSYMBOLS_CHECK_LEVEL=4

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
# Skip tests on the archs they are known to be flaky with current configuration
# Ref.: https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/1585942
testskip_architectures := powerpc ppc64el s390x

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
export DEB_BUILD_PROFILES := nocheck
endif

include /usr/share/dpkg/architecture.mk

# Add migrations add-on when build on Ubuntu & original name is available.
DH_MIGRATIONS = $(shell type dh_migrations >/dev/null 2>&1 && echo ",migrations")

%:
	dh $@ --with python3$(DH_MIGRATIONS)

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_BUILD_TYPE=Debug

override_dh_auto_test:
ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(testskip_architectures)))
	dh_auto_test
else
	-dh_auto_test
endif

override_dh_python3:
	dh_python3 -plomiri-dialer-app-autopilot

override_dh_missing:
	dh_missing --fail-missing
