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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

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

include /usr/share/dpkg/architecture.mk

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure --builddirectory=build-qt5 --buildsystem=qmake \
		-- LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
		CONFIG+="$(if $(filter %-doc, $(shell dh_listpackages)),,no_docs)" \
		QT_MAJOR_VERSION=5 \
		../accounts-qml-module.pro
	dh_auto_configure --builddirectory=build-qt6 --buildsystem=qmake6 \
		-- LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
		CONFIG+="$(if $(filter %-doc, $(shell dh_listpackages)),,no_docs)" \
		QT_MAJOR_VERSION=6 \
		../accounts-qml-module.pro

override_dh_auto_build:
	dh_auto_build --builddirectory=build-qt5 --buildsystem=qmake
	dh_auto_build --builddirectory=build-qt6 --buildsystem=qmake6

override_dh_auto_install:
	dh_auto_install --builddirectory=build-qt5
	dh_auto_install --builddirectory=build-qt6
	# remove empty directories
	find debian/tmp -type d -empty -print -delete
	# avoid shipping .gitignore files (mostly in the documentation)
	find debian/tmp -name .gitignore -print -delete

execute_after_dh_clean:
	# remove build-cruft stemming from make docs-html call during dh_auto_build override
	rm -rf doc/html/*

override_dh_auto_test:
	dh_auto_test --builddirectory=build-qt5
	dh_auto_test --builddirectory=build-qt6

override_dh_auto_clean:
	dh_auto_clean --builddirectory=build-qt5
	dh_auto_clean --builddirectory=build-qt6

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