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

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
include /usr/share/dpkg/buildflags.mk

export QT_SELECT=qt5

# Skip tests on the archs they are known to be flaky with current configuration
testskip_architectures :=

ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	CONFIGURE_OPTS += "CONFIG+=no_tests"
endif

%:
	dh $@

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_configure:
	dh_auto_configure -- \
	    LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
	    DEB_HOST_MULTIARCH=$(DEB_HOST_MULTIARCH) \
	    QMAKE_CXXFLAGS="$(CFLAGS)" \
	    $(CONFIGURE_OPTS) \
	    lomiri-system-settings-online-accounts.pro

override_dh_auto_install:
	dh_auto_install

override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
ifneq (,$(filter $(DEB_HOST_ARCH),$(testskip_architectures)))
	mkdir -p debian/home
	-export HOME=debian/home && -dh_auto_test --max-parallel=1
else
	mkdir -p debian/home
	export HOME=debian/home && dh_auto_test --max-parallel=1
endif
endif

override_dh_auto_test-indep:

override_dh_auto_clean:
	dh_auto_clean
	rm -f po/*.mo

override_dh_clean:
	dh_clean
	rm -Rfv debian/home

get-orig-source:
	uscan --noconf --force-download --rename --download-current-version --destdir=..
