-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (81 loc) · 2.96 KB
/
Makefile
File metadata and controls
104 lines (81 loc) · 2.96 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
# =============================================================================
# Quadtrix.cpp — Makefile (llama.cpp-style convenience targets)
# =============================================================================
.PHONY: all build clean run dev gpu train bench logs ps shell help
SHELL := /bin/bash
SCRIPT := ./scripts/build.sh
# ── Native C++ ───────────────────────────────────────────────────────────────
CC := g++
CFLAGS := -std=c++17 -O3 -march=native
IFLAGS := -I. -Iinclude
TARGET := quadtrix
SRCS := main.cpp
all: $(TARGET)
$(TARGET): $(SRCS)
$(CC) $(CFLAGS) $(IFLAGS) -o $@ $^
@echo "✓ Built $(TARGET)"
# Optimised release (same flags, explicit target)
release: $(SRCS)
$(CC) $(CFLAGS) $(IFLAGS) -DNDEBUG -o $(TARGET) $^
strip $(TARGET)
# Debug build
debug: $(SRCS)
$(CC) -std=c++17 -O0 -g -fsanitize=address,undefined \
$(IFLAGS) -o $(TARGET)-debug $^
benchmark-bin: benchmark.cpp
$(CC) $(CFLAGS) $(IFLAGS) -o quadtrix-bench $^
clean-native:
rm -f $(TARGET) $(TARGET)-debug quadtrix-bench
# ── Docker / Compose targets ─────────────────────────────────────────────────
build:
$(SCRIPT) up
run: build
@echo "Stack already started."
dev:
$(SCRIPT) dev
gpu:
$(SCRIPT) gpu
train-cpp:
$(SCRIPT) train-cpp
train-torch:
$(SCRIPT) train-torch
bench:
$(SCRIPT) bench
logs:
$(SCRIPT) logs
ps:
$(SCRIPT) ps
shell:
$(SCRIPT) shell $(SERVICE)
clean:
$(SCRIPT) clean
# ── Misc ─────────────────────────────────────────────────────────────────────
format:
find . \( -name "*.cpp" -o -name "*.h" \) \
! -path "./build/*" \
| xargs clang-format -i --style=LLVM
lint-py:
ruff check backend/ engine/
help:
@echo ""
@echo " Quadtrix.cpp — make targets"
@echo ""
@echo " Native:"
@echo " make Build C++ binary (native)"
@echo " make release Stripped release binary"
@echo " make debug Debug binary with ASan/UBSan"
@echo " make clean-native Remove native build artifacts"
@echo " make format Run clang-format on all C++ files"
@echo ""
@echo " Docker:"
@echo " make build docker compose up --build (CPU)"
@echo " make dev Hot-reload dev stack"
@echo " make gpu CUDA GPU stack"
@echo " make train-cpp Train with C++ inside Docker"
@echo " make train-torch Train with PyTorch inside Docker"
@echo " make bench Run benchmark"
@echo " make logs Tail all logs"
@echo " make ps Show container status"
@echo " make shell Shell into backend (SERVICE=frontend to change)"
@echo " make clean Remove containers + volumes"
@echo ""