I think this is not scalarable.

Why not use a switch instead of multiple ifs.  Something like this (copied from 
our internal build scripts):

  # Convert the target triplet into a linux target.
  case ${target} in
  arm*) linux_target=arm ;;
  powerpc*) linux_target=powerpc  ;;
  i[34567]86-* | x86_64-*) linux_target=x86 ;;
  mips*) linux_target=mips ;;
  aarch64*)  linux_target=arm64 ;;
  *) warning "please update table in build-common for your target"; exit 1 ;;
  esac
dryrun "make ${make_opts} -C ${srcdir} headers_install ARCH=${linux_target}  
INSTALL_HDR_PATH=${sysroots}/usr"

--- CUT ---
Then the code becomes a little easier to maintain and when a new target is 
supported you just have to add a line which sets linux_target rather than copy 
the whole "make headers_install" line.

Thanks,
Andrew Pinski

-----Original Message-----
From: linaro-toolchain-boun...@lists.linaro.org 
[mailto:linaro-toolchain-boun...@lists.linaro.org] On Behalf Of Will Newton
Sent: Monday, September 29, 2014 9:40 AM
To: linaro-toolchain@lists.linaro.org
Subject: [PATCH 1/2] lib/make.sh: Add support for installing headers for i686 
and x86_64

---
 lib/make.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/make.sh b/lib/make.sh
index fb7137c..b917ece 100755
--- a/lib/make.sh
+++ b/lib/make.sh
@@ -460,8 +460,15 @@ make_install()
         local srcdir="`get_srcdir $1 ${2:+$2}`"
         if test `echo ${target} | grep -c aarch64` -gt 0; then
             dryrun "make ${make_opts} -C ${srcdir} headers_install ARCH=arm64 
INSTALL_HDR_PATH=${sysroots}/usr"
-        else
+        elif test `echo ${target} | grep -c i.86` -gt 0; then
+            dryrun "make ${make_opts} -C ${srcdir} headers_install ARCH=i386 
INSTALL_HDR_PATH=${sysroots}/usr"
+        elif test `echo ${target} | grep -c x86_64` -gt 0; then
+            dryrun "make ${make_opts} -C ${srcdir} headers_install ARCH=x86_64 
INSTALL_HDR_PATH=${sysroots}/usr"
+        elif test `echo ${target} | grep -c arm` -gt 0; then
             dryrun "make ${make_opts} -C ${srcdir} headers_install ARCH=arm 
INSTALL_HDR_PATH=${sysroots}/usr"
+        else
+            warning "Unknown arch for make headers_install!"
+            return 1
         fi
         if test $? != "0"; then
             warning "Make headers_install failed!"
-- 
1.9.3


_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain

_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to