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