scripts/showSamples.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon May 26 21:49:36 2008 +0000 (2008-05-26)
changeset 539 c538627f69f1
parent 474 2904d77fe117
child 560 0ca969b84057
permissions -rwxr-xr-x
Rework dumping the samples.

/trunk/scripts/showSamples.sh | 1 0 1 0 -
/trunk/samples/samples.mk | 10 7 3 0 +++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
     1 #!/bin/bash
     2 
     3 # Parses all samples on the command line, and for each of them, prints
     4 # the versions of the main tools
     5 
     6 opt="$1"
     7 [ "${opt}" = "-v" ] && shift || opt=
     8 
     9 # GREP_OPTIONS screws things up.
    10 export GREP_OPTIONS=
    11 
    12 # Dump a single sample
    13 dump_single_sample() {
    14     local verbose=0
    15     [ "$1" = "-v" ] && verbose=1 && shift
    16     local width="$1"
    17     local sample="$2"
    18     if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
    19         sample_top="${CT_TOP_DIR}"
    20         sample_type="local"
    21     else
    22         sample_top="${CT_LIB_DIR}"
    23         sample_type="global"
    24     fi
    25     printf "  %-*s  (%s" ${width} "${sample}" "${sample_type}"
    26     [ -f "${sample_top}/samples/${sample}/broken" ] && printf ",broken"
    27     echo ")"
    28     if [ ${verbose} -ne 0 ]; then
    29         . "${sample_top}/samples/${sample}/crosstool.config"
    30         echo    "    OS        : ${CT_KERNEL}-${CT_KERNEL_VERSION}"
    31         echo    "    binutils  : binutils-${CT_BINUTILS_VERSION}"
    32         echo -n "    C compiler: ${CT_CC}-${CT_CC_VERSION} (C"
    33         [ "${CT_CC_LANG_CXX}" = "y"     ] && echo -n ",C++"
    34         [ "${CT_CC_LANG_FORTRAN}" = "y" ] && echo -n ",Fortran"
    35         [ "${CT_CC_LANG_JAVA}" = "y"    ] && echo -n ",Java"
    36         [ "${CT_CC_LANG_ADA}" = "y"     ] && echo -n ",ADA"
    37         [ "${CT_CC_LANG_OBJC}" = "y"    ] && echo -n ",Objective-C"
    38         [ "${CT_CC_LANG_OBJCXX}" = "y"  ] && echo -n ",Objective-C++"
    39         [ -n "${CT_CC_LANG_OTHERS}"     ] && echo -n ",$CT_CC_LANG_OTHERS}"
    40         echo    ")"
    41         echo    "    C library : ${CT_LIBC}-${CT_LIBC_VERSION}"
    42         echo -n "    Tools     :"
    43         [ "${CT_LIBELF}"  ] && echo -n " libelf-${CT_LIBELF_VERSION}"
    44         [ "${CT_SSTRIP}"  ] && echo -n " sstrip"
    45         [ "${CT_DMALLOC}" ] && echo -n " dmalloc-${CT_DMALLOC_VERSION}"
    46         [ "${CT_DUMA}"    ] && echo -n " duma-${CT_DUMA_VERSION}"
    47         [ "${CT_GDB}"     ] && echo -n " gdb-${CT_GDB_VERSION}"
    48         [ "${CT_LTRACE}"  ] && echo -n " ltrace-${CT_LTRACE_VERSION}"
    49         [ "${CT_STRACE}"  ] && echo -n " strace-${CT_STRACE_VERSION}"
    50         echo
    51     fi
    52 }
    53 
    54 # Get largest sample width
    55 width=0
    56 for sample in "${@}"; do
    57     [ ${#sample} -gt ${width} ] && width=${#sample}
    58 done
    59 
    60 for sample in "${@}"; do
    61     ( dump_single_sample ${opt} ${width} "${sample}" )
    62 done