Update WIN32 nasm build to use new asm files.
[openssl.git] / util / pl / VC-32.pl
index 58bf9934dd0554a15cf4fcd0c66e8046f4910d2d..1269761c6e155ef15502fc0a68f3fa1460a259c9 100644 (file)
@@ -9,7 +9,7 @@ $crypto="libeay32";
 $o='\\';
 $cp='$(PERL) util/copy.pl';
 $mkdir='$(PERL) util/mkdir-p.pl';
-$rm='del';
+$rm='del /Q';
 
 $zlib_lib="zlib1.lib";
 
@@ -31,8 +31,10 @@ if ($FLAVOR =~ /WIN64/)
     $base_cflags=' /W3 /Gs0 /GF /Gy /nologo -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DOPENSSL_SYSNAME_WIN32 -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE';
     $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE';       # shut up VC8
     $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE';      # shut up VC8
-    $opt_cflags=' /MD /Ox';
-    $dbg_cflags=' /MDd /Od -DDEBUG -D_DEBUG';
+    my $f = $shlib?' /MD':' /MT';
+    $lib_cflag='/Zl' if (!$shlib);     # remove /DEFAULTLIBs from static lib
+    $opt_cflags=$f.' /Ox';
+    $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /subsystem:console /opt:ref";
     }
 elsif ($FLAVOR =~ /CE/)
@@ -96,8 +98,10 @@ else # Win32
     $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
     $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE';       # shut up VC8
     $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE';      # shut up VC8
-    $opt_cflags=' /MD /Ox /O2 /Ob2';
-    $dbg_cflags=' /MDd /Od -DDEBUG -D_DEBUG';
+    my $f = $shlib?' /MD':' /MT';
+    $lib_cflag='/Zl' if (!$shlib);     # remove /DEFAULTLIBs from static lib
+    $opt_cflags=$f.' /Ox /O2 /Ob2';
+    $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /subsystem:console /opt:ref";
     }
 $mlflags='';
@@ -127,7 +131,7 @@ $efile="/out:";
 $exep='.exe';
 if ($no_sock)          { $ex_libs=''; }
 elsif ($FLAVOR =~ /CE/)        { $ex_libs='winsock.lib'; }
-else                   { $ex_libs='wsock32.lib'; }
+else                   { $ex_libs='ws2_32.lib'; }
 
 if ($FLAVOR =~ /CE/)
        {
@@ -159,7 +163,10 @@ $lfile='/out:';
 $shlib_ex_obj="";
 $app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/);
 if ($nasm) {
-       $asm='nasmw -f win32';
+       my $ver=`nasm -v 2>NUL`;
+       my $vew=`nasmw -v 2>NUL`;
+       # pick newest version
+       $asm=($ver gt $vew?"nasm":"nasmw")." -f win32";
        $afile='-o ';
 } else {
        $asm='ml /Cp /coff /c /Cx';
@@ -176,8 +183,12 @@ $bf_enc_src='';
 
 if (!$no_asm)
        {
+       $aes_asm_obj='crypto\aes\asm\a_win32.obj';
+       $aes_asm_src='crypto\aes\asm\a_win32.asm';
        $bn_asm_obj='crypto\bn\asm\bn_win32.obj';
        $bn_asm_src='crypto\bn\asm\bn_win32.asm';
+       $bnco_asm_obj='crypto\bn\asm\co_win32.obj';
+       $bnco_asm_src='crypto\bn\asm\co_win32.asm';
        $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
        $des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm';
        $bf_enc_obj='crypto\bf\asm\b_win32.obj';
@@ -190,17 +201,20 @@ if (!$no_asm)
        $rc5_enc_src='crypto\rc5\asm\r5_win32.asm';
        $md5_asm_obj='crypto\md5\asm\m5_win32.obj';
        $md5_asm_src='crypto\md5\asm\m5_win32.asm';
-       $sha1_asm_obj='crypto\sha\asm\s1_win32.obj';
-       $sha1_asm_src='crypto\sha\asm\s1_win32.asm';
+       $sha1_asm_obj='crypto\sha\asm\s1_win32.obj crypto\sha\asm\sha256_win32.obj crypto\sha\asm\sha512_win32.obj';
+       $sha1_asm_src='crypto\sha\asm\s1_win32.asm crypto\sha\asm\sha256_win32.asm crypto\sha\asm\sha512_win32.asm';
        $rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj';
        $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
-       $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
+       $whirlpool_asm_obj='crypto\whrlpool\asm\wp_win32.obj';
+       $whirlpool_asm_src='crypto\whrlpool\asm\wp_win32.asm';
+       $cpuid_asm_obj='crypto\cpu_win32.obj';
+       $cpuid_asm_src='crypto\cpu_win32.asm';
+       $cflags.=" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DOPENSSL_BN_ASM_PART_WORDS -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM -DWHIRLPOOL_ASM";
        }
 
 if ($shlib && $FLAVOR !~ /CE/)
        {
        $mlflags.=" $lflags /dll";
-#      $cflags =~ s| /MD| /MT|;
        $lib_cflag=" -D_WINDLL";
        $out_def="out32dll";
        $tmp_def="tmp32dll";
@@ -276,11 +290,12 @@ sub do_lib_rule
                else
                        {
                        $ex.=' unicows.lib' if ($FLAVOR =~ /NT/);
-                       $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib';
+                       $ex.=' ws2_32.lib gdi32.lib advapi32.lib user32.lib';
                        $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/);
                        }
                $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
                $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
+        $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n";
                }
        $ret.="\n";
        return($ret);
@@ -294,8 +309,9 @@ sub do_link_rule
        $file =~ s/\//$o/g if $o ne '/';
        $n=&bname($targer);
        $ret.="$target: $files $dep_libs\n";
-       $ret.="  \$(LINK) \$(LFLAGS) $efile$target @<<\n";
-       $ret.="  \$(APP_EX_OBJ) $files $libs\n<<\n\n";
+       $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
+       $ret.="  \$(APP_EX_OBJ) $files $libs\n<<\n";
+    $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
        return($ret);
        }