#!/usr/bin/make -f

# DH_VERBOSE := 1

DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
export CONFIG_SHELL = /bin/sh
export SHELL = /bin/sh
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with autoreconf

override_dh_installexamples:
	make -C test clean
	dh_installexamples
	sed -i -e '/^TOPPREDDATA/d' \
	    -e 's?../src/toppred?/usr/bin/toppred?' \
	    -e 's?$$srcdir/??g' \
	    debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME)/examples/test/*.test
	TMPFILE=`mktemp` && \
	egrep -v -f debian/filter-patterns debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME)/examples/test/Makefile  > $$TMPFILE && \
	mv $$TMPFILE debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME)/examples/test/Makefile && \
	egrep -v -f debian/filter-patterns debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME)/examples/data/Makefile > $$TMPFILE && \
	mv $$TMPFILE debian/$(DEBPKGNAME)/usr/share/doc/$(DEBPKGNAME)/examples/data/Makefile && \
	rm -f $$TMPFILE

#get-orig-source:
#	. debian/get-orig-source
