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

31 lines
830 B
Bash
Raw Normal View History

2023-08-02 06:57:45 -04:00
#!/bin/sh
# Simple script handling unity builds and options.
DIR=$(dirname $(readlink -f "$0"))
cd $DIR
PROGN=${PROGN:-probotic}
2023-08-02 06:57:45 -04:00
PREFIX=${PREFIX:-$DIR}
CC=${CC-cc}
2023-08-02 15:45:42 -04:00
CFLAGS='-std=c99 -Wall -Wextra -Wpedantic -Wno-unused-function'
CPPFLAGS="-I/usr/include/libircclient/ -Iinclude -D_GNU_SOURCE -DPROGN=\"$PROGN\""
2023-08-02 14:54:56 -04:00
LDFLAGS='-lircclient -lsqlite3'
2023-08-02 06:57:45 -04:00
mkdir -p $PREFIX && echo "Made directory: $PREFIX"
2023-08-02 23:16:42 -04:00
# Bourne shell is evil
2023-08-03 04:17:28 -04:00
if [ ${DEBUG-0} -eq 1 ]
2023-08-02 23:16:42 -04:00
then
2023-08-03 04:28:24 -04:00
CFLAGS=`echo "${CFLAGS} -Og -ggdb"`
2023-08-02 23:16:42 -04:00
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"
$CC $CFLAGS -pipe $DIR/src/unity.c -o $PREFIX/$PROGN $CPPFLAGS $LDFLAGS
2023-08-02 06:57:45 -04:00
echo "\nStatus: $?"