forked from buildonspark/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (41 loc) · 1.71 KB
/
Makefile
File metadata and controls
49 lines (41 loc) · 1.71 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
47
48
49
# DEPRECATED: Simple targets in this Makefile are being phased out in favor of mise tasks.
# Please use `mise <task>` instead. Run `mise tasks` to see all available tasks.
# Proto compilation targets will remain in this Makefile as they benefit from Make's dependency tracking.
# Directory containing .proto files
PROTO_DIR := protos
# List of .proto files
PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto)
# Generate output file paths
GO_OUT := $(patsubst $(PROTO_DIR)/%.proto,spark/proto/%/%.pb.go,$(PROTO_FILES))
# Rule to compile .proto files to Go
spark/proto/%/%.pb.go: $(PROTO_DIR)/%.proto
@echo "Compiling $< to $@"
@mkdir -p $(dir $@)
protoc --go_out=$(dir $@) \
--go_opt=paths=source_relative \
--proto_path=$(PROTO_DIR) \
--go-grpc_out=$(dir $@) \
--go-grpc_opt=paths=source_relative \
--validate_out="lang=go,paths=source_relative:$(dir $@)" \
$<
@if [ "$(notdir $<)" = "spark_ssp_internal.proto" ]; then \
echo "Adding build tag 'lightspark' to spark_ssp_internal generated files"; \
for file in $(dir $@)*.pb.go $(dir $@)*_grpc.pb.go $(dir $@)*.pb.validate.go; do \
if [ -f "$$file" ] && ! head -n1 "$$file" | grep -q "//go:build"; then \
printf '//go:build lightspark\n\n%s\n' "$$(cat "$$file")" > "$$file.tmp" && mv "$$file.tmp" "$$file"; \
fi \
done \
fi
# Default target
all: $(GO_OUT)
# Clean target
clean:
rm -rf spark/proto/*/*.pb.go
rm -rf spark/proto/*/*.pb.validate.go
ent:
@echo "DEPRECATED: Use 'mise gen-ent' instead"
@cd spark && go generate ./so/ent/...
@echo "\n!!!!\nEnts generated. Remember to add migration changes with atlas! See README.md for more info.\n!!!!\n"
ssp:
@echo "DEPRECATED: Use 'mise gen-ssp' instead"
@cd spark && go generate ./testing/wallet/ssp_api/...