[xbuild] ToolTask - add missing api
[mono.git] / scripts / patch-quiet.sh
1 #!/bin/sh
2
3 #
4 # patch-quiet.sh: Shell script to rewrite Makefiles using libtool to be less verbose
5 #
6
7 if [ "$1" = "" ]; then
8         echo "Usage: patch-quiet.sh <path to Makefile>"
9         exit 1
10 fi
11
12 src=$1
13
14 if head -n1 $src | grep -q '# Postprocessed with patch-quiet\.sh'; then
15     # already handled
16     exit 0
17 fi
18
19 echo "# Postprocessed with patch-quiet.sh" > $src.tmp && cat $src >> $src.tmp && cp $src.tmp $src && rm -f $src.tmp
20 # Try to find GNU sed
21 SED="sed"
22 sed --version >/dev/null 2>&1
23 if [ $? -ne 0 ] ; then
24         gsed --version > /dev/null 2>&1 && SED="gsed"
25 fi
26
27 # compile
28 ${SED} -e 's/^\t\(if \)\?$(COMPILE)/\t$(if $(V),,@echo -e "CC\\t$@";) \1$(COMPILE)/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
29 ${SED} -e 's/^\t\(if \)\?$(LTCOMPILE)/\t$(if $(V),,@echo -e "CC\\t$@";) \1$(LTCOMPILE)/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
30 ${SED} -e 's/^\t\(if \)\?$(LTCXXCOMPILE)/\t$(if $(V),,@echo -e "CC\\t$@";) \1$(LTCXXCOMPILE)/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
31 ${SED} -e 's/^\t\(if \)\?$(LIBTOOL)/\t$(if $(V),,@echo -e "CC\\t$@";) \1$(LIBTOOL)/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
32 # link
33 # automake defines multiple symbols ending with LINK
34 ${SED} -e 's/^\t$(\(.*LINK\))/\t$(if $(V),,@echo -e "LD\\t$@";) $(\1)/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
35 #sed -e 's/LINK = $(LIBTOOL)/LINK = $(if $(V),,@echo -e "LD\\t$@";) $(LIBTOOL)/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
36 # CC
37 ${SED} -e 's/^\t\(if \)\?$(CC)/\t$(if $(V),,@echo -e "CC\\t$@";) \1$(CC)/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
38 # mv
39 ${SED} -e 's/^\tmv -f/\t$(if $(V),,@)mv -f/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
40 ${SED} -e 's/^am__mv = /&$(if $(V),,@)/' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
41 # libtool messages
42 ${SED} -e 's/\$(LIBTOOL)/$(LIBTOOL) $(if $(V),,--quiet)/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
43
44 # This causes this script to be rerun if Makefile.am changes
45 ${SED} -e 's/am__depfiles_maybe = depfiles/& quiet/g' < $src > $src.tmp && cp $src.tmp $src && rm -f $src.tmp
46