#!/usr/bin/make -f

BUILDDIR = $(CURDIR)/debian/build

libwibble_source = $(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libwibble-dev)
tagcoll2_source = $(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libtagcoll2-dev)

%:
	dh $@ --buildsystem=cmake --builddirectory=$(BUILDDIR)

override_dh_fixperms:
	dh_fixperms
	test -e /usr/bin/dh_buildinfo && dh_buildinfo

override_dh_auto_build:
	dh_auto_build
	make -C $(BUILDDIR) unit
	make -C $(BUILDDIR) doc

override_dh_auto_install:
	dh_auto_install
	dh_installdocs -plibept-dev -n $(BUILDDIR)/doc/html
	dh_installdocs -plibept-dev -n $(BUILDDIR)/doc/libept.doxytags

override_dh_gencontrol:
	dh_gencontrol -- \
	  -Vlibwibble:Source="$(libwibble_source)" \
	  -Vtagcoll2:Source="$(tagcoll2_source)"

debsrc:
	debian/check_versions
	gbp buildpackage --git-pristine-tar -S -us -uc

