spb/zyquo-mlx Public MIT
The local MLX foundry for your Mac — run, fine-tune, quantize, and ship models. Nothing leaves your machine.
Swift 93.4%
Python 3.8%
Makefile 2.2%
Shell 0.5%
1#2# Makefile3# Zyquo MLX4#5# Author: Simon-Pierre Boucher6# Mail: contact@spboucher.ai7#8# Command-line-only builds (no Xcode IDE, no .xcodeproj) per docs/BUILD.md.9# Requires full Xcode installed as a toolchain + Metal toolchain component:10# sudo xcode-select -s /Applications/Xcode.app11# xcodebuild -downloadComponent metalToolchain12#1314APP_NAME := Zyquo MLX15EXEC_NAME := ZyquoMLX16BUNDLE_ID := com.zyquo.mlx17DIST := dist18APP := $(DIST)/$(APP_NAME).app19CONFIG ?= release2021# Use Xcode's toolchain per-command; the machine default (CLT) is untouched.22XCODE_DEV_DIR := /Applications/Xcode.app/Contents/Developer23DEV := DEVELOPER_DIR=$(XCODE_DEV_DIR)2425# Build backend per docs/BUILD.md §3.1 (RESOLVED 2026-07-30): the new26# SwiftPM backend (--build-system swiftbuild, Swift 6.4) compiles the Metal27# kernels and emits mlx-swift_Cmlx.bundle/default.metallib. The classic28# backend silently skips Metal → broken GPU path. xcodebuild kept as fallback.29BUILD_DIR := .build30CONFIG_TITLE = $(shell echo $(CONFIG) | awk '{print toupper(substr($$0,1,1)) substr($$0,2)}')31BIN_DIR = $(BUILD_DIR)/out/Products/$(CONFIG_TITLE)3233.PHONY: build build-xcodebuild app dev run icon icon-if-missing clean release dmg check-toolchain3435check-toolchain:36 @test -d $(XCODE_DEV_DIR) || { echo "error: Xcode toolchain not found at /Applications/Xcode.app — see docs/BUILD.md §2"; exit 1; }3738build: check-toolchain39 $(DEV) swift build --build-system swiftbuild --arch arm64 -c $(CONFIG)4041build-xcodebuild: check-toolchain42 $(DEV) xcodebuild build \43 -scheme $(EXEC_NAME) \44 -destination 'platform=OS X,arch=arm64' \45 -configuration Release \46 -derivedDataPath $(BUILD_DIR)/xcode \47 -skipMacroValidation4849app: build50 rm -rf "$(APP)"51 mkdir -p "$(APP)/Contents/MacOS" "$(APP)/Contents/Resources"52 cp Support/Info.plist "$(APP)/Contents/Info.plist"53 cp "$(BIN_DIR)/$(EXEC_NAME)" "$(APP)/Contents/MacOS/$(EXEC_NAME)"54 @# Ship every SPM resource bundle — mlx-swift_Cmlx.bundle carries55 @# default.metallib; omitting it crashes GPU ops (docs/BUILD.md §3.2).56 @for b in "$(BIN_DIR)"/*.bundle; do \57 [ -e "$$b" ] && cp -R "$$b" "$(APP)/Contents/Resources/" && echo "bundled $$(basename $$b)"; \58 done; true59 @if [ -f assets/icon/AppIcon.icns ]; then cp assets/icon/AppIcon.icns "$(APP)/Contents/Resources/AppIcon.icns"; fi60 codesign --force --deep --sign - "$(APP)"61 @echo "→ $(APP) (ad-hoc signed)"6263dev: app64 open "$(APP)"6566run: app67 "$(APP)/Contents/MacOS/$(EXEC_NAME)"6869icon:70 @# Phase 5: SVG → PNGs → .iconset → .icns (rsvg-convert + iconutil)71 bash scripts/make-icon.sh7273# Phase 8: Developer ID signing + notarization + stapling (docs/BUILD.md §4).74# Identity/profile reused from the zyquo-term pipeline (charter Phase 8).75IDENTITY := Developer ID Application: Simon-Pierre Boucher (3YM54G49SN)76KEYCHAIN_PROFILE := MacLustr-Notarize77ENTITLEMENTS := Support/entitlements.plist78ZIP := $(DIST)/ZyquoMLX.zip79DMG := $(DIST)/ZyquoMLX.dmg8081release: build icon-if-missing82 rm -rf "$(APP)"83 mkdir -p "$(APP)/Contents/MacOS" "$(APP)/Contents/Resources"84 cp Support/Info.plist "$(APP)/Contents/Info.plist"85 cp "$(BIN_DIR)/$(EXEC_NAME)" "$(APP)/Contents/MacOS/$(EXEC_NAME)"86 @for b in "$(BIN_DIR)"/*.bundle; do \87 [ -e "$$b" ] && cp -R "$$b" "$(APP)/Contents/Resources/" && echo "bundled $$(basename $$b)"; \88 done; true89 cp assets/icon/AppIcon.icns "$(APP)/Contents/Resources/AppIcon.icns"90 @echo "=== Signing (Developer ID, hardened runtime, nested-first) ==="91 @# Resource bundles carry no Mach-O code (metallib + .py are data) but we92 @# sign any nested code defensively before the outer bundle.93 @find "$(APP)/Contents/Resources" -type f \( -name "*.dylib" -o -name "*.so" \) -exec \94 codesign --force --options runtime --timestamp --sign "$(IDENTITY)" {} \; 2>/dev/null; true95 codesign --force --options runtime --timestamp \96 --entitlements $(ENTITLEMENTS) \97 --sign "$(IDENTITY)" "$(APP)/Contents/MacOS/$(EXEC_NAME)"98 codesign --force --options runtime --timestamp \99 --entitlements $(ENTITLEMENTS) \100 --sign "$(IDENTITY)" "$(APP)"101 codesign --verify --deep --strict --verbose=2 "$(APP)"102 @echo "=== Notarizing (profile: $(KEYCHAIN_PROFILE)) ==="103 rm -f "$(ZIP)"104 ditto -c -k --keepParent "$(APP)" "$(ZIP)"105 xcrun notarytool submit "$(ZIP)" --keychain-profile "$(KEYCHAIN_PROFILE)" --wait106 xcrun stapler staple "$(APP)"107 @echo "=== Verifying ==="108 spctl -a -vv "$(APP)"109 xcrun stapler validate "$(APP)"110 @echo "→ $(APP) (Developer ID signed, notarized, stapled)"111112dmg:113 rm -f "$(DMG)"114 rm -rf $(DIST)/dmg_temp115 mkdir -p $(DIST)/dmg_temp116 cp -R "$(APP)" $(DIST)/dmg_temp/117 ln -s /Applications "$(DIST)/dmg_temp/Applications"118 hdiutil create -volname "$(APP_NAME)" -srcfolder $(DIST)/dmg_temp -ov -format UDZO "$(DMG)"119 rm -rf $(DIST)/dmg_temp120 codesign --force --sign "$(IDENTITY)" --timestamp "$(DMG)"121 xcrun notarytool submit "$(DMG)" --keychain-profile "$(KEYCHAIN_PROFILE)" --wait122 xcrun stapler staple "$(DMG)"123 @echo "→ $(DMG) (signed, notarized, stapled)"124125icon-if-missing:126 @test -f assets/icon/AppIcon.icns || bash scripts/make-icon.sh127128clean:129 rm -rf $(BUILD_DIR) $(DIST)130