libwindmill/configure

97 lines
3.1 KiB
Bash
Executable File

#!/bin/sh
cd "$(dirname $0)"
#******************************************************************************#
# Defaults #
#******************************************************************************#
# Project variables
name="$(make -s getname)"
version="$(make -s getversion)"
# Maintainer info
maintainer="$(make -s getmaintainer)"
# Make options
make_full_log=
#******************************************************************************#
# Help message #
#******************************************************************************#
usage() {
cat <<EOF
\`configure\` configures ${name} to adapt to systems that aren't mine.
Usage: $0 [OPTION]
Defaults for the options are specified in brackets.
General options:
--help display this help and exit
--version display version information and quit
--make-full-log display full commands while making
Report bugs to ${maintainer}.
EOF
exit 0
}
#******************************************************************************#
# Version message #
#******************************************************************************#
version() {
cat <<EOF
${name} configure script v${version}
Hand-written by Thomas "Cakeisalie5" Touhey.
This configure script is free software.
There is NO warranty; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
EOF
exit 0
}
#******************************************************************************#
# Check for help and version #
#******************************************************************************#
put_version=
put_help=
for arg ; do case "$arg" in
--help|-h) put_help=1 ;;
--version|-v) put_version=1 ;;
esac; done
[ $put_version ] && version
[ $put_help ] && usage
#******************************************************************************#
# Parse arguments #
#******************************************************************************#
for arg ; do case "$arg" in
--make-full-log) make_full_log=yes ;;
*) echo "$arg: didn't read" ;;
esac; done
#******************************************************************************#
# Create Makefile configuration #
#******************************************************************************#
# Clean before.
make mrproper MAKE_FULL_LOG=y 1>/dev/null 2>/dev/null
# Do it!
exec 3>&1 1>Makefile.cfg
cat <<EOF
#!/usr/bin/make -f
#******************************************************************************#
# Makefile configuration generated by ./configure #
#******************************************************************************#
# Configuration version and messages configuration
CONFIG_VERSION = $version
MAKE_FULL_LOG = $make_full_log
# End of file.
EOF
exec 1>&3 3>&-
chmod +x Makefile.cfg
# Put the lil' message.
echo "Configuration loaded, you can make now."
# End of file.