#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh  $@

# dh_usrlocal fails to remove some directories and because we
# probably have no actual need for it. So skip.
override_dh_usrlocal:

override_dh_auto_install:
	dh_auto_install -- prefix=/usr

PACKAGE = $(shell dpkg-parsechangelog | sed -ne 's/^Source: //p')
SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
TARBALL = $(PACKAGE)_$(SRC_VERSION).orig.tar.gz
.PHONY: get-orig-source
get-orig-source:
	wget https://github.com/puavo-org/$(PACKAGE)/archive/$(SRC_VERSION).tar.gz -O../$(TARBALL)
	tar -z -x -f ../$(TARBALL) --strip-components=1 -C .
get-ref-source:
	wget https://github.com/puavo-org/$(PACKAGE)/archive/$(REF).tar.gz -O../$(TARBALL)
	tar -z -x -f ../$(TARBALL) --strip-components=1 -C .
