#!/bin/env bash cc="gcc" ld="gcc" rm -rf ./lib/ rm -rf ./bin/ mkdir ./lib/ mkdir ./bin/ echo "[BUILD] entry.c" cflags="-std=c99 -Wall -Wextra -g -Wno-error -pedantic" $cc $cflags \ -c -o lib/ungrateful.o \ -g src/ungrateful.c if [[ $? -ne 0 ]]; then exit fi if [[ $1 == "no_tests" ]]; then exit fi echo for test in tests/*.c; do fname=$(basename -- "$test") fname="${fname%.*}" echo "[BUILD] $test" $cc $cflags -o bin/$fname $test lib/ungrateful.o -Isrc/ done for case in bin/*; do if [[ $1 == "quiet" ]]; then $case > /dev/null 2>&1 else $case fi if [[ $? -eq 0 ]]; then echo "[DONE] $case" else echo "[FAIL] $case" fi done