2023-10-30 02:33:30 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-11-25 20:27:09 +03:00
|
|
|
usage()
|
|
|
|
{
|
2023-10-30 03:27:47 +03:00
|
|
|
echo "Use environment variables to pass values:
|
|
|
|
CC - compiler (default: cc)
|
|
|
|
CFLAGS - flags for compiler
|
|
|
|
LDFLAGS - flags for linker
|
2023-11-25 00:52:02 +03:00
|
|
|
OUT - out file (default: csnake
|
2023-10-30 03:27:47 +03:00
|
|
|
SIZE - size of game field
|
|
|
|
DEFX - start x
|
|
|
|
DEFY - start y"
|
|
|
|
exit 1
|
2023-11-25 20:27:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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}
|
2023-10-30 03:00:39 +03:00
|
|
|
SIZE=${SIZE:-10}
|
2023-10-30 03:09:32 +03:00
|
|
|
DEFX=${DEFX:-0}
|
|
|
|
DEFY=${DEFY:-0}
|
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:"
|
|
|
|
echo "Size: $SIZE"
|
|
|
|
echo "Start x: $DEFX"
|
|
|
|
echo "Start y: $DEFY"
|
2023-10-30 02:33:30 +03:00
|
|
|
|
|
|
|
echo "CC = $CC
|
|
|
|
CFLAGS = $CFLAGS
|
|
|
|
LDFLAGS = $LDFLAGS
|
2023-10-30 15:50:12 +03:00
|
|
|
OUT = $OUT" > config.mk
|
2023-10-30 03:09:32 +03:00
|
|
|
|
|
|
|
echo "#define SIZE $SIZE
|
|
|
|
#define DEFX $DEFX
|
2023-10-30 15:50:12 +03:00
|
|
|
#define DEFY $DEFY" > include/config.h
|