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