From b07a82baedbf4ed761c593cbd185a97f3fed4e36 Mon Sep 17 00:00:00 2001 From: Raymond Toy <toy.raymond@gmail.com> Date: Thu, 2 May 2013 21:42:51 -0700 Subject: [PATCH] Add -M option to pass extra flags to make. Use getopts to parse the options and also print slightly better error messages. --- bin/rebuild-lisp.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/bin/rebuild-lisp.sh b/bin/rebuild-lisp.sh index d6aa6e93f..1e49d0174 100755 --- a/bin/rebuild-lisp.sh +++ b/bin/rebuild-lisp.sh @@ -1,14 +1,34 @@ #!/bin/sh +while getopts "M:h?" arg +do + case $arg in + M) MFLAGS="$OPTARG" ;; + h) usage ;; + \?) usage ;; + esac +done + +usage() +{ + echo "rebuild.-lisp.sh [-h?] [-M opts] target-directory" + echo " -h this help" + echo " -? this help" + echo " -M opts Options to pass to make" + +} + +shift `expr $OPTIND - 1` + if [ "$1" = "" ] then - echo "Usage: $0 target-directory" + usage exit 1 fi if [ ! -d "$1" ] then - echo "$1 isn't a directory" + echo "$1" must be a directory. exit 2 fi @@ -23,4 +43,4 @@ fi export MAKE -${MAKE} -C $TARGET/lisp clean && ${MAKE} -C $TARGET/lisp +${MAKE} -C $TARGET/lisp $MFLAGS clean && ${MAKE} -C $TARGET/lisp $MFLAGS -- GitLab