-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (102 loc) · 3.34 KB
/
Makefile
File metadata and controls
119 lines (102 loc) · 3.34 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
# Generated by promptkit -- do not edit. Regenerate with: promptkit update
CARGO ?= cargo
PROFILE ?= release
TARGET_DIR ?= target
VERSION = $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
GIT_COMMIT = $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
# sccache: caches C/C++ compilation across clean builds.
# Cuts rebuild of whisper-rs-sys, aws-lc-sys, ort-sys from ~3min to ~10s.
ifneq (,$(shell command -v sccache 2>/dev/null))
export RUSTC_WRAPPER := sccache
endif
# CUDA build support: CUDA 12.9 requires GCC 14 as host compiler
# on Fedora 43+ (GCC 15 headers are incompatible with nvcc).
ifneq (,$(wildcard /usr/local/cuda/bin/nvcc))
export PATH := /usr/local/cuda/bin:$(PATH)
ifneq (,$(wildcard /usr/bin/gcc-14))
export CC := /usr/bin/gcc-14
export CXX := /usr/bin/g++-14
export CMAKE_CUDA_HOST_COMPILER := /usr/bin/gcc-14
endif
endif
all: build
# Build all binaries
.PHONY: build
build:
$(CARGO) build --profile $(PROFILE) --bin plaude
# Fast dev build — skip transcribe/diarize C++ deps (~5s vs ~4min)
.PHONY: build-fast
build-fast:
$(CARGO) build --bin plaude --no-default-features --features llm
# Show help
.PHONY: help
help:
@echo "Available targets:"
@echo " build - Build all binaries (release)"
@echo " install - Install binaries to ~/.cargo/bin"
@echo " test - Run all tests"
@echo " testv - Run all tests (verbose)"
@echo " lint - Run clippy, fmt check, and audit"
@echo " fmt - Format code"
@echo " audit - Run cargo audit"
@echo " clean - Clean build artifacts"
@echo " bench - Run benchmarks"
# Generate man pages from --help output (requires help2man)
.PHONY: man
man: build
@mkdir -p $(TARGET_DIR)/man
@if command -v help2man >/dev/null 2>&1; then \
help2man --no-info --no-discard-stderr \
$(TARGET_DIR)/$(PROFILE)/plaude \
-o $(TARGET_DIR)/man/plaude.1; \
echo "Man page generated at $(TARGET_DIR)/man/plaude.1"; \
else \
echo "help2man not found — skipping man page generation"; \
fi
# Install binaries (and man pages if generated)
# Uses `cp` from the build output instead of `cargo install`, which
# would recompile everything in its own target directory.
.PHONY: install
install: build
@mkdir -p $(HOME)/.cargo/bin
cp $(TARGET_DIR)/$(PROFILE)/plaude $(HOME)/.cargo/bin/plaude
@echo "Installed plaude to $(HOME)/.cargo/bin/plaude"
@if [ -f $(TARGET_DIR)/man/plaude.1 ]; then \
mkdir -p $(HOME)/.local/share/man/man1; \
cp $(TARGET_DIR)/man/plaude.1 $(HOME)/.local/share/man/man1/; \
echo "Man page installed to $(HOME)/.local/share/man/man1/"; \
fi
# Run all tests
.PHONY: test
test:
$(CARGO) test --all-targets --all-features
# Run all tests with verbose output
.PHONY: testv
testv:
$(CARGO) test --all-targets --all-features -- --nocapture
# Run benchmarks
.PHONY: bench
bench:
$(CARGO) bench --all-features
# Lint: clippy + fmt check + audit
.PHONY: lint
lint:
@echo "Running clippy..."
$(CARGO) clippy --all-targets --all-features -- -D warnings
@echo "Checking formatting..."
$(CARGO) fmt --all --check
@echo "Running cargo audit..."
$(CARGO) audit || true
@echo "Linting complete"
# Format code
.PHONY: fmt
fmt:
$(CARGO) fmt --all
# Security audit
.PHONY: audit
audit:
$(CARGO) audit
# Clean build artifacts
.PHONY: clean
clean:
$(CARGO) clean