use struct timeval to obtain the cputime. disable display atm until the code is corre...
[AROS.git] / compiler / purify / purify
blob4631c194c5e14ae25de6d31946d68611ce011b3d
1 #!/bin/bashx
3 export PURIFYPATH=$HOME/AROS/compiler/purify
5 debug=0
7 mode="link"
8 args=""
9 objs=""
10 cflags=""
11 cpu=`uname -m`
12 puredir=".pure"
14 #echo "$@"
16 while [ $# -ne 0 ] ; do
17     case "$1" in
18         --debug ) debug=1 ; shift
19         ;;
20         -g | cc | gcc | -Wall ) shift
21         ;;
22         -o ) dest="$2" ; shift ; shift
23         ;;
24         -c ) mode="compile" ; shift
25         ;;
26         -I ) cflags="$cflags $1 $2" ; shift ; shift
27         ;;
28         -I* ) cflags="$cflags $1" ; shift
29         ;;
30         -W ) cflags="$cflags $1 $2" ; shift ; shift
31         ;;
32         -W* ) cflags="$cflags $1" ; shift
33         ;;
34         -f ) cflags="$cflags $1 $2" ; shift ; shift
35         ;;
36         -f* ) cflags="$cflags $1" ; shift
37         ;;
38         *.c ) csrcs="$csrcs $1" ; shift
39         ;;
40         * ) args="$args $1" ; shift
41         ;;
42     esac
43 done
45 if [ "x$dest" = "x" ]; then
46     dest="`echo $csrcs | cut '-d ' -f1 | sed 's/.c$/.o/'`"
49 if [ $debug -ne 0 ]; then
50     echo "dest=$dest"
51     echo "mode=$mode"
52     echo "args=$args"
55 if [ ! -d $puredir ]; then
56     if [ -e $puredir ]; then
57         echo "$0: Error: $puredir is no directory"
58         exit 10
59     else
60         mkdir $puredir
61     fi
64 for cfile in $csrcs ; do
65     name=$puredir/`basename $cfile .c`
67     if [ $debug -ne 0 ]; then
68         echo cc -Wall -g -S $cflags "$cfile" -o "$name".S
69     fi
70     cc -Wall -g -S $cflags "$cfile" -o "$name".S
72     if [ $debug -ne 0 ]; then
73         echo gawk -f $PURIFYPATH/purify.gawk --assign cpu=$cpu --assign out="$name"_pure.S "$name.S"
74     fi
75     gawk -f $PURIFYPATH/purify.gawk --assign cpu=$cpu --assign out="$name"_pure.S "$name.S"
77     if [ $debug -ne 0 ]; then
78         echo cc -c "$name"_pure.S -o "$name".o
79     fi
80     cc -c "$name"_pure.S -o "$name".o
82     objs="$objs $name.o"
83 done
85 case $mode in
86     link )
87         if [ $debug -ne 0 ]; then
88             echo cc -g $PURIFYPATH/pbd.o $args $objs $PURIFYPATH/ped.o -o $dest -L$PURIFYPATH -lpurify -lc
89         fi
90         cc -g $PURIFYPATH/pbd.o $args $objs $PURIFYPATH/ped.o -o $dest -L$PURIFYPATH -lpurify -lc
91         ;;
92     compile )
93         mv $objs $dest
94         ;;
95 esac