feat: enhence makefile
This commit is contained in:
@@ -3,19 +3,8 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="${SCRIPT_DIR}/.."
|
||||
SRC_DIR="${PROJECT_ROOT}/src"
|
||||
CLANG_FORMAT_BIN="${CLANG_FORMAT:-clang-format}"
|
||||
|
||||
if ! command -v clang-format >/dev/null 2>&1; then
|
||||
echo "error: clang-format is not installed or not in PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
cd "${PROJECT_ROOT}"
|
||||
|
||||
if [ ! -d "${SRC_DIR}" ]; then
|
||||
echo "warning: src directory not found; nothing to format" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
find "${SRC_DIR}" -name '*.cpp' -o -name '*.hpp' -o -name '*.h' | while read -r file; do
|
||||
clang-format -i "$file"
|
||||
echo "formatted $file"
|
||||
done
|
||||
make CLANG_FORMAT="${CLANG_FORMAT_BIN}" format
|
||||
|
10
utils/tidy.sh
Executable file
10
utils/tidy.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="${SCRIPT_DIR}/.."
|
||||
CLANG_TIDY_BIN="${CLANG_TIDY:-clang-tidy}"
|
||||
|
||||
cd "${PROJECT_ROOT}"
|
||||
|
||||
make CLANG_TIDY="${CLANG_TIDY_BIN}" tidy
|
Reference in New Issue
Block a user