90 lines
884 B
Bash
Executable File
90 lines
884 B
Bash
Executable File
#! /bin/bash
|
|
|
|
#
|
|
# Basic configuration
|
|
#
|
|
|
|
|
|
|
|
output="Makefile.cfg"
|
|
|
|
#
|
|
# Help screen
|
|
#
|
|
|
|
help()
|
|
{
|
|
cat << EOF
|
|
Configuration script for the log library.
|
|
Usage: $0 [options...]
|
|
|
|
|
|
Specified target :
|
|
|
|
--fxcg50
|
|
|
|
--fx9680g
|
|
|
|
If you don't send any option, fxcg50 is set as default
|
|
|
|
|
|
|
|
|
|
|
|
EOF
|
|
exit 0
|
|
}
|
|
|
|
if [[ "$@" == "--help" ]]; then
|
|
help
|
|
exit 1
|
|
fi
|
|
|
|
#
|
|
# Parsing arguments
|
|
#
|
|
|
|
model=
|
|
|
|
fail=false
|
|
for arg; do case "$arg" in
|
|
-h | -? | --help)
|
|
help;;
|
|
|
|
|
|
--fx9860g)
|
|
model=fx;;
|
|
|
|
--fxcg50)
|
|
model=cg;;
|
|
|
|
*)
|
|
echo "error: unrecognized argument '$arg'";
|
|
fail=true;;
|
|
esac; done
|
|
|
|
#
|
|
# Checking mandatory arguments
|
|
#
|
|
|
|
if $fail; then
|
|
echo "Oops ! Maybe a wrong option..."
|
|
exit 1
|
|
fi
|
|
|
|
#
|
|
# Output config
|
|
#
|
|
|
|
output_config()
|
|
{
|
|
echo -n "MODEL ="
|
|
echo -n " $(echo $model)"
|
|
|
|
echo ""
|
|
}
|
|
|
|
output_config > $output
|
|
|
|
echo "Configuration saved in $output, ready to make!"
|