86 lines
1.9 KiB
Makefile
86 lines
1.9 KiB
Makefile
.PHONY: build run dev clean install test check fmt clippy examples help
|
|
|
|
# Default target
|
|
all: build
|
|
|
|
# Build the project
|
|
build:
|
|
cargo build
|
|
|
|
# Build optimized release version
|
|
build-release:
|
|
cargo build --release
|
|
|
|
# Run the server
|
|
run:
|
|
cargo run
|
|
|
|
# Run in development mode with logging
|
|
dev:
|
|
RUST_LOG=info cargo run
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
cargo clean
|
|
|
|
# Install dependencies and build
|
|
install:
|
|
cargo fetch
|
|
cargo build
|
|
|
|
# Run tests
|
|
test:
|
|
cargo test
|
|
|
|
# Check code without building
|
|
check:
|
|
cargo check
|
|
|
|
# Format code
|
|
fmt:
|
|
cargo fmt
|
|
|
|
# Run clippy linter
|
|
clippy:
|
|
cargo clippy -- -D warnings
|
|
|
|
# Run API examples (requires server to be running)
|
|
examples:
|
|
./examples.sh
|
|
|
|
# Start server in background and run examples
|
|
demo: build
|
|
@echo "Starting server in background..."
|
|
@cargo run & echo $$! > .server.pid
|
|
@sleep 3
|
|
@echo "Running examples..."
|
|
@./examples.sh || true
|
|
@echo "Stopping server..."
|
|
@if [ -f .server.pid ]; then kill `cat .server.pid` && rm .server.pid; fi
|
|
|
|
# Development setup
|
|
setup:
|
|
@echo "Setting up development environment..."
|
|
@rustup component add rustfmt clippy
|
|
@echo "Done! Run 'make run' to start the server."
|
|
|
|
# Show help
|
|
help:
|
|
@echo "Hyprmonitors Makefile"
|
|
@echo ""
|
|
@echo "Available targets:"
|
|
@echo " build - Build the project"
|
|
@echo " build-release - Build optimized release version"
|
|
@echo " run - Run the server"
|
|
@echo " dev - Run with debug logging"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " install - Install dependencies and build"
|
|
@echo " test - Run tests"
|
|
@echo " check - Check code without building"
|
|
@echo " fmt - Format code"
|
|
@echo " clippy - Run linter"
|
|
@echo " examples - Run API examples (server must be running)"
|
|
@echo " demo - Start server and run examples"
|
|
@echo " setup - Setup development environment"
|
|
@echo " help - Show this help"
|