vidio/build.sh
Ari Archer e8757e2f5e
init
Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
2023-01-04 03:32:23 +02:00

26 lines
615 B
Bash
Executable file

#!/usr/bin/env bash
set -xe
GENERIC_FLAGS="-std=c89 -Wall -Wextra -Wpedantic -Wshadow -Werror -pedantic -march=native -mtune=native -pipe -o ../vidio.elf main.c"
main() {
CC="${CC:-clang}"
cd src
if [ "$DEBUG" ]; then
$CC -g $GENERIC_FLAGS
else
$CC -flto -Ofast -ffunction-sections -fdata-sections -s $GENERIC_FLAGS
strip --strip-all --remove-section=.note --remove-section=.gnu.version --remove-section=.comment --strip-debug --strip-unneeded ../vidio.elf -o ../vidio.elf
fi
cd ..
if [ "$1" = '-r' ]; then
./vidio.elf "${@:2}"
fi
}
main "$@"