uxn-utils/cli/lz/build.sh

60 lines
1.1 KiB
Bash
Executable File

#!/bin/sh -e
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"
LIN="uxncli $HOME/roms/uxnlin.rom"
ASM="uxncli $HOME/roms/drifblim.rom"
if [[ "$*" == *"--lint"* ]]
then
$LIN decoder.tal
clang-format -i lz_main.c
clang-format -i ulzdec.c
clang-format -i ulzenc.c
fi
# Building
cc lz_main.c -o main
cc ulzdec.c -o ulzdec
cc ulzenc.c -o ulzenc
$ASM ulzdec.tal ulzdec.rom
# Make compressed file
./main && ./main # read example.txt, write compressed.bin
# C Decoder
echo ""
echo "C Decoder"
echo ""
./ulzdec a.ulz b.bin && cat b.bin
# Uxn Decoding
echo ""
echo "Uxn Decoder"
echo ""
uxncli ulzdec.rom a.ulz b.bin && cat b.bin
# C Encoder
echo ""
echo "C Encoder"
echo ""
./ulzenc example.txt a.ulz
# Uxn Decoding
uxncli ulzdec.rom a.ulz b.bin && cat b.bin
# ./ulzdec a.ulz b.bin && cat b.bin
rm ./main
rm ./ulzdec
rm ./ulzenc
rm ./a.ulz
rm ./b.bin
rm ./ulzdec.rom