#!/usr/bin/make -f
# -*- makefile -*-

include /usr/share/dpkg/pkg-info.mk

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

LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

override_dh_auto_build:
	dh_auto_build -- LIBDIR=$(LIBDIR) release pkgconfig debian/libgbinder1.install debian/libgbinder-dev.install
	dh_auto_build -- -C test/binder-bridge release
	dh_auto_build -- -C test/binder-call release
	dh_auto_build -- -C test/binder-list release
	dh_auto_build -- -C test/binder-ping release

override_dh_auto_install:
	dh_auto_install -- LIBDIR=$(LIBDIR) install-dev
	dh_auto_install -- -C test/binder-bridge
	dh_auto_install -- -C test/binder-call
	dh_auto_install -- -C test/binder-list
	dh_auto_install -- -C test/binder-ping


execute_before_dh_installman:
	for n in debian/tmp/usr/bin/binder-*; do \
		LD_LIBRARY_PATH=debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH):$(LD_LIBRARY_PATH) help2man -n "testing tool for libgbinder" -N --version-string='$(DEB_VERSION_UPSTREAM)' "$$n" > debian/$${n##*/}.1; \
	done

%:
	dh $@
