-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
51 lines (40 loc) · 1.41 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
40
41
42
43
44
45
46
47
48
49
50
PREFIX?=$(shell pwd)
.DEFAULT: all
all: watermelon test
# Package list
PKGS=$(shell go list ./cmd/... ./server/...| grep -v test )
server/pb/inventory.pb.go: proto/inventory.proto
protoc --proto_path=proto --go_out=plugins=grpc:../../.. $<
server/pb/module.pb.go: proto/module.proto
protoc --proto_path=proto --go_out=plugins=grpc:../../.. $<
server/pb/host.pb.go: proto/host.proto
protoc --proto_path=proto --go_out=plugins=grpc:../../.. $<
server/pb/remote.pb.go: proto/remote.proto
protoc --proto_path=proto --go_out=plugins=grpc:../../.. $<
server/pb/empty.pb.go: proto/empty.proto
protoc --proto_path=proto --go_out=plugins=grpc:../../.. $<
proto: server/pb/inventory.pb.go server/pb/module.pb.go server/pb/remote.pb.go server/pb/host.pb.go server/pb/empty.pb.go
.PHONY: vet
vet:
@echo "+ $@"
@go vet $(PKGS)
.PHONY: fmt
fmt:
@echo "+ $@"
@test -z "$$(gofmt -s -l server 2>&1 | grep -v pb\.go | tee /dev/stderr)" || \
(echo >&2 "+ please format Go code with 'gofmt -s'" && false)
@test -z "$$(gofmt -s -l cmd 2>&1 | tee /dev/stderr)" || \
(echo >&2 "+ please format Go code with 'gofmt -s'" && false)
@test -z "$$(gofmt -s -l client 2>&1 | tee /dev/stderr)" || \
(echo >&2 "+ please format Go code with 'gofmt -s'" && false)
watermelon: proto fmt vet
@echo "+ $@"
@go build -o watermelon main.go
.PHONY: test
test:
@echo "+ $@"
@go test $(PKGS)
.PHONY: clean
clean:
@echo "+ $@"
rm watermelon