7305c9566641c466b60431299d345128a0c95d11
[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 errors, and be quiet
22 $cflags="-j255 -w-aus -w-par -w-inl  -c -tWC -tWM -DWINDOWS -DWIN32 -DL_ENDIAN ";
23 $dcflags='n'
24 if ($debug)
25 {
26     $cflags.="-Od -y -v -vi- -D_DEBUG";
27     $mlflags.=' ';
28 }
29 else
30 {
31     $cflags.="-O2 -ff -fp";
32 }
33
34 $obj='.obj';
35 $ofile="-o";
36
37 # EXE linking stuff
38 $link="ilink32";
39 $efile="";
40 $exep='.exe';
41 if ($no_sock)
42         { $ex_libs=""; }
43 else    { $ex_libs="cw32mt.lib import32.lib"; }
44
45 # static library stuff
46 $mklib='tlib /P64';
47 $ranlib='';
48 $plib="";
49 $libp=".lib";
50 $shlibp=($shlib)?".dll":".lib";
51 $lfile='';
52
53 $shlib_ex_obj="";
54 $app_ex_obj="c0x32.obj"; 
55
56 $asm='n_o_T_a_s_m';
57 $asm.=" /Zi" if $debug;
58 $afile='/Fo';
59
60 $bn_mulw_obj='';
61 $bn_mulw_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_mulw_obj='crypto\bn\asm\bn-win32.obj';
70         $bn_mulw_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=" /GD -D_WINDLL -D_DLL";
95         $out_def="out32dll";
96         $tmp_def="tmp32dll";
97         }
98
99 sub do_lib_rule
100         {
101         local($objs,$target,$name,$shlib)=@_;
102         local($ret,$Name);
103
104         $taget =~ s/\//$o/g if $o ne '/';
105         ($Name=$name) =~ tr/a-z/A-Z/;
106
107 #       $target="\$(LIB_D)$o$target";
108         $ret.="$target: $objs\n";
109         if (!$shlib)
110                 {
111                 #               $ret.="\t\$(RM) \$(O_$Name)\n";
112                 $ret.="\techo LIB $<\n";    
113                 $ret.="\t\$(MKLIB) $lfile$target  \$(addprefix +, $objs)\n";
114                 }
115         else
116                 {
117                 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
118                 $ex.=' wsock32.lib gdi32.lib';
119                 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
120                 }
121         $ret.="\n";
122         return($ret);
123         }
124
125 sub do_link_rule
126         {
127         local($target,$files,$dep_libs,$libs)=@_;
128         local($ret,$_);
129         
130         $file =~ s/\//$o/g if $o ne '/';
131         $n=&bname($targer);
132         $ret.="$target: $files $dep_libs\n";
133         $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n";
134         return($ret);
135         }
136
137 1;