-
Notifications
You must be signed in to change notification settings - Fork 113
/
Makefile
39 lines (31 loc) · 1.04 KB
/
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
38
39
SHELL := /bin/bash
REPO := $(shell pwd)
GOFILES_NOVENDOR := $(shell go list -f "{{.Dir}}" ./...)
PACKAGES_NOVENDOR := $(shell go list ./...)
PROTOC_GEN_GO := $(GOPATH)/bin/protoc-gen-go
# Protobuf generated go files
PROTO_FILES = $(shell find . -path ./vendor -prune -o -type f -name '*.proto' -print)
PROTO_GO_FILES = $(patsubst %.proto, %.pb.go, $(PROTO_FILES))
PROTO_GO_FILES_REAL = $(shell find . -path ./vendor -prune -o -type f -name '*.pb.go' -print)
.PHONY: build
build: proto
go build -o goshimmer
# Protobuffing
.PHONY: proto
proto: $(PROTO_GO_FILES)
# If $GOPATH/bin/protoc-gen-go does not exist, we'll run this command to install it.
$(PROTOC_GEN_GO):
go install google.golang.org/protobuf/cmd/protoc-gen-go
# Implicit compile rule for GRPC/proto files
%.pb.go: %.proto | $(PROTOC_GEN_GO)
protoc $< --go_out=paths=source_relative:.
.PHONY: clean_proto
clean_proto:
@rm -f $(PROTO_GO_FILES_REAL)
.PHONY: vet
vet:
@echo "Running go vet."
@go vet ${PACKAGES_NOVENDOR}
.PHONY: test
test: vet
go test -timeout 30s ./... ${GOPACKAGES_NOVENDOR}