-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (40 loc) · 1.24 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
MAKEFLAGS += --no-builtin-rules
PROTO_DIR = proto
PB_GO_DIR = service
PROTOS = $(shell find $(PROTO_DIR) -type f -exec basename {} \; | grep proto$$)
PB_GOS = $(PROTOS:%.proto=$(PB_GO_DIR)/%.pb.go)
BUILD_CMD ?= go build
UPDATE_DEPENDENCIES_CMD ?= go get -u && go mod tidy
build:
cd $(CURDIR)/cmd/hashira && $(BUILD_CMD)
cd $(CURDIR)/cmd/hashirad && $(BUILD_CMD)
cd $(CURDIR)/cmd/hashira-cui && $(BUILD_CMD)
cd $(CURDIR)/cmd/hashira-web-client && $(BUILD_CMD)
install:
@BUILD_CMD="go install" make build
all: genproto lint test
make build
genproto: $(PB_GOS)
$(PB_GO_DIR)/%.pb.go: $(PROTO_DIR)/%.proto
mkdir -p $(dir $@)
protoc \
-I $(PROTO_DIR) \
--go_out=. \
--go_opt=module=github.com/pankona/hashira \
--go-grpc_out=. \
--go-grpc_opt=module=github.com/pankona/hashira \
./$<
update-dependencies:
cd $(CURDIR)/cmd/hashira && $(UPDATE_DEPENDENCIES_CMD)
cd $(CURDIR)/cmd/hashirad && $(UPDATE_DEPENDENCIES_CMD)
cd $(CURDIR)/cmd/hashira-cui && $(UPDATE_DEPENDENCIES_CMD)
cd $(CURDIR)/cmd/hashira-web-client && $(UPDATE_DEPENDENCIES_CMD)
lint:
dprint check
golangci-lint run ./...
test:
go test -race ./...
clean:
rm -rf $(PB_GO_DIR)
release:
goreleaser --clean