#!/bin/sh cd ${0%/*} # go to project root FLAGS="-Wall -Wextra -g -pedantic" FLAGS_DISPLAY="-lraylib -lm -lpthread -lGL -ldl -lrt -lX11" SRC="src" BIN="bin" OBJ="obj" RUN=0 VALGRIND="" function __run__ { RUN=1 } function __valgrind__ { VALGRIND=valgrind RUN=1 } function __clean__ { rm -rf $BIN rm -rf $OBJ kill $( ps -q $$ -o pgid= ) # exit } set -xe if ! { [[ $# -eq 0 ]]; } 2> /dev/null then __$1__ fi mkdir -p $BIN mkdir -p $OBJ gcc -c -o $OBJ/main.o $SRC/main.c gcc -c -o $OBJ/display.o $SRC/display.c gcc -o $BIN/main $OBJ/main.o $OBJ/display.o $FLAGS $FLAGS_DISPLAY if ! { [[ $RUN -eq 0 ]]; } 2> /dev/null then $BIN/main fi