Split out options appended to the version argument on the command line, e.g,
authorJim Phillips <jim@ks.uiuc.edu>
Mon, 8 Apr 2013 20:02:09 +0000 (15:02 -0500)
committerJim Phillips <jim@ks.uiuc.edu>
Mon, 8 Apr 2013 20:02:09 +0000 (15:02 -0500)
treat "net-linux-smp-icc" as "net-linux smp icc".

build

diff --git a/build b/build
index 8674a3d04e150c638bfe6da394a0c9fee0491cfb..2d94a470dbf0ab27f9a056f1f110ae4646b3a2a5 100755 (executable)
--- a/build
+++ b/build
@@ -225,7 +225,30 @@ QUIET=""
 [ $# -lt 2 ] && ./smart-build.pl && exit 1
 PROGRAM=$1
 shift
-VERSION=$1; BASEVERSION=$1; 
+
+# find longest prefix of version argument that exists as a directory in $src
+VERSION=$1
+VERSOPTS=""
+testversion=""
+oldifs=$IFS
+IFS=-
+for w in $1; do
+  IFS=$oldifs
+  if [ -z "$testversion" ]; then
+    testversion=$w
+  else
+    testversion="$testversion-$w"
+  fi
+  if [ -d $src/$testversion ]; then
+    VERSION=$testversion
+    VERSOPTS=""
+  else
+    VERSOPTS="$VERSOPTS $w"
+  fi
+done
+if [ $VERSION = $1 ]; then VERSOPTS=""; fi
+
+BASEVERSION=$VERSION; 
 if test -f $src/$BASEVERSION/vdir_link
 then
   BASEVERSION=`cat $src/$BASEVERSION/vdir_link`
@@ -239,6 +262,28 @@ shift
 
 OPT_DIRS="$src/$BASEVERSION $src/$ARCH $src/common"
 
+# process remainder of version argument as options, copied from below
+for w in $VERSOPTS; do
+  # This has to be a build-time option (like "smp", "gcc3", or "kcc")
+        TestIfCompiler $w
+        if [ $? -eq 1 ] 
+        then
+  # It specifies a compiler:
+          if [ ! -z "$COMPILER" ] 
+          then
+              echo "Error> Tried to specify two compilers: $COMPILER and $w"
+              printOption
+          fi
+          COMPILER=$w
+        else
+  # It specifies some other option:
+          TestIfOption $w
+          BOPTS="$BOPTS $w"
+          [ $w =  "bigemulator" ] && BUILD_EMULATOR=1
+          [ $w =  "bigsim" ] && BUILD_EMULATOR=1
+        fi
+done
+
 while [ ! $# -eq 0 ]
 do
   case "$1" in