Blob Blame Raw
#!/bin/bash

set -e


TARGET="coolkbd"
FLAGS="$(pkg-config --cflags --libs x11 xft xtst xrandr)"
FLAGS="$FLAGS -Wall"
MODE_FLAGS="-O3 -DNDEBUG"


if [ "$1" = "-debug" ]; then
  echo "debug mode"
  MODE_FLAGS="-g -O0"
  shift
elif [ "$1" = "-release" ]; then
  shift
fi

if [ ! -z "$1" ]; then
  TARGET="$1"
  shift
fi

if [ ! -f "config.h" ]; then
  echo "copy config.h from example"
  cp config.h.example config.h
fi


echo "build target: $TARGET"
echo cc main.c $MODE_FLAGS $FLAGS -o "$TARGET"
     cc main.c $MODE_FLAGS $FLAGS -o "$TARGET"


echo done