csnake/configure

57 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
usage()
{
echo "Use environment variables to pass values:
CC - compiler (default: cc)
CFLAGS - flags for compiler
LDFLAGS - flags for linker
OUT - out file (default: csnake
FIELD_SIZE - size of game field
DEFX - start x
DEFY - start y
SLEEP - sleep between frames (ms)"
exit 1
}
while test $# -gt 0; do
case "$1" in
-h) usage
;;
--help) usage
;;
esac
shift
done
CC=${CC:-cc}
CFLAGS=${CFLAGS:-}
LDFLAGS=${LDFLAGS:-}
OUT=${OUT:-csnake}
FIELD_SIZE=${FIELD_SIZE:-10}
DEFX=${DEFX:-0}
DEFY=${DEFY:-0}
SLEEP=${SLEEP:-1000}
echo "Makefile configuration:"
echo "Compiler: $CC"
echo "CFLAGS: $CFLAGS"
echo "LDFLAGS: $LDFLAGS"
echo "Out file: $OUT"
echo
echo "Code configuration:"
echo "Field size: $FIELD_SIZE"
echo "Start x: $DEFX"
echo "Start y: $DEFY"
echo "Sleep: $SLEEP"
echo "CC = $CC
CFLAGS = $CFLAGS
LDFLAGS = $LDFLAGS
OUT = $OUT" > config.mk
echo "#define FIELD_SIZE $FIELD_SIZE
#define DEFX $DEFX
#define DEFY $DEFY
#define SLEEP $SLEEP" > include/config.h