diff options
author | kartofen <mladenovnasko0@gmail.com> | 2022-08-23 20:45:56 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2022-08-23 20:45:56 +0300 |
commit | 39161cf246aa2b34c7c02ebb6c88da3776979670 (patch) | |
tree | 885d0945c4d15c3c9035327f1560357c4b9c9bd5 /build.sh |
Big Bang
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..988ee24 --- /dev/null +++ b/build.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +cd ${0%/*} # go to project root + +FLAGS="-Wall -Wextra -g -pedantic" +SRCD="src" +BIN="bin" +FILES="files" +RUN=0 + +function __run__ { + RUN=1 +} + +function __clean__ { + rm -rf $BIN + rm -rf files + kill $( ps -q $$ -o pgid= ) # exit +} + +set -xe + +if ! { [[ $# -eq 0 ]]; } 2> /dev/null +then + __$1__ +fi + + +mkdir -p $BIN +mkdir -p $FILES + +gcc -o $BIN/main $FLAGS $SRCD/main.c +gcc -o $BIN/gen_chain $FLAGS $SRCD/gen_chain.c + +if ! { [[ $RUN -eq 0 ]]; } 2> /dev/null +then + $BIN/gen_chain + $BIN/main +fi |