Add -r|--remove option to force abuild to remove the output directory
after every board build, in order to save disk space if you don't need
the actual output files.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>

Index: util/abuild/abuild.1
===================================================================
--- util/abuild/abuild.1	(Revision 3815)
+++ util/abuild/abuild.1	(Arbeitskopie)
@@ -3,7 +3,7 @@
 abuild \- build coreboot images for all available targets
 .SH SYNOPSIS
 .B abuild
-\fR[\fB\-abvxsTVh\fR] [\fB\-c\fR numcpus|max] [\fB\-t\fR vendor/board] [\fB\-p\fR dir]
+\fR[\fB\-abrvxsTVh\fR] [\fB\-c\fR numcpus|max] [\fB\-t\fR vendor/board] [\fB\-p\fR dir]
 [LBROOT]
 .SH DESCRIPTION
 .B abuild
@@ -36,6 +36,12 @@
 .B "\-t, \-\-target <vendor/board>"
 Attempt to build target vendor/board only.
 .TP
+.B "\-r, \-\-remove"
+Remove mainboard build directory after the respective target has been
+built. This is mainly used for development purposes, when you don't need
+the actual build output, but rather only want to know if a build failed
+or not.
+.TP
 .B "\-x, \-\-xml"
 Write an XML log file instead of a plain-text one.
 The file will be called
Index: util/abuild/abuild
===================================================================
--- util/abuild/abuild	(Revision 3815)
+++ util/abuild/abuild	(Arbeitskopie)
@@ -457,9 +457,22 @@
 	return 0
 }
 
+function remove_target
+{
+	VENDOR=$1
+	MAINBOARD=$2
+
+	if [ "$remove" == "true" ]; then
+		printf "Removing build dir for board $VENDOR $MAINBOARD...\n"
+		rm -rf $TARGET/${VENDOR}_${MAINBOARD}
+	fi
+
+	return 0
+}
+
 function myhelp
 {
-	printf "Usage: $0 [-v] [-a] [-b] [-t <vendor/board>] [-p <dir>] [lbroot]\n"
+	printf "Usage: $0 [-v] [-a] [-b] [-r] [-t <vendor/board>] [-p <dir>] [lbroot]\n"
 	printf "       $0 [-V|--version]\n"
 	printf "       $0 [-h|--help]\n\n"
 
@@ -467,6 +480,7 @@
 	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"
 	printf "    [-V|--version]		  print version number and exit\n"
@@ -507,7 +521,7 @@
 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 Vvhat:bp:Tc:sx -- "$@"`
+	args=`getopt -l version,verbose,help,all,target:,remove,broken,payloads:,test,cpus:,silent,xml Vvhat:bp:Tc:sx -- "$@"`
 	eval set "$args"
 else
 	# Detected non-GNU getopt
@@ -526,6 +540,7 @@
 		-t|--target)	shift; target="$1"; shift;;
 		-a|--all)	shift; buildall=true;;
 		-b|--broken)	shift; buildbroken=true;;
+		-r|--remove)	shift; remove=true; shift;;
 		-v|--verbose)	shift; verbose=true;;
 		-V|--version)	shift; myversion; exit 0;;
 		-h|--help)	shift; myversion; myhelp; exit 0;;
@@ -560,6 +575,7 @@
 		for MAINBOARD in $( mainboards $VENDOR ); do
 			build_target $VENDOR $MAINBOARD
 			test_target $VENDOR $MAINBOARD
+			remove_target $VENDOR $MAINBOARD
 		done
 	done
 fi
