-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (54 loc) · 2.17 KB
/
Makefile
File metadata and controls
73 lines (54 loc) · 2.17 KB
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
PROTOCCMD = protoc
PROTOGEN_PATH = $(shell which protoc-gen-go)
PROTOGENGRPC_PATH = $(shell which protoc-gen-go-grpc)
GO_FILES := $(shell find $(SRC_DIR) -name '*.go')
GOCMD := go
GOBUILD := $(GOCMD) build
GOCLEAN := $(GOCMD) clean
LDFLAGS := -s -w
ifeq ($(OS), Windows_NT)
DEFAULT_BUILD_FILENAME := StealthIMSession.exe
else
DEFAULT_BUILD_FILENAME := StealthIMSession
endif
.PHONY: run
run: build
./bin/$(DEFAULT_BUILD_FILENAME)
StealthIM.DBGateway/db_gateway_grpc.pb.go StealthIM.DBGateway/db_gateway.pb.go: proto/db_gateway.proto
$(PROTOCCMD) --plugin=protoc-gen-go=$(PROTOGEN_PATH) --plugin=protoc-gen-go-grpc=$(PROTOGENGRPC_PATH) --go-grpc_out=. --go_out=. proto/db_gateway.proto
StealthIM.Session/session_grpc.pb.go StealthIM.Session/session.pb.go: proto/session.proto
$(PROTOCCMD) --plugin=protoc-gen-go=$(PROTOGEN_PATH) --plugin=protoc-gen-go-grpc=$(PROTOGENGRPC_PATH) --go-grpc_out=. --go_out=. proto/session.proto
.PHONY: proto
proto: ./StealthIM.DBGateway/db_gateway_grpc.pb.go ./StealthIM.DBGateway/db_gateway.pb.go ./StealthIM.Session/session_grpc.pb.go ./StealthIM.Session/session.pb.go
.PHONY: build
build: ./bin/$(DEFAULT_BUILD_FILENAME)
./bin/StealthIMSession.exe: $(GO_FILES) proto
GOOS=windows GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -o ./bin/StealthIMSession.exe
./bin/StealthIMSession: $(GO_FILES) proto
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ./bin/StealthIMSession
.PHONY: build_win build_linux
build_win: ./bin/StealthIMSession.exe
build_linux: ./bin/StealthIMSession
.PHONY: docker_run
docker_run:
docker-compose up
./bin/StealthIMSession.docker.zst: $(GO_FILES) proto
docker-compose build
docker save stealthimsession-app > ./bin/StealthIMSession.docker
zstd ./bin/StealthIMSession.docker -19
@rm ./bin/StealthIMSession.docker
.PHONY: build_docker
build_docker: ./bin/StealthIMSession.docker.zst
.PHONY: release
release: build_win build_linux build_docker
.PHONY: clean
clean:
@rm -rf ./StealthIM.DBGateway
@rm -rf ./StealthIM.Session
@rm -rf ./bin
@rm -rf ./__debug*
.PHONY: dev
dev:
./run_env.sh
debug_proto:
cd test && python -m grpc_tools.protoc -I. --python_out=. --mypy_out=. --grpclib_python_out=. --proto_path=../proto session.proto