go-telecom/Makefile
2025-04-30 20:59:07 +02:00

49 lines
2.0 KiB
Makefile

# Directorios
PROTO_DIR := proto
OUT_DIR := internal/gen
# Ruta base Go para imports en go_package
GO_BASE := git.espin.casa/albert/go-telecom
# Proto tools
PROTOC := protoc
PROTOC_GEN_GO := $(shell which protoc-gen-go)
PROTOC_GEN_GO_GRPC := $(shell which protoc-gen-go-grpc)
PROTOC_GEN_GO_VERSION := $(shell $(PROTOC_GEN_GO) --version)
# Archivos .proto
PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto)
.PHONY: all proto build clean run-core run-admin run-monitor
all: proto build
## Compile todos los .proto a Go
proto:
@echo "🔧 Creating gRPC code from .proto..."
@mkdir -p $(OUT_DIR)
$(PROTOC) \
--proto_path=$(PROTO_DIR) \
--twirp_out=$(OUT_DIR) \
--go-grpc_out=$(OUT_DIR) \
$(PROTO_FILES)
## Build binario principal (solo CLI cobra, por ejemplo)
build:
@echo "🔨 Compiling main binary..."
go build -o bin/procontel main.go
## Ejecutar servicios individuales
run-core:
go run main.go core m
run-admin:
go run main.go admin
run-monitor:
go run main.go monitor
## Eliminar binarios y generación
clean:
@echo "🧹 Cleaning..."
rm -rf bin/ $(OUT_DIR)