Add option to build a certain target (and -h option)

This should allow us to run make/ninja on a given target, e.g.
`llvm-build llc` will build only the llc target
`llvm-build check-llvm-codegen-aarch64` will only run a subset of the tests

This also adds a -h option.

Change-Id: I4b2d195ed7f7f4b23f84438068dd1e13a094e947
diff --git a/helpers/llvm-build b/helpers/llvm-build
index b674fa9..40c42e2 100755
--- a/helpers/llvm-build
+++ b/helpers/llvm-build
@@ -18,42 +18,15 @@
 shared=
 targets=
 prog=`basename $0`
-syntax="Syntax: $prog [-u(pdate)] [-c(check-all)] [-i(nstall)]"
+syntax="Syntax: $prog [targets]"
 update=false
 check=false
 master=false
 inst=false
-while getopts "ucim" opt; do
-  case $opt in
-    u)
-      update=true
-      ;;
-    c)
-      check=true
-      ;;
-    i)
-      inst=true
-      ;;
-    m)
-      master=true
-      ;;
-    *)
-      echo $syntax
-      exit 1
-      ;;
-  esac
-done
 
-## Run llvm-sync before
-if $update; then
-	echo " + Updating Repositories"
-  safe_run llvm-sync -a
-fi
-
-## Make sure all branches are on master
-if $master; then
-  echo " + Checking out master"
-  safe_run llvm-branch master
+if [ "$1" = "-h" ]; then
+  echo $syntax
+  exit 0
 fi
 
 ## Choose between make and ninja
@@ -77,7 +50,7 @@
 fi
 cd $build_dir
 
-## Re-run CMake file files are damaged / not there
+## Re-run CMake if files are damaged / not there
 if [ ! -f build.ninja ] && [ ! -f Makefile ]; then
 	echo " + Configuring Build"
   safe_run cmake -G "$generator" $LLVM_SRC \
@@ -90,17 +63,13 @@
 fi
 
 ## Build
-echo " + Building LLVM"
-safe_run $make -j$CPUs
-
-## Check
-if $check; then
-  echo " + Running Tests"
-  safe_run $make check-all
+if [ "$1" == "" ]; then
+  echo " + Building LLVM"
+  safe_run $make -j$CPUs
+else
+  for target in "$@"; do
+    echo " + Running $target"
+    safe_run $make -j$CPUs $target
+  done
 fi
 
-## Install
-if $inst; then
-  echo " + Installing on the System"
-  safe_run $make install
-fi