diff --git a/build.sh b/build.sh index 3235d92..f9ed541 100644 --- a/build.sh +++ b/build.sh @@ -5,12 +5,21 @@ set -xe OUT="cw_tree.out" GFLAGS="-Wall -Wextra -Wswitch-enum -std=c++17" DFLAGS="-ggdb -fsanitize=address -fsanitize=undefined" +RFLAGS="-O2" CFLAGS="$GFLAGS $DFLAGS" LIBS="-lraylib -lm" -c++ $CFLAGS -o $OUT src/node.cpp src/state.cpp src/worker.cpp src/main.cpp $LIBS +build() { + c++ $CFLAGS -o $OUT src/node.cpp src/state.cpp src/worker.cpp src/main.cpp $LIBS +} if [ "$1" = "run" ] then - ./$OUT + build && ./$OUT +elif [ "$1" = "release" ] +then + CFLAGS="$GFLAGS $RFLAGS" + build; +else + build; fi