#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEBIAN  := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)
DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')

%:
	dh $@ --with autoreconf

override_dh_strip:
	dh_strip -plibosmo-sigtran3 --dbg-package=libosmo-sigtran-dbg
	dh_strip -posmo-stp --dbg-package=osmo-stp-dbg

override_dh_install:
	sed -i "/dependency_libs/ s/'.*'/''/" `find . -name '*.la'`
	dh_install

# enable-static: we require the tests to link to the static libosmo-sigtran
# library to access symbols not starting with osmo_*
override_dh_auto_configure:
	dh_auto_configure -- --enable-static --with-systemdsystemunitdir=/lib/systemd/system

# Print test results in case of a failure
override_dh_auto_test:
	dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false)

override_dh_clean:
	dh_clean
	rm -f .version tests/package.m4 tests/testsuite
