-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
55 lines (49 loc) · 2.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
GOPATH:=$(shell go env GOPATH)
VERSION=$(shell git describe --tags --always)
INTERNAL_PROTO_FILES=$(shell find internal -name *.proto)
API_PROTO_FILES=$(shell find api -name *.proto)
BUF_INSTALLED := $(shell command -v buf 2> /dev/null)
ifeq ($(GOHOSTOS), windows)
#the `find.exe` is different from `find` in bash/shell.
#to see https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/find.
#changed to use git-bash.exe to run find cli or other cli friendly, caused of every developer has a Git.
Git_Bash= $(subst cmd\,bin\bash.exe,$(dir $(shell where git)))
INTERNAL_PROTO_FILES=$(shell $(Git_Bash) -c "find internal -name *.proto")
API_PROTO_FILES=$(shell $(Git_Bash) -c "find api -name *.proto")
else
INTERNAL_PROTO_FILES=$(shell find internal -name *.proto)
API_PROTO_FILES=$(shell find api -name *.proto)
endif
.PHONY: init
# init env
init:
go install github.com/go-kratos/kratos/cmd/kratos/v2@a7bae93
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/[email protected]
go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@a7bae93
go install github.com/lyouthzzz/[email protected]
go install github.com/envoyproxy/[email protected]
go install github.com/google/wire/cmd/[email protected]
.PHONY: api
# generate api proto
api:
protoc --proto_path=. \
--proto_path=./third_party \
--go_out=paths=source_relative:. \
--go-http_out=paths=source_relative:. \
--go-grpc_out=paths=source_relative:. \
--go-errors_out=paths=source_relative:. \
--openapiv2_out=. \
$(API_PROTO_FILES)
.PHONY: wire
# wire
wire:
wire ./...
.PHONY: build
# build
build:
mkdir -p bin/ && GOPROXY="https://goproxy.cn,direct" go build -ldflags '-w -s -extldflags "-static"' -o ./bin/ ./...
buildimage:
docker build --target api -f Dockerfile -t go-web-layout .