# rcshell: Plan9 rc shell in Rust # Makefile: Makefile for rcshell # # Copyright (c) 2023, 2024 Ali Polatel # # SPDX-License-Identifier: GPL-3.0-or-later # Package name and version PACKAGE= rc VERSION= 0.0.1 # Build profile PROFILE?= debug # Installation directories PREFIX = /usr/local BIN_DIR = $(PREFIX)/bin # Cargo and Installer CARGO?= cargo INSTALL?= install # Cargo flags CARGOFLAGS?= -j$(shell nproc) RUSTFLAGS?= # Source files SRC= Cargo.toml $(wildcard *.rs src/*.rs) # Path to the binary ifeq ($(PROFILE), debug) BIN= ./target/debug/$(PACKAGE) else BIN= ./target/release/$(PACKAGE) CARGOFLAGS+= --release RUSTFLAGS+= -Ctarget-feature=+crt-static endif # Default target all: $(BIN) # QA targets fmt: $(CARGO) +nightly fmt lint: $(CARGO) deny check $(CARGO) +nightly acl -n || true $(CARGO) +nightly clippy $(CARGOFLAGS) # Install and Uninstall Targets install: $(BIN) $(INSTALL) -d $(BIN_DIR) $(INSTALL) -m 755 $(BIN) $(BIN_DIR) uninstall: rm -f $(BIN_DIR)/$(PACKAGE) # Check target check: test test: $(BIN) $(CARGO) test $(CARGOFLAGS) # Clean Target clean: $(CARGO) clean $(BIN): $(SRC) env RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build $(CARGOFLAGS) # Phony Targets .PHONY: all clean check test install uninstall fmt lint