MiBench

#/bin/bash
 
# This is for MiBench
 
TARBALL_DIR="source"
LINK="http://www.eecs.umich.edu/mibench"
 
if [ -d "$TARBALL_DIR" ]; then
  rm -f $TARBALL_DIR/*
else
  mkdir $TARBALL_DIR
fi
 
declare -a tarballs=(
  "automotive.tar.gz"
  "consumer.tar.gz"
  "network.tar.gz"
  "office.tar.gz"
  "security.tar.gz"
  "telecomm.tar.gz"
)
 
for tarball in "${tarballs[@]}"; do
  wget -P ${TARBALL_DIR} "${LINK}/${tarball}"
  tar xvf "${TARBALL_DIR}/${tarball}" -C .
done
 
# skip dirs below,
#   consumer/
#     tiff-data tiff-v3.5.4 tiff2bw tiff2rgba tiffdither tiffmedian
#     lame mad
#   office/
#     sphinx ghostscript ispell, rsynth
#   security/
#     rijndael pgp
declare -A dirs=(
  [automotive]="basicmath bitcount qsort susan"
  [consumer]="jpeg typeset"
  [network]="dijkstra patricia"
  [office]="stringsearch"
  [security]="blowfish sha"
  [telecomm]="CRC32 FFT adpcm gsm"
)
 
# rsynth
#  ./configure x86; -lm
declare -A config=(
  [rsynth]=""
)
 
declare -A exception=(
  [adpcm]="src"
  [jpeg]="jpeg-6a"
  [lame]="lame3.70"
  [mad]="mad-0.14.2b"
  [typeset]="lout-3.24"
  [ghostscript]="src"
)
 
# telecomm/adpcm
# consumer/
#   jpeg mad typeset
# security/
#   blowfish rijndael
for bench in "${!dirs[@]}"; do
  cd $bench
  for subdir in ${dirs[$bench]}; do  # requires subdirs with no spaces
    if [[ "${exception[$subdir]}" != "" ]] ; then
      cd "$subdir/${exception[$subdir]}"; ./configure; make; cd ../..
    else
      make -C "$subdir"
    fi
  done
  cd ..
done
 
export PATH=.:$PATH
 
for bench in "${!dirs[@]}"; do
  cd $bench
  for subdir in ${dirs[$bench]}; do
    cd $subdir
    echo "cd $subdir"
    ./runme_small.sh
    cd ..
  done
  cd ..
done
--- tiff-v3.5.4/tools/Makefile.in.orig  2012-05-01 11:03:25.246446038 +0800
+++ tiff-v3.5.4/tools/Makefile.in       2012-05-01 11:01:27.505828451 +0800
@@ -45,7 +45,7 @@
 COPTS  = @GCOPTS@
 OPTIMIZER=-O
 IPATH  = -I. -I${SRCDIR} -I${LIBDIR}
-CFLAGS = @ENVOPTS@ ${COPTS} ${OPTIMIZER} ${IPATH}
+CFLAGS = @ENVOPTS@ ${COPTS} ${OPTIMIZER} ${IPATH} -lm
 #
 TIFFLIB        = ${DEPTH}/libtiff/libtiff.@DSOSUF@
 LIBJPEG        = @LIBJPEG@
--- office/rsynth/Makefile.in.orig      2012-05-01 18:43:32.949628859 +0800
+++ office/rsynth/Makefile.in   2012-05-01 18:42:30.812984173 +0800
@@ -6,7 +6,7 @@
 PREFIX       = @prefix@
 BIN_DIR      = $(PREFIX)/bin
 LIB_DIR      = $(PREFIX)/lib/dict
-LDLIBS       = @LIBS@
+LDLIBS       = @LIBS@ -lm
 XLIBS        = @XLIBS@
 CFLAGS       = @CFLAGS@
 CPPFLAGS     = @CPPFLAGS@

SPEC