#!/usr/bin/env bash
TIDY_OPTS="-p . --fix --fix-errors"
COMPILER_OPTS="-nostdinc -fno-builtin -std=gnu90 -Iinclude -Isrc -D_LANGUAGE_C"
VERSIONS="-DVERSION_US -DVERSION_JP -DVERSION_EU"
cd "$( dirname $0 )" >/dev/null 2>&1; cd ../
if (( $# > 0 )); then
printf "Tidy file(s) $*"
echo
for VER in ${VERSIONS}; do
echo "with compiler version flag ${VER}"
clang-tidy ${TIDY_OPTS} "$@" -- ${COMPILER_OPTS} ${VER}
done
printf "Done tidying file(s) $*"
echo
exit
fi
echo "Tidying all C files for all versions. This will take a bit"
for VER in ${VERSIONS}; do
echo "Tidying for compiler version flag ${VER}"
clang-tidy ${TIDY_OPTS} src/audio/*.c -- ${COMPILER_OPTS} ${VER}
clang-tidy ${TIDY_OPTS} src/engine/*.c -- ${COMPILER_OPTS} ${VER}
clang-tidy ${TIDY_OPTS} src/game/*.c -- ${COMPILER_OPTS} ${VER}
clang-tidy ${TIDY_OPTS} src/goddard/*.c -- ${COMPILER_OPTS} ${VER}
clang-tidy ${TIDY_OPTS} lib/src/*.c -- ${COMPILER_OPTS} ${VER}
clang-tidy ${TIDY_OPTS} enhancements/*.inc.c -- ${COMPILER_OPTS} ${VER}
done
echo "Done tidying all C files. Hope you did something fun during the tidying"