#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DH_GOPKG := github.com/tomnomnom/gron
export GO_LDFLAGS += -X main.gronVersion=${DEB_VERSION_UPSTREAM}

export DH_VERBOSE = 1

override_dh_auto_build:
	dh_auto_build -- -ldflags '$(GO_LDFLAGS)'
	sed -e "s/__VERSION__/$(DEB_VERSION_UPSTREAM)/g" < debian/gron.1.md.in > debian/gron.1.md
	pandoc debian/gron.1.md -s -f markdown -t man -o debian/gron.1

override_dh_auto_install:
	dh_auto_install -- --no-source
	# Install completions
	install -D -m644 $(CURDIR)/completions/gron.fish \
			$(CURDIR)/debian/gron/usr/share/fish/vendor_completions.d/gron.fish

override_dh_installchangelogs:
	pandoc -f markdown_github -t plain -o CHANGELOG CHANGELOG.mkd
	dh_installchangelogs CHANGELOG

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