#!/usr/bin/make -f

export DH_OPTIONS

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

include /usr/share/dpkg/default.mk

%:
	dh $@

override_dh_clean:
	dh_clean
	if [ -d debian/tmp_save_tests ] ; then \
	    mv debian/tmp_save_tests/* tests ; \
	    rmdir debian/tmp_save_tests ; \
	fi

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

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp

override_dh_install:
	mkdir -p debian/tmp/usr/lib/$(DEB_SOURCE)
	mv debian/tmp/usr/bin/* debian/tmp/usr/lib/$(DEB_SOURCE)
	dh_install
	find debian -name "*.a" -delete
	find debian -name "*.la" -delete
	find debian -name "*.so" -delete
	find debian -name "pkgconfig" -type d | xargs rm -rf
	# there is no development package for this version any more - remove header files to keep dh_missing happy
	rm -rf debian/tmp/usr/include/jellyfish*

override_dh_installman:
	dh_installman
	mv debian/$(DEB_SOURCE)/usr/share/man/man1/jellyfish.1 debian/$(DEB_SOURCE)/usr/share/man/man1/jellyfish1.1

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# dh_auto_test && true
	echo "****************************************************** do not test for the moment ******************************************************"
# 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
endif
