GitHub284: Fix typo in xx-32.pl scripts.
[openssl.git] / util / pl / VC-32.pl
index 6918e8898d1e0b3df3636d3b469b0695b1d2a130..bf6aebf6c33b3fe0ea83b01281d1b1b6fdd8d0bb 100644 (file)
@@ -49,8 +49,7 @@ if ($FLAVOR =~ /WIN64/)
     # considered safe to ignore.
     # 
     $base_cflags= " $mf_cflag";
-    my $f = $shlib?' /MD':' /MT';
-    $lib_cflag='/Zl' if (!$shlib);     # remove /DEFAULTLIBs from static lib
+    my $f = ($shlib and !$fipscanisterbuild)?' /MD':' /MT';
     $opt_cflags=$f.' /Ox';
     $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /subsystem:console /opt:ref";
@@ -97,7 +96,7 @@ elsif ($FLAVOR =~ /CE/)
     $wcetgt = $ENV{'TARGETCPU'};       # just shorter name...
     SWITCH: for($wcetgt) {
        /^X86/          && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_";
-                               $wcelflag.=" /machine:IX86";    last; };
+                               $wcelflag.=" /machine:X86";     last; };
        /^ARMV4[IT]/    && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
                                $wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/);
                                $wcecdefs.=" -QRarch4T -QRinterwork-return";
@@ -122,24 +121,29 @@ elsif ($FLAVOR =~ /CE/)
          $wcelflag.=" /machine:$wcetgt";                       last; };
     }
 
-    $cc='$(CC)';
-    $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
+    $cc=($ENV{CC} or "cl");
+    $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYS_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
     $base_cflags.=" $wcecdefs";
     $base_cflags.=' -I$(WCECOMPAT)/include'            if (defined($ENV{'WCECOMPAT'}));
     $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include'        if (defined($ENV{'PORTSDK_LIBPATH'}));
-    $opt_cflags=' /MC /O1i';   # optimize for space, but with intrinsics...
-    $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG';
+    if (`$cc 2>&1` =~ /Version ([0-9]+)\./ && $1>=14) {
+       $base_cflags.=($shlib and !$fipscanisterbuild)?' /MD':' /MT';
+    } else {
+       $base_cflags.=' /MC';
+    }
+    $opt_cflags=' /O1i';       # optimize for space, but with intrinsics...
+    $dbg_cflags=' /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /opt:ref $wcelflag";
     }
 else   # Win32
     {
     $base_cflags= " $mf_cflag";
-    my $f = $shlib?' /MD':' /MT';
-    $lib_cflag='/Zl' if (!$shlib);     # remove /DEFAULTLIBs from static lib
+    my $f = ($shlib and !$fipscanisterbuild)?' /MD':' /MT';
     $opt_cflags=$f.' /Ox /O2 /Ob2';
     $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /subsystem:console /opt:ref";
     }
+$lib_cflag='/Zl' if (!$shlib or $fipscanisterbuild);   # remove /DEFAULTLIBs
 $mlflags='';
 
 $out_def ="out32";     $out_def.="dll"                 if ($shlib);
@@ -162,6 +166,8 @@ $app_cflag.=" /Zi /Fd\$(TMP_D)/app";
 $lib_cflag.=" /Zi /Fd\$(TMP_D)/lib";
 $lflags.=" /debug";
 
+$lflags.=" /fixed" if ($fips && $FLAVOR !~ /WIN64/);
+
 $obj='.obj';
 $asm_suffix='.asm';
 $ofile="/Fo";
@@ -172,14 +178,26 @@ $rsc="rc";
 $efile="/out:";
 $exep='.exe';
 if ($no_sock)          { $ex_libs=''; }
-elsif ($FLAVOR =~ /CE/)        { $ex_libs='winsock.lib'; }
+elsif ($FLAVOR =~ /CE/)        { $ex_libs='ws2.lib'; }
 else                   { $ex_libs='ws2_32.lib'; }
 
 if ($FLAVOR =~ /CE/)
        {
-       $ex_libs.=' $(WCECOMPAT)/lib/wcecompatex.lib'   if (defined($ENV{'WCECOMPAT'}));
+       $ex_libs.=' crypt32.lib';       # for e_capi.c
+       if (defined($ENV{WCECOMPAT}))
+               {
+               $ex_libs.= ' $(WCECOMPAT)/lib';
+               if (-f "$ENV{WCECOMPAT}/lib/$ENV{TARGETCPU}/wcecompatex.lib")
+                       {
+                       $ex_libs.='/$(TARGETCPU)/wcecompatex.lib';
+                       }
+               else
+                       {
+                       $ex_libs.='/wcecompatex.lib';
+                       }
+               }
        $ex_libs.=' $(PORTSDK_LIBPATH)/portlib.lib'     if (defined($ENV{'PORTSDK_LIBPATH'}));
-       $ex_libs.=' /nodefaultlib:oldnames.lib coredll.lib corelibc.lib' if ($ENV{'TARGETCPU'} eq "X86");
+       $ex_libs.=' /nodefaultlib coredll.lib corelibc.lib' if ($ENV{'TARGETCPU'} eq "X86");
        }
 else
        {
@@ -266,10 +284,6 @@ $(OBJ_D)\applink.obj:      ms\applink.c
        $(CC) /Fo$(OBJ_D)\applink.obj $(APP_CFLAGS) -c ms\applink.c
 $(OBJ_D)\uplink.obj:   ms\uplink.c ms\applink.c
        $(CC) /Fo$(OBJ_D)\uplink.obj $(SHLIB_CFLAGS) -c ms\uplink.c
-$(INCO_D)\applink.c:   ms\applink.c
-       $(CP) ms\applink.c $(INCO_D)\applink.c
-
-EXHEADER= $(EXHEADER) $(INCO_D)\applink.c
 
 LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj
 CRYPTOOBJ=$(OBJ_D)\uplink.obj $(CRYPTOOBJ)
@@ -282,7 +296,8 @@ elsif ($shlib && $FLAVOR =~ /CE/)
        {
        $mlflags.=" $lflags /dll";
        $lflags.=' /entry:mainCRTstartup' if(defined($ENV{'PORTSDK_LIBPATH'}));
-       $lib_cflag.=" -D_WINDLL -D_DLL";
+       $lib_cflag.=" -D_WINDLL";
+       $lib_cflag.=" -D_DLL" if (!$fipscanisterbuild);
        }
 
 sub do_lib_rule
@@ -350,7 +365,7 @@ sub do_link_rule
        my($target,$files,$dep_libs,$libs,$standalone)=@_;
        local($ret,$_);
        $file =~ s/\//$o/g if $o ne '/';
-       $n=&bname($targer);
+       $n=&bname($target);
        $ret.="$target: $files $dep_libs\n";
        if ($standalone == 1)
                {
@@ -386,7 +401,7 @@ sub do_rlink_rule
        my $files = "$rl_start $rl_mid $rl_end";
 
        $file =~ s/\//$o/g if $o ne '/';
-       $n=&bname($targer);
+       $n=&bname($target);
        $ret.="$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n";
        $ret.="\t\$(PERL) ms\\segrenam.pl \$\$a $rl_start\n";
        $ret.="\t\$(PERL) ms\\segrenam.pl \$\$b $rl_mid\n";