d695dda623dcc2c61c3e9389fe70745ab1e77e5d
[openssl.git] / util / pl / OS2-EMX.pl
1 #!/usr/local/bin/perl
2 #
3 # OS2-EMX.pl - for EMX GCC on OS/2
4 #
5
6 $o='\\';
7 $cp='copy';
8 $rm='rm -f';
9
10 # C compiler stuff
11
12 $cc='gcc';
13 $cflags="-DL_ENDIAN -O3 -fomit-frame-pointer -m486 -Zmtd -Wall ";
14 $cflags.="-Zomf " if $shlib;
15 $shl_cflag="-Zdll";
16
17 if ($debug) { 
18         $cflags.="-g "; 
19 }
20
21 $obj=$shlib ? '.obj' : '.o';
22 $ofile='-o ';
23
24 # EXE linking stuff
25 $link='${CC}';
26 $lflags='${CFLAGS} -Zbsd-signals -s';
27 $efile='-o ';
28 $exep='.exe';
29 $ex_libs="-lsocket";
30
31 # static library stuff
32 $mklib='ar r';
33 $mlflags='';
34 $ranlib="ar s";
35 $plib='';
36 $libp=$shlib ? ".lib" : ".a";
37 $shlibp=$shlib ? ".dll" : ".a";
38 $lfile='';
39
40 $asm=$shlib ? 'as -Zomf' : 'as';
41 $afile='-o ';
42 $bn_asm_obj="";
43 $bn_asm_src="";
44 $des_enc_obj="";
45 $des_enc_src="";
46 $bf_enc_obj="";
47 $bf_enc_src="";
48
49 if (!$no_asm)
50         {
51         $bn_asm_obj="crypto\\bn\\asm\\bn-os2$obj crypto\\bn\\asm\\co-os2$obj";
52         $bn_asm_src="crypto\\bn\\asm\\bn-os2.asm crypto\\bn\\asm\\co-os2.asm";
53         $des_enc_obj="crypto\\des\\asm\\d-os2$obj crypto\\des\\asm\\y-os2$obj";
54         $des_enc_src="crypto\\des\\asm\\d-os2.asm crypto\\des\\asm\\y-os2.asm";
55         $bf_enc_obj="crypto\\bf\\asm\\b-os2$obj";
56         $bf_enc_src="crypto\\bf\\asm\\b-os2.asm";
57         $cast_enc_obj="crypto\\cast\\asm\\c-os2$obj";
58         $cast_enc_src="crypto\\cast\\asm\\c-os2.asm";
59         $rc4_enc_obj="crypto\\rc4\\asm\\r4-os2$obj";
60         $rc4_enc_src="crypto\\rc4\\asm\\r4-os2.asm";
61         $rc5_enc_obj="crypto\\rc5\\asm\\r5-os2$obj";
62         $rc5_enc_src="crypto\\rc5\\asm\\r5-os2.asm";
63         $md5_asm_obj="crypto\\md5\\asm\\m5-os2$obj";
64         $md5_asm_src="crypto\\md5\\asm\\m5-os2.asm";
65         $sha1_asm_obj="crypto\\sha\\asm\\s1-os2$obj";
66         $sha1_asm_src="crypto\\sha\\asm\\s1-os2.asm";
67         $rmd160_asm_obj="crypto\\ripemd\\asm\\rm-os2$obj";
68         $rmd160_asm_src="crypto\\ripemd\\asm\\rm-os2.asm";
69         }
70
71 if ($shlib)
72         {
73         $mlflags.=" $lflags -Zdll";
74         $lib_cflag=" -D_DLL";
75         $out_def="out_dll";
76         $tmp_def="tmp_dll";
77         }
78
79 sub do_lib_rule
80         {
81         local($obj,$target,$name,$shlib)=@_;
82         local($ret,$_,$Name);
83
84         $target =~ s/\//$o/g if $o ne '/';
85         $target="$target";
86         ($Name=$name) =~ tr/a-z/A-Z/;
87
88         $ret.="$target: \$(${Name}OBJ)\n";
89         if (!$shlib) 
90                 {
91                 $ret.="\t\$(RM) $target\n";
92                 $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
93                 $ret.="\t\$(RANLIB) $target\n\n";
94                 }
95         else
96                 {
97                 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
98                 $ex.=' -lsocket';
99                 $ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n";
100                 $ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n";
101                 $ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n";
102                 }
103         }
104
105 sub do_link_rule
106         {
107         local($target,$files,$dep_libs,$libs)=@_;
108         local($ret,$_);
109         
110         $file =~ s/\//$o/g if $o ne '/';
111         $n=&bname($target);
112         $ret.="$target: $files $dep_libs\n";
113         $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n";
114         return($ret);
115         }
116
117 1;