-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
188 lines (148 loc) · 5.66 KB
/
Makefile
File metadata and controls
188 lines (148 loc) · 5.66 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# Agentkernel Makefile
# Build standalone executables for multiple platforms
VERSION := $(shell grep '^version' Cargo.toml | head -1 | cut -d'"' -f2)
NAME := agentkernel
BUILD_DIR := target
RELEASE_DIR := dist
.PHONY: all build build-release clean install test lint check help
.PHONY: build-macos build-linux build-all release
.PHONY: stress-test benchmark-test pool-benchmark
.PHONY: app app-build serve
# Default target
all: build
# Development build
build:
cargo build
# Release build (optimized)
build-release:
cargo build --release
# Run tests
test:
cargo test
# Stress test (parallel sandbox creation)
# Usage: make stress-test
# Usage: make stress-test VM_COUNT=100 MAX_CONCURRENT=50
stress-test: build-release
STRESS_VM_COUNT=$(or $(VM_COUNT),10) STRESS_MAX_CONCURRENT=$(or $(MAX_CONCURRENT),50) \
cargo test --test stress_test -- --nocapture --ignored
# Benchmark test (repeated lifecycle measurement)
# Usage: make benchmark-test
# Usage: make benchmark-test SANDBOXES=20 ITERATIONS=5 MAX_CONCURRENT=100
benchmark-test: build-release
BENCH_SANDBOXES=$(or $(SANDBOXES),10) BENCH_ITERATIONS=$(or $(ITERATIONS),10) BENCH_MAX_CONCURRENT=$(or $(MAX_CONCURRENT),50) \
cargo test --test benchmark_test -- --nocapture --ignored
# Pool benchmark (compare pooled vs direct container operations)
# Usage: make pool-benchmark
pool-benchmark:
cargo test --test pool_benchmark -- --nocapture --ignored
# Run linting and formatting checks
lint:
cargo fmt -- --check
cargo clippy -- -D warnings
# Run all checks (before commit)
check: lint test
# Clean build artifacts
clean:
cargo clean
rm -rf $(RELEASE_DIR)
# Install locally
install: build-release
cargo install --path .
# === Cross-platform builds ===
# Build for macOS (Apple Silicon)
build-macos-arm64:
cargo build --release --target aarch64-apple-darwin
# Build for macOS (Intel)
build-macos-x64:
cargo build --release --target x86_64-apple-darwin
# Build for Linux (x86_64)
build-linux-x64:
cargo build --release --target x86_64-unknown-linux-gnu
# Build for Linux (ARM64)
build-linux-arm64:
cargo build --release --target aarch64-unknown-linux-gnu
# Build for current platform
build-native: build-release
# === Release packaging ===
$(RELEASE_DIR):
mkdir -p $(RELEASE_DIR)
# Package release binaries
package-macos-arm64: build-macos-arm64 $(RELEASE_DIR)
cp $(BUILD_DIR)/aarch64-apple-darwin/release/$(NAME) $(RELEASE_DIR)/$(NAME)-$(VERSION)-darwin-arm64
cd $(RELEASE_DIR) && tar -czf $(NAME)-$(VERSION)-darwin-arm64.tar.gz $(NAME)-$(VERSION)-darwin-arm64
package-macos-x64: build-macos-x64 $(RELEASE_DIR)
cp $(BUILD_DIR)/x86_64-apple-darwin/release/$(NAME) $(RELEASE_DIR)/$(NAME)-$(VERSION)-darwin-x64
cd $(RELEASE_DIR) && tar -czf $(NAME)-$(VERSION)-darwin-x64.tar.gz $(NAME)-$(VERSION)-darwin-x64
package-linux-x64: build-linux-x64 $(RELEASE_DIR)
cp $(BUILD_DIR)/x86_64-unknown-linux-gnu/release/$(NAME) $(RELEASE_DIR)/$(NAME)-$(VERSION)-linux-x64
cd $(RELEASE_DIR) && tar -czf $(NAME)-$(VERSION)-linux-x64.tar.gz $(NAME)-$(VERSION)-linux-x64
package-linux-arm64: build-linux-arm64 $(RELEASE_DIR)
cp $(BUILD_DIR)/aarch64-unknown-linux-gnu/release/$(NAME) $(RELEASE_DIR)/$(NAME)-$(VERSION)-linux-arm64
cd $(RELEASE_DIR) && tar -czf $(NAME)-$(VERSION)-linux-arm64.tar.gz $(NAME)-$(VERSION)-linux-arm64
# === Convenience targets ===
# Build all macOS variants
build-macos: build-macos-arm64 build-macos-x64
# Build all Linux variants
build-linux: build-linux-x64 build-linux-arm64
# Build all platforms (requires cross-compilation toolchains)
build-all: build-macos build-linux
# Package all platforms
release: package-macos-arm64 package-macos-x64 package-linux-x64 package-linux-arm64
@echo "Release packages created in $(RELEASE_DIR)/"
@ls -la $(RELEASE_DIR)/
# === Desktop App ===
# Run the HTTP API server (backend for desktop app)
serve: build
cargo run -- serve
# Run desktop app in dev mode
app:
cd app && npm exec tauri dev -- --features debug-bridge
# Build desktop app for release
app-build:
cd app && npm exec tauri build
# === Development ===
# Run the CLI
run:
cargo run -- $(ARGS)
# Run with verbose output
run-verbose:
RUST_BACKTRACE=1 cargo run -- $(ARGS)
# Format code
fmt:
cargo fmt
# === Help ===
help:
@echo "Agentkernel Build System"
@echo ""
@echo "Development:"
@echo " make build - Development build"
@echo " make build-release - Optimized release build"
@echo " make test - Run tests"
@echo " make lint - Check formatting and lints"
@echo " make check - Run all checks (lint + test)"
@echo " make install - Install to ~/.cargo/bin"
@echo " make clean - Clean build artifacts"
@echo ""
@echo "Benchmarking:"
@echo " make stress-test - Run stress test (10 sandboxes)"
@echo " make stress-test VM_COUNT=100 - Custom sandbox count"
@echo " make benchmark-test - Run benchmark (10x10 cycles)"
@echo " make benchmark-test SANDBOXES=20 - Custom benchmark config"
@echo " make pool-benchmark - Compare pooled vs direct containers"
@echo ""
@echo "Cross-compilation:"
@echo " make build-macos-arm64 - Build for macOS ARM64"
@echo " make build-macos-x64 - Build for macOS x64"
@echo " make build-linux-x64 - Build for Linux x64"
@echo " make build-linux-arm64 - Build for Linux ARM64"
@echo " make build-all - Build all platforms"
@echo ""
@echo "Release:"
@echo " make release - Package all platforms"
@echo ""
@echo "Desktop App:"
@echo " make serve - Run HTTP API server (backend)"
@echo " make app - Run desktop app (dev mode)"
@echo " make app-build - Build desktop app for release"
@echo ""
@echo "Usage: make run ARGS='status'"