#!/usr/bin/make -f

deb_source := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
deb_version := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
upstream_version := $(shell echo '$(deb_version)' | sed 's/.*://; s/-[^-]*$$//')

# --remote doesn't work with git.linaro.org so this needs to be
# run from a local checkout
get-orig-source:
	rm -rf $(deb_source)-$(upstream_version)
	rm -f $(deb_source)-$(upstream_version).orig.tar.gz
	git clone --depth 1 git://git.linaro.org/people/jcrigby/linaro-boot-utils.git $(deb_source)-$(upstream_version)
	cd $(deb_source)-$(upstream_version) && git archive \
		--format=tar \
		--prefix=$(deb_source)-$(upstream_version)/ \
		v$(upstream_version) \
		| gzip >../$(deb_source)_$(upstream_version).orig.tar.gz
	rm -rf $(deb_source)-$(upstream_version)

#export DH_VERBOSE=1

%:
	dh $@ 
