-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
39 lines (30 loc) · 836 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
30
31
32
33
34
35
36
37
38
39
DIR = $(shell pwd)/app
GOPATH := $(shell go env GOPATH)
IDL_PATH = $(shell pwd)/idl
PORT ?= 10001
SERVICES := im user
service = $(word 1, $@)
node = 0
BIN = $(shell pwd)/bin
.PHONY: proto
proto:
@for dir in $(IDL_PATH)/*; do \
for file in $$dir/*.proto; do \
protoc -I $$dir $$file --proto_path=.:$(GOPATH)/src:../ --go-grpc_out=../ --go_out=../; \
done; \
find $$dir -type f -name '*.pb.go' -exec protoc-go-inject-tag -input {} -remove_tag_comment \;; \
done
.PHONY: $(SERVICES)
$(SERVICES):
go build -o $(BIN)/$(service)_$(PORT) -ldflags="-X 'main.Port=$(PORT)'" $(shell pwd)/cmd/$(service)
$(BIN)/$(service)_$(PORT)
.PHONY: gateway
gateway:
go build -o $(BIN)/$(service) $(shell pwd)/cmd/$(service)
$(BIN)/$(service)
.PHONY: env-up
env-up:
docker-compose up -d
.PHONY: env-down
env-down:
docker-compose down