#!/usr/bin/make -f
#export DH_VERBOSE = 1

VERSION ?= $(shell dpkg-parsechangelog |\
	     sed -rne 's/^Version: ([0-9.]+)[-+].*$$/\1/p')
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
export BUILDMOD=no

%:
	dh $@

override_dh_auto_install:
	dh_auto_install -- PREFIX=/usr

override_dh_install:
	mkdir -p debian/tmp/usr/src/kpatch-$(VERSION)
	dh_install -pkpatch-dkms -X.o -X.ko -Xkmod/patch kmod/ usr/src/kpatch-$(VERSION)
	dh_install -pkpatch-dkms Makefile.inc usr/src/kpatch-$(VERSION)
	dh_install -pkpatch-dkms debian/post-dkms.sh usr/src/kpatch-$(VERSION)
	dh_dkms -V $(VERSION)
	dh_install
