#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DH_GOLANG_INSTALL_EXTRA := examples/route_guide/testdata testdata
export DH_GOLANG_EXCLUDES := grpclb$$
export BUILDDIR := build

%:
	dh $@ --buildsystem=golang --with=golang --builddirectory=$(BUILDDIR)

PB_GO_FILES := $(wildcard */*/*.pb.go */*/*/*.pb.go)

override_dh_auto_configure:
	# grpc_testingv3/testv3.pb.go is not re-generated because it was
	# intentionally generated by an older version of protoc-gen-go.
	# comments from upstream in code
	rm -v -f $(filter-out reflection/grpc_testingv3/testv3.pb.go, $(PB_GO_FILES))
	go generate ./...
	dh_auto_configure
	mkdir -p -v $(BUILDDIR)/src/google.golang.org/
	cp -v -a debian/vendor/google.golang.org/genproto $(BUILDDIR)/src/google.golang.org/

override_dh_auto_test:
	dh_auto_test -- -short

override_dh_auto_install:
	dh_auto_install -- --no-binaries
