Blame build.sh

452870
#!/bin/bash
452870
452870
set -e
452870
20803a
20803a
TARGET="coolkbd"
e3897e
FLAGS="$(pkg-config --cflags --libs x11 xft xtst xrandr)"
cbe4b8
FLAGS="$FLAGS -Wall -lm"
20803a
MODE_FLAGS="-O3 -DNDEBUG"
20803a
7e0df9
while [ "$#" != "0" ]; do
7e0df9
  if [ "$1" = "-release" ]; then
7e0df9
    true
7e0df9
  elif [ "$1" = "-debug" ]; then
7e0df9
    echo "debug mode"
7e0df9
    MODE_FLAGS="-g -O0"
7e0df9
  elif [ "$1" = "-direct-touch" ]; then
7e0df9
    FLAGS="$FLAGS -DDIRECT_TOUCH $(pkg-config --cflags --libs mtdev)"
7e0df9
  elif [ "$1" = "-target" ] && [ -n "$2" ]; then
7e0df9
    TARGET="$2"
7e0df9
    shift
7e0df9
  else
7e0df9
    echo "usage: ./build.sh [-debug|-release] [-direct-touch] [-target TARGET]"
7e0df9
    exit 1
7e0df9
  fi
20803a
  shift
7e0df9
done
20803a
20803a
3c2742
if [ ! -f "config.h" ]; then
3c2742
  echo "copy config.h from example"
3c2742
  cp config.h.example config.h
3c2742
fi
3c2742
3c2742
20803a
echo "build target: $TARGET"
20803a
echo cc main.c $MODE_FLAGS $FLAGS -o "$TARGET"
20803a
     cc main.c $MODE_FLAGS $FLAGS -o "$TARGET"
452870
452870
452870
echo done