为x64和x86构建OpenSSL(并行安装)?

时间:2016-07-01 17:55:50

标签: windows build openssl

我在网上搜索构建了x86和x64版本的OpenSSL,并发现许多我遇到过同样的问题。问题是DLL使用相同的目录和文件名以32结尾。

当DLL必须并排驻留时,如何为x64和x86构建OpenSSL?

1 个答案:

答案 0 :(得分:0)

下面的统一差异是为openssl-1.0.2h创建的,并允许使用visual studio构建x86(win32)和x64(win64)版本而不会发生冲突。 openssl中包含的构建指令没有任何变化,您可以简单地运行perl configure,ms / do_xxx,然后nmake构建,并使用nmake安装。您可以在x64和x86环境中执行这些操作,而无需撤消先前构建中的任何内容。

+++ Configure   Mon Jan 19 14:26:32 1970
@@ -584,10 +584,10 @@
 # Visual C targets
 #
 # Win64 targets, WIN64I denotes IA-64 and WIN64A - AMD64
-"VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o ia64-mont.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32",
-"VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
-"debug-VC-WIN64I","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win32",
-"debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
+"VC-WIN64I","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o ia64-mont.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win64",
+"VC-WIN64A","cl:-W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win64",
+"debug-VC-WIN64I","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64I::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:ia64cpuid.o:ia64.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o:::::::ghash-ia64.o::ias:win64",
+"debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win64",
 # x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
 # 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
 "VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
@@ -2078,11 +2078,21 @@
        VALUE "FileDescription", "OpenSSL Shared Library\\0"
        VALUE "FileVersion", "$version\\0"
 #if defined(CRYPTO)
+   #if defined(_WIN64)
+       VALUE "InternalName", "libeay64\\0"
+       VALUE "OriginalFilename", "libeay64.dll\\0"
+   #else
        VALUE "InternalName", "libeay32\\0"
        VALUE "OriginalFilename", "libeay32.dll\\0"
+   #endif
 #elif defined(SSL)
+   #if defined(_WIN64)
+       VALUE "InternalName", "ssleay64\\0"
+       VALUE "OriginalFilename", "ssleay64.dll\\0"
+   #else
        VALUE "InternalName", "ssleay32\\0"
        VALUE "OriginalFilename", "ssleay32.dll\\0"
+   #endif
 #endif
        VALUE "ProductName", "The OpenSSL Toolkit\\0"
        VALUE "ProductVersion", "$version\\0"
@@ -2262,23 +2272,23 @@
        {
        @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);

-       if ($fields[$idx_dso_scheme-1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
+       if ($fields[$idx_dso_scheme-1] =~ /^(beos|dl|dlfcn|win32|win64|vms)$/)
            {
            $errorcnt++;
            print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
            print STDERR "              in the previous field\n";
            }
-       elsif ($fields[$idx_dso_scheme+1] =~ /^(beos|dl|dlfcn|win32|vms)$/)
+       elsif ($fields[$idx_dso_scheme+1] =~ /^(beos|dl|dlfcn|win32|win64|vms)$/)
            {
            $errorcnt++;
            print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] values\n";
            print STDERR "              in the following field\n";
            }
-       elsif ($fields[$idx_dso_scheme] !~ /^(beos|dl|dlfcn|win32|vms|)$/)
+       elsif ($fields[$idx_dso_scheme] !~ /^(beos|dl|dlfcn|win32|win64|vms|)$/)
            {
            $errorcnt++;
            print STDERR "SANITY ERROR: '$target' has the dso_scheme [$idx_dso_scheme] field = ",$fields[$idx_dso_scheme],"\n";
-           print STDERR "              valid values are 'beos', 'dl', 'dlfcn', 'win32' and 'vms'\n";
+           print STDERR "              valid values are 'beos', 'dl', 'dlfcn', 'win32', 'win64', and 'vms'\n";
            }
        }
    print STDERR "No sanity errors detected!\n" if $errorcnt == 0;
--- ms/do_ms.bat    Mon Jan 19 14:26:32 1970
+++ ms/do_ms.bat    Mon Jan 19 14:26:32 1970
@@ -1,7 +1,9 @@

 perl util\mkfiles.pl >MINFO
 perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak
+perl util\mk1mf.pl no-asm debug VC-WIN32 >ms\ntdebug.mak
 perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak
+perl util\mk1mf.pl dll no-asm debug VC-WIN32 >ms\ntdlldebug.mak
 if x%OSVERSION% == x goto skipce
 perl util\mk1mf.pl no-asm VC-CE >ms\ce.mak
 perl util\mk1mf.pl dll no-asm VC-CE >ms\cedll.mak
--- ms/do_nasm.bat  Mon Jan 19 14:26:32 1970
+++ ms/do_nasm.bat  Mon Jan 19 14:26:32 1970
@@ -1,7 +1,9 @@

 perl util\mkfiles.pl >MINFO
 perl util\mk1mf.pl nasm VC-WIN32 >ms\nt.mak
+perl util\mk1mf.pl nasm debug VC-WIN32 >ms\ntdebug.mak
 perl util\mk1mf.pl dll nasm VC-WIN32 >ms\ntdll.mak
+perl util\mk1mf.pl dll nasm debug VC-WIN32 >ms\ntdlldebug.mak
 perl util\mk1mf.pl nasm BC-NT >ms\bcb.mak

 perl util\mkdef.pl 32 libeay > ms\libeay32.def
--- ms/do_win64a.bat    Mon Jan 19 14:26:32 1970
+++ ms/do_win64a.bat    Mon Jan 19 14:26:32 1970
@@ -13,7 +13,9 @@

 :proceed
 perl util\mk1mf.pl VC-WIN64A >ms\nt.mak
+perl util\mk1mf.pl debug VC-WIN64A >ms\ntdebug.mak
 perl util\mk1mf.pl dll VC-WIN64A >ms\ntdll.mak
+perl util\mk1mf.pl dll debug VC-WIN64A >ms\ntdlldebug.mak

-perl util\mkdef.pl 32 libeay > ms\libeay32.def
-perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
+perl util\mkdef.pl 64 libeay > ms\libeay64.def
+perl util\mkdef.pl 64 ssleay > ms\ssleay64.def
--- util/mk1mf.pl   Mon Jan 19 14:26:32 1970
+++ util/mk1mf.pl   Mon Jan 19 14:26:32 1970
@@ -178,6 +178,12 @@

 $NT=0;

+$configuniqueundefinedtag="undefined";
+$confpreprocessorundefinedcondif="#if !defined(OPENSSL_UNIQUE_CONFIG)";
+# these values are to be overridden by specific patform .pl file
+$configuniquetag=$configuniqueundefinedtag;
+$confpreprocessorcondif=$confpreprocessorundefinedcondif;
+
 push(@INC,"util/pl","pl");

 if ($platform eq "auto" || $platform eq 'copy') {
@@ -242,6 +248,7 @@
    $cflags.=' -DTERMIO';
    }

+
 $fipsdir =~ s/\//${o}/g;

 $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
@@ -444,6 +451,14 @@
        $ex_l_libs .= " \$(O_FIPSCANISTER)";
        }
    }
+   
+if ($installpdb) 
+   {
+   $extra_install .= <<"EOF";
+   \$(CP) \"\$(TMP_D)${o}*.pdb\" \"\$(INSTALLTOP)${o}lib\"
+EOF
+   }
+   

 $defs= <<"EOF";
 # N.B. You MUST use -j on FreeBSD.
@@ -607,6 +622,8 @@
    \$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
    \$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
    \$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\"
+   \$(CP) \"\$(INSTALLTOP)${o}include${o}openssl${o}opensslconf.h\" \"\$(INSTALLTOP)${o}include${o}openssl${o}opensslconf.${configuniquetag}.h\"
+   \$(CP) \"crypto${o}opensslconf.common.h\" \"\$(INSTALLTOP)${o}include${o}openssl${o}opensslconf.h\"
    \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\"
    \$(MKDIR) \"\$(OPENSSLDIR)\"
    \$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
@@ -824,6 +841,67 @@
 }
 print "###################################################################\n";
 print $rules;
+
+###    
+# Create a common multi-platform opensslconf.common.h file that will become 
+# opensslconf.h as part of the make install process.  This relies on
+# the variables $configuniquetag and $confpreprocessorcondif being configured
+# by the lower level platform pl file.
+
+unlink("crypto/opensslconf.common.bak") || die "unable to remove old crypto/opensslconf.common.bak:$!\n" if ((-e "crypto/opensslconf.common.bak") && (-e "crypto/opensslconf.common.h"));
+rename("crypto/opensslconf.common.h","crypto/opensslconf.common.bak") || die "unable to rename crypto/opensslconf.common.h\n" if -e "crypto/opensslconf.common.h";
+
+open(OUT,'>crypto/opensslconf.common.h') || die "unable to create crypto/opensslconf.common.h:$!\n";
+print OUT "/* opensslconf.h - multi-platform conf file to include specific platform conf files */\n";
+print OUT "/* WARNING: Generated automatically by mk1mf.pl as opensslconf.common.h */\n\n";
+print OUT "#undef OPENSSL_UNIQUE_CONFIG\n\n";
+
+if (-e "crypto/opensslconf.common.bak") {
+   my $sectionhdr="//-- SECTION ";
+   my $insection=0;
+   my $skipsec=0;
+   
+   open(IN,'<crypto/opensslconf.common.bak') || die "unable to read crypto/crypto/opensslconf.common.bak:$!\n";
+   while (my $line = <IN>)
+   {
+       if ($line =~ /^$sectionhdr/) {
+           $insection=1;
+           if (($line =~ /${configuniquetag}$/) || ($line =~ /${configuniqueundefinedtag}$/)) {
+               $skipsec=1;
+           }
+           else {
+               $skipsec=0;
+           }
+       }
+       
+       if ($insection && !$skipsec) {
+           print OUT $line;
+       }
+   }
+   close(IN);
+}              
+
+print OUT "//-- SECTION ${configuniquetag}\n";
+print OUT $confpreprocessorcondif."\n";
+print OUT "  #define OPENSSL_UNIQUE_CONFIG ${configuniquetag}\n";
+print OUT "  #include \"opensslconf.${configuniquetag}.h\"\n";
+print OUT "#endif\n";
+print OUT "\n";
+
+# undefined has to be last
+if ($configuniquetag ne $configuniqueundefinedtag) {
+   print OUT "//-- SECTION ${configuniqueundefinedtag}\n";
+   print OUT $confpreprocessorundefinedcondif."\n";
+   print OUT "  #define OPENSSL_UNIQUE_CONFIG ${configuniqueundefinedtag}\n";
+   print OUT "  #include \"opensslconf.${configuniqueundefinedtag}.h\"\n";
+   print OUT "#endif\n";
+   print OUT "\n";
+}
+
+close(OUT);
+
+###    
+

 ###############################################
 # strip off any trailing .[och] and append the relative directory
--- util/mkdef.pl   Mon Jan 19 14:26:32 1970
+++ util/mkdef.pl   Mon Jan 19 14:26:32 1970
@@ -71,6 +71,7 @@
 my $VMSVAX=0;
 my $VMSNonVAX=0;
 my $VMS=0;
+my $W64=0;
 my $W32=0;
 my $W16=0;
 my $NT=0;
@@ -80,7 +81,7 @@

 my @known_platforms = ( "__FreeBSD__", "PERL5", "NeXT",
            "EXPORT_VAR_AS_FUNCTION", "ZLIB", "OPENSSL_FIPS" );
-my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WINNT", "OS2" );
+my @known_ossl_platforms = ( "VMS", "WIN16", "WIN32", "WIN64", "WINNT", "OS2" );
 my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
             "CAST", "MD2", "MD4", "MD5", "SHA", "SHA0", "SHA1",
             "SHA256", "SHA512", "RIPEMD",
@@ -157,6 +158,7 @@
 foreach (@ARGV, split(/ /, $options))
    {
    $debug=1 if $_ eq "debug";
+   $W64=1 if $_ eq "64";
    $W32=1 if $_ eq "32";
    $W16=1 if $_ eq "16";
    if($_ eq "NT") {
@@ -264,7 +266,7 @@
 }

 # If no platform is given, assume WIN32
-if ($W32 + $W16 + $VMS + $OS2 == 0) {
+if ($W64 + $W32 + $W16 + $VMS + $OS2 == 0) {
    $W32 = 1;
 }

@@ -275,7 +277,7 @@

 if (!$do_ssl && !$do_crypto)
    {
-   print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | NT | OS2 ]\n";
+   print STDERR "usage: $0 ( ssl | crypto ) [ 16 | 32 | 64 | NT | OS2 ]\n";
    exit(1);
    }

@@ -1001,7 +1003,7 @@
    # Prune the returned symbols

         delete $syms{"bn_dump1"};
-   $platform{"BIO_s_log"} .= ",!WIN32,!WIN16,!macintosh";
+   $platform{"BIO_s_log"} .= ",!WIN64,!WIN32,!WIN16,!macintosh";

    $platform{"PEM_read_NS_CERT_SEQ"} = "VMS";
    $platform{"PEM_write_NS_CERT_SEQ"} = "VMS";
@@ -1153,6 +1155,7 @@
            if ($keyword eq "VMSVAX" && $VMSVAX) { return 1; }
            if ($keyword eq "VMSNonVAX" && $VMSNonVAX) { return 1; }
            if ($keyword eq "VMS" && $VMS) { return 1; }
+           if ($keyword eq "WIN64" && $W64) { return 1; }
            if ($keyword eq "WIN32" && $W32) { return 1; }
            if ($keyword eq "WIN16" && $W16) { return 1; }
            if ($keyword eq "WINNT" && $NT) { return 1; }
@@ -1161,7 +1164,7 @@
            # EXPORT_VAR_AS_FUNCTION means that global variables
            # will be represented as functions.  This currently
            # only happens on VMS-VAX.
-           if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W32 || $W16)) {
+           if ($keyword eq "EXPORT_VAR_AS_FUNCTION" && ($VMSVAX || $W64 || $W32 || $W16)) {
                return 1;
            }
            if ($keyword eq "OPENSSL_FIPS" && $fips) {
@@ -1304,7 +1307,9 @@
    my $what = "OpenSSL: implementation of Secure Socket Layer";
    my $description = "$what $version, $name - http://$http_vendor";

-   if ($W32)
+   if ($W64)
+       { $libname.="64"; }
+   elsif ($W32)
        { $libname.="32"; }
    elsif ($W16)
        { $libname.="16"; }
@@ -1372,9 +1377,9 @@
                }
                $prev = $s2;    # To warn about duplicates...
                if($v && !$OS2) {
-                   printf OUT "    %s%-39s @%-8d DATA\n",($W32)?"":"_",$s2,$n;
+                   printf OUT "    %s%-39s @%-8d DATA\n",($W32||$W64)?"":"_",$s2,$n;
                } else {
-                   printf OUT "    %s%-39s @%d\n",($W32||$OS2)?"":"_",$s2,$n;
+                   printf OUT "    %s%-39s @%d\n",($W32||$W64||$OS2)?"":"_",$s2,$n;
                }
            }
        }
--- util/pl/linux.pl    Mon Jan 19 14:26:32 1970
+++ util/pl/linux.pl    Mon Jan 19 14:26:32 1970
@@ -7,6 +7,9 @@
 $cp='/bin/cp';
 $rm='/bin/rm -f';

+$configuniquetag="linux";
+$confpreprocessorcondif="#if defined(__linux__) || defined(linux)";
+
 # C compiler stuff

 $cc='gcc';
--- util/pl/VC-32.pl    Mon Jan 19 14:26:32 1970
+++ util/pl/VC-32.pl    Mon Jan 19 14:26:32 1970
@@ -3,19 +3,6 @@
 # Win64 and WinCE [follow $FLAVOR variable to trace the differences].
 #

-$ssl=  "ssleay32";
-$crypto="libeay32";
-
-if ($fips && !$shlib)
-   {
-   $crypto="libeayfips32";
-   $crypto_compat = "libeaycompat32.lib";
-   }
-else
-   {
-   $crypto="libeay32";
-   }
-
 $o='\\';
 $cp='$(PERL) util/copy.pl';
 $mkdir='$(PERL) util/mkdir-p.pl';
@@ -44,6 +31,11 @@
     # per 0.9.8 release remaining warnings were explicitly examined and
     # considered safe to ignore.
     # 
+   
+   $suffix="64";
+   $configuniquetag="win64";
+   $confpreprocessorcondif="#if defined(_WIN64)";
+   
     $base_cflags= " $mf_cflag";
     my $f = $shlib || $fips ?' /MD':' /MT';
     $opt_cflags=$f.' /Ox';
@@ -68,6 +60,11 @@
     }
 elsif ($FLAVOR =~ /CE/)
     {
+   
+   $suffix="ce32";
+   $configuniquetag="ce32";
+   $confpreprocessorcondif="#if defined(_WIN32_WCE)"; 
+   
     # sanity check
     die '%OSVERSION% is not defined'   if (!defined($ENV{'OSVERSION'}));
     die '%PLATFORM% is not defined'    if (!defined($ENV{'PLATFORM'}));
@@ -129,6 +126,10 @@
     }
 else   # Win32
     {
+   $suffix="32";
+   $configuniquetag="win32";
+   $confpreprocessorcondif="#if defined(_WIN32) && !defined(_WIN64)";
+   
     $base_cflags= " $mf_cflag";
     my $f = $shlib || $fips ?' /MD':' /MT';
     $ff = "/fixed";
@@ -136,27 +137,49 @@
     $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
     $lflags="/nologo /subsystem:console /opt:ref";
     }
+   
+$ssl=  "ssleay".$suffix;   $ssl.="dll" if ($shlib);    $ssl.="dbg" if ($debug);
+$crypto="libeay".$suffix;  $crypto.="dll"  if ($shlib);    $crypto.="dbg"  if ($debug);
+
+if ($fips && !$shlib)
+   {
+   $crypto="libeayfips".$suffix;   $crypto.="dbg"  if ($debug);
+   $crypto_compat = "libeaycompat".$suffix; $crypto_compat.="dbg"  if ($debug);  $crypto_compat.=".lib";
+   }
+   
+   
 $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
 $mlflags='';

-$out_def ="out32"; $out_def.="dll"         if ($shlib);
+$out_def ="out".$suffix;   $out_def.="dll"         if ($shlib);    $out_def.="dbg" if ($debug);
            $out_def.='_$(TARGETCPU)'   if ($FLAVOR =~ /CE/);
-$tmp_def ="tmp32"; $tmp_def.="dll"         if ($shlib);
+$tmp_def ="tmp".$suffix;   $tmp_def.="dll"         if ($shlib);    $tmp_def.="dbg" if ($debug);
            $tmp_def.='_$(TARGETCPU)'   if ($FLAVOR =~ /CE/);
-$inc_def="inc32";
+$inc_def="inc".$suffix;
+
+# generate .pdb 
+$installpdb=1;
+$app_cflag.=" /Zi";
+$lib_cflag.=" /Zi"; 

 if ($debug)
    {
    $cflags=$dbg_cflags.$base_cflags;
+   
+   if ($FLAVOR !~ /WIN64/) 
+       {
+       $app_cflag.=" /ZI";
+       $lib_cflag.=" /ZI"; 
+       }
+   
    }
 else
    {
    $cflags=$opt_cflags.$base_cflags;
    }

-# generate symbols.pdb unconditionally
-$app_cflag.=" /Zi /Fd\$(TMP_D)/app";
-$lib_cflag.=" /Zi /Fd\$(TMP_D)/lib";
+$lib_cflag.= " /Fd\$(TMP_D)/lib".$suffix;  $lib_cflag.="dll"   if ($shlib);    $lib_cflag.="dbg"   if ($debug);
+$app_cflag.= " /Fd\$(TMP_D)/app".$suffix;  $app_cflag.="dll"   if ($shlib);    $app_cflag.="dbg"   if ($debug);
 $lflags.=" /debug";

 $obj='.obj';

另外,对于我自己,我为配置设置了几个批处理文件,因此我不会忘记前缀。

perl Configure VC-WIN32 --prefix=d:\lib\openssl

perl Configure VC-WIN64A --prefix=d:\lib\openssl

另外,对于调试版本,而不是使用debug-xxx配置,你只需使用上面的两个配置,修补的do_win64a.bat和do_ms.bat / do_nasm.bat也将创建一个ntdebug.mak和ntddldebug.mak,所以你可以运行nmake -f ms\ntdebug.mak。在x64上没有使用/ ZI进行了最后一分钟的更改以摆脱警告(希望我没有破坏某些东西)。