run-build.sh: Allow to override build target using BUILD_TARGET envvar

This is useful to debug complex/long-running CI jobs. Indeed, this change
is made to accommodate testing of ECLAIR integration.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Ifc0e5c890c08433c5c2940fa6caa862af6173615
diff --git a/run-build.sh b/run-build.sh
index 2b43371..d3db1ff 100755
--- a/run-build.sh
+++ b/run-build.sh
@@ -32,6 +32,11 @@
 set -ex
 build_commands=$(python3 tf-m-ci-scripts/configs.py -b -g all -j ${BUILD_JOBS:-2} $CONFIG_NAME)
 
+if [ -n "$BUILD_TARGET" ]; then
+    build_commands=$(echo "$build_commands" | head -4)
+    build_commands=${build_commands/-- install/-- $BUILD_TARGET}
+fi
+
 if [ $CODE_COVERAGE_EN = "TRUE" ] && [[ $CONFIG_NAME =~ "GCC" ]] ; then
     build_commands=${build_commands/toolchain_GNUARM.cmake/toolchain_GNUARM.cmake -DTFM_CODE_COVERAGE=True}
     echo "Flag: Add compiler flag for build with code coverage supported."