1*8c1441f8SAlexey Samsonov#!/bin/sh 2*8c1441f8SAlexey Samsonov 3*8c1441f8SAlexey Samsonovfunction test () { 4*8c1441f8SAlexey Samsonov arch=$1 5*8c1441f8SAlexey Samsonov file=$2 6*8c1441f8SAlexey Samsonov name=$3 7*8c1441f8SAlexey Samsonov ldflags=$4 8*8c1441f8SAlexey Samsonov 9*8c1441f8SAlexey Samsonov if gcc -arch $arch -Os $file $ldflags -DLIBNAME=$name 10*8c1441f8SAlexey Samsonov then 11*8c1441f8SAlexey Samsonov if ./a.out 12*8c1441f8SAlexey Samsonov then 13*8c1441f8SAlexey Samsonov rm ./a.out 14*8c1441f8SAlexey Samsonov else 15*8c1441f8SAlexey Samsonov echo "fail" 16*8c1441f8SAlexey Samsonov fi 17*8c1441f8SAlexey Samsonov else 18*8c1441f8SAlexey Samsonov echo "$FILE failed to compile" 19*8c1441f8SAlexey Samsonov fi 20*8c1441f8SAlexey Samsonov} 21*8c1441f8SAlexey Samsonov 22*8c1441f8SAlexey SamsonovINSTALLED=/usr/local/lib/system/libcompiler_rt.a 23*8c1441f8SAlexey Samsonov 24*8c1441f8SAlexey Samsonovfor ARCH in i386 x86_64; do 25*8c1441f8SAlexey Samsonov for FILE in $(ls *.c); do 26*8c1441f8SAlexey Samsonov 27*8c1441f8SAlexey Samsonov echo "Timing $FILE for $ARCH" 28*8c1441f8SAlexey Samsonov 29*8c1441f8SAlexey Samsonov test $ARCH $FILE libgcc "" 30*8c1441f8SAlexey Samsonov test $ARCH $FILE tuned ../../darwin_fat/Release/libcompiler_rt.a 31*8c1441f8SAlexey Samsonov if [ -f "$INSTALLED" ]; then 32*8c1441f8SAlexey Samsonov test $ARCH $FILE installed $INSTALLED 33*8c1441f8SAlexey Samsonov fi 34*8c1441f8SAlexey Samsonov 35*8c1441f8SAlexey Samsonov echo " " 36*8c1441f8SAlexey Samsonov 37*8c1441f8SAlexey Samsonov done 38*8c1441f8SAlexey Samsonovdone 39*8c1441f8SAlexey Samsonovexit 40