#!/usr/bin/make -f

DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')

export DH_OPTIONS

%:
	dh $@ --with autoreconf

override_dh_install:
	# dh_install -X*.a -X*.la -Xpkgconfig
	dh_install
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --movedev "debian/tmp/usr/include/$(DEBPKGNAME)*/$(DEBPKGNAME)/*.hpp" usr/include/$(DEBPKGNAME) \
		    --movedev "debian/tmp/usr/include/$(DEBPKGNAME)*/$(DEBPKGNAME)/*.h" usr/include/$(DEBPKGNAME) \
			debian/tmp/usr/lib/*/lib$(DEBPKGNAME)-*.so

override_dh_clean:
	dh_clean
	if [ -d debian/tmp_save_tests ] ; then \
	    mv debian/tmp_save_tests/* tests ; \
	    rmdir debian/tmp_save_tests ; \
	fi
	rm -f tests/compat.sh

override_dh_auto_build:
	mkdir -p debian/tmp_save_tests
	cp -a tests/* debian/tmp_save_tests
	dh_auto_build -- all bin/generate_sequence bin/test_all

# jellyfish contains a *really* big test which should *not* run on autobuilders
# if you have a *really* large machine you can try to activate this test by
# uncommenting the following.
#override_dh_auto_test:
#	BIG=1 dh_auto_test	
