From 55aa7f51e361b33f7b56c9cb0263b11626e4be61 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 1 Sep 2012 14:53:17 +0800 Subject: [PATCH] Tools/GCCProxy - Fixing bugs --- Tools/GCCProxy/gccproxy.sh | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Tools/GCCProxy/gccproxy.sh b/Tools/GCCProxy/gccproxy.sh index 11dd9e40..213b54fe 100755 --- a/Tools/GCCProxy/gccproxy.sh +++ b/Tools/GCCProxy/gccproxy.sh @@ -24,6 +24,9 @@ _compile=0 while [[ $# -gt 0 ]]; do case "$1" in + -E) + _preproc=1 + ;; -c) _compile=1 ;; @@ -48,7 +51,7 @@ while [[ $# -gt 0 ]]; do shift _libs=$_libs" -l$1" ;; - -l*) + -l*|-L*) _libs=$_libs" $1" ;; *) @@ -58,15 +61,26 @@ while [[ $# -gt 0 ]]; do shift done +run() { +# echo $* + $* +} + +if [[ $_preproc -eq 1 ]]; then + run $_CC -E $CFLAGS $_cflags $_outfile + exit $? +fi if [[ $_compile -eq 1 ]]; then -# echo $_CC $CFLAGS $* - $_CC $CFLAGS $_miscargs -c $_outfile -else if echo " $_miscargs" | grep '\.c' >/dev/null; then + run $_CC $CFLAGS $_cflags $_miscargs -c $_outfile + exit $? +fi + +if echo " $_miscargs" | grep '\.c' >/dev/null; then tmpout=`mktemp acess_gccproxy.XXXXXXXXXX.o --tmpdir` - $_CC $CFLAGS $_miscargs -c -o $tmpout - $_LD $LDFLAGS $_ldflags $_libs $tmpout $_outfile + run $_CC $CFLAGS $_miscargs -c -o $tmpout + run $_LD $LDFLAGS $_ldflags $_libs $tmpout $_outfile rm $tmpout else - $_LD $LDFLAGS $_ldflags $_miscargs $_outfile $LIBGCC_PATH -fi; fi + run $_LD $LDFLAGS $_ldflags $_miscargs $_outfile $LIBGCC_PATH +fi -- 2.20.1