Advertisement
trini

Tom Rini's MAKEALL wrapper

Oct 25th, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.56 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. KEEP=0
  4. NOOBJDIR=0
  5. TC=0
  6. MACHINE=omap3_beagle
  7. LOG=/dev/stdout
  8.  
  9. # Find our arguments
  10. while test $# -ne 0; do
  11.     if [ "$1" == "--keep" ]; then
  12.         KEEP=1
  13.         shift
  14.     elif [ "$1" == "--no-objdir" ]; then
  15.         NOOBJDIR=1
  16.         shift
  17.     elif [ "$1" == "--angstrom" ]; then
  18.         TC=1
  19.         if [ -z $SOC ]; then
  20.             source /usr/local/angstrom-eglibc-x86_64-armv5te/environment-setup-armv5te-angstrom-linux-gnueabi
  21.             export CROSS_COMPILE=arm-angstrom-linux-gnueabi-
  22.         elif [ "$MACHINE" == "x86" ]; then
  23.             source /usr/local/angstrom-eglibc-x86_64-i586/environment-setup-i586-angstrom-linux
  24.             export CROSS_COMPILE=i586-angstrom-linux-
  25.         fi
  26.         shift
  27.     elif [ "$1" == "--eldk-42" ]; then
  28.         TC=1
  29.         export CROSS_COMPILE=/opt/eldk-4.2/arm/usr/bin/arm-linux-gnueabi-
  30.         shift
  31.     elif [ "$1" == "--eldk-521" ]; then
  32.         TC=1
  33.         if [ -z "$SOC" -o "$MACHINE" == "arm" ]; then
  34.             source /opt/eldk-5.2.1/armv7a/environment-setup-armv7a-vfp-neon-linux-gnueabi
  35.             export CROSS_COMPILE=arm-linux-gnueabi-
  36.         elif [ "$MACHINE" == "mips" ]; then
  37.             source /opt/eldk-5.2.1/mips/environment-setup-mips32-linux
  38.             export CROSS_COMPILE=mips-linux-
  39.         elif [ "$MACHINE" == "powerpc" ]; then
  40.             source /opt/eldk-5.2.1/powerpc/environment-setup-powerpc-linux
  41.             export CROSS_COMPILE=powerpc-linux-
  42.         fi
  43.         shift
  44.     elif [ "$1" == "--linaro" ]; then
  45.         TC=1
  46.         export CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-
  47.         shift
  48.     elif [ "$1" == "--log" ]; then
  49.         LOG=$2
  50.         shift 2
  51.     elif [ "$1" == "--soc" ]; then
  52.         MACHINE="$2"
  53.         SOC="-s"
  54.         shift 2
  55.     elif [ "$1" == "--arch" ]; then
  56.         MACHINE="$2"
  57.         SOC="-a"
  58.         if [ "$MACHINE" == "m68k" ]; then
  59.             export CROSS_COMPILE=/usr/local/bin/m68k-uclinux-
  60.             TC=1
  61.         fi
  62.         shift 2
  63.     elif [ "$1" == "--cpu" ]; then
  64.         MACHINE="$2"
  65.         SOC="-c"
  66.         shift 2
  67.     else
  68.         MACHINE=$1
  69.         if [ "$MACHINE" == "sandbox" ]; then
  70.             TC=1
  71.         fi
  72.         shift
  73.     fi
  74. done
  75.  
  76. if [ $TC -eq 0 ]; then
  77.     source /opt/eldk-5.2.1/armv7a/environment-setup-armv7a-vfp-neon-linux-gnueabi
  78.     export CROSS_COMPILE=arm-linux-gnueabi-
  79. fi
  80.  
  81. if [ $NOOBJDIR -eq 0 ]; then
  82.     export BUILD_DIR=${MACHINE}
  83.     export MAKEALL_LOGDIR=${MACHINE}
  84. fi
  85. echo -n "Testing $MACHINE"
  86. if [ -x ./tools/setlocalversion ]; then
  87.     echo -n " on "
  88.     ./tools/setlocalversion
  89. else
  90.     echo
  91. fi
  92.  
  93. TIMEFILE=`mktemp testersh.XXXXXX`
  94.  
  95. if [ $KEEP -eq 0 ]; then
  96.     if [ $NOOBJDIR -eq 1 ]; then
  97.         make distclean >/dev/null 2>&1
  98.     else
  99.         rm -rf ${BUILD_DIR}
  100.     fi
  101. fi
  102.  
  103. date
  104.  
  105. if [ ! -z $SOC ]; then
  106.     export BUILD_NCPUS=1
  107.     export BUILD_NBUILDS=`grep -c processor /proc/cpuinfo`
  108. fi
  109.  
  110. /usr/bin/time -o $TIMEFILE -f %e ./MAKEALL $SOC $MACHINE > $LOG 2>&1
  111. RC=$?
  112. if [ $RC -eq 0 ]; then
  113.     echo -n "OK in "
  114. else
  115.     echo -n "Failed in "
  116. fi
  117. cat $TIMEFILE
  118. rm $TIMEFILE
  119.  
  120. exit $RC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement