Attempt 1
This commit is contained in:
40
AppServer/Makefile
Normal file
40
AppServer/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
# Makefile for compiling all proto files into Go
|
||||
|
||||
PROTO_IN := src/app_comm/proto
|
||||
PROTO_OUT := src/app_comm/api
|
||||
|
||||
# Find all .proto files recursively
|
||||
PROTO_FILES := $(shell find $(PROTO_IN) -name "*.proto")
|
||||
GO_FILES := $(shell find ./src/** -name "*.go")
|
||||
|
||||
# Default target
|
||||
all: proto
|
||||
|
||||
# Go build
|
||||
go: $(GO_FILES)
|
||||
@echo "Building Go application..."
|
||||
go build -o ../build/app_server -C src
|
||||
@echo "Done."
|
||||
|
||||
# Compile all proto files
|
||||
proto: $(PROTO_FILES)
|
||||
@echo "Generating Go code from proto files..."
|
||||
@for f in $(PROTO_FILES); do \
|
||||
base=$${f##*/}; \
|
||||
name=$${base%%.*}; \
|
||||
echo "Generating $$f -> $(PROTO_OUT)/$$name"; \
|
||||
mkdir -p $(PROTO_OUT)/$$name; \
|
||||
protoc -I=$(PROTO_IN) \
|
||||
--go_out=$(PROTO_OUT)/$$name --go_opt=paths=source_relative \
|
||||
--go-grpc_out=$(PROTO_OUT)/$$name --go-grpc_opt=paths=source_relative \
|
||||
$$f || exit 1; \
|
||||
done
|
||||
@echo "Done."
|
||||
|
||||
# Clean builds
|
||||
clean:
|
||||
@echo "Deleting built files..."
|
||||
rm -rf $(PROTO_OUT)/* build/*
|
||||
@echo "Done."
|
||||
|
||||
.PHONY: all clean
|
||||
Reference in New Issue
Block a user