From 9af36f75f77784da6b6eda53dd0fbb04f306ebba Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Tue, 28 Oct 2025 20:53:07 +0800 Subject: [PATCH] Add Makefile to automate build process --- Makefile | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..16a5050 --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +.PHONY: all clean whisper setup build check healthcheck help dev run + +# Default target +all: check build + +# Development workflow +dev: build run + +# Prerequisites +check: + @echo "Checking prerequisites..." + @command -v git >/dev/null 2>&1 || { echo "git is not installed"; exit 1; } + @command -v xcodebuild >/dev/null 2>&1 || { echo "xcodebuild is not installed (need Xcode)"; exit 1; } + @command -v swift >/dev/null 2>&1 || { echo "swift is not installed"; exit 1; } + @echo "Prerequisites OK" + +healthcheck: check + +# Build process +whisper: + @if [ ! -d "whisper.cpp/build-apple/whisper.xcframework" ]; then \ + echo "Building whisper.xcframework..."; \ + git clone https://github.com/ggerganov/whisper.cpp.git || (cd whisper.cpp && git pull); \ + cd whisper.cpp && ./build-xcframework.sh; \ + else \ + echo "whisper.xcframework already built, skipping build"; \ + fi + +setup: whisper + @if [ ! -d "VoiceInk/whisper.xcframework" ]; then \ + echo "Copying whisper.xcframework to VoiceInk..."; \ + cp -r whisper.cpp/build-apple/whisper.xcframework VoiceInk/; \ + else \ + echo "whisper.xcframework already in VoiceInk, skipping copy"; \ + fi + +build: setup + xcodebuild -project VoiceInk.xcodeproj -scheme VoiceInk -configuration Debug CODE_SIGN_IDENTITY="" build + +# Run application +run: + @echo "Looking for VoiceInk.app..." + @APP_PATH=$$(find "$$HOME/Library/Developer/Xcode/DerivedData" -name "VoiceInk.app" -type d | head -1) && \ + if [ -n "$$APP_PATH" ]; then \ + echo "Found app at: $$APP_PATH"; \ + open "$$APP_PATH"; \ + else \ + echo "VoiceInk.app not found. Please run 'make build' first."; \ + exit 1; \ + fi + +# Cleanup +clean: + @echo "Cleaning build artifacts..." + @rm -rf whisper.cpp VoiceInk/whisper.xcframework + @echo "Clean complete" + +# Help +help: + @echo "Available targets:" + @echo " check/healthcheck Check if required CLI tools are installed" + @echo " whisper Clone and build whisper.cpp XCFramework" + @echo " setup Copy whisper XCFramework to VoiceInk project" + @echo " build Build the VoiceInk Xcode project" + @echo " run Launch the built VoiceInk app" + @echo " dev Build and run the app (for development)" + @echo " all Run full build process (default)" + @echo " clean Remove build artifacts" + @echo " help Show this help message" \ No newline at end of file