First definition

This commit is contained in:
2019-12-31 15:43:01 +01:00
parent 2706bd2d79
commit e7cd6f7e40
8 changed files with 1108 additions and 0 deletions

40
Makefile Normal file
View File

@ -0,0 +1,40 @@
.PHONY: generate
PROTOC_GEN_GO := $(GOPATH)/bin/protoc-gen-go
PROTOC := $(shell which protoc)
# If protoc isn't on the path, set it to a target that's never up to date, so
# the install command always runs.
ifeq ($(PROTOC),)
PROTOC = must-rebuild
endif
# Figure out which machine we're running on.
UNAME := $(shell uname)
$(PROTOC):
# Run the right installation command for the operating system.
ifeq ($(UNAME), Darwin)
brew install protobuf
endif
ifeq ($(UNAME), Linux)
sudo apt-get install protobuf-compiler
endif
# You can add instructions for other operating systems here, or use different
# branching logic as appropriate.
# If $GOPATH/bin/protoc-gen-go does not exist, we'll run this command to install
# it.
$(PROTOC_GEN_GO):
go get -u github.com/golang/protobuf/protoc-gen-go
events.pb.go: events/events.proto | $(PROTOC_GEN_GO) $(PROTOC)
protoc --go_out=./go events/events.proto
events.pb.py: events/events.proto | $(PROTOC)
protoc --python_out=./python events/events.proto
events: events.pb.go events.pb.py
# This is a "phony" target - an alias for the above command, so "make compile"
# still works.
generate: events