diff options
author | kartofen <mladenovnasko0@gmail.com> | 2022-10-07 23:26:38 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2022-10-07 23:26:38 +0300 |
commit | e41af6679dae3f4c69b46962a6bf1a1f81bee600 (patch) | |
tree | b8d48e6707c4114408b270853ba8c6114d5d5a21 /build.sh |
kind of working but not really
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..95ea230 --- /dev/null +++ b/build.sh @@ -0,0 +1,46 @@ +#!/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 |