-
Notifications
You must be signed in to change notification settings - Fork 57
/
Makefile
95 lines (72 loc) · 2.45 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
PROTO_FILES := $(shell find api -name *.proto)
OS:=$(shell go env GOHOSTOS)
ifeq ($(OS), windows)
Git_Bash=$(subst \,/,$(subst cmd\,bin\bash.exe,$(dir $(shell where git))))
PROTO_FILES=$(shell $(Git_Bash) -c "find api -iname *.proto")
else
PROTO_FILES=$(shell find api -iname *.proto)
endif
.PHONY: install
install:
go install github.com/google/wire/cmd/wire@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/envoyproxy/protoc-gen-validate@latest
go install github.com/srikrsna/protoc-gen-gotag@latest
.PHONY: conf
conf:
cp config.example.yaml config.yaml
.PHONY: generate
generate:
go generate ./...
lint:
golangci-lint run --timeout=5m --config ./.golangci.yml
test:
go test -v ./...
http:
go run ./cmd/lumenim http
comet:
go run ./cmd/lumenim comet
migrate:
go run ./cmd/lumenim migrate
queue:
go run ./cmd/lumenim queue
crontab:
go run ./cmd/lumenim crontab
.PHONY: build
build:
go build -o ./bin/lumenim ./cmd/lumenim
.PHONY: build-all
build-all:
@mkdir -p ./build/linux/ ./build/windows/ ./build/mac/ ./build/macm1/
# 构建 windows
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./build/windows/lumenim ./cmd/lumenim
cp ./config.example.yaml ./build/windows/config.yaml
# 构建 linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/linux/lumenim ./cmd/lumenim
cp ./config.example.yaml ./build/linux/config.yaml
# 构建 mac amd
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./build/mac/lumenim ./cmd/lumenim
cp ./config.example.yaml ./build/mac/config.yaml
# 构建 mac m1
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./build/macm1/lumenim ./cmd/lumenim
cp ./config.example.yaml ./build/macm1/config.yaml
.PHONY: proto
proto:
@if [ -n "$(PROTO_FILES)" ]; then \
protoc \
--proto_path=./api/proto \
--proto_path=./third_party \
--go_out=paths=source_relative:./api/pb/ \
--validate_out=paths=source_relative,lang=go:./api/pb/ $(PROTO_FILES) \
&& protoc --proto_path=./third_party --proto_path=./api/proto --gotag_out=outdir="./api/pb/":./ $(PROTO_FILES) \
&& echo "protoc generate success"; \
fi
.PHONY: deploy
deploy:
git reset --hard origin/develop && git pull && make build && supervisorctl reload
#--go-grpc_out=paths=source_relative:./api/pb/ \
.PHONY: docker-image
docker-image:
docker build -t gzydong/lumenim:latest .