feat(makefile): C++, Python, and Rust checks included (incomplete)

This commit is contained in:
2026-10-25 16:01:40 +01:00
parent 9f9d09bc5b
commit cbb108a6dd
+74 -7
View File
@@ -1,12 +1,34 @@
BUILD ?= cmake -B build -G Ninja BUILD ?= cmake -B build -G Ninja
INSTALL ?= $(BUILD) \ NINJA ?= ninja -C build
&& ninja -C build \ COMPILE ?= $(BUILD) && $(NINJA)
&& sudo ninja -C build install INSTALL ?= $(BUILD) && $(NINJA) && sudo ninja -C build install
CPPFMT ?= find . \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) -not -path './build/*' -exec clang-format -i --style=file {} +
NUITKA ?= nuitka --module --include-package=zshell cli/src/zshell/ --output-dir=cli/
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
# string is misaligned to align when run in terminal
help: help:
@echo "build cmake builds into build directory" @echo "build cmake builds into build directory"
@echo "install cmake builds, compiles and installs into filesystem"
@echo "compile cmake builds and compiles C++ code"
@echo "cpp-fmt format C++ code with clang-format"
@echo "cpp-lint lint check C++ code with clang-tidy"
@echo "cpp-compile alias to make compile"
@echo "py-fmt format Python code with ruff"
@echo "py-lint lint check Python code with ruff"
@echo "py-check lsp and typecheck all Python code using Basedpyright"
@echo "py-test run all Python tests using Pytest"
@echo "py-compile compiles Python code using Nuitka"
@echo "rs-compile compiles Rust code"
@echo "rs-format formats Rust code with Rustfmt"
@echo "rs-lint lint check Rust code with Clippy"
@echo "rs-test runs all Rust tests"
@echo "check-cpp runs all C++ checks"
@echo "check-py runs all Python checks"
@echo "check-rs runs all Rust checks"
build: build:
$(BUILD) $(BUILD)
@@ -14,15 +36,21 @@ build:
install: install:
$(INSTALL) $(INSTALL)
compile:
$(COMPILE)
# TODO: Anything below is not ready # TODO: Anything below is not ready
# C++
cpp-fmt: cpp-fmt:
find . \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ $(CPPFMT)
-not -path './build/*' \
-exec clang-format -i --style=file {} +
# cpp-lint needs adjustments in ci and here # cpp-lint needs adjustments in ci and here
cpp-compile:
$(COMPILE)
# Python
py-fmt: py-fmt:
ruff format --check ruff format --check
@@ -33,4 +61,43 @@ py-check:
basedpyright basedpyright
py-test: py-test:
python -m pytest ./cli/src/tests/ -v python -m pytest ./cli/tests/ -v
# Want to use gcc, clang or zig C compiler instead? Output directory?
py-compile:
$(NUITKA)
# Rust
rs-compile:
cd ./zshell-img-tools/ && cargo run
rs-fmt:
cd ./zshell-img-tools/ && cargo fmt && echo "formatted!"
rs-lint:
cd ./zshell-img-tools/ && cargo clippy
rs-test:
cd ./zshell-img-tools/ && cargo test
# Qml
# Full checks
check-cpp:
$(MAKE) cpp-fmt
$(MAKE) cpp-lint
$(MAKE) install
check-rs:
$(MAKE) rs-fmt
$(MAKE) rs-lint
$(MAKE) rs-test
$(MAKE) rs-compile
check-py:
$(MAKE) py-fmt
$(MAKE) py-lint
$(MAKE) py-test
$(MAKE) py-check
$(MAKE) py-compile