-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
90 lines (72 loc) · 2.99 KB
/
Makefile
File metadata and controls
90 lines (72 loc) · 2.99 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.PHONY: all build build-agent build-server build-web clean run-agent run-server dev help build-all-platforms test test-server test-agent test-plugin test-web
# Default target
all: build
## 🔨 Build
build: build-agent build-server build-web ## Build all services for current platform
build-agent: ## Build the Go Agent for current platform
@echo "Building Agent..."
@cd services/agent && go build -o ../../bin/clawo11y-agent main.go
build-server: ## Build the Go Server for current platform
@echo "Building Server..."
@cd services/server && go build -o ../../bin/clawo11y-server main.go
build-web: ## Build the React Web UI
@echo "Building Web UI..."
@cd services/web && npm install && npm run build
## 🌍 Cross-Compilation
PLATFORMS := darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 windows/amd64
build-all-platforms: ## Build Go binaries for all platforms (darwin, linux, windows) x (amd64, arm64)
@echo "Building cross-platform binaries..."
@for platform in $(PLATFORMS); do \
GOOS=$${platform%/*}; \
GOARCH=$${platform#*/}; \
EXT=""; \
if [ "$$GOOS" = "windows" ]; then EXT=".exe"; fi; \
echo "Building Agent for $$GOOS/$$GOARCH..."; \
cd services/agent && GOOS=$$GOOS GOARCH=$$GOARCH go build -o ../../bin/clawo11y-agent-$$GOOS-$$GOARCH$$EXT main.go && cd ../..; \
echo "Building Server for $$GOOS/$$GOARCH..."; \
cd services/server && CGO_ENABLED=0 GOOS=$$GOOS GOARCH=$$GOARCH go build -o ../../bin/clawo11y-server-$$GOOS-$$GOARCH$$EXT main.go && cd ../..; \
done
@echo "Cross-compilation complete! Binaries are in the bin/ directory."
## 🧪 Test
test: test-server test-agent test-plugin test-web ## Run all tests
test-server: ## Run Server tests
@echo "Testing Server..."
@cd services/server && go test ./...
test-agent: ## Run Agent tests
@echo "Testing Agent..."
@cd services/agent && go test ./...
test-plugin: ## Run Plugin tests
@echo "Testing Plugin..."
@cd openclaw-otel-plugin && npm install --legacy-peer-deps && npm test
test-web: ## Run Web tests
@echo "Testing Web UI..."
@cd services/web && npm install && npm test
## 🧹 Clean
clean: ## Remove build artifacts
@echo "Cleaning up..."
@rm -rf bin/
@rm -rf services/web/dist/
## 🚀 Run (Development)
run-agent: build-agent ## Run the Agent locally
@echo "Running Agent..."
@./bin/clawo11y-agent
run-server: build-server ## Run the Server locally
@echo "Running Server..."
@./bin/clawo11y-server
dev: ## Start both Server and Web UI in development mode
@echo "Starting development environment..."
@# Run server in background, then run web UI
@cd services/server && go run main.go &
@cd services/web && npm run dev
## 🛠️ Tidy
tidy: ## Run 'go mod tidy' for all Go modules
@echo "Tidying Agent module..."
@cd services/agent && go mod tidy
@echo "Tidying Server module..."
@cd services/server && go mod tidy
## ❓ Help
help: ## Show this help message
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)