487596e35689beb965d53a47806b3ce84a2fae77
[gnome.gobject-introspection] / scripts / shave.in
1 #!/bin/sh
2
3 # we need sed
4 SED=@SED@
5 if test -z "$SED" ; then
6 SED=sed
7 fi
8 Xsed="$SED -e s/^X//"
9
10 lt_unmangle ()
11 {
12    last_result=`echo -n X$1 | $Xsed -e 's#.libs/##' -e 's#[^0-9a-zA-Z_]\+_la##'`
13 }
14
15 # the tool to wrap (cc, cxx, ar, ranlib, ..)
16 tool="$1"
17 shift
18
19 # the reel tool (to call)
20 REEL_TOOL="$1"
21 shift
22
23 pass_through=0
24 preserved_args=
25 while test "$#" -gt 0; do
26     opt="$1"
27     shift
28
29     case $opt in
30     --shave-mode=*)
31         mode=`echo "X$opt" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'`
32         ;;
33     -o)
34         lt_output="$1"
35         preserved_args="$preserved_args $opt"
36         ;;
37     *)
38         preserved_args="$preserved_args $opt"
39         ;;
40       esac
41 done
42
43 # mode=link is handled in the libtool wrapper
44 case "$mode,$tool" in
45 link,*)
46     pass_through=1
47     ;;
48 compile,cxx)
49     Q="  CXX   "
50     ;;
51 compile,cc|*,*)
52     # no "libtool" mode has been given, we are called by the Makefile:
53     # -> assume compilation
54     mode=compile
55     Q="  CC    "
56     ;;
57 esac
58
59 lt_unmangle "$lt_output"
60 output=$last_result
61
62 if test -z $V; then
63     if test $pass_through -eq 0; then
64         echo "$Q$output"
65     fi
66     $REEL_TOOL $preserved_args
67 else
68     echo $REEL_TOOL $preserved_args
69     $REEL_TOOL $preserved_args
70 fi