-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
29 lines (22 loc) · 872 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
.PHONY: help
.DEFAULT_GOAL := help
CURRENT_REVISION = $(shell git rev-parse --short HEAD)
BUILD_LDFLAGS = "-X main.revision=$(CURRENT_REVISION)"
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
build: ## Build All
go generate ./...
make build-proto
go build -o myshoes -ldflags $(BUILD_LDFLAGS) cmd/server/cmd.go
build-linux: ## Build for Linux
go generate ./...
make build-proto
GOOS=linux GOARCH=amd64 go build -o myshoes-linux-amd64 -ldflags $(BUILD_LDFLAGS) cmd/server/cmd.go
build-proto: ## Build proto file
mkdir -p tmp/proto-go
rm -rf api/proto.go
protoc -I=api/proto/ --go_out=tmp/proto-go/ --go-grpc_out=tmp/proto-go/ api/proto/**.proto
mv tmp/proto-go/github.com/whywaita/myshoes/api/proto.go api/
rm -rf tmp
test: ## Exec test
go test -v ./...