-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
37 lines (30 loc) · 926 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
SHELL := /bin/bash
TMP := /tmp
GO := /usr/local/go/bin/go
VERSION := $(shell grep Version version.go | sed -e 's/\"//g' -e 's/const Version = //')
PROTOC := /usr/bin/protoc
PROTOC_VERSION := 2.5.0
PROTOC_PREFIX := /usr
build: clean generate_proto
$(GO) build ./...
setup:
@if [ ! -e $(PROTOC) ]; \
then \
cd $(TMP) && \
wget https://protobuf.googlecode.com/files/protobuf-$(PROTOC_VERSION).tar.gz && \
tar -xzvf protobuf-$(PROTOC_VERSION).tar.gz && \
cd protobuf-$(PROTOC_VERSION) && \
./configure --prefix=$(PROTOC_PREFIX) && \
make && \
sudo make install; \
fi
go get github.com/golang/protobuf/{proto,protoc-gen-go}
@if [ "$(shell which protoc-gen-go)" == "" ]; then go install github.com/golang/protobuf/protoc-gen-go; fi
go get ./...
generate_proto:
$(PROTOC) --go_out=. ./test_types.proto
clean:
$(GO) clean
rm -f *.pb.go
test: build
$(GO) test