#!/usr/bin/make -f
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_HOST_MULTIARCH
DEB_DEBIAN_DIR=$(dir $(firstword $(MAKEFILE_LIST)))
VER=$(shell dpkg-parsechangelog -l$(DEB_DEBIAN_DIR)/changelog \
              | sed -rne 's,^Version: ([^-]+).*,\1,p')
GITREV=$(shell echo $(VER) | sed -rne 's,[0-9]+\.[0-9]+\.[0-9]+\.([0-9]+),\1,p')

%:
	dh $@ --buildsystem=cmake

override_dh_install:
	dh_install
	cp debian/sdrangelove-wrapper debian/sdrangelove/usr/bin/sdrangelove

version-to-get:
	echo $(VER) is $(GITREV)

get-orig-source: version-to-get
	git clone git://git.osmocom.org/gr-osmosdr
	cd gr-osmosdr && git archive --format=tar --prefix=gr-osmosdr-$(VER)/  $(GITREV) | gzip > ../gr-osmosdr_$(VER).orig.tar.gz
	rm -rf gr-osmosdr
