forked from tonysparks/litac-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
50 lines (41 loc) · 1.14 KB
/
build.sh
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
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
unameOut="$(uname -s)"
case "${unameOut}" in
Darwin*)
LIBS="-lm -lpthread";
EXE_NAME="litac_mac";
;;
*)
LIBS="-lm -lrt -lpthread";
EXE_NAME="litac_linux";
;;
esac
BUILD_CMD="gcc %input% -o %output% -D_CRT_SECURE_NO_WARNINGS -I../include -L../lib ${LIBS}"
error_compiling() {
echo ""
echo "=========================================="
echo "ERROR: Compiling litac compiler "
echo "=========================================="
echo ""
exit 2;
}
build_litac() {
echo "Running bootstrapped litaC..."
cd bootstrap
./litacc -verbose -cFormat -profile -buildCmd "${BUILD_CMD}" "../src/main.lita" -outputDir "../bin/" -output "${EXE_NAME}" -maxMemory 1GiB
if [ $? -gt 0 ]; then
error_compiling
return 1;
fi
echo "Running litaC inception!..."
cd ../bin
./$EXE_NAME -profile -cFormat -buildCmd "${BUILD_CMD}" "../src/main.lita" -maxMemory 1GiB
if [ $? -gt 0 ]; then
error_compiling
return 1;
fi
echo Completed.
}
LITAC_HOME=${LITAC_HOME:-${PWD}}
echo "Environment variable: ${LITAC_HOME}"
build_litac