#!/usr/bin/make -f

# Include test fixtures.
export DH_GOLANG_INSTALL_EXTRA := expfmt/testdata config/testdata

# Remove the version package, to avoid circular dependency. These are copied
# later using dh_install.
export DH_GOLANG_EXCLUDES := github.com/prometheus/common/version

DEBVERS    ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
VERSION    ?= $(shell echo '$(DEBVERS)' | sed 's/^[[:digit:]]*://; s/[-].*//')
DEBPKGNAME ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Source: //p')

%:
	dh $@ --buildsystem=golang --with=golang

gen-orig-tgz:
	if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.gz ] ; then \
            git archive --format=tar.gz --prefix=$(DEBPKGNAME)-$(VERSION)/ \
                upstream/$(VERSION) >../$(DEBPKGNAME)_$(VERSION).orig.tar.gz; \
        fi
