#!/bin/bash

SCRIPT_DIR="$(dirname "$(realpath "$0")")"
cd "${SCRIPT_DIR}"

set -e

CFLAGS='-Wall -Wextra -Werror -O3 -static'

names='_bincon dec2bin_le dec2bin_be _multicon sgnlen _pss_offset_finder tga_merge update_uint32_le update_uint32_be'

for name in ${names}; do
	musl-gcc ${CFLAGS} "${name}.c" -o "../../bin/${name}" && echo "${name} built successfully" 1>&2
done

musl-gcc ${CFLAGS} "PatchText/PatchText/patch_text.cpp" -o "../../bin/patch_text" && echo "patch_text built successfully" 1>&2

cd - > /dev/null
