50bfb3438549688934bd82fdbbb5327db849d721
[openssl.git] / util / pl / VC-32.pl
1 #!/usr/local/bin/perl
2 # VCw32lib.pl - the file for Visual C++ 4.[01] for windows NT, static libraries
3 #
4
5 $ssl=   "ssleay32";
6 $crypto="libeay32";
7
8 $o='\\';
9 $cp='copy nul+';        # Timestamps get stuffed otherwise
10 $rm='del';
11
12 # C compiler stuff
13 $cc='cl';
14 $cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
15 $lflags="/nologo /subsystem:console /machine:I386 /opt:ref";
16 $mlflags='';
17
18 $out_def="out32";
19 $tmp_def="tmp32";
20 $inc_def="inc32";
21
22 if ($debug)
23         {
24         $cflags=" /MDd /W3 /WX /Zi /Yd /Od /nologo -DOPENSSL_SYSNAME_WIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32";
25         $lflags.=" /debug";
26         $mlflags.=' /debug';
27         }
28 $cflags .= " -DOPENSSL_SYSNAME_WINNT" if $NT == 1;
29
30 $obj='.obj';
31 $ofile="/Fo";
32
33 # EXE linking stuff
34 $link="link";
35 $efile="/out:";
36 $exep='.exe';
37 if ($no_sock)
38         { $ex_libs=""; }
39 else    { $ex_libs="wsock32.lib user32.lib gdi32.lib"; }
40
41 # static library stuff
42 $mklib='lib';
43 $ranlib='';
44 $plib="";
45 $libp=".lib";
46 $shlibp=($shlib)?".dll":".lib";
47 $lfile='/out:';
48
49 $shlib_ex_obj="";
50 $app_ex_obj="setargv.obj";
51 if ($nasm) {
52         $asm='nasmw -f win32';
53         $afile='-o ';
54 } else {
55         $asm='ml /Cp /coff /c /Cx';
56         $asm.=" /Zi" if $debug;
57         $afile='/Fo';
58 }
59
60 $bn_asm_obj='';
61 $bn_asm_src='';
62 $des_enc_obj='';
63 $des_enc_src='';
64 $bf_enc_obj='';
65 $bf_enc_src='';
66
67 if (!$no_asm)
68         {
69         $bn_asm_obj='crypto\bn\asm\bn-win32.obj';
70         $bn_asm_src='crypto\bn\asm\bn-win32.asm';
71         $des_enc_obj='crypto\des\asm\d-win32.obj crypto\des\asm\y-win32.obj';
72         $des_enc_src='crypto\des\asm\d-win32.asm crypto\des\asm\y-win32.asm';
73         $bf_enc_obj='crypto\bf\asm\b-win32.obj';
74         $bf_enc_src='crypto\bf\asm\b-win32.asm';
75         $cast_enc_obj='crypto\cast\asm\c-win32.obj';
76         $cast_enc_src='crypto\cast\asm\c-win32.asm';
77         $rc4_enc_obj='crypto\rc4\asm\r4-win32.obj';
78         $rc4_enc_src='crypto\rc4\asm\r4-win32.asm';
79         $rc5_enc_obj='crypto\rc5\asm\r5-win32.obj';
80         $rc5_enc_src='crypto\rc5\asm\r5-win32.asm';
81         $md5_asm_obj='crypto\md5\asm\m5-win32.obj';
82         $md5_asm_src='crypto\md5\asm\m5-win32.asm';
83         $sha1_asm_obj='crypto\sha\asm\s1-win32.obj';
84         $sha1_asm_src='crypto\sha\asm\s1-win32.asm';
85         $rmd160_asm_obj='crypto\ripemd\asm\rm-win32.obj';
86         $rmd160_asm_src='crypto\ripemd\asm\rm-win32.asm';
87         $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
88         }
89
90 if ($shlib)
91         {
92         $mlflags.=" $lflags /dll";
93 #       $cflags =~ s| /MD| /MT|;
94         $lib_cflag=" -D_WINDLL -D_DLL";
95         $out_def="out32dll";
96         $tmp_def="tmp32dll";
97         }
98
99 $cflags.=" /Fd$out_def";
100
101 sub do_lib_rule
102         {
103         local($objs,$target,$name,$shlib)=@_;
104         local($ret,$Name);
105
106         $taget =~ s/\//$o/g if $o ne '/';
107         ($Name=$name) =~ tr/a-z/A-Z/;
108
109 #       $target="\$(LIB_D)$o$target";
110         $ret.="$target: $objs\n";
111         if (!$shlib)
112                 {
113 #               $ret.="\t\$(RM) \$(O_$Name)\n";
114                 $ex =' advapi32.lib';
115                 $ret.="\t\$(MKLIB) $lfile$target @<<\n  $objs $ex\n<<\n";
116                 }
117         else
118                 {
119                 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
120                 $ex.=' wsock32.lib gdi32.lib advapi32.lib';
121                 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
122                 }
123         $ret.="\n";
124         return($ret);
125         }
126
127 sub do_link_rule
128         {
129         local($target,$files,$dep_libs,$libs)=@_;
130         local($ret,$_);
131         
132         $file =~ s/\//$o/g if $o ne '/';
133         $n=&bname($targer);
134         $ret.="$target: $files $dep_libs\n";
135         $ret.="  \$(LINK) \$(LFLAGS) $efile$target @<<\n";
136         $ret.="  \$(APP_EX_OBJ) $files $libs\n<<\n\n";
137         return($ret);
138         }
139
140 1;