OpenSSL 1.0.2g
[tomato.git] / release / src / router / openssl / util / pl / linux.pl
blob3362941f7bf3a1571094f3ea4560e4a50f453885
1 #!/usr/local/bin/perl
3 # linux.pl - the standard unix makefile stuff.
6 $o='/';
7 $cp='/bin/cp';
8 $rm='/bin/rm -f';
10 # C compiler stuff
12 $cc='gcc';
13 if ($debug)
14 { $cflags="-g2 -ggdb -DREF_CHECK -DCRYPTO_MDEBUG"; }
15 elsif ($profile)
16 { $cflags="-pg -O3"; }
17 else
18 { $cflags="-O3 -fomit-frame-pointer"; }
20 if (!$no_asm)
22 $bn_asm_obj='$(OBJ_D)/bn86-elf.o';
23 $bn_asm_src='crypto/bn/asm/bn86unix.cpp';
24 $bnco_asm_obj='$(OBJ_D)/co86-elf.o';
25 $bnco_asm_src='crypto/bn/asm/co86unix.cpp';
26 $des_enc_obj='$(OBJ_D)/dx86-elf.o $(OBJ_D)/yx86-elf.o';
27 $des_enc_src='crypto/des/asm/dx86unix.cpp crypto/des/asm/yx86unix.cpp';
28 $bf_enc_obj='$(OBJ_D)/bx86-elf.o';
29 $bf_enc_src='crypto/bf/asm/bx86unix.cpp';
30 $cast_enc_obj='$(OBJ_D)/cx86-elf.o';
31 $cast_enc_src='crypto/cast/asm/cx86unix.cpp';
32 $rc4_enc_obj='$(OBJ_D)/rx86-elf.o';
33 $rc4_enc_src='crypto/rc4/asm/rx86unix.cpp';
34 $rc5_enc_obj='$(OBJ_D)/r586-elf.o';
35 $rc5_enc_src='crypto/rc5/asm/r586unix.cpp';
36 $md5_asm_obj='$(OBJ_D)/mx86-elf.o';
37 $md5_asm_src='crypto/md5/asm/mx86unix.cpp';
38 $rmd160_asm_obj='$(OBJ_D)/rm86-elf.o';
39 $rmd160_asm_src='crypto/ripemd/asm/rm86unix.cpp';
40 $sha1_asm_obj='$(OBJ_D)/sx86-elf.o';
41 $sha1_asm_src='crypto/sha/asm/sx86unix.cpp';
42 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
45 $cflags.=" -DTERMIO -DL_ENDIAN -m486 -Wall";
47 if ($shlib)
49 $shl_cflag=" -DPIC -fpic";
50 $shlibp=".so.$ssl_version";
51 $so_shlibp=".so";
54 sub do_shlib_rule
56 local($obj,$target,$name,$shlib,$so_name)=@_;
57 local($ret,$_,$Name);
59 $target =~ s/\//$o/g if $o ne '/';
60 ($Name=$name) =~ tr/a-z/A-Z/;
62 $ret.="$target: \$(${Name}OBJ)\n";
63 $ret.="\t\$(RM) target\n";
64 $ret.="\tgcc \${CFLAGS} -shared -Wl,-soname,$target -o $target \$(${Name}OBJ)\n";
65 ($t=$target) =~ s/(^.*)\/[^\/]*$/$1/;
66 if ($so_name ne "")
68 $ret.="\t\$(RM) \$(LIB_D)$o$so_name\n";
69 $ret.="\tln -s $target \$(LIB_D)$o$so_name\n\n";
73 sub do_link_rule
75 local($target,$files,$dep_libs,$libs)=@_;
76 local($ret,$_);
78 $file =~ s/\//$o/g if $o ne '/';
79 $n=&bname($target);
80 $ret.="$target: $files $dep_libs\n";
81 $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n";
82 return($ret);
85 sub do_asm_rule
87 local($target,$src)=@_;
88 local($ret,@s,@t,$i);
90 $target =~ s/\//$o/g if $o ne "/";
91 $src =~ s/\//$o/g if $o ne "/";
93 @s=split(/\s+/,$src);
94 @t=split(/\s+/,$target);
96 for ($i=0; $i<=$#s; $i++)
98 $ret.="$t[$i]: $s[$i]\n";
99 $ret.="\tgcc -E -DELF \$(SRC_D)$o$s[$i]|\$(AS) $afile$t[$i]\n\n";
101 return($ret);