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