#!/usr/bin/make -f

DEB_CFLAGS_MAINT_APPEND  := $(shell getconf LFS_CFLAGS)
export DEB_CFLAGS_MAINT_APPEND

DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
VERSION = $(shell echo $(DEB_VERSION) | sed -e 's/-.*//; s/+dfsg.*//')

%:
	dh $@ --parallel

override_dh_install:
	dh_install --fail-missing

get-orig-source:
	git clone https://github.com/Benjamin-Dobell/Heimdall.git
	cd Heimdall && git checkout v$(VERSION)
	cd Heimdall && rm -rf libusb-1.0 Win32 libpit/autom4te.cache \
		.git Heimdall/heimdall/autom4te.cache
	mv Heimdall heimdall-flash-$(VERSION)
	tar zcvf heimdall_$(VERSION)+dfsg.orig.tar.gz heimdall-flash-$(VERSION)/ --numeric-owner
	rm -rf heimdall-flash-$(VERSION)

