#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEBVERS := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2 \
		| cut -d- -f1)
VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
DKMS_WIFI_SRC_DIR := $(CURDIR)/debian/mt7630e-wireless/usr/src/mt7630e-wireless-$(VERSION)
DKMS_BT_SRC_DIR := $(CURDIR)/debian/mt7630e-bluetooth/usr/src/mt7630e-bluetooth-$(VERSION)

override_dh_auto_install:
	install -d $(DKMS_BT_SRC_DIR)
	install -d $(DKMS_WIFI_SRC_DIR)
	cp -a btloader/* $(DKMS_BT_SRC_DIR)
	cp -a rt2x00/* $(DKMS_WIFI_SRC_DIR)
	dh_auto_install

override_dh_dkms:
	dh_dkms -V $(VERSION)

%:
	dh $@ --with dkms

