#!/usr/bin/make -f

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

export DH_GOLANG_INSTALL_EXTRA := \
	test/fulcio-policy-presigned.json \
	test/policy-hello-signed.json \
	test/test.json \
	test/test.txt

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

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

execute_after_dh_auto_install:
	rm -fv $(B)/test
	rm -fv $(B)/docgen

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
execute_before_dh_installman-arch:
	mkdir -pv $(M)
	help2man --no-info --version-string="$(DEB_VERSION)" \
		--name="Witness command-line tool" \
		-o $(M)/witness.1 \
		$(B)/witness
endif
