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

28 lines
866 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}
CFLAGS='-std=c99 -Wall -Wextra -Wpedantic'
2023-08-02 11:48:30 -04:00
CPPFLAGS="-I/usr/bin/ircclient/ -Iinclude -D_GNU_SOURCE -DPROGN=\"$PROGN\""
2023-08-02 09:15:49 -04:00
LDFLAGS='-lircclient'
2023-08-02 06:57:45 -04:00
mkdir -p $PREFIX && echo "Made directory: $PREFIX"
if [ ! -z ${DEBUG} ]; then CFLAG="$CFLAGS -Og -g3";
2023-08-02 14:38:51 -04:00
else CPPFLAGS="$CPPFLAGS -DNDEBUG";
CFLAG="$CFLAGS -O2 -flto=auto -fomit-frame-pointer -s"; fi
2023-08-02 06:57:45 -04:00
[ ! -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
2023-08-02 06:57:45 -04:00
echo "\nStatus: $?"