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