60 lines
1.1 KiB
Bash
Executable File
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
|
|
clang-format -i ulzdec.c
|
|
clang-format -i ulzenc.c
|
|
$LIN decoder.tal
|
|
$LIN encoder.tal
|
|
fi
|
|
|
|
# Building
|
|
|
|
cc ulzdec.c $DEBUG_flags -o ulzdec
|
|
cc ulzenc.c $DEBUG_flags -o ulzenc
|
|
$ASM ulzdec.tal ulzdec.rom
|
|
$ASM ulzenc.tal ulzenc.rom
|
|
|
|
if [[ "$*" == *"--install"* ]]
|
|
then
|
|
cp ulzenc ~/bin
|
|
cp ulzdec ~/bin
|
|
cp ulzdec.rom ~/roms
|
|
cp ulzenc.rom ~/roms
|
|
fi
|
|
|
|
# Make compressed file
|
|
|
|
./ulzenc example.txt a.ulz
|
|
./ulzdec a.ulz b.bin
|
|
echo ""
|
|
echo "c decoder:"
|
|
echo ""
|
|
cat b.bin
|
|
echo ""
|
|
echo ""
|
|
echo "uxn decoder:"
|
|
echo ""
|
|
uxncli ulzdec.rom a.ulz b.bin && cat b.bin
|
|
echo ""
|
|
echo ""
|
|
|
|
echo "================================"
|
|
|
|
# ./ulzenc example.txt a.ulz
|
|
uxncli ulzenc.rom example.txt a.ulz
|
|
uxncli ~/roms/hx.rom a.ulz
|
|
|
|
rm ./ulzdec
|
|
rm ./ulzenc
|
|
rm ./a.ulz
|
|
rm ./b.bin
|
|
rm ./ulzdec.rom
|
|
rm *.sym
|