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

PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
PKG  = $(word 2, $(shell dpkg-parsechangelog -l$(PKD)/changelog))
UVER = $(shell dpkg-parsechangelog -l$(PKD)/changelog | \
               sed -nr 's/^Version: (.*:)?(.*)-(.*)/\2/p')

.PHONY: get-orig-source
get-orig-source: $(PKG)_$(UVER).orig.tar.xz
$(PKG)_$(UVER).orig.tar.xz: $(PKD)/get-orig-source $(PKD)/copyright
	set $^; $$1 $@ "`sed -n 's/^Source: //p' $$2`/tarball/%s"

%:
	dh $@ --with dkms

override_dh_install:
	dh_install Makefile *.c *.h usr/src/$(PKG)-$(UVER)/

override_dh_dkms:
	dh_dkms -V $(UVER)

# do nothing
override_dh_auto_build override_dh_auto_test override_dh_auto_install override_dh_auto_clean:
