march.sh 960 B

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