#!/usr/bin/make -f

# Export DEB_VERSION
include /usr/share/dpkg/pkg-info.mk

export DH_GOLANG_EXCLUDES := file
export VERSION := $(shell echo $(DEB_VERSION) | cut -d'-' -f1)

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

override_dh_auto_build:
	dh_auto_build --  \
		-ldflags="-extldflags -Wl,-z,now -s -w \
			-X 'github.com/kong/deck/cmd.VERSION=$(VERSION)'"

override_dh_auto_install:
	dh_auto_install -- --no-source

override_dh_installman:
	help2man --no-info --version-string=$(VERSION) \
		-n "Configuration management for Kong and Kong Enterprise" \
		debian/deck/usr/bin/deck > debian/deck.1
	dh_installman

override_dh_auto_clean:
	rm -f debian/deck.1
	dh_auto_clean
