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