uxn/build.sh

52 lines
2.1 KiB
Bash
Raw Normal View History

2021-05-18 09:31:05 -04:00
#!/usr/bin/env bash
2021-01-29 14:17:59 -05:00
2021-03-22 22:04:31 -04:00
echo "Formatting.."
clang-format -i src/uxn.h
clang-format -i src/uxn.c
2021-05-11 14:42:12 -04: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
clang-format -i src/uxnasm.c
clang-format -i src/uxnemu.c
clang-format -i src/uxncli.c
2021-01-29 14:17:59 -05:00
2021-03-22 22:04:31 -04:00
echo "Cleaning.."
2021-05-11 14:42:12 -04:00
rm -f ./bin/uxnasm
2021-05-11 23:30:03 -04:00
rm -f ./bin/uxnemu
rm -f ./bin/uxncli
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/uxnasm.c -o bin/uxnasm
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/uxnemu.c -L/usr/local/lib -lSDL2 -o bin/uxnemu
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/uxncli.c -o bin/uxncli
2021-03-22 22:04:31 -04:00
else
cc src/uxnasm.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o bin/uxnasm
cc src/uxn-fast.c src/uxncli.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o bin/uxncli
cc src/uxn-fast.c src/devices/ppu.c src/devices/apu.c src/devices/mpu.c src/uxnemu.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/uxnemu
2021-05-11 23:30:03 -04:00
fi
echo "Installing.."
if [ -d "$HOME/bin" ] && [ -e ./bin/uxnemu ] && [ -e ./bin/uxnasm ]
then
cp ./bin/uxnemu $HOME/bin
cp ./bin/uxnasm $HOME/bin
cp ./bin/uxncli $HOME/bin
2021-05-11 23:30:03 -04:00
echo "Installed in $HOME/bin"
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.."
./bin/uxnasm projects/examples/demos/piano.usm bin/piano.rom
2021-01-29 14:17:59 -05:00
2021-03-22 22:04:31 -04:00
echo "Running.."
./bin/uxnemu bin/piano.rom
2021-03-22 19:51:12 -04:00
2021-05-18 09:31:05 -04:00
echo "Done."