-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (46 loc) · 1.84 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
51
52
53
54
55
56
57
GOOS ?= linux
GOARCH ?= amd64
GO_FILES = $(shell find . -name '*.go' -not -path "./vendor/*")
export PATH = $(shell pwd)/tools/bin:$(shell echo $$PATH)
caddy: atlas/caddy/caddy
cp atlas/caddy/caddy caddy
atlas/caddy/caddy: $(GO_FILES) atlas/bootstrap/bootstrap.pb.go atlas/consensus/consensus.pb.go
@echo "Building Caddy"
@cd atlas/caddy && go build
atlas/bootstrap/bootstrap.pb.go: atlas/bootstrap/bootstrap.proto tools/bin/protoc tools/bin/protoc-gen-go-grpc
@echo "Generating bootstrap protobuf files"
@cd atlas && protoc --go_out=. --go-grpc_out=. bootstrap/bootstrap.proto
atlas/consensus/consensus.pb.go: atlas/consensus/consensus.proto tools/bin/protoc tools/bin/protoc-gen-go-grpc
@echo "Generating consensus protobuf files"
@cd atlas && protoc --go_out=. --go-grpc_out=. consensus/consensus.proto
tools/bin/protoc-gen-go:
@echo "Installing protoc"
@mkdir -p tools
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
cp $(shell go env GOPATH)/bin/protoc-gen-go tools/bin/protoc-gen-go
tools/bin/protoc-gen-go-grpc: tools/bin/protoc-gen-go
@echo "Installing protoc"
@mkdir -p tools
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
cp $(shell go env GOPATH)/bin/protoc-gen-go-grpc tools/bin/protoc-gen-go-grpc
tools/bin/protoc:
./scripts/install-protoc.sh
tools/bin/upx:
@mkdir -p tools/bin
@wget https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-amd64_linux.tar.xz -O upx.tar.xz
@tar -xvf upx.tar.xz && mv upx-*/upx tools/bin/upx && rm -rf upx.tar.xz && rm -rf upx-*
.PHONY: release
release: caddy tools/bin/upx
@upx caddy
.PHONY: test
test:
@go test -v -race ./...
.PHONY: clean
clean:
@rm -f caddy
@rm -f atlas/caddy/caddy
@rm -f atlas/bootstrap/bootstrap.pb.go
@rm -f atlas/consensus/consensus.pb.go
@rm -f atlas/consensus/consensus_grpc.pb.go
@rm -f atlas/bootstrap/bootstrap_grpc.pb.go
@rm -rf tools