-
Notifications
You must be signed in to change notification settings - Fork 3
/
make-llvm-ir.sh
executable file
·54 lines (36 loc) · 1 KB
/
make-llvm-ir.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
export SPEC=/home/max/academico/spec2006/cpu2006
LEVEL=$PWD
OUTDIR="llvm-bin"
AUXFILES="make-files"
# Find all apps (file that start with number)
ALL=$(find $SPEC/benchspec -maxdepth 2 | grep CPU2006/[0-9])
for i in $ALL; do
cd $LEVEL
APP=$(basename $i)
echo $i/src
cd $i/src
cp $LEVEL/$AUXFILES/Makefile.spec .
# The 'make' dont makes the replacement =(
sed -i "s/\$(EXEBASE)/$APP/g" Makefile.spec
if [ -a $LEVEL/$AUXFILES/$APP.spec ]; then
cp $LEVEL/$AUXFILES/$APP.spec .
else
touch $APP.spec .
fi
if [ -a $LEVEL/$AUXFILES/$APP.deps ]; then
cp $LEVEL/$AUXFILES/$APP.deps Makefile.deps
else
touch $APP.spec Makefile.deps
fi
make clean &> $LEVEL/$OUTDIR/$APP.make
make EXEBASE="$APP" &>> $LEVEL/$OUTDIR/$APP.make
if [ $? -eq 0 ]; then
chmod +x $APP
mv $APP $LEVEL/$OUTDIR/$APP.bc
fi
make clean &> /dev/null
rm Makefile.spec
rm Makefile.deps
rm $APP.spec
done