-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (36 loc) · 1.5 KB
/
Makefile
File metadata and controls
46 lines (36 loc) · 1.5 KB
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
# ==============================================================================
# RP C++ GENERATION MAKEFILE
# ==============================================================================
# ---------------------------- CONFIGURATION -----------------------------------
# The path to the submodule containing .proto files and buf config
PROTO_ROOT := render-protocol-spec
# The config file specific to C++ (inside the submodule)
BUF_CONFIG := $(PROTO_ROOT)/buf.gen.cpp.yaml
# The destination for generated files (Standard SPM structure)
OUTPUT_DIR := src
# ------------------------------- TASKS ----------------------------------------
.PHONY: all generate clean update-protos init-protos
all: generate
# 1. Init/Update the submodule to get the latest .proto definitions
init-protos:
@echo "🔄 Initializing submodule..."
git submodule update --init --remote
update-protos:
@echo "🔄 Updating submodule..."
git submodule update --remote --merge
# 2. Clean the output directory to remove stale files
clean:
@echo "🧹 Cleaning previous build..."
rm -rf $(OUTPUT_DIR)/*
# 3. Generate the C++ code
generate: clean
@echo "🚀 Generating C++ sources..."
@mkdir -p $(OUTPUT_DIR)
# command breakdown:
# 1. input: $(PROTO_ROOT) -> The directory containing .proto files
# 2. --template: Uses the config file located INSIDE the submodule
# 3. -o: Overrides the output path to your local Source folder
buf generate $(PROTO_ROOT) \
--template $(BUF_CONFIG) \
-o $(OUTPUT_DIR)
@echo "✅ C++ generation complete!"