#!/usr/bin/make -f

# DH_VERBOSE := 1

include /usr/share/dpkg/default.mk

BUILD_DIR := obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
BUILD_DATE := $(shell TZ=UTC LC_ALL=C dpkg-parsechangelog | grep Date: | cut -d' ' -f2-7)
export BDATE=$(shell TZ=UTC LC_ALL=C date -d"$(BUILD_DATE)" +'%Y-%m-%d')
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --buildsystem=cmake

override_dh_install-arch:
	dh_install -a
	# install binary
	cp -a $(BUILD_DIR)/bin/*/plast debian/$(DEB_SOURCE)/usr/lib/$(DEB_SOURCE)/bin
	# no need for the includes
	rm -rf debian/*/usr/include

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	scripts/test-plast.sh
endif
