Includes provider integrations, settings, NSStatusItem UI, tests, Makefile, and README with screenshot. Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
2.3 KiB
Makefile
74 lines
2.3 KiB
Makefile
.PHONY: help build test run clean clean-all xcodegen open release install
|
|
|
|
PROJECT := AIMenubarUsage.xcodeproj
|
|
SCHEME := AIMenubarUsage
|
|
DESTINATION := platform=macOS
|
|
BUILD_DIR := build
|
|
DERIVED_DATA := $(BUILD_DIR)/DerivedData
|
|
APP_NAME := AI Menubar Usage
|
|
EXEC_NAME := AIMenubarUsage
|
|
APP_PRODUCTS := $(DERIVED_DATA)/Build/Products
|
|
|
|
help: ## Show this help
|
|
@grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
|
|
build: ## Build the app (Debug)
|
|
xcodebuild \
|
|
-project $(PROJECT) \
|
|
-scheme $(SCHEME) \
|
|
-configuration Debug \
|
|
-destination '$(DESTINATION)' \
|
|
-derivedDataPath '$(DERIVED_DATA)' \
|
|
build
|
|
|
|
release: ## Build the app (Release)
|
|
xcodebuild \
|
|
-project $(PROJECT) \
|
|
-scheme $(SCHEME) \
|
|
-configuration Release \
|
|
-destination '$(DESTINATION)' \
|
|
-derivedDataPath '$(DERIVED_DATA)' \
|
|
build
|
|
|
|
test: ## Run unit tests
|
|
xcodebuild \
|
|
-project $(PROJECT) \
|
|
-scheme $(SCHEME) \
|
|
-destination '$(DESTINATION)' \
|
|
-derivedDataPath '$(DERIVED_DATA)' \
|
|
test
|
|
|
|
run: build ## Build and launch the app (restarts if already running)
|
|
@app_path="$$(find '$(APP_PRODUCTS)/Debug' -name '$(APP_NAME).app' -maxdepth 1 2>/dev/null | head -1)"; \
|
|
if [ ! -d "$$app_path" ]; then \
|
|
echo "App not found under $(APP_PRODUCTS)/Debug"; exit 1; \
|
|
fi; \
|
|
if pgrep -xq '$(EXEC_NAME)'; then \
|
|
echo "Stopping running $(EXEC_NAME)…"; \
|
|
killall '$(EXEC_NAME)' 2>/dev/null || true; \
|
|
sleep 0.5; \
|
|
fi; \
|
|
open "$$app_path" || { echo "Failed to launch $$app_path"; exit 1; }; \
|
|
echo "Launched $$app_path"
|
|
|
|
open: ## Open the project in Xcode
|
|
open $(PROJECT)
|
|
|
|
xcodegen: ## Regenerate Xcode project from project.yml
|
|
xcodegen generate
|
|
|
|
clean: ## Remove local build output
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
clean-all: clean ## Remove build output and Xcode DerivedData for this project
|
|
rm -rf ~/Library/Developer/Xcode/DerivedData/AIMenubarUsage-*
|
|
|
|
install: release ## Copy Release build to /Applications
|
|
@release_app="$$(find '$(APP_PRODUCTS)/Release' -name '$(APP_NAME).app' -maxdepth 1 2>/dev/null)"; \
|
|
if [ ! -d "$$release_app" ]; then \
|
|
echo "Release app not found. Run 'make release' first."; exit 1; \
|
|
fi; \
|
|
cp -R "$$release_app" /Applications/; \
|
|
echo "Installed to /Applications/$(APP_NAME).app"
|
|
|
|
.DEFAULT_GOAL := help
|