-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
155 lines (123 loc) · 4.7 KB
/
justfile
File metadata and controls
155 lines (123 loc) · 4.7 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
# Generator - Sega Genesis Emulator
# Justfile for building and running different UI backends
# Default recipe - show available commands
default:
@just --list
# Build console version
build-console:
meson setup --wipe build -Dui-backend=console -Dz80-backend=cmz80
meson compile -C build
# Build GTK4 version
build-gtk4:
meson setup --wipe build -Dui-backend=gtk4 -Dz80-backend=cmz80
meson compile -C build
# Build console version (release mode, optimized)
build-console-release:
meson setup --wipe build --buildtype=release -Dui-backend=console -Dz80-backend=cmz80
meson compile -C build
# Build GTK4 version (release mode, optimized)
build-gtk4-release:
meson setup --wipe build --buildtype=release -Dui-backend=gtk4 -Dz80-backend=cmz80
meson compile -C build
# Run console version with custom ROM
run-console ROM: build-console
./build/src/app/generator-console "{{ROM}}"
# Run GTK4 version with custom ROM
run-gtk4 ROM: build-gtk4
./build/src/app/generator-gtk4 "{{ROM}}"
# Run console version (release) with custom ROM
run-console-release ROM: build-console-release
./build/src/app/generator-console "{{ROM}}"
# Run GTK4 version (release) with custom ROM
run-gtk4-release ROM: build-gtk4-release
./build/src/app/generator-gtk4 "{{ROM}}"
# Clean build artifacts
clean:
rm -rf build
# Reconfigure without wiping (preserves build artifacts)
reconfigure-console:
meson setup --reconfigure build -Dui-backend=console -Dz80-backend=cmz80
reconfigure-gtk4:
meson setup --reconfigure build -Dui-backend=gtk4 -Dz80-backend=cmz80
# Quick compile without reconfigure (fast iteration)
compile:
meson compile -C build
# Rebuild (clean + compile, keeps current config)
rebuild:
meson compile -C build --clean
meson compile -C build
# Quick rebuild and run with custom ROM (console)
run-console-quick ROM: compile
./build/src/app/generator-console "{{ROM}}"
# Quick rebuild and run with custom ROM (GTK4)
run-gtk4-quick ROM: compile
./build/src/app/generator-gtk4 "{{ROM}}"
# Show build configuration
show-config:
@if [ -d build ]; then \
meson configure build | grep -E "(ui-backend|z80-backend|buildtype)"; \
else \
echo "No build directory found. Run 'just build-console' or 'just build-gtk4' first."; \
fi
# Run with debug verbosity
run-console-verbose ROM: build-console
./build/src/app/generator-console -v 3 "{{ROM}}"
run-gtk4-verbose ROM: build-gtk4
./build/src/app/generator-gtk4 -v 3 "{{ROM}}"
# Build and run with memory debugging (valgrind)
run-console-valgrind ROM: build-console
valgrind --leak-check=full ./build/src/app/generator-console "{{ROM}}"
# Build with RAZE Z80 backend (x86 only, faster)
build-console-raze:
meson setup --wipe build -Dui-backend=console -Dz80-backend=raze
meson compile -C build
build-gtk4-raze:
meson setup --wipe build -Dui-backend=gtk4 -Dz80-backend=raze
meson compile -C build
# Install to system
install:
meson install -C build
# Uninstall from system
uninstall:
ninja -C build uninstall
# =============================================================================
# Static Analysis & Code Quality
# =============================================================================
# Run Clang Static Analyzer (requires clang)
analyze:
@if [ ! -d build ]; then \
echo "Setting up build directory..."; \
meson setup build -Dui-backend=gtk4 -Dz80-backend=cmz80; \
fi
ninja -C build scan-build
# Run analyzer with HTML report (opens in browser)
analyze-report:
@if [ ! -d build ]; then \
meson setup build -Dui-backend=gtk4 -Dz80-backend=cmz80; \
fi
scan-build -o ./analysis-report -V meson compile -C build
@echo "Report saved to ./analysis-report/"
# Run analyzer for CI (fails on bugs found)
analyze-ci:
@if [ ! -d build ]; then \
meson setup build -Dui-backend=gtk4 -Dz80-backend=cmz80; \
fi
SCANBUILD="scan-build --status-bugs" ninja -C build scan-build
# Format all source files with clang-format
format:
find src -name '*.c' -o -name '*.h' -o -name '*.cpp' -o -name '*.hpp' | xargs clang-format -i
@echo "Formatted all source files"
# Check formatting without modifying files
format-check:
find src -name '*.c' -o -name '*.h' -o -name '*.cpp' -o -name '*.hpp' | xargs clang-format --dry-run --Werror
@echo "All files are properly formatted"
# Run clang-tidy (requires compile_commands.json)
tidy:
@if [ ! -f build/compile_commands.json ]; then \
echo "Setting up build directory..."; \
meson setup build -Dui-backend=gtk4 -Dz80-backend=cmz80; \
fi
find src/app -name '*.c' | head -20 | xargs clang-tidy -p build
# Clean analysis reports
clean-reports:
rm -rf analysis-report