#!/usr/bin/make -f

export DH_GOLANG_GO_GENERATE := 1
export DH_GOLANG_INSTALL_EXTRA := test/

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

override_dh_clean:
	dh_clean
	## Remove Files-Excluded (when built from checkout or non-DFSG tarball):
	$(RM) -rv `perl -0nE 'say $$1 if m{^Files\-Excluded\:\s*(.*?)(?:\n\n|Files:|Comment:)}sm;' debian/copyright`
	-find . -type f -name '*.pb.go' -delete -printf 'removed %p\n'            ## delete generated .pb.go files
	-find vendor -type d -empty -delete -print

override_dh_auto_test:
#	PATH="$(CURDIR)/_build/bin:$${PATH}" dh_auto_test --max-parallel=3 -- -test.short -timeout 20m -failfast

override_dh_install:
	## Do not install "github.com/hashicorp/consul/vendor" to -dev package.
	dh_install  -X/src/github.com/hashicorp/consul/vendor

override_dh_installsystemd:
	dh_installsystemd --no-enable --no-start