#!/usr/bin/make -f

export DEB_BUILD_HARDENING=1

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_SRC_DIR := $(CURDIR)/debian/fwts-efi-runtime-dkms/usr/src/fwts-efi-runtime-dkms-$(VERSION)

override_dh_auto_install:
	install -d $(DKMS_SRC_DIR)
	cp -a efi_runtime/* $(DKMS_SRC_DIR)
	dh_auto_install

override_dh_dkms:
	dh_dkms -V $(VERSION)

override_dh_auto_test:
ifneq ($(DEB_BUILD_ARCH),arm64)
	dh_auto_test $@
endif

%:
	dh $@ --with autoreconf,dkms
