#!/usr/bin/make -f

#export DH_VERBOSE := 1
export DH_GOLANG_GO_GENERATE := 1
export DH_GOLANG_EXCLUDES := benchmark xds
export DH_GOLANG_INSTALL_EXTRA = $(shell find . -name '*.sh')

export PATH := $(CURDIR)/debian:$(PATH)
export CURDIR := $(CURDIR)

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

override_dh_auto_configure:
	dh_auto_configure
## Build integrity: remove generated .pb.go files whenever possible:
	-find _build \
            -not -path '*/binarylog/grpc_binarylog_v1/*' \
            -not -path '*/reflection/*' \
            -type f -name '*.pb.go' -delete -printf 'removed %p\n'

override_dh_auto_test:
	DH_GOLANG_EXCLUDES="$(DH_GOLANG_EXCLUDES) internal/resolver/dns internal/proto/grpc_service_config" \
	dh_auto_test -- -short

override_dh_auto_install:
	dh_auto_install -- --no-binaries
