#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/utils.mk

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

DEB_BUILD_PARALLEL = 1

# use the NEWS file as upstream ChangeLog...
DEB_DH_INSTALLCHANGELOGS_ARGS = NEWS
DEB_INSTALL_DOCS_ALL = README AUTHORS HACKING

DEB_CONFIGURE_SCRIPT := ./autogen.sh

DEB_CONFIGURE_EXTRA_FLAGS := --disable-silent-rules \
                             --localstatedir=/var \
                             --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
                             --includedir=/usr/include/$(DEB_HOST_MULTIARCH) \
                             --libexecdir=/usr/lib/$(DEB_HOST_MULTIARCH)/polkit-mate \
                             --disable-silent-rules \
                             --disable-static \
                             --enable-gtk-doc

common-install-indep:: remove-cruft install-wrapper
common-install-arch:: remove-cruft install-wrapper
common-binary-post-install-arch:: list-missing

remove-cruft::
	rm -fv debian/tmp/usr/lib/*/*.la

install-wrapper::
	mkdir -p debian/tmp/usr/bin/
	sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/' < debian/bin/mate-polkit.in > debian/tmp/usr/bin/mate-polkit

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