tools.mk: install protoc

- works only for Linux / Mac 64bit
- you need to call it manually - make protoc
- on Mac, brew install protoc might be favorable
This commit is contained in:
Anton Kaliaev
2019-11-20 15:09:54 +04:00
parent 0d0d151e2e
commit d7d61e9a6c
2 changed files with 31 additions and 17 deletions

View File

@@ -35,7 +35,7 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(shell cd $(shell dirname $(mkfile_path)); pwd)
###
# tools
# Go tools
###
TOOLS_DESTDIR ?= $(GOPATH)/bin
@@ -63,7 +63,7 @@ $(CERTSTRAP):
protobuf: $(PROTOBUF)
$(PROTOBUF):
@echo "Get Protobuf"
@echo "Get GoGo Protobuf"
@go get github.com/gogo/protobuf/protoc-gen-gogo@v1.3.1
# used to build tm-monitor binaries
@@ -80,5 +80,32 @@ $(GOODMAN):
tools-clean:
rm -f $(CERTSTRAP) $(PROTOBUF) $(GOX) $(GOODMAN)
rm -f tools-stamp
rm -rf /usr/local/include/google/protobuf
rm -f /usr/local/bin/protoc
.PHONY: all tools tools-clean
###
# Non Go tools
###
# Choose protobuf binary based on OS (only works for 64bit Linux and Mac).
# NOTE: On Mac, installation via brew (brew install protoc) might be favorable.
PROTOC_ZIP=""
ifneq ($(OS),Windows_NT)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
PROTOC_ZIP="protoc-3.10.1-linux-x86_64.zip"
endif
ifeq ($(UNAME_S),Darwin)
PROTOC_ZIP="protoc-3.10.1-osx-x86_64.zip"
endif
endif
protoc:
@echo "Get Protobuf"
@echo "In case of any errors, please install directly from https://github.com/protocolbuffers/protobuf/releases"
@curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.10.1/$(PROTOC_ZIP)
@unzip -o $(PROTOC_ZIP) -d /usr/local bin/protoc
@unzip -o $(PROTOC_ZIP) -d /usr/local 'include/*'
@rm -f $(PROTOC_ZIP)
.PHONY: all tools tools-clean protoc