|
| 1 | +# OSVM CLI Makefile |
| 2 | +# Quick commands for building, testing, and installing |
| 3 | + |
| 4 | +.PHONY: help build build-release test install install-dev clean clean-install uninstall |
| 5 | + |
| 6 | +# Default target |
| 7 | +help: |
| 8 | + @echo "🚀 OSVM CLI Build & Installation Commands" |
| 9 | + @echo "========================================" |
| 10 | + @echo "" |
| 11 | + @echo "Build Commands:" |
| 12 | + @echo " make build - Build debug binary" |
| 13 | + @echo " make build-release - Build optimized release binary" |
| 14 | + @echo " make test - Run all tests" |
| 15 | + @echo "" |
| 16 | + @echo "Installation Commands:" |
| 17 | + @echo " make install - Build release and install to /usr/bin (requires sudo)" |
| 18 | + @echo " make install-dev - Install debug binary to /usr/bin (requires sudo)" |
| 19 | + @echo " make uninstall - Remove osvm from /usr/bin (requires sudo)" |
| 20 | + @echo "" |
| 21 | + @echo "Cleanup Commands:" |
| 22 | + @echo " make clean - Clean build artifacts" |
| 23 | + @echo " make clean-install - Remove installed binaries and backups" |
| 24 | + @echo "" |
| 25 | + @echo "Development Commands:" |
| 26 | + @echo " make run - Run the debug binary locally" |
| 27 | + @echo " make check - Check code without building" |
| 28 | + @echo " make fmt - Format code" |
| 29 | + @echo " make clippy - Run clippy linter" |
| 30 | + |
| 31 | +# Build commands |
| 32 | +build: |
| 33 | + @echo "🔨 Building debug binary..." |
| 34 | + cargo build |
| 35 | + |
| 36 | +build-release: |
| 37 | + @echo "🔨 Building release binary..." |
| 38 | + cargo build --release |
| 39 | + |
| 40 | +test: |
| 41 | + @echo "🧪 Running tests..." |
| 42 | + cargo test |
| 43 | + |
| 44 | +check: |
| 45 | + @echo "🔍 Checking code..." |
| 46 | + cargo check |
| 47 | + |
| 48 | +fmt: |
| 49 | + @echo "🎨 Formatting code..." |
| 50 | + cargo fmt |
| 51 | + |
| 52 | +clippy: |
| 53 | + @echo "📎 Running clippy..." |
| 54 | + cargo clippy -- -D warnings |
| 55 | + |
| 56 | +# Installation commands |
| 57 | +install: build-release |
| 58 | + @echo "📦 Installing release binary..." |
| 59 | + ./install-release.sh |
| 60 | + |
| 61 | +install-dev: build |
| 62 | + @echo "📦 Installing debug binary..." |
| 63 | + sudo cp target/debug/osvm /usr/bin/osvm |
| 64 | + sudo chmod +x /usr/bin/osvm |
| 65 | + @echo "✅ Debug binary installed to /usr/bin/osvm" |
| 66 | + |
| 67 | +uninstall: |
| 68 | + @echo "🗑️ Uninstalling osvm..." |
| 69 | + sudo rm -f /usr/bin/osvm |
| 70 | + @echo "✅ osvm removed from /usr/bin" |
| 71 | + |
| 72 | +# Cleanup commands |
| 73 | +clean: |
| 74 | + @echo "🧹 Cleaning build artifacts..." |
| 75 | + cargo clean |
| 76 | + |
| 77 | +clean-install: uninstall |
| 78 | + @echo "🧹 Cleaning installed binaries and backups..." |
| 79 | + sudo rm -f /usr/bin/osvm.backup |
| 80 | + @echo "✅ All installed files cleaned" |
| 81 | + |
| 82 | +# Development commands |
| 83 | +run: |
| 84 | + @echo "🏃 Running debug binary..." |
| 85 | + cargo run |
| 86 | + |
| 87 | +# Verification command |
| 88 | +verify-install: |
| 89 | + @echo "🧪 Verifying installation..." |
| 90 | + @if command -v osvm >/dev/null 2>&1; then \ |
| 91 | + echo "✅ osvm is installed and accessible"; \ |
| 92 | + echo "📍 Location: $$(which osvm)"; \ |
| 93 | + echo "📦 Version: $$(osvm --version)"; \ |
| 94 | + else \ |
| 95 | + echo "❌ osvm is not installed or not in PATH"; \ |
| 96 | + exit 1; \ |
| 97 | + fi |
| 98 | + |
| 99 | +# Quick development cycle |
| 100 | +dev: clean build test |
| 101 | + @echo "✅ Development build completed" |
| 102 | + |
| 103 | +# Full release cycle |
| 104 | +release: clean build-release test install |
| 105 | + @echo "✅ Release build and installation completed" |
0 commit comments