Switch to OpenSSL name
[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 $RSAref="RSAref32";
8
9 $o='\\';
10 $cp='"copy /b nul+ "';  # Timestamps get stuffed otherwise
11 $rm='del';
12
13 # C compiler stuff
14 $cc='cl';
15 $cflags=' /MD /W3 /WX /G5 /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo -DWIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN';
16 $lflags="/nologo /subsystem:console /machine:I386 /opt:ref";
17 $mlflags='';
18
19 $out_def="out32";
20 $tmp_def="tmp32";
21 $inc_def="inc32";
22
23 if ($debug)
24         {
25         $cflags=" /MDd /W3 /WX /Zi /Yd /Od /nologo -DWINDOWS -DWIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG";
26         $lflags.=" /debug";
27         $mlflags.=' /debug';
28         }
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
52 $asm='ml /Cp /coff /c /Cx';
53 $asm.=" /Zi" if $debug;
54 $afile='/Fo';
55
56 $bn_asm_obj='';
57 $bn_asm_src='';
58 $des_enc_obj='';
59 $des_enc_src='';
60 $bf_enc_obj='';
61 $bf_enc_src='';
62
63 if (!$no_asm)
64         {
65         $bn_asm_obj='crypto\bn\asm\bn-win32.obj';
66         $bn_asm_src='crypto\bn\asm\bn-win32.asm';
67         $des_enc_obj='crypto\des\asm\d-win32.obj crypto\des\asm\y-win32.obj';
68         $des_enc_src='crypto\des\asm\d-win32.asm crypto\des\asm\y-win32.asm';
69         $bf_enc_obj='crypto\bf\asm\b-win32.obj';
70         $bf_enc_src='crypto\bf\asm\b-win32.asm';
71         $cast_enc_obj='crypto\cast\asm\c-win32.obj';
72         $cast_enc_src='crypto\cast\asm\c-win32.asm';
73         $rc4_enc_obj='crypto\rc4\asm\r4-win32.obj';
74         $rc4_enc_src='crypto\rc4\asm\r4-win32.asm';
75         $rc5_enc_obj='crypto\rc5\asm\r5-win32.obj';
76         $rc5_enc_src='crypto\rc5\asm\r5-win32.asm';
77         $md5_asm_obj='crypto\md5\asm\m5-win32.obj';
78         $md5_asm_src='crypto\md5\asm\m5-win32.asm';
79         $sha1_asm_obj='crypto\sha\asm\s1-win32.obj';
80         $sha1_asm_src='crypto\sha\asm\s1-win32.asm';
81         $rmd160_asm_obj='crypto\ripemd\asm\rm-win32.obj';
82         $rmd160_asm_src='crypto\ripemd\asm\rm-win32.asm';
83         $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
84         }
85
86 if ($shlib)
87         {
88         $mlflags.=" $lflags /dll";
89 #       $cflags =~ s| /MD| /MT|;
90         $lib_cflag=" /GD -D_WINDLL -D_DLL";
91         $out_def="out32dll";
92         $tmp_def="tmp32dll";
93         }
94
95 $cflags.=" /Fd$out_def";
96
97 sub do_lib_rule
98         {
99         local($objs,$target,$name,$shlib)=@_;
100         local($ret,$Name);
101
102         $taget =~ s/\//$o/g if $o ne '/';
103         ($Name=$name) =~ tr/a-z/A-Z/;
104
105 #       $target="\$(LIB_D)$o$target";
106         $ret.="$target: $objs\n";
107         if (!$shlib)
108                 {
109 #               $ret.="\t\$(RM) \$(O_$Name)\n";
110                 $ret.="\t\$(MKLIB) $lfile$target @<<\n  $objs\n<<\n";
111                 }
112         else
113                 {
114                 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
115                 $ex.=' wsock32.lib gdi32.lib';
116                 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
117                 }
118         $ret.="\n";
119         return($ret);
120         }
121
122 sub do_link_rule
123         {
124         local($target,$files,$dep_libs,$libs)=@_;
125         local($ret,$_);
126         
127         $file =~ s/\//$o/g if $o ne '/';
128         $n=&bname($targer);
129         $ret.="$target: $files $dep_libs\n";
130         $ret.="  \$(LINK) \$(LFLAGS) $efile$target @<<\n";
131         $ret.="  \$(APP_EX_OBJ) $files $libs\n<<\n\n";
132         return($ret);
133         }
134
135 1;