-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (74 loc) · 3.44 KB
/
Makefile
File metadata and controls
92 lines (74 loc) · 3.44 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
# SubReader — Unified Build Commands
#
# Usage:
# make build-rust Build Rust library (debug)
# make build-rust-release Build Rust library (release)
# make build-app Build macOS app (debug)
# make build-app-release Build macOS app (release)
# make test-rust Run Rust tests
# make test-app Run Swift tests
# make test Run all tests
# make release Full release build
# make clean Clean all build artifacts
# make header Regenerate C header only
.PHONY: all build-rust build-rust-release build-app build-app-release \
test-rust test-app test release clean header ci
# ─── Paths ────────────────────────────────────────────────────────────────────
PROJECT_ROOT := $(shell pwd)
APPLE_APP_DIR := $(PROJECT_ROOT)/apple_app
SCRIPTS_DIR := $(APPLE_APP_DIR)/Scripts
# ─── Rust Library ─────────────────────────────────────────────────────────────
build-rust: header
@echo "=== Building Rust library (debug) ==="
@bash $(SCRIPTS_DIR)/build-rust.sh --debug
build-rust-release: header
@echo "=== Building Rust library (release) ==="
@bash $(SCRIPTS_DIR)/build-rust.sh --release
header:
@echo "=== Generating C header ==="
@cargo build -p ffi_c
test-rust:
@echo "=== Running Rust tests ==="
@cargo test --workspace
# ─── macOS App ────────────────────────────────────────────────────────────────
build-app: build-rust
@echo "=== Building macOS app (debug) ==="
@if [ -d "$(APPLE_APP_DIR)/SubReader.xcodeproj" ]; then \
xcodebuild -project $(APPLE_APP_DIR)/SubReader.xcodeproj \
-scheme SubReader -configuration Debug \
-destination "platform=macOS" build; \
else \
echo "Xcode project not found. Skipping app build."; \
fi
build-app-release: build-rust-release
@echo "=== Building macOS app (release) ==="
@if [ -d "$(APPLE_APP_DIR)/SubReader.xcodeproj" ]; then \
xcodebuild -project $(APPLE_APP_DIR)/SubReader.xcodeproj \
-scheme SubReader -configuration Release \
-destination "platform=macOS" build; \
else \
echo "Xcode project not found. Skipping app build."; \
fi
test-app: build-rust
@echo "=== Running Swift tests ==="
@if [ -d "$(APPLE_APP_DIR)/SubReader.xcodeproj" ]; then \
xcodebuild -project $(APPLE_APP_DIR)/SubReader.xcodeproj \
-scheme SubReader -configuration Debug \
-destination "platform=macOS" test; \
else \
echo "Xcode project not found. Skipping app tests."; \
fi
# ─── Combined ─────────────────────────────────────────────────────────────────
test: test-rust test-app
release: build-rust-release build-app-release
@echo "=== Release build complete ==="
ci:
@bash $(SCRIPTS_DIR)/ci-build.sh --release --test
clean:
@echo "=== Cleaning build artifacts ==="
@cargo clean
@rm -rf $(APPLE_APP_DIR)/DerivedData
@rm -rf $(APPLE_APP_DIR)/SubReader/Vendor/libreader_core.a
@rm -rf $(APPLE_APP_DIR)/SubReader/Vendor/reader_core.h
@echo "=== Clean complete ==="
all: build-app