csnake/configure

50 lines
1.0 KiB
Plaintext
Raw Normal View History

2023-10-30 02:33:30 +03:00
#!/bin/sh
usage()
{
2023-10-30 03:27:47 +03:00
echo "Use environment variables to pass values:
2024-03-06 23:50:27 +03:00
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)"
2023-10-30 03:27:47 +03:00
exit 1
}
while test $# -gt 0; do
case "$1" in
-h) usage
;;
--help) usage
;;
esac
shift
done
2023-10-30 03:27:47 +03:00
2023-10-30 02:33:30 +03:00
CC=${CC:-cc}
CFLAGS=${CFLAGS:-}
LDFLAGS=${LDFLAGS:-}
2023-11-25 00:52:02 +03:00
OUT=${OUT:-csnake}
2024-03-06 23:50:27 +03:00
FIELD_SIZE=${FIELD_SIZE:-10}
2023-10-30 03:09:32 +03:00
DEFX=${DEFX:-0}
DEFY=${DEFY:-0}
2023-11-30 18:05:51 +03:00
SLEEP=${SLEEP:-1000}
2023-10-30 02:33:30 +03:00
2023-10-30 03:09:32 +03:00
echo "Makefile configuration:"
2023-10-30 02:33:30 +03:00
echo "Compiler: $CC"
echo "CFLAGS: $CFLAGS"
echo "LDFLAGS: $LDFLAGS"
echo "Out file: $OUT"
2023-10-30 03:09:32 +03:00
echo
echo "Code configuration:"
2024-03-06 23:50:27 +03:00
echo "Field size: $FIELD_SIZE"
2023-10-30 03:09:32 +03:00
echo "Start x: $DEFX"
echo "Start y: $DEFY"
2023-11-30 18:05:51 +03:00
echo "Sleep: $SLEEP"
2023-10-30 02:33:30 +03:00
2024-03-07 00:31:36 +03:00
eval "echo \"$(cat templates/config.mk.in)\"" > include/config.mk
eval "echo \"$(cat templates/config.h.in)\"" > include/config.h