d1dcadd94e6d3419efa26b341007a23894aef7b3
[openssl.git] / util / pl / BC-32.pl
1 #!/usr/local/bin/perl
2 # VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries
3 #
4
5 $o='\\';
6 $cp='copy';
7 $rm='del';
8
9 # C compiler stuff
10 $cc='bcc32';
11
12 if ($debug)
13         { $op="-v "; }
14 else    { $op="-O "; }
15
16 $cflags="-d $op -DL_ENDIAN ";
17 # I add the stack opt
18 $base_lflags="-c";
19 $lflags="$base_lflags";
20
21 $cflags.=" -DWINDOWS -DWIN32";
22 $app_cflag="-WC";
23 $lib_cflag="-WC";
24 $lflags.=" -Tpe";
25
26 if ($shlib)
27         {
28         $mlflags="$base_lflags -Tpe"; # stack if defined in .def file
29         $libs="libw ldllcew";
30         }
31 else
32         { $mlflags=''; }
33
34 $obj='.obj';
35 $ofile="-o";
36
37 # EXE linking stuff
38 $link="tlink32";
39 $efile="";
40 $exep='.exe';
41 $ex_libs="CW32.LIB IMPORT32.LIB";
42 $ex_libs.=$no_sock?"":" wsock32.lib";
43 $shlib_ex_obj="" if $shlib;
44 $app_ex_obj="C0X32.OBJ";
45
46 # static library stuff
47 $mklib='tlib';
48 $ranlib='';
49 $plib="";
50 $libp=".lib";
51 $shlibp=($shlib)?".dll":".lib";
52 $lfile='';
53
54 $asm='ml /Cp /c /Cx';
55 $afile='/Fo';
56 if ($noasm)
57         {
58         $bn_asm_obj='';
59         $bn_asm_src='';
60         }
61 else
62         {
63         $bn_asm_obj='crypto\bn\asm\x86b32.obj';
64         $bn_asm_src='crypto\bn\asm\x86m32.asm';
65         }
66
67 sub do_lib_rule
68         {
69         local($target,$name,$shlib)=@_;
70         local($ret,$Name);
71
72         $taget =~ s/\//$o/g if $o ne '/';
73         ($Name=$name) =~ tr/a-z/A-Z/;
74
75         $ret.="$target: \$(${Name}OBJ)\n";
76         $ret.="\t\$(RM) \$(O_$Name)\n";
77
78         # Due to a pathetic line length limit, I unwrap the args.
79         local($lib_names)="";
80         local($dll_names)="";
81         foreach $_ (sort split(/\s+/,$Vars{"${Name}OBJ"}))
82                 {
83                 $lib_names.="  +$_ &\n";
84                 $dll_names.="  $_\n";
85                 }
86
87         if (!$shlib)
88                 {
89                 $ret.="\t\$(MKLIB) $target & <<|\n$lib_names\n,\n|\n";
90                 }
91         else
92                 {
93                 # $(SHLIB_EX_OBJ)
94                 local($ex)=($Name eq "SSL")?' $(L_CRYPTO) winsock':"";
95                 $ret.="\t\$(LINK) \$(MLFLAGS) @&&|\n";
96                 $ret.=$dll_names;
97                 $ret.="\n  $target\n\n  $ex $libs\nms$o${name}16.def;\n|\n";
98                 ($out_lib=$target) =~ s/O_/L_/;
99                 $ret.="\timplib /nowep $out_lib $target\n\n";
100                 }
101         $ret.="\n";
102         return($ret);
103         }
104
105 sub do_link_rule
106         {
107         local($target,$files,$dep_libs,$libs)=@_;
108         local($ret,$f,$_,@f);
109         
110         $file =~ s/\//$o/g if $o ne '/';
111         $n=&bname($targer);
112         $ret.="$target: $files $dep_libs\n";
113         $ret.="  \$(LINK) @&&|";
114         
115         # Due to a pathetic line length limit, I have to unwrap the args.
116         $r="  \$(LFLAGS) ";
117         if ($files =~ /\(([^)]*)\)$/)
118                 {
119                 @a=('$(APP_EX_OBJ)');
120                 push(@a,sort split(/\s+/,$Vars{$1}));
121                 foreach $_ (@a)
122                         {
123                         $ret.="\n  $r $_ +";
124                         $r="";
125                         }
126                 chop($ret);
127                 $ret.="\n";
128                 }
129         else
130                 { $ret.="\n $r \$(APP_EX_OBJ) $files\n"; }
131         $ret.="  $target\n\n  $libs\n\n|\n\n";
132         return($ret);
133         }
134
135 1;