120 lines
3.2 KiB
Makefile
120 lines
3.2 KiB
Makefile
|
|
# BOC — Business Operations Center
|
||
|
|
# Makefile for building and deploying the entire stack
|
||
|
|
|
||
|
|
.PHONY: all build build-go build-rust build-c test test-go test-rust lint lint-go lint-rust clean docker-up docker-down docker-logs deploy dev
|
||
|
|
|
||
|
|
# Default target
|
||
|
|
all: build
|
||
|
|
|
||
|
|
# Build all components
|
||
|
|
build: build-go build-rust build-c
|
||
|
|
|
||
|
|
# Build Go backend
|
||
|
|
build-go:
|
||
|
|
@echo "🔨 Building Go backend..."
|
||
|
|
cd backend && go build -o boc .
|
||
|
|
|
||
|
|
# Build Rust service
|
||
|
|
build-rust:
|
||
|
|
@echo "🔨 Building Rust service..."
|
||
|
|
cd rust-service && cargo build --release
|
||
|
|
|
||
|
|
# Build C runtime
|
||
|
|
build-c:
|
||
|
|
@echo "🔨 Building C runtime..."
|
||
|
|
cd c-runtime && \
|
||
|
|
gcc -shared -fPIC -O3 -o libboc_ipc.so src/ipc.c -lpthread -lrt && \
|
||
|
|
gcc -c -O3 -o ipc.o src/ipc.c && \
|
||
|
|
ar rcs libboc_ipc.a ipc.o
|
||
|
|
|
||
|
|
# Run all tests
|
||
|
|
test: test-go test-rust
|
||
|
|
|
||
|
|
# Run Go tests
|
||
|
|
test-go:
|
||
|
|
@echo "🧪 Running Go tests..."
|
||
|
|
cd backend && go test ./...
|
||
|
|
|
||
|
|
# Run Rust tests
|
||
|
|
test-rust:
|
||
|
|
@echo "🧪 Running Rust tests..."
|
||
|
|
cd rust-service && cargo test
|
||
|
|
|
||
|
|
# Lint all code
|
||
|
|
lint: lint-go lint-rust
|
||
|
|
|
||
|
|
# Lint Go code
|
||
|
|
lint-go:
|
||
|
|
@echo "🔍 Linting Go code..."
|
||
|
|
cd backend && go vet ./...
|
||
|
|
|
||
|
|
# Lint Rust code
|
||
|
|
lint-rust:
|
||
|
|
@echo "🔍 Linting Rust code..."
|
||
|
|
cd rust-service && cargo clippy -- -D warnings
|
||
|
|
|
||
|
|
# Clean build artifacts
|
||
|
|
clean:
|
||
|
|
@echo "🧹 Cleaning build artifacts..."
|
||
|
|
cd backend && rm -f boc
|
||
|
|
cd rust-service && cargo clean
|
||
|
|
cd c-runtime && rm -f *.o *.so *.a
|
||
|
|
|
||
|
|
# Docker commands
|
||
|
|
docker-up:
|
||
|
|
@echo "🐳 Starting Docker containers..."
|
||
|
|
docker-compose up -d --build
|
||
|
|
|
||
|
|
docker-down:
|
||
|
|
@echo "🐳 Stopping Docker containers..."
|
||
|
|
docker-compose down
|
||
|
|
|
||
|
|
docker-logs:
|
||
|
|
@echo "📋 Showing logs..."
|
||
|
|
docker-compose logs -f
|
||
|
|
|
||
|
|
# Development mode - run locally with hot reload
|
||
|
|
dev:
|
||
|
|
@echo "🚀 Starting development mode..."
|
||
|
|
@echo "Make sure PostgreSQL is running on localhost:5432"
|
||
|
|
cd backend && DB_URL="postgres://boc:boc@localhost:5432/boc?sslmode=disable" go run .
|
||
|
|
|
||
|
|
# Deploy to production
|
||
|
|
deploy: build
|
||
|
|
@echo "🚀 Deploying to production..."
|
||
|
|
# Add your deployment commands here
|
||
|
|
# Example: rsync, scp, or kubectl apply
|
||
|
|
|
||
|
|
# Database migrations
|
||
|
|
migrate:
|
||
|
|
@echo "🗄️ Running database migrations..."
|
||
|
|
cd backend && go run . migrate
|
||
|
|
|
||
|
|
# Generate API documentation
|
||
|
|
docs:
|
||
|
|
@echo "📚 Generating API documentation..."
|
||
|
|
cd backend && go doc ./...
|
||
|
|
|
||
|
|
# Help
|
||
|
|
help:
|
||
|
|
@echo "BOC — Business Operations Center"
|
||
|
|
@echo ""
|
||
|
|
@echo "Available targets:"
|
||
|
|
@echo " make build - Build all components"
|
||
|
|
@echo " make build-go - Build Go backend only"
|
||
|
|
@echo " make build-rust - Build Rust service only"
|
||
|
|
@echo " make build-c - Build C runtime only"
|
||
|
|
@echo " make test - Run all tests"
|
||
|
|
@echo " make test-go - Run Go tests"
|
||
|
|
@echo " make test-rust - Run Rust tests"
|
||
|
|
@echo " make lint - Lint all code"
|
||
|
|
@echo " make clean - Clean build artifacts"
|
||
|
|
@echo " make docker-up - Start Docker containers"
|
||
|
|
@echo " make docker-down - Stop Docker containers"
|
||
|
|
@echo " make docker-logs - Show Docker logs"
|
||
|
|
@echo " make dev - Run in development mode"
|
||
|
|
@echo " make deploy - Deploy to production"
|
||
|
|
@echo " make migrate - Run database migrations"
|
||
|
|
@echo " make docs - Generate API documentation"
|
||
|
|
@echo " make help - Show this help"
|