From 82b93e31932f45fefc505a7425db194b0d283ee4 Mon Sep 17 00:00:00 2001 From: AramJonghu Date: Fri, 23 Oct 2026 16:52:22 +0200 Subject: [PATCH] feat(makefile): C++, Python, and Rust checks included (incomplete) --- makefile | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 76 insertions(+), 9 deletions(-) diff --git a/makefile b/makefile index c7d3ce6..79920f3 100644 --- a/makefile +++ b/makefile @@ -1,12 +1,34 @@ -BUILD ?= cmake -B build -G Ninja -INSTALL ?= $(BUILD) \ - && ninja -C build \ - && sudo ninja -C build install +BUILD ?= cmake -B build -G Ninja +NINJA ?= ninja -C build +COMPILE ?= $(BUILD) && $(NINJA) +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 +# string is misaligned to align when run in terminal 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) @@ -14,15 +36,21 @@ build: install: $(INSTALL) +compile: + $(COMPILE) + # TODO: Anything below is not ready +# C++ cpp-fmt: - find . \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ - -not -path './build/*' \ - -exec clang-format -i --style=file {} + + $(CPPFMT) # cpp-lint needs adjustments in ci and here +cpp-compile: + $(COMPILE) + +# Python py-fmt: ruff format --check @@ -33,4 +61,43 @@ py-check: basedpyright 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