compat: add optional target options for ckmake
authorLuis R. Rodriguez <mcgrof@frijolero.org>
Sat, 5 May 2012 00:42:57 +0000 (17:42 -0700)
committerLuis R. Rodriguez <mcgrof@frijolero.org>
Sat, 5 May 2012 00:42:57 +0000 (17:42 -0700)
This also adds -q option to suppress build messages
that succeed, this helps reduce the size of ckmake.log
if you care only about errors or warnings.

In theory this should help build time but I haven't seen
this help yet

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
bin/ckmake

index 71142c93dbcce6bd4e802439ef5d03df5ae4d635..1e98097484ce0f13dcfe969f6c37f3f5cd270472 100755 (executable)
@@ -58,24 +58,43 @@ function log_try_kernel()
 
 function usage()
 {
-       echo -e "Usage: $0 [-t]"
+       echo -e "Usage: $0 [-t] <optional-target>"
        echo -e "-t   will run: 'time ckmake; time ckmake' account for"
        echo -e "     benchmark how long it takes to compile without ccache"
        echo -e "     and a run after cache kicks in"
+       echo -e "-q   will ask ckmake to run make with -s to only output errors"
+       echo
+       echo -e "<optional-target>  is the arguments you want to pass to the"
+       echo -e "child make call that ckmake will use. For example if you have"
+       echo -e "a target 'linux' on your Makefile you can run 'cmake linux'"
 }
 
-if [[ $# -gt 1 ]]; then
-       usage
-       exit 1
-fi
-
-if [[ $# -eq 1 ]]; then
-       if [[ $1 != "-t" ]]; then
-               usage
-               exit 1
-       fi
-       TIME="1"
-fi
+ARGS=""
+QUIET=""
+
+for i in $@ ; do
+       case $1 in
+               "-h")
+                       usage
+                       exit 1
+                       ;;
+               "--help")
+                       usage
+                       exit 1
+                       ;;
+               "-t")
+                       TIME="1"
+                       shift
+                       ;;
+               "-q")
+                       QUIET="-s"
+                       shift
+                       ;;
+               *)
+                       ARGS="${ARGS} $1"
+                       shift
+       esac
+done
 
 function run_ckmake()
 {
@@ -94,7 +113,7 @@ function run_ckmake()
                log_try_kernel $KERNEL | ./scripts/skip-colors >> $LOG
                log_try_kernel $KERNEL
 
-               ionice -c 3 nice -n 20 make -s KLIB=$DIR KLIB_BUILD=$DIR -j6 -Wunused-but-set-variable &>> $LOG
+               ionice -c 3 nice -n 20 make $QUIET KLIB=$DIR KLIB_BUILD=$DIR -j6 -Wunused-but-set-variable $ARGS &>> $LOG
                CUR_RET=$?
 
                if [[ $RET = "" ]]; then