.PHONY: help build test clean install uninstall fmt clippy bench docs package release
help:
@echo "dist_agent_lang Development Makefile"
@echo "==================================="
@echo ""
@echo "Available targets:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@echo ""
@echo "Examples:"
@echo " make build @echo " make test @echo " make install @echo " make package
build:
cargo build
build-release:
cargo build --release
test:
cargo test
test-all:
cargo test --all-features
test-examples:
cargo test --examples
fmt:
cargo fmt
clippy:
cargo clippy
check:
cargo check
bench:
cargo bench
docs:
cargo doc --no-deps --open
docs-build:
cargo doc --no-deps
install: build-release
cargo install --path .
install-local: build-release
@mkdir -p ~/.local/bin
cp target/release/dist_agent_lang ~/.local/bin/
chmod +x ~/.local/bin/dist_agent_lang
@echo "dist_agent_lang installed to ~/.local/bin/"
@echo "Add ~/.local/bin to your PATH if not already there"
uninstall:
cargo uninstall dist_agent_lang
clean:
cargo clean
clean-all:
cargo clean
rm -rf node_modules
rm -rf dist_agent_lang-*.tar.gz
rm -rf dist_agent_lang-*.zip
rm -rf dist_agent_lang-*
package: build-release
@echo "Creating minimal release package..."
@mkdir -p dist_agent_lang-1.0.0/bin
@cp target/release/dist_agent_lang dist_agent_lang-1.0.0/bin/
@mkdir -p dist_agent_lang-1.0.0/examples
@for file in examples/*.dal; do \
if [ -f "$$file" ] && ! echo "$$file" | grep -q "test_"; then \
cp "$$file" dist_agent_lang-1.0.0/examples/; \
fi \
done
@cp README.md LICENSE CHANGELOG.md dist_agent_lang-1.0.0/
@cp scripts/install.sh dist_agent_lang-1.0.0/
@chmod +x dist_agent_lang-1.0.0/install.sh
@tar -czf dist_agent_lang-1.0.0.tar.gz dist_agent_lang-1.0.0/
@zip -r dist_agent_lang-1.0.0.zip dist_agent_lang-1.0.0/
@echo "Minimal release packages created:"
@echo " - dist_agent_lang-1.0.0.tar.gz"
@echo " - dist_agent_lang-1.0.0.zip"
@echo "Contents: binary, examples (.dal files only), README, LICENSE, CHANGELOG, install script"
release: test-all clippy package
@echo "Release created successfully!"
dev:
cargo watch -x check -x test -x run
watch:
cargo watch -x test
run-examples:
@echo "Running examples..."
@for example in examples/*.rs; do \
echo "Running $$example..."; \
cargo run --example $$(basename $$example .rs) || true; \
done
setup:
@echo "Setting up development environment..."
rustup update
cargo install cargo-watch
cargo install cargo-audit
@echo "Development environment setup complete!"
audit:
cargo audit
profile:
cargo build --release
perf record --call-graph=dwarf target/release/dist_agent_lang
perf report
docker-build:
docker build -t dist_agent_lang:latest .
docker-run:
docker run -it dist_agent_lang:latest
ci: test-all clippy audit
@echo "CI pipeline completed successfully!"
version:
@echo "dist_agent_lang version: 1.0.0"
@echo "Rust version: $(shell rustc --version)"
@echo "Cargo version: $(shell cargo --version)"
deps:
cargo tree
update:
cargo update
install-linux:
@echo "Installing on Linux..."
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libssl-dev
make install-local
install-macos:
@echo "Installing on macOS..."
brew install openssl pkg-config
make install-local
install-windows:
@echo "Installing on Windows..."
@echo "Please use the Windows installer or run: cargo install --path ."
.PHONY: check-deps
check-deps:
@echo "Checking dependencies..."
@command -v cargo >/dev/null 2>&1 || { echo "Cargo not found. Please install Rust: https://rustup.rs/"; exit 1; }
@command -v node >/dev/null 2>&1 || { echo "Node.js not found. Please install Node.js: https://nodejs.org/"; exit 1; }
@echo "All dependencies are installed!"
.PHONY: validate
validate: check-deps fmt clippy test
@echo "Code validation completed successfully!"