diff --git a/Makefile b/Makefile index efd5f56..32e9333 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,21 @@ +DIRENV := $(shell command -v direnv 2> /dev/null) +ifdef DIRENV + EXEC := direnv exec . +else + EXEC := +endif + build: - cargo build + $(EXEC) cargo build run: - cargo run + $(EXEC) cargo run test: - cargo test + $(EXEC) cargo test clean: - cargo clean + $(EXEC) cargo clean .PHONY: build run test clean @@ -16,4 +23,4 @@ clean: # Flatpak build target .PHONY: flatpak-build flatpak-build: - flatpak-builder --force-clean build-flatpak flatpak/app.flatpak.json + $(EXEC) flatpak-builder --force-clean build-flatpak flatpak/app.flatpak.json diff --git a/README.md b/README.md index ac3ac2d..a5bbe4e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,18 @@ This project is an embedded Rust application for the Raspberry Pi Pico W, utilizing the Embassy async framework. +## Build Commands + +This project uses a `Makefile` to simplify common tasks. The `Makefile` is configured to automatically use `direnv` to load the Nix environment if `direnv` is installed on your system. This ensures that the correct Rust toolchain and dependencies are available even if you haven't manually run `nix develop` or `direnv allow`. + +| Command | Description | +|---------|-------------| +| `make build` | Build the project using `cargo build` | +| `make run` | Run the project using `cargo run` | +| `make test` | Run tests using `cargo test` | +| `make clean` | Clean build artifacts | +| `make flatpak-build` | Build the Flatpak package | + ## LLM Agent Guidelines This project uses LLM agents for configuration and housekeeping. Please refer to [agents.md](agents.md) for the rules and guidelines governing their use.