uxn11/build.sh

42 lines
1.2 KiB
Bash
Raw Normal View History

2022-03-26 20:23:52 -04:00
#!/bin/sh -e
2022-04-18 15:32:42 -04:00
RELEASE_FLAGS="-Os -DNDEBUG -g0 -s"
2022-04-06 15:38:34 -04:00
DEBUG_FLAGS="-std=c89 -D_POSIX_C_SOURCE=199309L -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"
EMU_INC="src/uxn.c src/devices/system.c src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/devices/file.c src/devices/datetime.c src/uxn11.c -o bin/uxn11 -lX11"
CLI_INC="src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c src/uxncli.c -o bin/uxncli"
2022-04-05 14:42:50 -04:00
if [ "${1}" = '--format' ];
then
echo "Formatting.."
2022-04-06 15:38:34 -04:00
clang-format -i src/uxn.c
clang-format -i src/uxn.h
2022-04-05 14:42:50 -04:00
clang-format -i src/uxn11.c
2022-04-05 15:08:49 -04:00
clang-format -i src/uxncli.c
2022-04-05 14:42:50 -04:00
clang-format -i src/devices/*
fi
2022-03-26 20:23:52 -04:00
echo "Cleaning.."
2022-04-06 15:38:34 -04:00
rm -f bin/*
2022-03-26 20:23:52 -04:00
mkdir -p bin
2022-03-26 21:46:17 -04:00
2022-04-06 15:38:34 -04:00
echo "Building.."
2022-04-05 14:42:50 -04:00
if [ "${1}" = '--install' ];
2022-03-30 13:37:47 -04:00
then
echo "Installing.."
2022-04-06 15:38:34 -04:00
gcc ${RELEASE_FLAGS} ${EMU_INC}
gcc ${RELEASE_FLAGS} ${CLI_INC}
2022-03-30 13:37:47 -04:00
cp bin/uxn11 ~/bin
2022-04-05 15:08:49 -04:00
cp bin/uxncli ~/bin
2022-03-30 13:37:47 -04:00
else
2022-04-06 15:38:34 -04:00
gcc ${DEBUG_FLAGS} ${EMU_INC}
gcc ${DEBUG_FLAGS} ${CLI_INC}
2022-03-30 13:37:47 -04:00
fi
2022-03-26 21:46:17 -04:00
2022-04-06 15:38:34 -04:00
echo "Assembling.."
2022-04-05 22:13:14 -04:00
bin/uxncli etc/drifblim.rom etc/polycat.tal && mv etc/polycat.rom bin/
2022-04-03 13:43:13 -04:00
2022-04-05 22:13:14 -04:00
echo "Running.."
bin/uxn11 bin/polycat.rom
2022-04-05 22:31:53 -04:00
echo "Done."