.DEFAULT_GOAL := help SHELL := /bin/bash FLUTTER ?= flutter PNPM ?= pnpm DART ?= dart DEVICE ?= macos .PHONY: help deps analyze test check format run build-macos build-ios-sim package-mac install-mac clean help: ## Show available targets @grep -E '^[a-zA-Z0-9_.-]+:.*?## ' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-18s %s\n", $$1, $$2}' deps: ## Install Flutter dependencies $(FLUTTER) pub get analyze: ## Run static analysis $(FLUTTER) analyze test: ## Run Flutter tests $(FLUTTER) test check: analyze test ## Run the standard validation suite format: ## Format Dart sources $(DART) format lib test run: ## Run the app on a device or desktop target (DEVICE=macos by default) $(FLUTTER) run -d $(DEVICE) build-macos: ## Build the macOS app in release mode $(FLUTTER) build macos --release build-ios-sim: ## Build the iOS app for the simulator $(FLUTTER) build ios --simulator package-mac: ## Create the macOS .app and DMG bash scripts/package-flutter-mac-app.sh install-mac: ## Package and install the macOS app into /Applications bash scripts/package-flutter-mac-app.sh bash scripts/install-flutter-mac-dmg.sh clean: ## Remove generated artifacts $(FLUTTER) clean rm -rf build dist # Rust FFI targets .PHONY: rust-build rust-build-release rust-build-debug rust-test ffi-copy ffi-generate rust-build: rust-build-release ## Build Rust FFI library (release mode) rust-build-release: ## Build Rust FFI library in release mode cd rust && cargo build --release --target aarch64-apple-darwin cd rust && cargo build --release --target x86_64-apple-darwin @echo "Creating universal binary..." mkdir -p rust/target/universal lipo -create \ rust/target/aarch64-apple-darwin/release/libcodex_ffi.dylib \ rust/target/x86_64-apple-darwin/release/libcodex_ffi.dylib \ -output rust/target/universal/libcodex_ffi.dylib || true @echo "Universal binary created at rust/target/universal/" rust-build-debug: ## Build Rust FFI library in debug mode cd rust && cargo build --target aarch64-apple-darwin rust-test: ## Run Rust tests cd rust && cargo test ffi-copy: ## Copy FFI library to macOS Frameworks bash scripts/copy_ffi_framework.sh ffi-generate: ## Generate FFI bindings using flutter_rust_bridge bash scripts/generate_ffi_bindings.sh ffi-integrate: rust-build-release ffi-copy ## Build and copy FFI library (full integration) # Build with FFI integration build-macos-ffi: rust-build-release ffi-copy build-macos ## Build macOS app with FFI integration