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-02 20:54:56 +02:00

25 lines
786 B
Bash
Executable File

#!/bin/sh
# Simple 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-parameter -g'
CPPFLAGS="-I/usr/bin/ircclient/ -I/usr/include/libircclient/ -Iinclude -D_GNU_SOURCE -DPROGN=\"$PROGN\""
LDFLAGS='-lircclient -lsqlite3'
mkdir -p $PREFIX && echo "Made directory: $PREFIX"
if [ ! -z ${DEBUG} ] ; then CFLAG="$CFLAGS -Og -g3";
else CFLAG="$CFLAGS -O2 -flto=auto -fomit-frame-pointer"; fi
[ ! -z ${SAN} ] && CFLAG="$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
echo "\nStatus: $?"