setup: Allow user to pass in the build directory name

This can be extremely useful if one is working on multiple
platforms simultaneously

Change-Id: I316ef106d972413221ab2691dfc727f8f9bcffa8
Signed-off-by: Amithash Prasad <amithash@fb.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/setup b/setup
index 05a1c38..a1b3cc1 100755
--- a/setup
+++ b/setup
@@ -23,6 +23,7 @@
 
 machine() {
 	local target=$1
+	local build_dir=$2
 	local mfg mach realmach
 	for mfg in meta-*; do
 		for mach in $mfg/meta-*; do
@@ -33,7 +34,7 @@
 				if [ -n "$target" ]; then
 					if [ "$realmach" = "$target" ]; then
 						echo Machine $target is $mach
-						TEMPLATECONF="$mach/conf" source oe-init-build-env build
+						TEMPLATECONF="$mach/conf" source oe-init-build-env $build_dir
 						return
 					fi
 				else
@@ -53,6 +54,10 @@
 elif [ "$1" = "qemuarm" ]; then
 	source openbmc-env
 else
-	machine $1
+	bld_dir=$2
+	if [ -z "$2" ]; then
+		bld_dir="build"
+	fi
+	machine $1 $bld_dir
 fi