a few changes so that it behaves more like a normal compiler, and can be used in...
authorGengbin Zheng <gzheng@illinois.edu>
Sun, 27 Sep 2009 19:33:07 +0000 (19:33 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Sun, 27 Sep 2009 19:33:07 +0000 (19:33 +0000)
src/arch/win64/unix2nt_cc

index 5e28421923440b85714b4b11695f6c2141826675..3d17992888f29589f0c1a5939af31bb7132f712a 100755 (executable)
@@ -48,7 +48,7 @@ fi
 #CL command-line options for -O and -g mode
 #only for the environment that has set corresponding environmental variables
 CL_CMD="CL.EXE"
-CL_COMMON=' /nologo /W3 /EHsc /D_WINDOWS /FD'
+CL_COMMON=' /nologo /W1 /EHsc /D_WINDOWS /FD'
 CL_COMMON="$CL_COMMON /I`cygpath -d \"$SDK_DIR/Include\"`"
 CL_COMMON="$CL_COMMON /I`cygpath -d \"$VCC_DIR/Include\"`"
 CL_O=$CL_COMMON" /DNDEBUG /MT /Ox"
@@ -176,7 +176,7 @@ do
        -E)
                CL="$CL /E"
                ;;
-       -O)
+       -O|-O1|-O2|-O3)
                CL_OPTS=$CL_O
                LINK_OPTS=$LINK_O
                ;;
@@ -224,12 +224,14 @@ do
                        [ -r "$L.a" ] && D="$L.a"
                        [ -r "$L.lib" ] && D="$L.lib"
                        [ -r "lib$L.a" ] && D="lib$L.a"
+                       [ -r "lib$L.lib" ] && D="lib$L.lib"
                        test -n "$LIBDIRS" &&   \
                        for dir in $LIBDIRS
                        do
                          [ -r "$dir/lib$L" ] && D="$dir/lib$L"
                          [ -r "$dir/lib$L.a" ] && D="$dir/lib$L.a"
                          [ -r "$dir/$L.lib" ] && D="$dir/$L.lib"
+                         [ -r "$dir/lib$L.lib" ] && D="$dir/lib$L.lib"
                        done
                        [ $D = no ] && Abort "Couldn't find library $L in . or $LIBDIRS"
                        LINK="$LINK `cygpath -w $D`"
@@ -242,9 +244,16 @@ do
                then
 #It's a .o output filename-- tell CL
                        OUTPUT="/Fo`cygpath -w $out`"
+               elif [ "x`getExtention $out`" = "x.obj" ]
+               then
+                       OUTPUT="/Fo`cygpath -w $out`"
                elif [ "x`getExtention $out`" = "x.so" ]
                then
                        OUTPUT="/Fo`cygpath -w $out`"
+               elif [ "x`getExtention $out`" = "x.exe" ]
+               then
+                       LINK="$LINK /out:$out"
+                       DOLINK="yes"
                else
 #It's an exe filename-- tell LINK
                        LINK="$LINK /out:$out.exe"
@@ -253,7 +262,7 @@ do
                ;;
        
 #Object file or library-- add to link
-       *.o|*.a|*.lib)
+       *.o|*.a|*.lib|*.obj)
                if [ "$DOCOMPILE" = "yes" ]
                then
                  CL="$CL `cygpath -w $arg`"
@@ -266,7 +275,7 @@ do
        *.c)
                base=`stripExtention $arg`
                CL="$CL /Tc`cygpath -w $arg`"
-#              OUTPUT="/Fo$base.o"
+               OBJ_OUTPUT="/Fo$base.o"
                LINK="$LINK $base.o"
                DOCOMPILE="yes"
                ;;
@@ -290,6 +299,7 @@ done
 if [ $DOCOMPILE = yes ]
 then
        OPTS="$CL_OPTS $OUTPUT $CL"
+        [ "$DOLINK" = yes -a -z "$OUTPUT" ] && OPTS="$OPTS $OBJ_OUTPUT"
        [ $VERBOSE = yes ] && echo "unix2nt_cc> $CL_CMD" $OPTS
        "$CL_CMD" $OPTS
        if [ $? != 0 ]