#!/usr/bin/make -f

export DH_GOLANG_EXCLUDES := crit-go/magic-gen

PBGO   := rpc/rpc.pb.go stats/stats.pb.go
PBGO_S := rpc/rpc.proto stats/stats.proto

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

$(PBGO):
	cp -rv debian/missing-sources/* ./
	protoc --go_out=. $(@:.pb.go=.proto)

override_dh_clean:
	dh_clean $(PBGO) $(PBGO_S) */*.URL

override_dh_auto_configure: $(PBGO)
	dh_auto_configure
	# remove test dir manually, this dir will cause `go list` failed
	# C source files not allowed when not using cgo or SWIG: piggie.c
	rm -rvf _build/src/github.com/checkpoint-restore/go-criu/test/
