27 lines
830 B
Bash
Executable File
27 lines
830 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'
|
|
CPPFLAGS="-I/usr/bin/ircclient/ -Iinclude -D_GNU_SOURCE -DPROGN=\"$PROGN\""
|
|
LDFLAGS='-lircclient'
|
|
|
|
mkdir -p $PREFIX && echo "Made directory: $PREFIX"
|
|
|
|
if [ ! -z ${DEBUG} ]; then CFLAG="$CFLAGS -Og -g3";
|
|
else CFLAG="$CFLAGS -O2 -flto=auto -fomit-frame-pointer -s"; fi
|
|
|
|
[ ! -z ${SAN} ] && CFLAG="$CFLAGS -fsanitize=$SAN"
|
|
|
|
[ ! -e $DIR/include/config.h ] && cp $DIR/include/config.mk.h $DIR/include/config.h
|
|
|
|
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: $?"
|