This repository has been archived on 2024-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
probotic/build.sh
2023-08-04 04:59:01 -06:00

31 lines
833 B
Bash
Executable File

#!/bin/bash
# Script handling unity builds and options.
DIR=$(dirname $(readlink -f "$0"))
cd $DIR
PROGN=${PROGN:-probotic}
PREFIX=${PREFIX:-$DIR}
CC=${CC-cc}
CFLAGS='-std=c99 -Wall -Wextra -Wpedantic -Wno-unused-function'
CPPFLAGS="-I/usr/include/libircclient/ -Iinclude -D_GNU_SOURCE -DPROGN=\"$PROGN\""
LDFLAGS='-lircclient -lsqlite3'
mkdir -p $PREFIX && echo "Made directory: $PREFIX"
# Bourne shell is evil
if [ ${DEBUG-0} -eq 1 ]
then
CFLAGS=`echo "${CFLAGS} -O0 -ggdb"`
else
CPPFLAGS="${CPPFLAGS} -DNDEBUG"
CFLAGS=`echo "${CFLAGS} -O2 -flto=auto -fomit-frame-pointer -s"`
fi
[ ! -z ${SAN} ] && CFLAGS=`echo "$CFLAGS -fsanitize=$SAN"`
echo "$CC $CFLAGS -pipe $DIR/src/unity.c -o $PREFIX/$PROGN $CPPFLAGS $LDFLAGS"
time $CC $CFLAGS -pipe $DIR/src/unity.c -o $PREFIX/$PROGN $CPPFLAGS $LDFLAGS
echo -e "\nStatus: $?"