Use shave to reduce compiling output
[gnome.gobject-introspection] / scripts / shave-libtool.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 real libtool to use
16 LIBTOOL="$1"
17 shift
18
19 # if 1, don't print anything, the underlaying wrapper will do it
20 pass_though=0
21
22 # scan the arguments, keep the right ones for libtool, and discover the mode
23 preserved_args=
24 while test "$#" -gt 0; do
25     opt="$1"
26     shift
27
28     case $opt in
29     --mode=*)
30         mode=`echo "X$opt" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'`
31         preserved_args="$preserved_args $opt"
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 case "$mode" in
44 compile)
45     # shave will be called and print the actual CC/CXX/LINK line
46     preserved_args="$preserved_args --shave-mode=$mode"
47     pass_though=1
48     ;;
49 link)
50     preserved_args="$preserved_args --shave-mode=$mode"
51     Q="  LINK  "
52     ;;
53 *)
54     # let's u
55     # echo "*** libtool: Unimplemented mode: $mode, fill a bug report"
56     ;;
57 esac
58
59 lt_unmangle "$lt_output"
60 output=$last_result
61
62 if test -z $V; then
63     if test $pass_though -eq 0; then
64         echo "$Q$output"
65     fi
66     $LIBTOOL --silent $preserved_args
67 else
68     echo $LIBTOOL $preserved_args
69     $LIBTOOL $preserved_args
70 fi