3 echo "Using PREFIX="${PREFIX:=$1}
4 echo "Using PROJECT="${PROJECT:=$2}
5 echo "Using COCCI="${COCCI:=$3}
6 echo "Using RESULTS="${RESULTS:=$4}
7 echo "Using SPFLAGS="${SPFLAGS:=$5}
9 #echo "Using PREFIX="${PREFIX:=`pwd`}
10 #echo "Using COCCI="${COCCI:=$PREFIX/cocci}
11 #echo "Using PROJECT="${PROJECT:=$PREFIX/project}
12 #echo "Using RESULTS="${RESULTS:=$PREFIX/results}
14 SMPL
=`find $COCCI -mindepth 1 -type f -name "*.cocci"| sed "s|$COCCI/||g"`
16 PRJNAME
=`basename $PROJECT`
18 echo "Processing project \"$PRJNAME\""
24 f
=`basename $s .cocci`
26 # Produce bug report for a particular version and a particular bug pattern
27 echo "#!/bin/bash" > $RESULTS/$f.sh
28 echo "" >> $RESULTS/$f.sh
29 echo "FLAGS=\"`grep -E \"// +Options *:\" $COCCI/$s | cut -f2 -d\":\"`\"" >> $RESULTS/$f.sh
30 echo "INC=$PROJECT/include" >> $RESULTS/$f.sh
31 echo "echo \"Applying $COCCI/$s with: '\$FLAGS'\"" >> $RESULTS/$f.sh
32 echo "nice -19 spatch.opt $SPFLAGS \$FLAGS -I \$INC -cocci_file $COCCI/$s -dir $PROJECT/ $FLAGS \\" >> $RESULTS/$f.sh
33 echo "> $f.out \\" >> $RESULTS/$f.sh
34 echo "2> $f.log" >> $RESULTS/$f.sh
35 echo "echo \"$f.out completed\"" >> $RESULTS/$f.sh
36 chmod u
+x
$RESULTS/$f.sh
41 #############################################
43 #############################################
44 # Generation of a Makefile per project
45 echo -e ".SUFFIXES: .out .sh\n" > $RESULTS/Makefile
46 echo -e "all: out\n" >> $RESULTS/Makefile
47 echo -e ".sh.out:" >> $RESULTS/Makefile
48 echo -e "\t-@./\$<\n" >> $RESULTS/Makefile
50 ALL_SMPL
=`echo -n "out:"`
53 f
=`basename $s .cocci`
55 # echo "$f.out:" >> $RESULTS/Makefile
56 # echo " -./$f.sh" >> $RESULTS/Makefile
57 ALL_SMPL
="$ALL_SMPL $f.out"
61 echo "$ALL_SMPL" >> $RESULTS/Makefile
63 #############################################
66 find -L $RESULTS -type l
-delete
68 find results
/ -depth -type d
-empty -delete