#!/usr/bin/make -f

# DH_VERBOSE := 1

# export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

pkg=$(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
export PYBUILD_NAME=$(pkg)
PYVERS = $(shell pyversions -r)
PY3VERS = $(shell py3versions -r)

%:
	dh $@ --buildsystem=cmake

override_dh_auto_clean:
	dh_auto_clean

override_dh_auto_configure:
	dh_auto_configure -- -DINSTALL_PREFIX=/usr

override_dh_auto_build:
	# no idea about the purpose of the dynamic library - executables are not simply linked against it
	dh_auto_build -- HYPHYGTK MP2 MPI GTEST # LIB

override_dh_auto_test:
	find obj-* -name HYPHYGTEST -exec \{\} \;

override_dh_install:
	# smallcaps for executables
	for bindir in `find . -type d -name bin` ; do \
	    for bin in $${bindir}/* ; do \
	        # ln -s `basename $${bin}` $${bindir}/`basename $${bin} | tr [A-Z] [a-z]` ; \
	        mv $${bindir}/`basename $${bin}` $${bindir}/`basename $${bin} | tr [A-Z] [a-z]` ; \
	    done ; \
	done
	dh_install
