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

# Uncomment this to be more picky with non-updated .symbols files
#export DPKG_GENSYMBOLS_CHECK_LEVEL=4

include /usr/share/dpkg/default.mk

include /usr/share/dpkg/buildflags.mk
# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

%:
	dh $@ --with pkgkde_symbolshelper

override_dh_missing:
	dh_missing --fail-missing

FLAGS := -DWerror=OFF
# Explicitly disable building with Valgrind on architectures without it.
valgrind_architectures := amd64 arm64 armhf i386 mips64el mipsel ppc64el s390x powerpc ppc64 x32
ifeq ($(filter $(DEB_HOST_ARCH), $(valgrind_architectures)),)
	FLAGS += -DWITH_VALGRIND=OFF
endif

override_dh_auto_configure:
	dh_auto_configure -- $(FLAGS)

override_dh_install:
	#clean gmock/gtest if it built in our build dir
	-rm -f debian/tmp/usr/lib/libgmock*.a debian/tmp/usr/lib/libgtest*.a
	-rm -rf debian/tmp/usr/include/gmock debian/tmp/usr/include/gtest
	dh_install

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