#!/usr/bin/make -f

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

%:
	dh $@

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)
	env PATH=$(PATH):$(B) \
		help2man --no-info --version-string="$(DEB_VERSION)" \
		-Idebian/certstream-server-go.h2m \
		certstream-server-go -o $(M)/certstream-server-go.1
	env PATH=$(PATH):$(B) \
		help2man --no-info --version-string="$(DEB_VERSION)" \
		--no-discard-stderr \
		--name="certstream certificate picker" \
		certpicker -o $(M)/certpicker.1
	sed -i '/disable exposing PSI metrics because of failed init/d' \
		$(M)/certstream-server-go.1 $(M)/certpicker.1
endif
