#!/usr/bin/make -f

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

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

B = $(CURDIR)/debian/tmp/usr/bin
M = $(CURDIR)/debian/tmp/usr/share/man/man1

override_dh_auto_install:
	dh_auto_install
	rm -fv $(B)/mk-add-tree-request $(B)/sha256-n $(B)/use-agent
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
	mkdir -pv $(M)
	for p in key monitor submit token verify witness; do \
		help2man --no-info --version-string="$(DEB_VERSION)" \
			-Idebian/sigsum-$$p.h2m $(B)/sigsum-$$p \
			-o $(M)/sigsum-$$p.1; \
	done
endif
