#!/usr/bin/make -f

# DH_VERBOSE := 1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

DEB_CMAKE_EXTRA_FLAGS = -DCMAKE_BUILD_TYPE=Release \
                        -Dspoa_build_executable=ON \
                        -Dspoa_build_tests=ON

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS)

override_dh_install:
	dh_install
	file-rename 's/_static\.a/.a/' `find debian -name libspoa_static.a`
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --exclude-la \
		    --movedev debian/tmp/usr/include/* usr/include \
		    --movedev debian/tmp/usr/lib/*/pkgconfig usr/lib/$(DEB_HOST_MULTIARCH) \
		    debian/tmp/usr/lib/*/*.so

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	`find . -name spoa_test`
	`find . -name spoa | grep bin` test/data/sample.fastq
endif
