CORE := ../usage-core # The core pins Zig 0.16.0; prefer whatever is on PATH, else the checkout's usual install location. ZIG ?= $(shell command -v zig 2>/dev/null || echo $(HOME)/.local/share/zig/0.16.0/zig) all: bundle # The quota rules live in the usage core and arrive as a Swift package dependency, but its Swift # wrapper links the Zig static library the core installs, so the core has to be built first: a stale # zig-out/lib/libusage.a silently links and the app runs yesterday's rules. core: @if [ ! -x "$(ZIG)" ] && ! command -v "$(ZIG)" >/dev/null 2>&1; then \ echo "zig not found (looked for $(ZIG))."; \ echo "install the pinned toolchain, see $(CORE)/README.md, or run: make ZIG=/path/to/zig"; \ exit 1; \ fi @if [ ! -f "$(CORE)/build.zig" ]; then \ echo "usage core not found at $(CORE)."; \ echo "clone it next to this repo: git clone git@knot.gaze.systems:did:plc:2lf7buutfnfcucljnmaypf7u $(CORE)"; \ exit 1; \ fi cd $(CORE) && $(ZIG) build -Doptimize=ReleaseSafe build: core swift build -c release bundle: build ./scripts/bundle.sh dump: core swift run UsageTray --dump run: bundle open dist/UsageTray.app install: bundle -killall -9 UsageTray 2>/dev/null || pkill -9 -f UsageTray 2>/dev/null || true @sleep 0.5 rm -rf /Applications/UsageTray.app cp -R dist/UsageTray.app /Applications/UsageTray.app open /Applications/UsageTray.app @echo "✓ Installed and restarted /Applications/UsageTray.app" clean: rm -rf .build dist .PHONY: all core build bundle dump run install clean