X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Tools%2FGCCProxy%2Fgccproxy.sh;h=477c4766641c622318bfa97088f3fc7de2de72a6;hb=c6bba3a75fd1a3773750ef0cdc1e7a5b811336b5;hp=8fb035b6ad53fdec2d8806abdad40d703689f59d;hpb=07bb757218ab9c79273b6fb668599a33df1fc6e6;p=tpg%2Facess2.git diff --git a/Tools/GCCProxy/gccproxy.sh b/Tools/GCCProxy/gccproxy.sh index 8fb035b6..477c4766 100755 --- a/Tools/GCCProxy/gccproxy.sh +++ b/Tools/GCCProxy/gccproxy.sh @@ -12,21 +12,18 @@ fullpath=`readlink -f "$fullpath"` # Get base directory BASEDIR=`dirname "$fullpath"` -cfgfile=`mktemp` -make --no-print-directory -f $BASEDIR/getconfig.mk ARCH=x86 > $cfgfile -#echo $cfgfile -#cat $cfgfile -. $cfgfile -rm $cfgfile - _miscargs="" _compile=0 +_linktype=Applications while [[ $# -gt 0 ]]; do case "$1" in -E) _preproc=1 ;; + -M) + _makedep=1 + ;; -c) _compile=1 ;; @@ -34,9 +31,13 @@ while [[ $# -gt 0 ]]; do shift _outfile="-o $1" ;; - -I) + -shared) + _ldflags=$_ldflags" -shared -lc -lgcc" + _linktype=Libraries + ;; + -I|-D|-O) + _cflags=$_cflags" $1 $2" shift - _cflags=$_cflags" -I$1" ;; -I*|-D*|-O*) _cflags=$_cflags" $1" @@ -47,13 +48,23 @@ while [[ $# -gt 0 ]]; do arg=${arg/,/ } _ldflags=$_ldflags" ${arg}" ;; - -l) + -l|-L) + _libs=$_libs" $1$2" shift - _libs=$_libs" -l$1" ;; -l*|-L*) _libs=$_libs" $1" ;; + -v|--version|-V) + _verarg=$_verarg" $1" + ;; + --inv=ld) + _actas=ld + ;; + -print-prog-name=ld) + echo $0 --inv=ld + exit 0 + ;; *) _miscargs=$_miscargs" $1" ;; @@ -62,25 +73,37 @@ while [[ $# -gt 0 ]]; do done run() { -# echo $* + #echo --- $* $* + return $? } -if [[ $_preproc -eq 1 ]]; then - run $_CC -E $CFLAGS $_cflags $_miscargs $_outfile - exit $? -fi -if [[ $_compile -eq 1 ]]; then - run $_CC $CFLAGS $_cflags $_miscargs -c $_outfile +cfgfile=`mktemp` +make --no-print-directory -f $BASEDIR/getconfig.mk ARCH=x86 TYPE=$_linktype > $cfgfile +. $cfgfile +rm $cfgfile + +#echo "_compile = $_compile, _preproc = $_preproc" + +if [[ "x$_actas" == "xld" ]]; then + run $_LD $LDFLAGS $_ldflags $_outfile $_miscargs $LIBGCC_PATH $_libs exit $? fi -if echo " $_miscargs" | grep '\.c' >/dev/null; then +if [[ $_preproc -eq 1 ]]; then + run $_CC -E $CFLAGS $_cflags $_miscargs $_outfile +elif [[ $_makedep -eq 1 ]]; then + run $_CC -M $CFLAGS $_cflags $_miscargs $_outfile +elif [[ $_compile -eq 1 ]]; then + run $_CC $CFLAGS $_cflags $_miscargs -c $_outfile +elif echo " $_miscargs" | grep '\.c' >/dev/null; then tmpout=`mktemp acess_gccproxy.XXXXXXXXXX.o --tmpdir` - run $_CC $CFLAGS $_miscargs -c -o $tmpout - run $_LD $LDFLAGS $_ldflags $_libs $tmpout $_outfile + run $_CC $CFLAGS $_cflags $_miscargs -c -o $tmpout + run $_LD $LDFLAGS $_ldflags $_libs $tmpout $_outfile $LIBGCC_PATH $_libs + _rv=$? rm $tmpout + exit $_rv else - run $_LD $LDFLAGS $_ldflags $_miscargs $_outfile $LIBGCC_PATH + run $_LD$_ldflags $_miscargs $_outfile $LDFLAGS $_libs fi