march.sh 950 B

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