-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (27 loc) · 958 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
# Makefile to generate Python and JavaScript SDKs from .proto files
# Variables
PROTO_DIR := ./protos
PYTHON_OUT_DIR := ./python_sdk
JS_OUT_DIR := ./js_sdk
# Protobuf files
PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto)
# Protoc Python plugin
PROTOC_PYTHON_PLUGIN := python_out
# For gRPC support, you might use something like `grpc_python_out` and ensure you have the gRPC plugin
# Protoc JavaScript plugin
# Depending on your setup, this might be `js_out` or something like `grpc-web_out`
PROTOC_JS_PLUGIN := js_out
# Default rule
all: python js
# Python SDK generation
python:
@mkdir -p $(PYTHON_OUT_DIR)
protoc -I=$(PROTO_DIR) --$(PROTOC_PYTHON_PLUGIN)=$(PYTHON_OUT_DIR) $(PROTO_FILES)
# JavaScript SDK generation
js:
@mkdir -p $(JS_OUT_DIR)
protoc -I=$(PROTO_DIR) --$(PROTOC_JS_PLUGIN)=$(JS_OUT_DIR) $(PROTO_FILES)
# Clean rule for cleaning up generated files
clean:
rm -rf $(PYTHON_OUT_DIR)/* $(JS_OUT_DIR)/*
.PHONY: all python js clean