#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
export DEB_DESTDIR ?= $(CURDIR)/debian/tmp/

OPTS=DESTDIR=$(DEB_DESTDIR) VERBOSE=$(if $(filter terse,$(DEB_BUILD_OPTIONS)),0,1)

%:
	dh $@ --builddirectory=builddir

override_dh_auto_configure:
	mkdir -p $(CURDIR)/builddir
	cp $(CURDIR)/build/* $(CURDIR)/builddir/.
	dh_auto_configure -- -D_INSTALL_PREFIX=/usr -D_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) \
          -DPKG_CONGIG_DIR=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig

override_dh_auto_build:
	dh_auto_build -- $(OPTS)

override_dh_auto_install:
	$(MAKE) -C $(CURDIR)/builddir install $(OPTS)

override_dh_gencontrol:
	dh_gencontrol -p kernelshark -- -v2.9.3+really$(DEB_VERSION)
	dh_gencontrol --remaining-packages