uxn-utils/cli/lz/build.sh

46 lines
921 B
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 ulzcdec.c
fi
# Building
cc lz_main.c -o main
cc ulzdec.c -o ulzdec
$ASM ulzdec.tal ulzdec.rom
# Make compressed file
./main && ./main # read example.txt, write compressed.bin
# C Decoder
echo ""
echo "C Decoder"
echo ""
./ulzdec compressed.bin
# Uxn Decoding
echo ""
echo "Uxn Decoder"
echo ""
uxncli ulzdec.rom compressed.bin decompressed.txt && cat decompressed.txt
rm ./main
rm ./ulzdec
rm ./compressed.bin
rm ./decompressed.txt
rm ./ulzdec.rom