forked from CocaineCong/micro-todoList
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (35 loc) · 845 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
40
41
42
43
44
45
46
47
48
DIR = $(shell pwd)/app
CONFIG_PATH = $(shell pwd)/config
IDL_PATH = $(shell pwd)/idl
SERVICES := gateway user task
service = $(word 1, $@)
node = 0
BIN = $(shell pwd)/bin
.PHONY: proto
proto:
@for file in $(IDL_PATH)/*.proto; do \
protoc -I $(IDL_PATH) $$file --micro_out=$(IDL_PATH)/pb --go_out=$(IDL_PATH)/pb; \
done
.PHONY: proto2
proto2:
@for file in $(shell find $(IDL_PATH)/pb/* -type f); do \
protoc-go-inject-tag -input=$$file; \
done
.PHONY: $(SERVICES)
$(SERVICES):
go build -o $(BIN)/$(service) $(DIR)/$(service)/cmd
$(BIN)/$(service) -config $(CONFIG_PATH) -srvnum=$(node)
.PHONY: env-up
env-up:
docker compose up -d
.PHONY: env-down
env-down:
docker compose down
.PHONY: run
run:
make -j3 run-all;
.PHONY: run-all
run-all: $(addprefix run-, $(SERVICES))
.PHONY: run-%
run-%:
go run $(DIR)/$*/cmd/main.go;