Commit a827765a authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

bootstrap: Use getopts.

parent 4881724b
...@@ -24,17 +24,23 @@ ...@@ -24,17 +24,23 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
# *************************************************************************** # ***************************************************************************
if test "$#" -gt "2" -o "$1" = "-h" -o "$1" = "--help" ; then
echo "Usage: $0 [target [distro]]" >&2
echo " Prepare config.mak and distro.mak file." >&2
exit 1
fi
LANG=C LANG=C
export LANG export LANG
set -e set -e
set +x set +x
usage()
{
cat << EOF
usage: $0 [-t target] [-d distro]
OPTIONS:
-t Force target
-d Force distro
-h Help
EOF
}
add_makefile_cfg() add_makefile_cfg()
{ {
echo $1 >> "${config_mak}" echo $1 >> "${config_mak}"
...@@ -63,20 +69,33 @@ ensure_macosx_sdk_presence() ...@@ -63,20 +69,33 @@ ensure_macosx_sdk_presence()
DISTRO= DISTRO=
BUILDDIR=. BUILDDIR=.
while getopts “ht:d:” OPTION
do
case $OPTION in
h)
usage
exit 1
;;
t)
TARGET=$OPTARG
;;
d)
DISTRO=$OPTARG
;;
?)
usage
exit
;;
esac
done
BUILD=`gcc -dumpmachine` BUILD=`gcc -dumpmachine`
if test "$#" -ge "1"; then if test "x$TARGET" = "x"; then
TARGET="$1" info "No target specified, using '$BUILD'"
else
TARGET="$BUILD" TARGET="$BUILD"
fi fi
if test "$#" = "2"; then
info "Forcing distro.mak to use $2.mak"
DISTRO="$2"
TARGET="$1"
fi
config_mak="${BUILDDIR}/config.mak" config_mak="${BUILDDIR}/config.mak"
rm -f "${config_mak}" rm -f "${config_mak}"
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment