USBDEBUG by default in abuild was committed by mistake and
[coreboot.git] / util / abuild / abuild
index 851f1a374d0ff49722301f4b88ff19bd8f9bcda7..5a17e5e328e06c4ff2579cc1089bd27d65e04006 100755 (executable)
@@ -10,7 +10,7 @@
 #  This file is subject to the terms and conditions of the GNU General
 #  Public License. See the file COPYING in the main directory of this
 #  archive for more details.
-#     
+#
 
 #set -x # Turn echo on....
 
@@ -99,10 +99,10 @@ function xml
 
 function xmlfile
 {
-       test "$mode" == "xml" && { 
+       test "$mode" == "xml" && {
                printf '<![CDATA[\n'
                cat $1
-               printf ']]>\n' 
+               printf ']]>\n'
        } >> $XMLFILE
 }
 
@@ -119,9 +119,9 @@ function mainboards
 {
        # make this a function so we can easily select
        # without breaking readability
-       
+
        VENDOR=$1
-       
+
        ls -1 $ROOT/src/mainboard/$VENDOR | grep -v Kconfig
 }
 
@@ -143,7 +143,7 @@ function create_config
        build_dir=$TARGET/${VENDOR}_${MAINBOARD}
 
         # get a working payload for the board if we have one.
-        # the --payload option expects a directory containing 
+        # the --payload option expects a directory containing
        # a shell script payload.sh
        #   Usage: payload.sh [VENDOR] [DEVICE]
        # the script returns an absolute path to the payload binary.
@@ -166,9 +166,9 @@ function create_config
        else
                printf "  Creating config file... "
                xml "  <config>autogenerated</config>"
-               grep "depends[\t ]on[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \
+               grep "if[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \
                        sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > .config
-               grep "config[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
+               grep "if[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
                        sed "s,^.*\(BOARD_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
                grep "select[\t ]*ARCH" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
                        sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
@@ -253,7 +253,7 @@ function create_buildenv
 }
 
 function compile_target
-{      
+{
        VENDOR=$1
        MAINBOARD=$2
 
@@ -381,17 +381,17 @@ function build_target
                        done
                fi
 
-       
+
                # TBD: look for suitable cross compiler suite
                # cross-$TARCH-gcc and cross-$TARCH-ld
-               
+
                # Check result:
                if [ $found_crosscompiler == "false" ]; then
                        printf "$TARCH: skipped, we're $ARCH\n\n"
                        xml "  <status>notbuilt</status>"
                        xml ""
                        xml "</mainboard>"
-               
+
                        return 0
                else
                        printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n"
@@ -426,16 +426,19 @@ function build_target
                xml "</mainboard>"
                return 0
        }
-       
+
        stime=`perl -e 'print time();' 2>/dev/null || date +%s`
        create_buildenv $VENDOR $MAINBOARD $CONFIG
        if [ $? -eq 0  -a  $configureonly -eq 0 ]; then
-               compile_target $VENDOR $MAINBOARD && 
+               if [ "$scanbuild" = "true" ]; then
+                       rm -rf $TARGET/scan-build-results-tmp
+               fi
+               compile_target $VENDOR $MAINBOARD &&
                        xml "  <status>ok</status>" ||
                        xml "<status>broken</status>"
                if [ "$scanbuild" = "true" ]; then
+                       rm -rf $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
                        mv `dirname $TARGET/scan-build-results-tmp/*/index.html` $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
-                       MAKE=$origMAKE
                fi
        fi
        # Not calculated here because we still print it in compile_target
@@ -538,7 +541,7 @@ function myhelp
        printf "                                  (defaults to $ROOT)\n\n"
 }
 
-function myversion 
+function myversion
 {
        cat << EOF
 
@@ -567,8 +570,8 @@ test "$ROOT" = "" && ROOT=$( cd ../..; pwd )
 getoptbrand="`getopt -V`"
 if [ "${getoptbrand:0:6}" == "getopt" ]; then
        # Detected GNU getopt that supports long options.
-       args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache Vvhat:bp:Tc:sxCl:rP:uy -- "$@"`
-       eval set "$args"
+       args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache -o Vvhat:bp:Tc:sxCl:rP:uy -- "$@"`
+       eval set -- $args
 else
        # Detected non-GNU getopt
        args=`getopt Vvhat:bp:Tc:sxCl:rP:uy $*`
@@ -586,7 +589,7 @@ while true ; do
                -t|--target)    shift; target="$1"; shift;;
                -a|--all)       shift; buildall=true;;
                -b|--broken)    shift; buildbroken=true;;
-               -r|--remove)    shift; remove=true; shift;;
+               -r|--remove)    shift; remove=true;;
                -v|--verbose)   shift; verbose=true; silent='V=1';;
                -V|--version)   shift; myversion; exit 0;;
                -h|--help)      shift; myversion; myhelp; exit 0;;