-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
135 lines (112 loc) · 3.95 KB
/
Makefile
File metadata and controls
135 lines (112 loc) · 3.95 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
# MallocVis - Build System
# Simplified build system for core functionality
# Configuration
TARGET_DIR = target
RUSTFLAGS ?= -A warnings
export RUSTFLAGS
# Library paths
TRACER_LIB = $(TARGET_DIR)/release/libmallocvis.so
# Include testing framework and examples
include tests.mk
include examples/examples.mk
include release.mk
# Default target
.PHONY: all
all: server
# ============= MAIN BUILD TARGETS =============
.PHONY: server
server: web-frontend
@echo "🔨 Building mallocvis (debug)..."
cargo build -p mallocvis_server --bin mallocvis \
--no-default-features --features integrated-frontend
.PHONY: server-release
server-release: tracer-lib web-frontend
@echo "🔨 Building mallocvis (release, with embedded tracer)..."
cargo build --release -p mallocvis_server --bin mallocvis \
--features integrated-frontend,embedded-tracer
# ============= COMPONENT BUILD TARGETS =============
.PHONY: tracer-lib
tracer-lib:
@echo "🔧 Building libmallocvis.so..."
cargo build --release -p mallocvis_lib
.PHONY: web-frontend
web-frontend: check-trunk
@echo "🌐 Building web frontend..."
@cd crates/mallocvis_ui && trunk build --release
# ============= RUN TARGETS =============
.PHONY: run
run: server
@echo "🚀 Starting MallocVis Server..."
cargo run -p mallocvis_server --bin mallocvis \
--no-default-features --features integrated-frontend
.PHONY: run-bg
run-bg: server
@echo "🚀 Starting MallocVis Server in background..."
@nohup cargo run -p mallocvis_server --bin mallocvis \
--no-default-features --features integrated-frontend \
> mallocvis.log 2>&1 & \
PID=$$!; \
echo "✅ MallocVis Server started in background with PID: $$PID"; \
echo "📝 Logs are being written to mallocvis.log"; \
echo "🛑 To stop the server, run: kill $$PID"
.PHONY: extract-tracer
extract-tracer: server-release
@echo "📦 Extracting libmallocvis.so to current directory..."
./target/release/mallocvis --extract-tracer
# ============= DEVELOPMENT TARGETS =============
.PHONY: format
format:
@echo "📝 Formatting code..."
cargo fmt --all
.PHONY: lint
lint:
@echo "🔍 Running lints..."
cargo clippy --workspace -- -D warnings
.PHONY: clean
clean:
@echo "🧹 Cleaning build artifacts..."
cargo clean
@cd crates/mallocvis_ui && rm -rf dist
@rm -f libmallocvis.so
@rm -f mallocvis.log
# ============= UTILITY TARGETS =============
.PHONY: check-trunk
check-trunk:
@command -v trunk >/dev/null 2>&1 || { \
echo "❌ trunk is required but not installed."; \
echo "Install with: cargo install trunk"; \
exit 1; \
}
.PHONY: help
help:
@echo "📋 MallocVis Build System"
@echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@echo "🎯 Build targets:"
@echo " server - Build debug server"
@echo " server-release - Build release server with embedded tracer"
@echo ""
@echo "🚀 Run targets:"
@echo " run - Run debug server"
@echo " run-bg - Run debug server in background (returns PID)"
@echo " extract-tracer - Extract libmallocvis.so to current dir"
@echo ""
@echo "🧪 Test targets (see tests.mk):"
@echo " test-select - Interactive test selection"
@echo " run-test-<name> - Run specific test with tracer"
@echo " list-tests - List available tests"
@echo " test-help - Show testing help"
@echo ""
@echo "🎓 Example targets (see examples/examples.mk):"
@echo " examples-select - Interactive example selection"
@echo " demo-all-examples - Run all example demonstrations"
@echo " list-examples - List available examples"
@echo " examples-help - Show examples help"
@echo ""
@echo "🔧 Development:"
@echo " format - Format all code"
@echo " lint - Run linters"
@echo " clean - Clean build artifacts"
# Default help target
%:
@echo "❓ Unknown target: $@"
@echo "Run 'make help' to see available targets"