25 lines
666 B
Bash
25 lines
666 B
Bash
|
#!/bin/sh
|
||
|
# Simple script handling unity builds and options.
|
||
|
|
||
|
DIR=$(dirname $(readlink -f "$0"))
|
||
|
cd $DIR
|
||
|
|
||
|
PROGN=${PROGN:-dc}
|
||
|
PREFIX=${PREFIX:-$DIR}
|
||
|
|
||
|
CC=${CC-cc}
|
||
|
CFLAGS='-std=c99 -Wall -Wextra -Wpedantic'
|
||
|
CPPFLAGS='-Iinclude'
|
||
|
LDFLAGS='-lgmp -lreadline'
|
||
|
|
||
|
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: $?"
|