2021-01-29 19:17:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-03-23 02:04:31 +00:00
|
|
|
echo "Formatting.."
|
|
|
|
clang-format -i src/uxn.h
|
|
|
|
clang-format -i src/uxn.c
|
2021-05-11 18:42:12 +00:00
|
|
|
clang-format -i src/devices/ppu.h
|
|
|
|
clang-format -i src/devices/ppu.c
|
|
|
|
clang-format -i src/devices/apu.h
|
|
|
|
clang-format -i src/devices/apu.c
|
|
|
|
clang-format -i src/devices/mpu.h
|
|
|
|
clang-format -i src/devices/mpu.c
|
2021-04-08 23:30:44 +00:00
|
|
|
clang-format -i src/assembler.c
|
|
|
|
clang-format -i src/emulator.c
|
|
|
|
clang-format -i src/debugger.c
|
2021-01-29 19:17:59 +00:00
|
|
|
|
2021-03-23 02:04:31 +00:00
|
|
|
echo "Cleaning.."
|
2021-05-11 18:42:12 +00:00
|
|
|
rm -f ./bin/uxnasm
|
2021-05-12 03:30:03 +00:00
|
|
|
rm -f ./bin/uxnemu
|
2021-03-23 02:04:31 +00:00
|
|
|
rm -f ./bin/debugger
|
2021-02-09 05:59:46 +00:00
|
|
|
rm -f ./bin/boot.rom
|
2021-01-29 19:17:59 +00:00
|
|
|
|
2021-03-23 02:04:31 +00:00
|
|
|
echo "Building.."
|
|
|
|
mkdir -p bin
|
|
|
|
if [ "${1}" = '--debug' ];
|
|
|
|
then
|
|
|
|
echo "[debug]"
|
2021-05-11 18:42:12 +00: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/assembler.c -o bin/uxnasm
|
2021-05-12 03:30:03 +00: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/devices/ppu.c src/devices/apu.c src/devices/mpu.c src/emulator.c -L/usr/local/lib -lSDL2 -lportmidi -o bin/uxnemu
|
2021-03-23 02:04:31 +00: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
|
2021-05-11 18:42:12 +00:00
|
|
|
cc src/assembler.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o bin/uxnasm
|
2021-03-23 02:04:31 +00:00
|
|
|
cc src/uxn.c src/debugger.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o bin/debugger
|
2021-05-12 03:30:03 +00:00
|
|
|
cc src/uxn.c src/devices/ppu.c src/devices/apu.c src/devices/mpu.c src/emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -lportmidi -o bin/uxnemu
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Installing.."
|
|
|
|
if [ -d "$HOME/bin" ] && [ -e ./bin/uxnemu ] && [ -e ./bin/uxnasm ]
|
|
|
|
then
|
|
|
|
cp ./bin/uxnemu $HOME/bin
|
|
|
|
cp ./bin/uxnasm $HOME/bin
|
|
|
|
echo "Installed in $HOME/bin"
|
2021-03-23 02:04:31 +00:00
|
|
|
fi
|
2021-02-09 18:06:55 +00:00
|
|
|
|
2021-03-23 02:04:31 +00:00
|
|
|
echo "Assembling.."
|
2021-05-16 04:35:01 +00:00
|
|
|
./bin/uxnasm projects/demos/piano.usm bin/boot.rom
|
2021-01-29 19:17:59 +00:00
|
|
|
|
2021-03-23 02:04:31 +00:00
|
|
|
echo "Running.."
|
|
|
|
if [ "${2}" = '--cli' ];
|
|
|
|
then
|
|
|
|
echo "[cli]"
|
|
|
|
./bin/debugger bin/boot.rom
|
|
|
|
else
|
2021-05-12 03:30:03 +00:00
|
|
|
./bin/uxnemu bin/boot.rom
|
2021-03-23 02:04:31 +00:00
|
|
|
fi
|
2021-03-22 23:51:12 +00:00
|
|
|
|
2021-03-23 02:04:31 +00:00
|
|
|
echo "Done."
|