-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-debug.sh
35 lines (27 loc) · 965 Bytes
/
build-debug.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
#!/bin/bash
function printLine {
num=$(( 100-${#1} ))
echo -n "$1"
v=$(printf "%0*s\r" "${num}" " ")
echo -n "${v// / }"
}
mkdir -p build
rm -r build/*
mkdir -p bin
declare -i fileID=0
for inputFile in $(find ./debug ./src -type f \( -iname "*.c" \))
do
printLine "Running: C Pre-Processor : $inputFile -> ./build/$fileID.i"
if [[ "$1" == "enabled" ]]; then
./src/objectSystem/customPreProcessor.sh $inputFile ./build/$fileID.i
else
gcc -E $inputFile > ./build/$fileID.i
fi
printLine "Running: GCC Compiler : ./build/$fileID.i -> ./build/$fileID.o"
gcc -Wpointer-arith -Wall -g -c ./build/$fileID.i -o ./build/$fileID.o
fileID=$(( fileID+1 ))
done
printLine "Running: GCC Linker : ./build/*.o -> ./bin/main_$OSTYPE.exe"
gcc ./build/*.o -lm -o ./bin/main_${OSTYPE}.exe
printLine "Running: ./bin/main_${OSTYPE}.exe"
./bin/main_$OSTYPE.exe