Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (36 loc) · 1.66 KB
/
Copy pathMakefile
File metadata and controls
44 lines (36 loc) · 1.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
.PHONY: build frontend backend clean install uninstall build-windows
# User-local install prefix (~/.local/bin is on PATH, so install needs no sudo —
# running make under sudo is what used to leave dist_new root-owned).
PREFIX ?= $(HOME)/.local
# Build everything — frontend first (rust-embed needs the dist at compile time).
build: frontend backend
# Build the Vue frontend (output to dist_new, read by rust-embed at compile time).
frontend:
cd frontend && npx vite build --outDir dist_new --emptyOutDir
# Build the Rust backend in release mode.
backend:
cd backend && cargo build --release
# Install the binary to the user-local bin (no sudo needed).
install: build
@mkdir -p $(PREFIX)/bin
cp backend/target/release/obsidian-brain $(PREFIX)/bin/
# On macOS (esp. 26/Tahoe arm64), the linker's ad-hoc signature is only valid
# in the build path; a cp'd binary has no matching Gatekeeper rule and the kernel
# SIGKILLs it before main() (exit 137). Re-sign explicitly so it runs anywhere.
ifeq ($(shell uname -s),Darwin)
codesign --force --sign - $(PREFIX)/bin/obsidian-brain
endif
@echo "Installed: $(PREFIX)/bin/obsidian-brain"
@echo "Run 'obsidian-brain start' to start the server."
# Remove the installed binary.
uninstall:
rm -f $(PREFIX)/bin/obsidian-brain
@echo "Uninstalled."
# Cross-compile for Windows x86_64 (requires: rustup target add x86_64-pc-windows-gnu; brew install mingw-w64).
build-windows: frontend
cd backend && cargo build --release --target x86_64-pc-windows-gnu
@echo "Windows binary: backend/target/x86_64-pc-windows-gnu/release/obsidian-brain.exe"
# Clean build artifacts.
clean:
rm -rf frontend/dist frontend/dist_new
cd backend && cargo clean