7f57809a165fa6a394a5a44de9a200371fb15785
[openssl.git] / util / pl / BC-32.pl
1 #!/usr/local/bin/perl
2 # Borland C++ builder 3 and 4 -- Janez Jere <jj@void.si>
3 #
4
5 $ssl=   "ssleay32";
6 $crypto="libeay32";
7 $RSAref="RSAref32";
8
9 $o='\\';
10 $cp='copy';
11 $rm='del';
12
13 # C compiler stuff
14 $cc='bcc32';
15 $lflags="-ap -Tpe -x -Gn ";
16 $mlflags='';
17
18 $out_def="out32";
19 $tmp_def="tmp32";
20 $inc_def="inc32";
21 #enable max error messages, disable most common warnings
22 $cflags="-DWIN32_LEAN_AND_MEAN -q -w-aus -w-par -w-inl  -c -tWC -tWM -DWINDOWS -DWIN32 -DL_ENDIAN ";
23 if ($debug)
24 {
25     $cflags.="-Od -y -v -vi- -D_DEBUG";
26     $mlflags.=' ';
27 }
28 else
29 {
30     $cflags.="-O2 -ff -fp";
31 }
32
33 $obj='.obj';
34 $ofile="-o";
35
36 # EXE linking stuff
37 $link="ilink32";
38 $efile="";
39 $exep='.exe';
40 if ($no_sock)
41         { $ex_libs=""; }
42 else    { $ex_libs="cw32mt.lib import32.lib"; }
43
44 # static library stuff
45 $mklib='tlib /P64';
46 $ranlib='';
47 $plib="";
48 $libp=".lib";
49 $shlibp=($shlib)?".dll":".lib";
50 $lfile='';
51
52 $shlib_ex_obj="";
53 $app_ex_obj="c0x32.obj"; 
54
55 $asm='n_o_T_a_s_m';
56 $asm.=" /Zi" if $debug;
57 $afile='/Fo';
58
59 $bn_mulw_obj='';
60 $bn_mulw_src='';
61 $des_enc_obj='';
62 $des_enc_src='';
63 $bf_enc_obj='';
64 $bf_enc_src='';
65
66 if (!$no_asm)
67         {
68         $bn_mulw_obj='crypto\bn\asm\bn-win32.obj';
69         $bn_mulw_src='crypto\bn\asm\bn-win32.asm';
70         $des_enc_obj='crypto\des\asm\d-win32.obj crypto\des\asm\y-win32.obj';
71         $des_enc_src='crypto\des\asm\d-win32.asm crypto\des\asm\y-win32.asm';
72         $bf_enc_obj='crypto\bf\asm\b-win32.obj';
73         $bf_enc_src='crypto\bf\asm\b-win32.asm';
74         $cast_enc_obj='crypto\cast\asm\c-win32.obj';
75         $cast_enc_src='crypto\cast\asm\c-win32.asm';
76         $rc4_enc_obj='crypto\rc4\asm\r4-win32.obj';
77         $rc4_enc_src='crypto\rc4\asm\r4-win32.asm';
78         $rc5_enc_obj='crypto\rc5\asm\r5-win32.obj';
79         $rc5_enc_src='crypto\rc5\asm\r5-win32.asm';
80         $md5_asm_obj='crypto\md5\asm\m5-win32.obj';
81         $md5_asm_src='crypto\md5\asm\m5-win32.asm';
82         $sha1_asm_obj='crypto\sha\asm\s1-win32.obj';
83         $sha1_asm_src='crypto\sha\asm\s1-win32.asm';
84         $rmd160_asm_obj='crypto\ripemd\asm\rm-win32.obj';
85         $rmd160_asm_src='crypto\ripemd\asm\rm-win32.asm';
86         $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
87         }
88
89 if ($shlib)
90         {
91         $mlflags.=" $lflags /dll";
92 #       $cflags =~ s| /MD| /MT|;
93         $lib_cflag=" /GD -D_WINDLL -D_DLL";
94         $out_def="out32dll";
95         $tmp_def="tmp32dll";
96         }
97
98 sub do_lib_rule
99         {
100         local($objs,$target,$name,$shlib)=@_;
101         local($ret,$Name);
102
103         $taget =~ s/\//$o/g if $o ne '/';
104         ($Name=$name) =~ tr/a-z/A-Z/;
105
106 #       $target="\$(LIB_D)$o$target";
107         $ret.="$target: $objs\n";
108         if (!$shlib)
109                 {
110                 #               $ret.="\t\$(RM) \$(O_$Name)\n";
111                 $ret.="\techo LIB $<\n";    
112                 $ret.="\t&\$(MKLIB) $lfile$target -+\$**\n";
113                 }
114         else
115                 {
116                 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
117                 $ex.=' wsock32.lib gdi32.lib';
118                 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
119                 }
120         $ret.="\n";
121         return($ret);
122         }
123
124 sub do_link_rule
125         {
126         local($target,$files,$dep_libs,$libs)=@_;
127         local($ret,$_);
128         
129         $file =~ s/\//$o/g if $o ne '/';
130         $n=&bname($targer);
131         $ret.="$target: $files $dep_libs\n";
132         $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n";
133         return($ret);
134         }
135
136 1;