uxn-utils/cli/lz/build.sh

47 lines
876 B
Bash
Raw Normal View History

2023-11-14 23:12:28 -05:00
#!/bin/sh -e
2023-11-15 15:06:28 -05:00
RELEASE_flags="-DNDEBUG -O2 -g0 -s"
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-11-14 23:12:28 -05:00
LIN="uxncli $HOME/roms/uxnlin.rom"
ASM="uxncli $HOME/roms/drifblim.rom"
if [[ "$*" == *"--lint"* ]]
then
$LIN decoder.tal
clang-format -i lz_main.c
2023-11-15 19:14:41 -05:00
clang-format -i ulzdec.c
2023-11-14 23:12:28 -05:00
fi
2023-11-15 17:46:18 -05:00
# Building
2023-11-14 23:30:09 -05:00
2023-11-15 17:46:18 -05:00
cc lz_main.c -o main
cc ulzdec.c -o ulzdec
$ASM ulzdec.tal ulzdec.rom
2023-11-14 23:12:28 -05:00
2023-11-15 17:46:18 -05:00
# Make compressed file
2023-11-14 23:30:09 -05:00
2023-11-15 17:46:18 -05:00
./main && ./main # read example.txt, write compressed.bin
2023-11-14 23:12:28 -05:00
2023-11-15 17:46:18 -05:00
# C Decoder
2023-11-14 23:30:09 -05:00
2023-11-15 17:46:18 -05:00
echo ""
echo "C Decoder"
echo ""
2023-11-15 19:14:41 -05:00
./ulzdec a.ulz b.bin
cat b.bin
2023-11-14 23:30:09 -05:00
2023-11-15 17:46:18 -05:00
# Uxn Decoding
2023-11-14 23:30:09 -05:00
2023-11-15 17:46:18 -05:00
echo ""
echo "Uxn Decoder"
echo ""
2023-11-15 19:14:41 -05:00
uxncli ulzdec.rom a.ulz b.bin && cat b.bin
2023-11-14 23:30:09 -05:00
2023-11-15 17:46:18 -05:00
rm ./main
rm ./ulzdec
2023-11-15 19:14:41 -05:00
rm ./a.ulz
rm ./b.bin
2023-11-15 17:46:18 -05:00
rm ./ulzdec.rom