#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

SONAME := $(shell dpkg-parsechangelog -SVersion| cut -d ":" -f 2 |cut -d "-" -f 1 |cut -d "." -f 1,2)

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
%:
	dh $@ --sourcedirectory=Release

override_dh_auto_clean:
	dh_auto_clean
	rm -rf html latex

override_dh_auto_build-indep:
	doxygen Release/public_apis_doxyfile

override_dh_install-indep:
	dh_install -plibcpprest-doc html/* usr/share/doc/libcpprest-doc/html

override_dh_install:
	dh_install -plibcpprest-dev		debian/tmp/usr/include				usr/
	dh_install -plibcpprest-dev		debian/tmp/usr/lib/libcpprest.so		usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -plibcpprest$(SONAME)	debian/tmp/usr/lib/libcpprest.so.$(SONAME)	usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -plibcpprest-dev		debian/tmp/usr/lib/cpprestsdk			usr/lib/cmake/

override_dh_auto_test:
	if [ -f obj-*/Binaries/test_runner ]; then dh_auto_test; fi
