From 821e36532631750ef68e24ae39987630e80ca3a4 Mon Sep 17 00:00:00 2001 From: Arthur Neves Date: Mon, 13 Nov 2017 13:11:14 -0500 Subject: [PATCH] Make sure proto is only required on proto tasks --- Makefile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d975742d18..68cf5520c5 100644 --- a/Makefile +++ b/Makefile @@ -109,14 +109,13 @@ install_protoc-gen-go: cp -a vendor/github.com/golang/protobuf $${GOPATH}/src/github.com/golang/ go install github.com/golang/protobuf/protoc-gen-go -PROTOC_DIR := $(VTROOT)/dist/grpc/usr/local/bin -PROTOC_EXISTS := $(shell type -p $(PROTOC_DIR)/protoc) -ifeq (,$(PROTOC_EXISTS)) - PROTOC_BINARY := $(shell which protoc) - ifeq (,$(PROTOC_BINARY)) - $(error "Cannot find protoc binary. Did bootstrap.sh succeed, and did you execute 'source dev.env'?") - endif - PROTOC_DIR := $(dir $(PROTOC_BINARY)) +PROTOC_BINARY := $(shell type -p $(VTROOT)/dist/grpc/usr/local/bin/protoc) +ifeq (,$(PROTOC_BINARY)) + PROTOC_BINARY := $(shell which protoc) +endif + +ifneq (,$(PROTOC_BINARY)) + PROTOC_DIR := $(dir $(PROTOC_BINARY)) endif PROTO_SRCS = $(wildcard proto/*.proto) @@ -129,6 +128,10 @@ PROTO_GO_TEMPS = $(foreach name, $(PROTO_SRC_NAMES), go/vt/.proto.tmp/$(name).pb proto: proto_banner $(PROTO_GO_OUTS) $(PROTO_PY_OUTS) proto_banner: +ifeq (,$(PROTOC_DIR)) + $(error "Cannot find protoc binary. Did bootstrap.sh succeed, and did you execute 'source dev.env'?") +endif + ifndef NOBANNER echo $$(date): Compiling proto definitions endif @@ -138,8 +141,8 @@ $(PROTO_PY_OUTS): py/vtproto/%_pb2.py: proto/%.proto $(PROTO_GO_OUTS): $(PROTO_GO_TEMPS) for name in $(PROTO_SRC_NAMES); do \ - mkdir -p go/vt/proto/$${name}; \ - cp -a go/vt/.proto.tmp/$${name}.pb.go go/vt/proto/$${name}/$${name}.pb.go; \ + mkdir -p go/vt/proto/$${name}; \ + cp -a go/vt/.proto.tmp/$${name}.pb.go go/vt/proto/$${name}/$${name}.pb.go; \ done $(PROTO_GO_TEMPS): install_protoc-gen-go