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

include /usr/share/dpkg/architecture.mk

export QT_MAJOR_VERSION=5

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
export QT_SELECT=qt$(QT_MAJOR_VERSION)-$(DEB_BUILD_MULTIARCH)-$(DEB_HOST_MULTIARCH)
endif

export PKG_CONFIG_PATH=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig

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

# work around CMake's lack of support for CPPFLAGS
CFLAGS+=$(CPPFLAGS)
CXXFLAGS+=$(CPPFLAGS)


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

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DQT_MAJOR_VERSION=$(QT_MAJOR_VERSION)

override_dh_missing:
	dh_missing --fail-missing

override_dh_fixperms:
	dh_fixperms
	chmod a-x debian/libqofono-tests/usr/libexec/libqofono-qt$(QT_MAJOR_VERSION)/tests/tests.xml

# FIXME: disable tests for now. These require ofono to be running and probably
#  need more love before they can be run during build-time (LP: #1334652)
override_dh_auto_test:
#	LD_LIBRARY_PATH=../../../src dh_auto_test

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