# Makefile — common entry points for CxLLM-SAFARI SHELL := /bin/bash .DEFAULT_GOAL := help PROJECT := CxLLM-SAFARI SCHEME ?= $(PROJECT) CONFIG ?= Debug DERIVED ?= build .PHONY: help build test lint clean fmt info help: ## show this help @grep -E '^[a-zA-Z_-]+:.*## ' $(MAKEFILE_LIST) | awk -F':.*## ' '{printf " %-12s %s\n", $$1, $$2}' info: ## show project info @echo "project : $(PROJECT)" @echo "scheme : $(SCHEME)" @echo "config : $(CONFIG)" @echo "derived : $(DERIVED)" build: ## xcodebuild build (skip if no .xcodeproj) @if ls *.xcodeproj 1>/dev/null 2>&1; then \ xcodebuild -project "$(PROJECT).xcodeproj" -scheme "$(SCHEME)" -configuration "$(CONFIG)" -derivedDataPath "$(DERIVED)" build | xcbeautify || true ; \ elif [ -f Package.swift ]; then \ swift build -c $(shell echo "$(CONFIG)" | tr '[:upper:]' '[:lower:]') ; \ else echo "no buildable target" ; fi test: ## xcodebuild test @if ls *.xcodeproj 1>/dev/null 2>&1; then \ xcodebuild -project "$(PROJECT).xcodeproj" -scheme "$(SCHEME)" -configuration "$(CONFIG)" -derivedDataPath "$(DERIVED)" test | xcbeautify || true ; \ elif [ -f Package.swift ]; then \ swift test ; \ else echo "no testable target" ; fi lint: ## swiftlint + swiftformat (no-op if missing) @command -v swiftlint >/dev/null && swiftlint --quiet || echo "swiftlint not installed" @command -v swiftformat >/dev/null && swiftformat --lint . || echo "swiftformat not installed" fmt: ## swiftformat in-place @command -v swiftformat >/dev/null && swiftformat . || echo "swiftformat not installed" clean: ## remove build artifacts rm -rf "$(DERIVED)" .build DerivedData