2022-03-26 20:23:52 -04:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2023-06-08 12:35:17 -04:00
|
|
|
RELEASE_FLAGS="-DNDEBUG -O2 -g0 -s"
|
2023-05-04 00:39:04 -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"
|
2023-05-01 01:03:35 -04:00
|
|
|
CORE_DEVICES="src/uxn.c src/devices/system.c src/devices/file.c src/devices/datetime.c -lpthread"
|
2023-04-10 13:16:17 -04:00
|
|
|
EMU_INC="${CORE_DEVICES} src/devices/screen.c src/devices/controller.c src/devices/mouse.c src/uxn11.c -o bin/uxn11 -lX11"
|
|
|
|
CLI_INC="${CORE_DEVICES} src/uxncli.c -o bin/uxncli"
|
2022-04-06 15:38:34 -04:00
|
|
|
|
2022-05-26 07:37:57 -04:00
|
|
|
# find X11 libs on various systems
|
|
|
|
if [ -e /usr/X11R6 ]; then
|
|
|
|
# OpenBSD
|
|
|
|
RELEASE_FLAGS="-L/usr/X11R6/lib/ -I/usr/X11R6/include/ $RELEASE_FLAGS"
|
|
|
|
DEBUG_FLAGS="-L/usr/X11R6/lib/ -I/usr/X11R6/include/ $DEBUG_FLAGS"
|
|
|
|
fi
|
|
|
|
|
2022-04-05 14:42:50 -04:00
|
|
|
if [ "${1}" = '--format' ];
|
|
|
|
then
|
|
|
|
clang-format -i src/uxn11.c
|
2022-07-13 00:27:52 -04:00
|
|
|
clang-format -i src/uxnasm.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-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
|
|
|
|
2023-04-10 13:16:17 -04:00
|
|
|
cc ${RELEASE_FLAGS} src/uxnasm.c -o bin/uxnasm
|
|
|
|
|
|
|
|
if [ "${1}" = '--release' ];
|
2023-03-18 14:04:50 -04:00
|
|
|
then
|
|
|
|
gcc ${C_FLAGS} ${LD_FLAGS} ${RELEASE_FLAGS} ${EMU_INC}
|
|
|
|
gcc ${C_FLAGS} ${LD_FLAGS} ${RELEASE_FLAGS} ${CLI_INC}
|
2022-03-30 13:37:47 -04:00
|
|
|
else
|
2023-03-18 14:04:50 -04:00
|
|
|
gcc ${C_FLAGS} ${LD_FLAGS} ${DEBUG_FLAGS} ${EMU_INC}
|
2023-05-01 01:03:35 -04:00
|
|
|
gcc ${C_FLAGS} ${LD_FLAGS} ${DEBUG_FLAGS} ${CLI_INC}
|
2022-03-30 13:37:47 -04:00
|
|
|
fi
|
2022-03-26 21:46:17 -04:00
|
|
|
|
2023-04-30 14:41:00 -04:00
|
|
|
if [ "${1}" = '--install' ];
|
|
|
|
then
|
|
|
|
gcc ${C_FLAGS} ${LD_FLAGS} ${RELEASE_FLAGS} ${EMU_INC}
|
|
|
|
gcc ${C_FLAGS} ${LD_FLAGS} ${RELEASE_FLAGS} ${CLI_INC}
|
2023-05-01 01:03:35 -04:00
|
|
|
cp bin/uxn11 bin/uxnemu
|
|
|
|
cp bin/uxnemu bin/uxnasm bin/uxncli $HOME/bin/
|
2023-04-30 14:41:00 -04:00
|
|
|
fi
|
|
|
|
|
2023-05-01 01:03:35 -04:00
|
|
|
# bin/uxnasm etc/polycat.tal bin/polycat.rom
|
|
|
|
# bin/uxn11 bin/polycat.rom
|
2023-06-07 11:42:22 -04:00
|
|
|
# bin/uxnasm etc/friend.tal bin/friend.rom
|
2023-05-01 01:03:35 -04:00
|
|
|
|
2023-06-08 13:13:45 -04:00
|
|
|
if [ "${1}" = '--norun' ]; then exit; fi
|
|
|
|
|
2023-06-07 11:42:22 -04:00
|
|
|
bin/uxnasm etc/mouse.tal bin/mouse.rom
|
|
|
|
bin/uxn11 bin/mouse.rom
|
2022-04-05 22:13:14 -04:00
|
|
|
|