#!/usr/bin/make -f

NULL =

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

built_binaries := $(shell dh_listpackages)

configure_options := --enable-headless-tests

ifneq ($(filter %-doc,$(built_binaries)),)
configure_options += --enable-docs
else
configure_options += --disable-docs
endif

override_dh_install:
	find debian/tmp -name *.la -delete
	find debian/tmp -name *.a -delete
	rm debian/tmp/usr/share/apport/package-hooks/source_plank.py
	mkdir -p debian/tmp/usr/share/devhelp/books/
	ln -s ../../doc/plank/html debian/tmp/usr/share/devhelp/books/html
	dh_install

override_dh_missing:
	dh_missing --fail-missing

override_dh_auto_configure:
	dh_auto_configure -- $(configure_options)
	                     $(NULL)

override_dh_auto_test:
	dh_auto_test || true

override_dh_makeshlibs:
	dh_makeshlibs -p libplank1 -V 'libplank1 (>= 0.11.89)'

%:
	dh $@

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