This commit was generated by cvs2svn to track changes on a CVS vendor
[openssl.git] / util / pl / VC-16.pl
1 #!/usr/local/bin/perl
2 # VCw16lib.pl - the file for Visual C++ 1.52b for windows, static libraries
3 #
4
5 $ssl=   "ssleay16";
6 $crypto="libeay16";
7 $RSAref="RSAref16";
8
9 $o='\\';
10 $cp='copy';
11 $rm='del';
12
13 # C compiler stuff
14 $cc='cl';
15
16 if ($debug)
17         {
18         $op="/Od /Zi /Zd";
19         $base_lflags="/CO";
20         }
21 else    {
22         $op="/G2 /f- /Ocgnotb2";
23         }
24 $base_lflags.=" /FARCALL /NOLOGO /NOD /SEG:1024 /ONERROR:NOEXE /NOE /PACKC:60000";
25 if ($win16) { $base_lflags.=" /PACKD:60000"; }
26
27 $cflags="/ALw /Gx- /Gt256 /Gf $op /W3 /WX -DL_ENDIAN /nologo";
28 # I add the stack opt
29 $lflags="$base_lflags /STACK:20000";
30
31 if ($win16)
32         {
33         $cflags.=" -DWIN16";
34         $app_cflag="/Gw /FPi87";
35         $lib_cflag="/Gw";
36         $lib_cflag.=" -DWIN16TTY" if !$shlib;
37         $lflags.=" /ALIGN:16";
38         $ex_libs.="oldnames llibcewq libw";
39         }
40 else
41         {
42         $no_sock=1;
43         $cflags.=" -DMSDOS";
44         $lflags.=" /EXEPACK";
45         $ex_libs.="oldnames.lib llibce.lib";
46         }
47
48 if ($shlib)
49         {
50         $mlflags="$base_lflags";
51         $libs="oldnames ldllcew libw";
52         $shlib_ex_obj="";
53 #       $no_asm=1;
54         }
55 else
56         { $mlflags=''; }
57
58 $app_ex_obj="setargv.obj";
59
60 $obj='.obj';
61 $ofile="/Fo";
62
63 # EXE linking stuff
64 $link="link";
65 $efile="";
66 $exep='.exe';
67 $ex_libs.=$no_sock?"":" winsock";
68
69 # static library stuff
70 $mklib='lib /PAGESIZE:1024';
71 $ranlib='';
72 $plib="";
73 $libp=".lib";
74 $shlibp=($shlib)?".dll":".lib";
75 $lfile='';
76
77 $asm='ml /Cp /c /Cx';
78 $afile='/Fo';
79
80 $bn_mulw_obj='';
81 $bn_mulw_src='';
82 $des_enc_obj='';
83 $des_enc_src='';
84 $bf_enc_obj='';
85 $bf_enc_src='';
86
87 if (!$no_asm)
88         {
89         if ($asmbits == 32)
90                 {
91                 $bn_mulw_obj='crypto\bn\asm\x86w32.obj';
92                 $bn_mulw_src='crypto\bn\asm\x86w32.asm';
93                 }
94         else
95                 {
96                 $bn_mulw_obj='crypto\bn\asm\x86w16.obj';
97                 $bn_mulw_src='crypto\bn\asm\x86w16.asm';
98                 }
99         }
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         $ret.="$target: $objs\n";
110 #       $ret.="\t\$(RM) \$(O_$Name)\n";
111
112         # Due to a pathetic line length limit, I unwrap the args.
113         local($lib_names)="";
114         local($dll_names)="  \$(SHLIB_EX_OBJ) +\n";
115         ($obj)= ($objs =~ /\((.*)\)/);
116         foreach $_ (sort split(/\s+/,$Vars{$obj}))
117                 {
118                 $lib_names.="+$_ &\n";
119                 $dll_names.="  $_ +\n";
120                 }
121
122         if (!$shlib)
123                 {
124                 $ret.="\tdel $target\n";
125                 $ret.="\t\$(MKLIB) @<<\n$target\ny\n$lib_names\n\n<<\n";
126                 }
127         else
128                 {
129                 local($ex)=($target eq '$(O_SSL)')?'$(L_CRYPTO)':"";
130                 $ex.=' winsock';
131                 $ret.="\t\$(LINK) \$(MLFLAGS) @<<\n";
132                 $ret.=$dll_names;
133                 $ret.="\n  $target\n\n  $ex $libs\nms$o${name}.def;\n<<\n";
134                 ($out_lib=$target) =~ s/O_/L_/;
135                 $ret.="\timplib /noignorecase /nowep $out_lib $target\n";
136                 }
137         $ret.="\n";
138         return($ret);
139         }
140
141 sub do_link_rule
142         {
143         local($target,$files,$dep_libs,$libs)=@_;
144         local($ret,$f,$_,@f);
145         
146         $file =~ s/\//$o/g if $o ne '/';
147         $n=&bname($targer);
148         $ret.="$target: $files $dep_libs\n";
149         $ret.="  \$(LINK) \$(LFLAGS) @<<\n";
150         
151         # Due to a pathetic line length limit, I have to unwrap the args.
152         if ($files =~ /\(([^)]*)\)$/)
153                 {
154                 @a=('$(APP_EX_OBJ)');
155                 push(@a,sort split(/\s+/,$Vars{$1}));
156                 for $_ (@a)
157                         { $ret.="  $_ +\n"; }
158                 }
159         else
160                 { $ret.="  \$(APP_EX_OBJ) $files"; }
161         $ret.="\n  $target\n\n  $libs\n\n<<\n\n";
162         return($ret);
163         }
164
165 1;