#!/usr/bin/make -f

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

TIMESTAMP := $(shell date -d @$(SOURCE_DATE_EPOCH) --utc +%Y-%m-%dT%H:%M:%SZ)

LDFLAGS := -X main.version=$(DEB_VERSION_UPSTREAM)
LDFLAGS += -X main.commit=$(DEB_VERSION)
LDFLAGS += -X main.date=$(TIMESTAMP)

export DH_GOLANG_INSTALL_EXTRA := test/

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

override_dh_auto_build:
	dh_auto_build -- -ldflags '$(LDFLAGS)'

# Skip to install only qbt binary with dh_install
override_dh_auto_install:

execute_before_dh_installman:
	TZ=Etc/UTC debian/_build/bin/gen-docs -format man -out debian/tmp
