OS2-EMX.pl 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/usr/local/bin/perl
  2. #
  3. # OS2-EMX.pl - for EMX GCC on OS/2
  4. #
  5. $o='/';
  6. $cp='cp';
  7. $rm='rm -f';
  8. $preamble = "SHELL=sh\n";
  9. # C compiler stuff
  10. $cc='gcc';
  11. $cflags="-DL_ENDIAN -O3 -fomit-frame-pointer -m486 -Zmtd -Wall ";
  12. $cflags.="-Zomf " if $shlib;
  13. $shl_cflag="-Zdll";
  14. if ($debug) {
  15. $cflags.="-g ";
  16. }
  17. $obj=$shlib ? '.obj' : '.o';
  18. $ofile='-o ';
  19. # EXE linking stuff
  20. $link='${CC}';
  21. $lflags='${CFLAGS} -Zbsd-signals -s';
  22. $efile='-o ';
  23. $exep='.exe';
  24. $ex_libs="-lsocket";
  25. # static library stuff
  26. $mklib='ar r';
  27. $mlflags='';
  28. $ranlib="ar s";
  29. $plib='';
  30. $libp=$shlib ? ".lib" : ".a";
  31. $shlibp=$shlib ? ".dll" : ".a";
  32. $lfile='';
  33. $asm=$shlib ? 'as -Zomf' : 'as';
  34. $afile='-o ';
  35. $bn_asm_obj="";
  36. $bn_asm_src="";
  37. $des_enc_obj="";
  38. $des_enc_src="";
  39. $bf_enc_obj="";
  40. $bf_enc_src="";
  41. if (!$no_asm)
  42. {
  43. $bn_asm_obj="crypto/bn/asm/bn-os2$obj crypto/bn/asm/co-os2$obj";
  44. $bn_asm_src="crypto/bn/asm/bn-os2.asm crypto/bn/asm/co-os2.asm";
  45. $des_enc_obj="crypto/des/asm/d-os2$obj crypto/des/asm/y-os2$obj";
  46. $des_enc_src="crypto/des/asm/d-os2.asm crypto/des/asm/y-os2.asm";
  47. $bf_enc_obj="crypto/bf/asm/b-os2$obj";
  48. $bf_enc_src="crypto/bf/asm/b-os2.asm";
  49. $cast_enc_obj="crypto/cast/asm/c-os2$obj";
  50. $cast_enc_src="crypto/cast/asm/c-os2.asm";
  51. $rc4_enc_obj="crypto/rc4/asm/r4-os2$obj";
  52. $rc4_enc_src="crypto/rc4/asm/r4-os2.asm";
  53. $rc5_enc_obj="crypto/rc5/asm/r5-os2$obj";
  54. $rc5_enc_src="crypto/rc5/asm/r5-os2.asm";
  55. $md5_asm_obj="crypto/md5/asm/m5-os2$obj";
  56. $md5_asm_src="crypto/md5/asm/m5-os2.asm";
  57. $sha1_asm_obj="crypto/sha/asm/s1-os2$obj";
  58. $sha1_asm_src="crypto/sha/asm/s1-os2.asm";
  59. $rmd160_asm_obj="crypto/ripemd/asm/rm-os2$obj";
  60. $rmd160_asm_src="crypto/ripemd/asm/rm-os2.asm";
  61. $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DOPENSSL_BN_ASM_PART_WORDS";
  62. }
  63. if ($shlib)
  64. {
  65. $mlflags.=" $lflags -Zdll";
  66. $lib_cflag=" -D_DLL";
  67. $out_def="out_dll";
  68. $tmp_def="tmp_dll";
  69. }
  70. sub do_lib_rule
  71. {
  72. local($obj,$target,$name,$shlib)=@_;
  73. local($ret,$_,$Name);
  74. $target =~ s/\//$o/g if $o ne '/';
  75. $target="$target";
  76. ($Name=$name) =~ tr/a-z/A-Z/;
  77. $ret.="$target: \$(${Name}OBJ)\n";
  78. if (!$shlib)
  79. {
  80. $ret.="\t\$(RM) $target\n";
  81. $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
  82. $ret.="\t\$(RANLIB) $target\n\n";
  83. }
  84. else
  85. {
  86. local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
  87. $ex.=' -lsocket';
  88. $ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n";
  89. $ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n";
  90. $ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n";
  91. }
  92. }
  93. sub do_link_rule
  94. {
  95. local($target,$files,$dep_libs,$libs)=@_;
  96. local($ret,$_);
  97. $file =~ s/\//$o/g if $o ne '/';
  98. $n=&bname($target);
  99. $ret.="$target: $files $dep_libs\n";
  100. $ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n";
  101. return($ret);
  102. }
  103. 1;