# ML Experiment Manager CLI Build System # Fast, small, and cross-platform builds .PHONY: help build dev prod release cross clean install size test run # Default target help: @echo "ML Experiment Manager CLI - Build System" @echo "" @echo "Available targets:" @echo " build - Build default version (debug)" @echo " dev - Build development version (fast compile, debug info)" @echo " prod - Build production version (small binary, stripped)" @echo " release - Build release version (optimized for speed)" @echo " cross - Build cross-platform binaries" @echo " clean - Clean all build artifacts" @echo " install - Install binary to /usr/local/bin" @echo " size - Show binary sizes" @echo " test - Run unit tests" @echo " run - Build and run with arguments" @echo "" @echo "Examples:" @echo " make dev" @echo " make prod" @echo " make cross" @echo " make run ARGS=\"status\"" # Default build build: zig build # Development build - fast compilation, debug info dev: @echo "Building development version..." zig build dev @echo "Dev binary: zig-out/dev/ml-dev" # Production build - small and fast prod: @echo "Building production version (optimized for size)..." zig build prod @echo "Production binary: zig-out/prod/ml" # Release build - maximum performance release: @echo "Building release version (optimized for speed)..." zig build release @echo "Release binary: zig-out/release/ml-release" # Cross-platform builds cross: @echo "Building cross-platform binaries..." zig build cross @echo "Cross-platform binaries in: zig-out/cross/" # Clean build artifacts clean: @echo "Cleaning build artifacts..." zig build clean @echo "Cleaned zig-out/ and zig-cache/" # Install to system PATH install: prod @echo "Installing to /usr/local/bin..." zig build install-system @echo "Installed! Run 'ml' from anywhere." # Show binary sizes size: @echo "Binary sizes:" zig build size # Run tests test: @echo "Running unit tests..." zig build test # Run with arguments run: @if [ -z "$(ARGS)" ]; then \ echo "Usage: make run ARGS=\" [options]\""; \ echo "Example: make run ARGS=\"status\""; \ exit 1; \ fi zig build run -- $(ARGS) # Development workflow dev-test: dev test @echo "Development build and tests completed!" # Production workflow prod-test: prod test size @echo "Production build, tests, and size check completed!" # Full release workflow release-all: clean cross prod test size @echo "Full release workflow completed!" @echo "Binaries ready for distribution in zig-out/" # Quick development commands quick-run: dev ./zig-out/dev/ml-dev $(ARGS) quick-test: dev test @echo "Quick dev and test cycle completed!" # Check for required tools check-tools: @echo "Checking required tools..." @which zig > /dev/null || (echo "Error: zig not found. Install from https://ziglang.org/" && exit 1) @echo "All tools found!" # Show build info info: @echo "Build information:" @echo " Zig version: $$(zig version)" @echo " Target: $$(zig target)" @echo " CPU: $$(uname -m)" @echo " OS: $$(uname -s)" @echo " Available memory: $$(free -h 2>/dev/null || vm_stat | grep 'Pages free' || echo 'N/A')"