#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with elpa

override_dh_auto_configure:
	dh_auto_configure -- \
		--disable-rpath \
		--disable-hserver \
		--disable-gui

override_dh_auto_install:
	dh_auto_install
	rm -v \
		debian/tmp/usr/lib/*/libpoke.a \
		debian/tmp/usr/lib/*/libpoke.la \
		debian/tmp/usr/bin/pk-elfextractor \
		debian/tmp/usr/bin/pk-strings

PKGEL_VERSION = $(subst +dfsg,,$(DEB_VERSION_UPSTREAM))

override_dh_elpa:
	sed "s@%VERSION%@\"$(PKGEL_VERSION)\"@" \
		debian/poke-pkg.el.in \
		> debian/tmp/usr/share/emacs/site-lisp/poke-pkg.el
	dh_elpa

override_dh_auto_clean:
ifneq (,$(wildcard ./Makefile))
	dh_auto_clean
endif
