shave.in 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. # we need sed
  3. SED=@SED@
  4. if test -z "$SED" ; then
  5. SED=sed
  6. fi
  7. lt_unmangle ()
  8. {
  9. last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_]\*_la-##'`
  10. }
  11. # the tool to wrap (cc, cxx, ar, ranlib, ..)
  12. tool="$1"
  13. shift
  14. # the reel tool (to call)
  15. REEL_TOOL="$1"
  16. shift
  17. pass_through=0
  18. preserved_args=
  19. while test "$#" -gt 0; do
  20. opt="$1"
  21. shift
  22. case $opt in
  23. --shave-mode=*)
  24. mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'`
  25. ;;
  26. -o)
  27. lt_output="$1"
  28. preserved_args="$preserved_args $opt"
  29. ;;
  30. *)
  31. preserved_args="$preserved_args $opt"
  32. ;;
  33. esac
  34. done
  35. # mode=link is handled in the libtool wrapper
  36. case "$mode,$tool" in
  37. link,*)
  38. pass_through=1
  39. ;;
  40. *,cxx)
  41. Q=" CXX "
  42. ;;
  43. *,cc)
  44. Q=" CC "
  45. ;;
  46. *,*)
  47. # should not happen
  48. Q=" CC "
  49. ;;
  50. esac
  51. lt_unmangle "$lt_output"
  52. output=$last_result
  53. if test -z $V; then
  54. if test $pass_through -eq 0; then
  55. echo "$Q$output"
  56. fi
  57. $REEL_TOOL $preserved_args
  58. else
  59. echo $REEL_TOOL $preserved_args
  60. $REEL_TOOL $preserved_args
  61. fi