uxn/build.sh

46 lines
1.8 KiB
Bash
Raw Normal View History

2021-01-29 14:17:59 -05:00
#!/bin/bash
2021-03-22 22:04:31 -04:00
echo "Formatting.."
clang-format -i src/uxn.h
clang-format -i src/uxn.c
2021-04-08 19:30:44 -04:00
clang-format -i src/ppu.h
2021-04-07 20:32:18 -04:00
clang-format -i src/ppu.c
2021-04-08 16:21:46 -04:00
clang-format -i src/apu.h
2021-04-08 19:30:44 -04:00
clang-format -i src/apu.c
clang-format -i src/assembler.c
clang-format -i src/emulator.c
clang-format -i src/debugger.c
2021-01-29 14:17:59 -05:00
2021-03-22 22:04:31 -04:00
echo "Cleaning.."
2021-02-09 00:59:46 -05:00
rm -f ./bin/assembler
2021-03-22 22:04:31 -04:00
rm -f ./bin/emulator
rm -f ./bin/debugger
2021-02-09 00:59:46 -05:00
rm -f ./bin/boot.rom
2021-01-29 14:17:59 -05:00
2021-03-22 22:04:31 -04:00
echo "Building.."
mkdir -p bin
if [ "${1}" = '--debug' ];
then
echo "[debug]"
cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/assembler.c -o bin/assembler
2021-04-07 20:32:18 -04:00
cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/ppu.c src/emulator.c src/apu.c -L/usr/local/lib -lSDL2 -o bin/emulator
2021-03-22 22:04:31 -04:00
cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined src/uxn.c src/debugger.c -o bin/debugger
else
cc src/assembler.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o bin/assembler
cc src/uxn.c src/debugger.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o bin/debugger
2021-04-07 20:32:18 -04:00
cc src/uxn.c src/ppu.c src/emulator.c src/apu.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator
2021-03-22 22:04:31 -04:00
fi
2021-02-09 13:06:55 -05:00
2021-03-22 22:04:31 -04:00
echo "Assembling.."
2021-04-09 16:38:47 -04:00
./bin/assembler projects/examples/dev.audio.usm bin/boot.rom
2021-01-29 14:17:59 -05:00
2021-03-22 22:04:31 -04:00
echo "Running.."
if [ "${2}" = '--cli' ];
then
echo "[cli]"
./bin/debugger bin/boot.rom
else
./bin/emulator bin/boot.rom
fi
2021-03-22 19:51:12 -04:00
2021-03-22 22:04:31 -04:00
echo "Done."