#!/usr/bin/make -f

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

override_dh_auto_install:
	mv obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)/bin/sql_exporter \
	obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)/bin/prometheus-sql-exporter
	dh_auto_install -- --no-source

override_dh_installman:
	PATH=$(PATH):obj-$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)/bin \
	help2man --no-discard-stderr --no-info \
		--name "SQL Exporter for Prometheus" \
		--version-string=$(shell dpkg-parsechangelog -S Version) \
		prometheus-sql-exporter > prometheus-sql-exporter.1
	dh_installman
