046f0e253c3971a373fda65357a74cd7c4e3388a
[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 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 -DWIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG";
26         $lflags.=" /debug";
27         $mlflags.=' /debug';
28         }
29 $cflags .= " -DWINNT" if $NT == 1;
30
31 $obj='.obj';
32 $ofile="/Fo";
33
34 # EXE linking stuff
35 $link="link";
36 $efile="/out:";
37 $exep='.exe';
38 if ($no_sock)
39         { $ex_libs=""; }
40 else    { $ex_libs="wsock32.lib user32.lib gdi32.lib"; }
41
42 # static library stuff
43 $mklib='lib';
44 $ranlib='';
45 $plib="";
46 $libp=".lib";
47 $shlibp=($shlib)?".dll":".lib";
48 $lfile='/out:';
49
50 $shlib_ex_obj="";
51 $app_ex_obj="setargv.obj";
52 if ($nasm) {
53         $asm='nasmw -f win32';
54         $afile='-o ';
55 } else {
56         $asm='ml /Cp /coff /c /Cx';
57         $asm.=" /Zi" if $debug;
58         $afile='/Fo';
59 }
60
61 $bn_asm_obj='';
62 $bn_asm_src='';
63 $des_enc_obj='';
64 $des_enc_src='';
65 $bf_enc_obj='';
66 $bf_enc_src='';
67
68 if (!$no_asm)
69         {
70         $bn_asm_obj='crypto\bn\asm\bn-win32.obj';
71         $bn_asm_src='crypto\bn\asm\bn-win32.asm';
72         $des_enc_obj='crypto\des\asm\d-win32.obj crypto\des\asm\y-win32.obj';
73         $des_enc_src='crypto\des\asm\d-win32.asm crypto\des\asm\y-win32.asm';
74         $bf_enc_obj='crypto\bf\asm\b-win32.obj';
75         $bf_enc_src='crypto\bf\asm\b-win32.asm';
76         $cast_enc_obj='crypto\cast\asm\c-win32.obj';
77         $cast_enc_src='crypto\cast\asm\c-win32.asm';
78         $rc4_enc_obj='crypto\rc4\asm\r4-win32.obj';
79         $rc4_enc_src='crypto\rc4\asm\r4-win32.asm';
80         $rc5_enc_obj='crypto\rc5\asm\r5-win32.obj';
81         $rc5_enc_src='crypto\rc5\asm\r5-win32.asm';
82         $md5_asm_obj='crypto\md5\asm\m5-win32.obj';
83         $md5_asm_src='crypto\md5\asm\m5-win32.asm';
84         $sha1_asm_obj='crypto\sha\asm\s1-win32.obj';
85         $sha1_asm_src='crypto\sha\asm\s1-win32.asm';
86         $rmd160_asm_obj='crypto\ripemd\asm\rm-win32.obj';
87         $rmd160_asm_src='crypto\ripemd\asm\rm-win32.asm';
88         $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
89         }
90
91 if ($shlib)
92         {
93         $mlflags.=" $lflags /dll";
94 #       $cflags =~ s| /MD| /MT|;
95         $lib_cflag=" /GD -D_WINDLL -D_DLL";
96         $out_def="out32dll";
97         $tmp_def="tmp32dll";
98         }
99
100 $cflags.=" /Fd$out_def";
101
102 sub do_lib_rule
103         {
104         local($objs,$target,$name,$shlib)=@_;
105         local($ret,$Name);
106
107         $taget =~ s/\//$o/g if $o ne '/';
108         ($Name=$name) =~ tr/a-z/A-Z/;
109
110 #       $target="\$(LIB_D)$o$target";
111         $ret.="$target: $objs\n";
112         if (!$shlib)
113                 {
114 #               $ret.="\t\$(RM) \$(O_$Name)\n";
115                 $ret.="\t\$(MKLIB) $lfile$target @<<\n  $objs\n<<\n";
116                 }
117         else
118                 {
119                 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
120                 $ex.=' wsock32.lib gdi32.lib advapi32.lib';
121                 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n  \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
122                 }
123         $ret.="\n";
124         return($ret);
125         }
126
127 sub do_link_rule
128         {
129         local($target,$files,$dep_libs,$libs)=@_;
130         local($ret,$_);
131         
132         $file =~ s/\//$o/g if $o ne '/';
133         $n=&bname($targer);
134         $ret.="$target: $files $dep_libs\n";
135         $ret.="  \$(LINK) \$(LFLAGS) $efile$target @<<\n";
136         $ret.="  \$(APP_EX_OBJ) $files $libs\n<<\n\n";
137         return($ret);
138         }
139
140 1;