Last active
December 12, 2017 22:41
-
-
Save GeorgeErickson/39983f7ee995be61282431d23fcfaf0a to your computer and use it in GitHub Desktop.
protobuf makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OS := $(shell uname -s) | |
PROTO_VERSION := 3.0.2 | |
PROTO_ZIP_FILE := /tmp/protoc-$(PROTO_VERSION).zip | |
PROTOC := /usr/local/bin/protoc-$(PROTO_VERSION) | |
ifeq ($(OS),Darwin) | |
PROTO_URL := https://github.com/google/protobuf/releases/download/v$(PROTO_VERSION)/protoc-$(PROTO_VERSION)-osx-x86_64.zip | |
PROTO_CHECKSUM := 06f7401ffe5211340692b0a16dc53f3d8f9dc8ef3c1f74378110ee222e36436d | |
else | |
PROTO_URL := "https://s3.amazonaws.com/dd-public-oss-mirror/protoc-$(PROTO_VERSION)-linux-x86_64.zip" | |
PROTO_CHECKSUM := e194ef8f1f3baf518bf3cba2e1c2657e5dea84a76a780f8ebb3b65ed29b271af | |
endif | |
$(PROTOC): | |
@curl -fsSL $(PROTO_URL) -o $(PROTO_ZIP_FILE) | |
@echo $(PROTO_CHECKSUM) $(PROTO_ZIP_FILE) | sha256sum --strict -c - | |
@unzip -p $(PROTO_ZIP_FILE) bin/protoc > $(PROTOC) | |
@rm $(PROTO_ZIP_FILE) | |
@chmod +x $(PROTOC) | |
proto: pb/*.proto | $(PROTOC) | |
rm -f $(wildcard *.pb.go) $(wildcard pb/*.pb.go) | |
$(PROTOC) -I=$(@D) -I=vendor -I=vendor/github.com/gogo/protobuf/protobuf --gogofaster_out=$(GOPATH)/src $< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment