Pristine Ack-5.5
[Ack-5.5.git] / util / shf / march.sh
1 : '$Id: march.sh,v 1.8 1995/08/15 14:59:28 ceriel Exp $'
2
3 case $# in
4 3) makecmd=$3 ;;
5 2) makecmd=compmodule ;;
6 *) echo "Usage: $0 srcdir archname [ makecmd ]"; exit 1 ;;
7 esac
8
9 errors=no
10 if test -r $1/LIST
11 then
12   (
13     read archname
14     if test -r $1/$archname
15     then 
16       arch x $1/$archname
17       for file in `arch t $1/$archname`
18       do
19         echo $file: 1>&2
20         suffix=`expr $file : '.*\(\..*\)'`
21         ofile=`$makecmd $file $suffix`
22         if test $? != 0
23         then errors=yes
24         fi
25         rm $file
26         OFILES="$OFILES $ofile"
27       done
28     else
29       while read file
30       do
31         echo $file: 1>&2
32         suffix=`expr $file : '.*\(\..*\)'`
33         ofile=`$makecmd $1/$file $suffix`
34         if test $? != 0
35         then errors=yes
36         fi
37         OFILES="$OFILES $ofile"
38       done
39     fi
40     if test $errors = no
41     then
42       if ${ASAR-arch} cr $2 $OFILES && ${RANLIB-:} $2
43       then
44         rm $OFILES
45       fi
46     else
47       echo $2 not made, due to compilation errors
48       exit 1
49     fi
50   ) < $1/LIST
51 else
52   echo no LIST file in directory $1
53   exit 1
54 fi