aboutsummaryrefslogtreecommitdiffstats
path: root/telebot/makefile
blob: b919633e5cc16e0f5aee7d1e4f9415a663938222 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
DST_DIR?=./v1
SRC_DIR?=./v1
PROTOBUF_SRC_LIST:=$(shell find ./v1 -name '*.proto' )
ARTIFACT_LIST:=$(patsubst %.proto, %.pb.go, $(shell find ./v1 -name '*.proto'))

DEFAULT: default

default: $(ARTIFACT_LIST)

$(SRC_DIR)/%.pb.go:$(SRC_DIR)/%.proto
	protoc --proto_path=$(SRC_DIR) \
		--go_out=$(DST_DIR) --go_opt=paths=source_relative \
		--go-grpc_out=$(DST_DIR) --go-grpc_opt=paths=source_relative $<
	if [ -d go.mod ];then : else;go mod init github.com/terminaldweller/grpc/telebot/v1;fi
	go mod tidy

clean:
	- rm $(ARTIFACT_LIST)