diff --git a/check.sh b/check.sh index 65ca758..3b9a8a2 100755 --- a/check.sh +++ b/check.sh @@ -35,12 +35,15 @@ if [ ! -d "$COPY_DEST" ]; then exit 84 fi +# In build directory cd "$COPY_DEST" +# Copy from delivery directory to build directory if [ "$DELIVERY_DIR" != "$COPY_DEST" ]; then cp -a "$DELIVERY_DIR"/. . fi +# Back to root directory cd - >/dev/null find "$COPY_DEST" \ @@ -49,14 +52,28 @@ find "$COPY_DEST" \ -o \( -name '*.c' -o -name '*.h' \) -print0 \ > "$COPY_DEST/coding-style-files.log" +# Back to build directory cd - >/dev/null +# If the student has compile flags, ignore them +rm -f compile_commands.json +rm -f compile_flags.txt + if [ -d rush-1-1 ]; then + # Rush1 is a special case bear -- gcc rush-1-*/*.c >/dev/null 2>&1 -else +elif [[ -f Makefile || -f makefile || -f GNUmakefile ]]; then + # Normal case, with a Makefile at the root bear -- make re >/dev/null 2>&1 +else + # Most days of the CPool + if [ -d lib/my ]; then + (cd lib/my && bear -- ./build.sh) >/dev/null 2>&1 + fi + bear -- gcc *.c -I./include >/dev/null 2>&1 fi +# Back to root directory cd - >/dev/null REPORT="$REPORTS_DIR"/coding-style-reports.log.unsorted