#!/bin/bash
set -e
if [ -z "$1" ] || [ "$1" == "release" ]; then
echo "build release"
FLAGS="-O3 -DNDEBUG"
elif [ "$1" == "debug" ]; then
echo "build debug"
FLAGS="-g -O0"
else
echo "usage: $0 [debug|release]"
exit 1
fi
LIBS="$(pkg-config --cflags --libs helianthus) -lm"
FLAGS="-Wall $FLAGS $LIBS"
cc $FLAGS *.c icons.S $LIBS -lm -o jigsaw
echo "build success"