#!/usr/bin/make -f

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

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

execute_after_dh_install:
	rm -fv $(CURDIR)/debian/gitsign/usr/bin/cli

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

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
execute_before_dh_installman-arch:
	mkdir -pv $(M)
	help2man --version-string="$(DEB_VERSION)" \
		--no-info \
		--name="Keyless Git signing using Sigstore" \
		--output $(M)/gitsign.1 \
		$(B)/gitsign
	help2man --version-string="$(DEB_VERSION)" \
		--no-info \
		--name="Gitsign(1) credential caching helper" \
		--output $(M)/gitsign-credential-cache.1 \
		$(B)/gitsign-credential-cache
endif
