X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Tools%2FGCCProxy%2Fgccproxy.sh;h=59880812f7fa3a29c390efc40a7109f1a6f2de5b;hb=13078002b01ee4f63eb2001d2ef479a2a006ea32;hp=5a126a9235e48fef609673051d1543d8b17e3af8;hpb=e7a76b0d8a0cc6aa77966509780973a6f8216ef7;p=tpg%2Facess2.git diff --git a/Tools/GCCProxy/gccproxy.sh b/Tools/GCCProxy/gccproxy.sh index 5a126a92..59880812 100755 --- a/Tools/GCCProxy/gccproxy.sh +++ b/Tools/GCCProxy/gccproxy.sh @@ -1,5 +1,7 @@ #!/bin/bash +toolname=${0##*-} + # Get invocation path (which could be a symlink in $PATH) fullpath=`which "$0"` if [[ !$? ]]; then @@ -16,7 +18,9 @@ _miscargs="" _compile=0 _linktype=Applications -echo [GCCProxy] $* >&2 +echo [GCCProxy] $toolname $* >&2 + + while [[ $# -gt 0 ]]; do case "$1" in @@ -50,6 +54,9 @@ while [[ $# -gt 0 ]]; do arg=${arg/,/ } _ldflags=$_ldflags" ${arg}" ;; + -Wall|-Werror|-Wextra)\ + _cflags=$_cflags" $1" + ;; -l|-L) _libs=$_libs" $1$2" shift @@ -63,10 +70,21 @@ while [[ $# -gt 0 ]]; do --inv=ld) _actas=ld ;; + -pthread) + _ldflags=$_ldflags" -lpthread" + ;; -print-prog-name=ld) echo $0 --inv=ld exit 0 ;; + -print-search-dirs) + _compile=1 + _cflags=$_cflags" $1" + ;; + -print-multi-os-directory) + _compile=1 + _cflags=$_cflags" $1" + ;; -dumpspecs) _compile=1 _miscargs=$_miscargs" $1" @@ -100,6 +118,16 @@ rm $cfgfile #echo "_compile = $_compile, _preproc = $_preproc" +if [[ "$toolname" == "g++" ]]; then + COMPILER=$_CXX + _libs="-lc++ $_libs" +elif [[ "$toolname" == "gcc" ]]; then + COMPILER=$_CC +else + echo "ERROR: Unknown tool name $toolname" >&2 + exit 1 +fi + if [[ "x$_verarg" != "x" ]]; then if [[ "x$_actas" == "xld" ]]; then run $_LD $_miscargs $_verarg @@ -127,11 +155,11 @@ elif [[ $_compile -eq 1 ]]; then elif echo " $_miscargs" | grep '\.c' >/dev/null; then tmpout=`mktemp acess_gccproxy.XXXXXXXXXX.o --tmpdir` run $_CC $CFLAGS $_cflags $_miscargs -c -o $tmpout - run $_LD $LDFLAGS $_ldflags $_libs $tmpout $_outfile $_libs $LIBGCC_PATH + run $_LD $LDFLAGS $_ldflags $CRTBEGIN $_libs $tmpout $_outfile $_libs $LIBGCC_PATH $CRTEND _rv=$? rm $tmpout exit $_rv else - run $_LD $_ldflags $_miscargs $_outfile $LDFLAGS $_libs $LIBGCC_PATH + run $_LD $_ldflags $CRTBEGIN $_miscargs $_outfile $LDFLAGS $_libs $LIBGCC_PATH $CRTEND fi