-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (75 loc) · 3.03 KB
/
Makefile
File metadata and controls
91 lines (75 loc) · 3.03 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
.PHONY: setup build build-release test install uninstall clean header
SHELL := /bin/bash
PROJECT_DIR := $(shell pwd)
ENGINE_DIR := $(PROJECT_DIR)/vant-engine
MACOS_DIR := $(PROJECT_DIR)/vant-macos
SCRIPTS_DIR := $(PROJECT_DIR)/scripts
# Ensure cargo is in PATH
export PATH := $(HOME)/.cargo/bin:$(PATH)
## setup: Install development dependencies
setup:
@echo "==> Checking Rust toolchain..."
@which rustc > /dev/null 2>&1 || (echo "ERROR: Rust not installed. Run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh" && exit 1)
@rustc --version
@echo "==> Checking cbindgen..."
@which cbindgen > /dev/null 2>&1 || cargo install cbindgen
@echo "==> Checking xcodegen..."
@which xcodegen > /dev/null 2>&1 || (echo "WARNING: xcodegen not installed. Run: brew install xcodegen")
@echo "==> Setup complete"
## build: Build Rust engine (debug) + Xcode targets (debug)
build: build-engine-debug build-xcode-debug
## build-release: Build everything in release mode
build-release: build-engine-release build-xcode-release
## build-engine-debug: Build Rust engine in debug mode
build-engine-debug:
@bash $(SCRIPTS_DIR)/build-rust.sh debug
## build-engine-release: Build Rust engine in release mode
build-engine-release:
@bash $(SCRIPTS_DIR)/build-rust.sh release
## build-xcode-debug: Build Xcode targets in debug mode
build-xcode-debug:
@echo "==> Building Xcode targets (Debug)..."
cd $(MACOS_DIR) && xcodebuild -target VantIME -configuration Debug build 2>&1 | tail -5
cd $(MACOS_DIR) && xcodebuild -target Vant -configuration Debug build 2>&1 | tail -5
## build-xcode-release: Build Xcode targets in release mode
build-xcode-release:
@echo "==> Building Xcode targets (Release)..."
cd $(MACOS_DIR) && xcodebuild -target VantIME -configuration Release build 2>&1 | tail -5
cd $(MACOS_DIR) && xcodebuild -target Vant -configuration Release build 2>&1 | tail -5
## test: Run all tests
test:
@echo "==> Running Rust tests..."
cd $(ENGINE_DIR) && cargo test
@echo "==> All tests passed"
## install: Build release and install IME
install:
@bash $(SCRIPTS_DIR)/install.sh
## uninstall: Remove VantIME from Input Methods
uninstall:
@echo "==> Uninstalling VantIME..."
@killall VantIME 2>/dev/null || true
@rm -rf "$(HOME)/Library/Input Methods/VantIME.app"
@echo "==> VantIME uninstalled. Log out and back in to complete removal."
## clean: Clean all build artifacts
clean:
@echo "==> Cleaning Rust build..."
cd $(ENGINE_DIR) && cargo clean
@echo "==> Cleaning Xcode build..."
cd $(MACOS_DIR) && xcodebuild clean 2>/dev/null || true
@rm -rf $(MACOS_DIR)/build
@echo "==> Clean complete"
## header: Regenerate C header via cbindgen
header:
@echo "==> Regenerating vant_engine.h..."
cd $(ENGINE_DIR) && cargo build
@echo "==> Header regenerated"
## xcode-project: Regenerate Xcode project from project.yml
xcode-project:
@echo "==> Regenerating Xcode project..."
cd $(MACOS_DIR) && xcodegen generate
@echo "==> Xcode project regenerated"
## help: Show this help
help:
@echo "Vant Build System"
@echo ""
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## / /'