Force coreboot mconf to create temp files in the output directory
[coreboot.git] / util / abuild / abuild
index ba144aabd5bade857992394590540d489a422c05..74d2908e69f23870101a72b4cd88bae0bf91e4ea 100755 (executable)
 ABUILD_DATE="December 10th, 2010"
 ABUILD_VERSION="0.9.1"
 
+TOP=$PWD
+
 # Where shall we place all the build trees?
 TARGET=coreboot-builds
-XMLFILE=$( pwd )/abuild.xml
+XMLFILE=$TOP/abuild.xml
+REAL_XMLFILE=$XMLFILE
 
 # path to payload. Should be more generic
 PAYLOAD=/dev/null
@@ -222,7 +225,7 @@ function create_config
                fi
        fi
 
-       #yes "" | $MAKE oldconfig -j $cpus obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
+       #yes "" | $MAKE oldconfig obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
        yes "" | $MAKE oldconfig DOTCONFIG=${build_dir}/config.build obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
        ret=$?
        if [ $ret -eq 0 ]; then
@@ -286,7 +289,7 @@ function compile_target
        CURR=$( pwd )
        #stime=`perl -e 'print time();' 2>/dev/null || date +%s`
        build_dir=$TARGET/${VENDOR}_${MAINBOARD}
-       eval $MAKE $silent -j $cpus DOTCONFIG=${build_dir}/config.build obj=${build_dir} objutil=$TARGET/sharedutils \
+       eval $MAKE $silent DOTCONFIG=${build_dir}/config.build obj=${build_dir} objutil=$TARGET/sharedutils \
                &> ${build_dir}/make.log
        ret=$?
        cp .xcompile ${build_dir}/xcompile.build
@@ -323,14 +326,6 @@ function compile_target
        fi
 }
 
-function build_broken
-{
-       CURR=`pwd`
-       status="yes"
-       [ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/BROKEN" ] && status="no"
-       [ "$buildbroken" == "true" -o "$status" == "yes" ]
-}
-
 function build_target
 {
        VENDOR=$1
@@ -363,6 +358,7 @@ function build_target
        HOSTCC='gcc'
 
        printf "Building $VENDOR/$MAINBOARD; "
+       XMLFILE=$TOP/$TARGET/${VENDOR}_${MAINBOARD}/abuild.xml
 
        xml "<mainboard>"
        xml ""
@@ -426,17 +422,6 @@ function build_target
                CC="$CC -fno-stack-protector"
        fi
 
-       build_broken $VENDOR $MAINBOARD || \
-       {
-               printf " ( broken mainboard/$VENDOR/$MAINBOARD skipped )\n\n"
-               xml "  <status>knownbroken</status>"
-               xml ""
-               xml "</mainboard>"
-               junit " <testcase classname='board' name='$TARCH/$VENDOR/$MAINBOARD' >"
-               junit "<failure type='KnownBroken'>Board is marked as broken</failure>"
-               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
@@ -530,7 +515,6 @@ function myhelp
        printf "Options:\n"
        printf "    [-v|--verbose]                print more messages\n"
        printf "    [-a|--all]                    build previously succeeded ports as well\n"
-       printf "    [-b|--broken]                 attempt to build ports that are known broken\n"
        printf "    [-r|--remove]                 remove output dir after build\n"
        printf "    [-t|--target <vendor/board>]  attempt to build target vendor/board only\n"
        printf "    [-p|--payloads <dir>]         use payloads in <dir> to build images\n"
@@ -583,7 +567,7 @@ 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,junit,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache -o Vvhat:bp:Tc:sJxCl:rP:uy -- "$@"`
+       args=`getopt -l version,verbose,help,all,target:,payloads:,test,cpus:,silent,junit,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache -o Vvhat:p:Tc:sJxCl:rP:uy -- "$@"`
        eval set -- $args
 else
        # Detected non-GNU getopt
@@ -602,7 +586,6 @@ while true ; do
                -J|--junit)     shift; mode=junit; rm -f $XMLFILE ;;
                -t|--target)    shift; target="$1"; shift;;
                -a|--all)       shift; buildall=true;;
-               -b|--broken)    shift; buildbroken=true;;
                -r|--remove)    shift; remove=true;;
                -v|--verbose)   shift; verbose=true; silent='V=1';;
                -V|--version)   shift; myversion; exit 0;;
@@ -624,6 +607,10 @@ while true ; do
        esac
 done
 
+if [ "$cpus" != "1" ]; then
+       export MAKEFLAGS="-j $cpus"
+fi
+
 # /path/to/freebios2/
 test -z "$1" || ROOT=$1
 
@@ -648,6 +635,8 @@ if [ "$target" != "" ]; then
        fi
        build_target $VENDOR $MAINBOARD $CONFIG
        test_target $VENDOR $MAINBOARD
+       test "$mode" != "text" && cat $TARGET/${VENDOR}_${MAINBOARD}/abuild.xml >> $REAL_XMLFILE
+       XMLFILE=$REAL_XMLFILE
 else
        # build all boards per default
        for VENDOR in $( vendors ); do
@@ -657,6 +646,12 @@ else
                        remove_target $VENDOR $MAINBOARD
                done
        done
+       if [ "$mode" != "text" ]; then
+               for xmlfile in $TARGET/*_*/abuild.xml; do
+                       cat $xmlfile >> $REAL_XMLFILE
+               done
+       fi
+       XMLFILE=$REAL_XMLFILE
 fi
 xml '</abuild>'
 junit '</testsuite>'