BC-32.pl 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #!/usr/local/bin/perl
  2. # Borland C++ builder 3 and 4 -- Janez Jere <jj@void.si>
  3. #
  4. $ssl= "ssleay32";
  5. $crypto="libeay32";
  6. $o='\\';
  7. $cp='copy';
  8. $rm='del';
  9. # C compiler stuff
  10. $cc='bcc32';
  11. $lflags="-ap -Tpe -x -Gn ";
  12. $mlflags='';
  13. $out_def="out32";
  14. $tmp_def="tmp32";
  15. $inc_def="inc32";
  16. #enable max error messages, disable most common warnings
  17. $cflags="-DWIN32_LEAN_AND_MEAN -q -w-ccc -w-rch -w-pia -w-aus -w-par -w-inl -c -tWC -tWM -DOPENSSL_SYSNAME_WIN32 -DL_ENDIAN -DDSO_WIN32 -D_stricmp=stricmp -D_strnicmp=strnicmp -D_timeb=timeb -D_ftime=ftime ";
  18. if ($debug)
  19. {
  20. $cflags.="-Od -y -v -vi- -D_DEBUG";
  21. $mlflags.=' ';
  22. }
  23. else
  24. {
  25. $cflags.="-O2 -ff -fp";
  26. }
  27. $obj='.obj';
  28. $ofile="-o";
  29. # EXE linking stuff
  30. $link="ilink32";
  31. $efile="";
  32. $exep='.exe';
  33. if ($no_sock)
  34. { $ex_libs=""; }
  35. else { $ex_libs="cw32mt.lib import32.lib crypt32.lib ws2_32.lib"; }
  36. # static library stuff
  37. $mklib='tlib /P64';
  38. $ranlib='';
  39. $plib="";
  40. $libp=".lib";
  41. $shlibp=($shlib)?".dll":".lib";
  42. $lfile='';
  43. $shlib_ex_obj="";
  44. $app_ex_obj="c0x32.obj";
  45. $asm=(`nasm -v 2>NUL` ge `nasmw -v 2>NUL`?"nasm":"nasmw")." -f obj -d__omf__";
  46. $asm.=" -g" if $debug;
  47. $afile='-o';
  48. $bn_mulw_obj='';
  49. $bn_mulw_src='';
  50. $des_enc_obj='';
  51. $des_enc_src='';
  52. $bf_enc_obj='';
  53. $bf_enc_src='';
  54. if (!$no_asm)
  55. {
  56. $bn_mulw_obj='crypto\bn\asm\bn_win32.obj';
  57. $bn_mulw_src='crypto\bn\asm\bn_win32.asm';
  58. $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
  59. $des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm';
  60. $bf_enc_obj='crypto\bf\asm\b_win32.obj';
  61. $bf_enc_src='crypto\bf\asm\b_win32.asm';
  62. $cast_enc_obj='crypto\cast\asm\c_win32.obj';
  63. $cast_enc_src='crypto\cast\asm\c_win32.asm';
  64. $rc4_enc_obj='crypto\rc4\asm\r4_win32.obj';
  65. $rc4_enc_src='crypto\rc4\asm\r4_win32.asm';
  66. $rc5_enc_obj='crypto\rc5\asm\r5_win32.obj';
  67. $rc5_enc_src='crypto\rc5\asm\r5_win32.asm';
  68. $md5_asm_obj='crypto\md5\asm\m5_win32.obj';
  69. $md5_asm_src='crypto\md5\asm\m5_win32.asm';
  70. $sha1_asm_obj='crypto\sha\asm\s1_win32.obj';
  71. $sha1_asm_src='crypto\sha\asm\s1_win32.asm';
  72. $rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj';
  73. $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
  74. $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
  75. }
  76. if ($shlib)
  77. {
  78. $mlflags.=" $lflags /dll";
  79. # $cflags =~ s| /MD| /MT|;
  80. $lib_cflag=" /GD -D_WINDLL -D_DLL";
  81. $out_def="out32dll";
  82. $tmp_def="tmp32dll";
  83. }
  84. sub do_lib_rule
  85. {
  86. local($objs,$target,$name,$shlib)=@_;
  87. local($ret,$Name);
  88. $taget =~ s/\//$o/g if $o ne '/';
  89. ($Name=$name) =~ tr/a-z/A-Z/;
  90. # $target="\$(LIB_D)$o$target";
  91. $ret.="$target: $objs\n";
  92. if (!$shlib)
  93. {
  94. $ret.=<<___;
  95. -\$(RM) $lfile$target
  96. \$(MKLIB) $lfile$target \@&&!
  97. +\$(**: = &^
  98. +)
  99. !
  100. ___
  101. }
  102. else
  103. {
  104. local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
  105. $ex.=' ws2_32.lib gdi32.lib';
  106. $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
  107. }
  108. $ret.="\n";
  109. return($ret);
  110. }
  111. sub do_link_rule
  112. {
  113. local($target,$files,$dep_libs,$libs)=@_;
  114. local($ret,$_);
  115. $file =~ s/\//$o/g if $o ne '/';
  116. $n=&bname($target);
  117. $ret.="$target: $files $dep_libs\n";
  118. $ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n";
  119. return($ret);
  120. }
  121. 1;