linux.pl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/usr/local/bin/perl
  2. #
  3. # linux.pl - the standard unix makefile stuff.
  4. #
  5. $o='/';
  6. $cp='/bin/cp';
  7. $rm='/bin/rm -f';
  8. # C compiler stuff
  9. $cc='gcc';
  10. if ($debug)
  11. { $cflags="-g2 -ggdb -DREF_CHECK -DCRYPTO_MDEBUG"; }
  12. elsif ($profile)
  13. { $cflags="-pg -O3"; }
  14. else
  15. { $cflags="-O3 -fomit-frame-pointer"; }
  16. if (!$no_asm)
  17. {
  18. $bn_asm_obj='$(OBJ_D)/bn86-elf.o';
  19. $bn_asm_src='crypto/bn/asm/bn86unix.cpp';
  20. $bnco_asm_obj='$(OBJ_D)/co86-elf.o';
  21. $bnco_asm_src='crypto/bn/asm/co86unix.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 -DOPENSSL_BN_ASM_PART_WORDS";
  39. }
  40. $cflags.=" -DTERMIO -DL_ENDIAN -m486 -Wall";
  41. if ($shlib)
  42. {
  43. $shl_cflag=" -DPIC -fpic";
  44. $shlibp=".so.$ssl_version";
  45. $so_shlibp=".so";
  46. }
  47. sub do_shlib_rule
  48. {
  49. local($obj,$target,$name,$shlib,$so_name)=@_;
  50. local($ret,$_,$Name);
  51. $target =~ s/\//$o/g if $o ne '/';
  52. ($Name=$name) =~ tr/a-z/A-Z/;
  53. $ret.="$target: \$(${Name}OBJ)\n";
  54. $ret.="\t\$(RM) target\n";
  55. $ret.="\tgcc \${CFLAGS} -shared -Wl,-soname,$target -o $target \$(${Name}OBJ)\n";
  56. ($t=$target) =~ s/(^.*)\/[^\/]*$/$1/;
  57. if ($so_name ne "")
  58. {
  59. $ret.="\t\$(RM) \$(LIB_D)$o$so_name\n";
  60. $ret.="\tln -s $target \$(LIB_D)$o$so_name\n\n";
  61. }
  62. }
  63. sub do_link_rule
  64. {
  65. local($target,$files,$dep_libs,$libs)=@_;
  66. local($ret,$_);
  67. $file =~ s/\//$o/g if $o ne '/';
  68. $n=&bname($target);
  69. $ret.="$target: $files $dep_libs\n";
  70. $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n";
  71. return($ret);
  72. }
  73. sub do_asm_rule
  74. {
  75. local($target,$src)=@_;
  76. local($ret,@s,@t,$i);
  77. $target =~ s/\//$o/g if $o ne "/";
  78. $src =~ s/\//$o/g if $o ne "/";
  79. @s=split(/\s+/,$src);
  80. @t=split(/\s+/,$target);
  81. for ($i=0; $i<=$#s; $i++)
  82. {
  83. $ret.="$t[$i]: $s[$i]\n";
  84. $ret.="\tgcc -E -DELF \$(SRC_D)$o$s[$i]|\$(AS) $afile$t[$i]\n\n";
  85. }
  86. return($ret);
  87. }
  88. 1;