#!/usr/bin/make -f

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

export DH_GOLANG_INSTALL_EXTRA := goldens

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

override_dh_auto_install:
	dh_auto_install --destdir=debian/keep-sorted/ -- --no-source

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
override_dh_installman:
	help2man --no-info --no-discard-stderr \
		--section=1 \
		--name="language-agnostic formatter that sorts lines between markers" \
		--version-string="$(DEB_VERSION_UPSTREAM)" \
		--output=_build/keep-sorted.1 \
		_build/bin/keep-sorted
	dh_installman _build/keep-sorted.1
endif
