aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: c8e8cecf9044ed3e9a1790853da812fda23fb39d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env sh

set -xe

CFLAGS="-Wall -Wextra -std=c11 -ggdb -fsanitize=address -fsanitize=undefined -Wswitch -Wswitch-enum"
LINK="-I."
LIB=$(find "./" -name "*.c" -not -name "main.c" -not -name "test.c")
OUT="alisp.out"

build() {
    cc $LINK $CFLAGS -o $OUT $LIB main.c;
    cc $LINK $CFLAGS -o test.out $LIB test.c;
}

clean() {
    rm -v $OUT test.out;
}

run() {
    ./$OUT;
}

test() {
    ./test.out
}

build

if [ "$1" = "run" ]
then
    run
elif [ "$1" = "test" ]
then
    test
elif [ "$1" = "clean" ]
then
    clean
fi