#!/usr/bin/make -f

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

# Golang does not support PIE on mips
# cf. https://github.com/golang/go/issues/21222
ifeq ($(filter $(DEB_HOST_ARCH),mips mipsel mips64el),)
GO_FLAGS += -buildmode=pie
endif

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

override_dh_auto_install:
	dh_auto_install -- --no-source

execute_before_dh_installman:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	help2man debian/tfk8s/usr/bin/tfk8s \
		--no-info --no-discard-stderr \
		--version-string="$(DEB_VERSION)" \
		-n "Tool for converting Kubernetes YAML manifests to Terraform HCL" > debian/tfk8s.1
endif
