VC-32.pl 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. #!/usr/local/bin/perl
  2. # VC-32.pl - unified script for Microsoft Visual C++, covering Win32,
  3. # Win64 and WinCE [follow $FLAVOR variable to trace the differences].
  4. #
  5. $ssl= "ssleay32";
  6. if ($fips && !$shlib)
  7. {
  8. $crypto="libeayfips32";
  9. $crypto_compat = "libeaycompat32.lib";
  10. }
  11. else
  12. {
  13. $crypto="libeay32";
  14. }
  15. if ($fipscanisterbuild)
  16. {
  17. $fips_canister_path = "\$(LIB_D)\\fipscanister.lib";
  18. }
  19. $o='\\';
  20. $cp='$(PERL) util/copy.pl';
  21. $mkdir='$(PERL) util/mkdir-p.pl';
  22. $rm='del /Q';
  23. $zlib_lib="zlib1.lib";
  24. # Santize -L options for ms link
  25. $l_flags =~ s/-L("\[^"]+")/\/libpath:$1/g;
  26. $l_flags =~ s/-L(\S+)/\/libpath:$1/g;
  27. # C compiler stuff
  28. $cc='cl';
  29. if ($FLAVOR =~ /WIN64/)
  30. {
  31. # Note that we currently don't have /WX on Win64! There is a lot of
  32. # warnings, but only of two types:
  33. #
  34. # C4344: conversion from '__int64' to 'int/long', possible loss of data
  35. # C4267: conversion from 'size_t' to 'int/long', possible loss of data
  36. #
  37. # Amount of latter type is minimized by aliasing strlen to function of
  38. # own desing and limiting its return value to 2GB-1 (see e_os.h). As
  39. # per 0.9.8 release remaining warnings were explicitly examined and
  40. # considered safe to ignore.
  41. #
  42. $base_cflags=' /W3 /Gs0 /GF /Gy /nologo -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DOPENSSL_SYSNAME_WIN32 -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE';
  43. $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
  44. $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
  45. my $f = $shlib || $fips ?' /MD':' /MT';
  46. $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
  47. $opt_cflags=$f.' /Ox';
  48. $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
  49. $lflags="/nologo /subsystem:console /opt:ref";
  50. }
  51. elsif ($FLAVOR =~ /CE/)
  52. {
  53. # sanity check
  54. die '%OSVERSION% is not defined' if (!defined($ENV{'OSVERSION'}));
  55. die '%PLATFORM% is not defined' if (!defined($ENV{'PLATFORM'}));
  56. die '%TARGETCPU% is not defined' if (!defined($ENV{'TARGETCPU'}));
  57. #
  58. # Idea behind this is to mimic flags set by eVC++ IDE...
  59. #
  60. $wcevers = $ENV{'OSVERSION'}; # WCENNN
  61. die '%OSVERSION% value is insane' if ($wcevers !~ /^WCE([1-9])([0-9]{2})$/);
  62. $wcecdefs = "-D_WIN32_WCE=$1$2 -DUNDER_CE=$1$2"; # -D_WIN32_WCE=NNN
  63. $wcelflag = "/subsystem:windowsce,$1.$2"; # ...,N.NN
  64. $wceplatf = $ENV{'PLATFORM'};
  65. $wceplatf =~ tr/a-z0-9 /A-Z0-9_/d;
  66. $wcecdefs .= " -DWCE_PLATFORM_$wceplatf";
  67. $wcetgt = $ENV{'TARGETCPU'}; # just shorter name...
  68. SWITCH: for($wcetgt) {
  69. /^X86/ && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_";
  70. $wcelflag.=" /machine:IX86"; last; };
  71. /^ARMV4[IT]/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
  72. $wcecdefs.=" -DTHUMB -D_THUMB_" if($wcetgt=~/T$/);
  73. $wcecdefs.=" -QRarch4T -QRinterwork-return";
  74. $wcelflag.=" /machine:THUMB"; last; };
  75. /^ARM/ && do { $wcecdefs.=" -DARM -D_ARM_ -D$wcetgt";
  76. $wcelflag.=" /machine:ARM"; last; };
  77. /^MIPSIV/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
  78. $wcecdefs.=" -D_MIPS64 -QMmips4 -QMn32";
  79. $wcelflag.=" /machine:MIPSFPU"; last; };
  80. /^MIPS16/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
  81. $wcecdefs.=" -DMIPSII -QMmips16";
  82. $wcelflag.=" /machine:MIPS16"; last; };
  83. /^MIPSII/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000 -D$wcetgt";
  84. $wcecdefs.=" -QMmips2";
  85. $wcelflag.=" /machine:MIPS"; last; };
  86. /^R4[0-9]{3}/ && do { $wcecdefs.=" -DMIPS -D_MIPS_ -DR4000";
  87. $wcelflag.=" /machine:MIPS"; last; };
  88. /^SH[0-9]/ && do { $wcecdefs.=" -D$wcetgt -D_$wcetgt_ -DSHx";
  89. $wcecdefs.=" -Qsh4" if ($wcetgt =~ /^SH4/);
  90. $wcelflag.=" /machine:$wcetgt"; last; };
  91. { $wcecdefs.=" -D$wcetgt -D_$wcetgt_";
  92. $wcelflag.=" /machine:$wcetgt"; last; };
  93. }
  94. $cc='$(CC)';
  95. $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include -DOPENSSL_SMALL_FOOTPRINT';
  96. $base_cflags.=" $wcecdefs";
  97. $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics...
  98. $dbg_clfags=' /MC /Od -DDEBUG -D_DEBUG';
  99. $lflags="/nologo /opt:ref $wcelflag";
  100. }
  101. else # Win32
  102. {
  103. $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
  104. $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
  105. $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
  106. my $f = $shlib || $fips ?' /MD':' /MT';
  107. $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
  108. $opt_cflags=$f.' /Ox /O2 /Ob2';
  109. $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
  110. $lflags="/nologo /subsystem:console /opt:ref";
  111. }
  112. $mlflags='';
  113. $out_def="out32"; $out_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/);
  114. $tmp_def="tmp32"; $tmp_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/);
  115. $inc_def="inc32";
  116. if ($debug)
  117. {
  118. $cflags=$dbg_cflags.$base_cflags.' /Zi';
  119. $lflags.=" /debug";
  120. $mlflags.=' /debug';
  121. }
  122. else
  123. {
  124. $cflags=$opt_cflags.$base_cflags;
  125. }
  126. $obj='.obj';
  127. $ofile="/Fo";
  128. # EXE linking stuff
  129. $link="link";
  130. $rsc="rc";
  131. $efile="/out:";
  132. $exep='.exe';
  133. if ($no_sock) { $ex_libs=''; }
  134. elsif ($FLAVOR =~ /CE/) { $ex_libs='winsock.lib'; }
  135. else { $ex_libs='wsock32.lib'; }
  136. my $oflow;
  137. if ($FLAVOR =~ /WIN64/ and `cl 2>&1` =~ /14\.00\.4[0-9]{4}\./)
  138. {
  139. $oflow=' bufferoverflowu.lib';
  140. }
  141. else
  142. {
  143. $oflow="";
  144. }
  145. if ($FLAVOR =~ /CE/)
  146. {
  147. $ex_libs.=' $(WCECOMPAT)/lib/wcecompatex.lib';
  148. $ex_libs.=' /nodefaultlib:oldnames.lib coredll.lib corelibc.lib' if ($ENV{'TARGETCPU'} eq "X86");
  149. }
  150. else
  151. {
  152. $ex_libs.=' gdi32.lib crypt32.lib advapi32.lib user32.lib';
  153. $ex_libs.= $oflow;
  154. }
  155. # As native NT API is pure UNICODE, our WIN-NT build defaults to UNICODE,
  156. # but gets linked with unicows.lib to ensure backward compatibility.
  157. if ($FLAVOR =~ /NT/)
  158. {
  159. $cflags.=" -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE";
  160. $ex_libs="unicows.lib $ex_libs";
  161. }
  162. # static library stuff
  163. $mklib='lib /nologo';
  164. $ranlib='';
  165. $plib="";
  166. $libp=".lib";
  167. $shlibp=($shlib)?".dll":".lib";
  168. $lfile='/out:';
  169. $shlib_ex_obj="";
  170. $app_ex_obj="setargv.obj" if ($FLAVOR !~ /CE/);
  171. if ($nasm) {
  172. my $ver=`nasm -v 2>NUL`;
  173. my $vew=`nasmw -v 2>NUL`;
  174. # pick newest version
  175. $asm=($ver gt $vew?"nasm":"nasmw")." -f win32";
  176. $afile='-o ';
  177. } elsif ($ml64) {
  178. $asm='ml64 /c /Cp /Cx';
  179. $asm.=' /Zi' if $debug;
  180. $afile='/Fo';
  181. } else {
  182. $asm='ml /nologo /Cp /coff /c /Cx';
  183. $asm.=" /Zi" if $debug;
  184. $afile='/Fo';
  185. }
  186. $aes_asm_obj='';
  187. $bn_asm_obj='';
  188. $bn_asm_src='';
  189. $des_enc_obj='';
  190. $des_enc_src='';
  191. $bf_enc_obj='';
  192. $bf_enc_src='';
  193. if (!$no_asm)
  194. {
  195. if ($FLAVOR =~ "WIN32")
  196. {
  197. $aes_asm_obj='crypto\aes\asm\a_win32.obj';
  198. $aes_asm_src='crypto\aes\asm\a_win32.asm';
  199. $bn_asm_obj='crypto\bn\asm\bn_win32.obj crypto\bn\asm\mt_win32.obj';
  200. $bn_asm_src='crypto\bn\asm\bn_win32.asm crypto\bn\asm\mt_win32.asm';
  201. $bnco_asm_obj='crypto\bn\asm\co_win32.obj';
  202. $bnco_asm_src='crypto\bn\asm\co_win32.asm';
  203. $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
  204. $des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm';
  205. $bf_enc_obj='crypto\bf\asm\b_win32.obj';
  206. $bf_enc_src='crypto\bf\asm\b_win32.asm';
  207. $cast_enc_obj='crypto\cast\asm\c_win32.obj';
  208. $cast_enc_src='crypto\cast\asm\c_win32.asm';
  209. $rc4_enc_obj='crypto\rc4\asm\r4_win32.obj';
  210. $rc4_enc_src='crypto\rc4\asm\r4_win32.asm';
  211. $rc5_enc_obj='crypto\rc5\asm\r5_win32.obj';
  212. $rc5_enc_src='crypto\rc5\asm\r5_win32.asm';
  213. $md5_asm_obj='crypto\md5\asm\m5_win32.obj';
  214. $md5_asm_src='crypto\md5\asm\m5_win32.asm';
  215. $sha1_asm_obj='crypto\sha\asm\s1_win32.obj crypto\sha\asm\sha512-sse2.obj';
  216. $sha1_asm_src='crypto\sha\asm\s1_win32.asm crypto\sha\asm\sha512-sse2.asm';
  217. $rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj';
  218. $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
  219. $cpuid_asm_obj='crypto\cpu_win32.obj';
  220. $cpuid_asm_src='crypto\cpu_win32.asm';
  221. $cflags.=" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
  222. }
  223. elsif ($FLAVOR =~ "WIN64A")
  224. {
  225. $aes_asm_obj='$(OBJ_D)\aes-x86_64.obj';
  226. $aes_asm_src='crypto\aes\asm\aes-x86_64.asm';
  227. $bn_asm_obj='$(OBJ_D)\x86_64-mont.obj $(OBJ_D)\bn_asm.obj';
  228. $bn_asm_src='crypto\bn\asm\x86_64-mont.asm';
  229. $sha1_asm_obj='$(OBJ_D)\sha1-x86_64.obj $(OBJ_D)\sha256-x86_64.obj $(OBJ_D)\sha512-x86_64.obj';
  230. $sha1_asm_src='crypto\sha\asm\sha1-x86_64.asm crypto\sha\asm\sha256-x86_64.asm crypto\sha\asm\sha512-x86_64.asm';
  231. $cpuid_asm_obj='$(OBJ_D)\cpuid-x86_64.obj';
  232. $cpuid_asm_src='crypto\cpuid-x86_64.asm';
  233. $cflags.=" -DOPENSSL_CPUID_OBJ -DAES_ASM -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM";
  234. }
  235. }
  236. if ($shlib && $FLAVOR !~ /CE/)
  237. {
  238. $mlflags.=" $lflags /dll";
  239. # $cflags =~ s| /MD| /MT|;
  240. $lib_cflag=" -D_WINDLL";
  241. $out_def="out32dll";
  242. $tmp_def="tmp32dll";
  243. #
  244. # Engage Applink...
  245. #
  246. $app_ex_obj.=" \$(OBJ_D)\\applink.obj /implib:\$(TMP_D)\\junk.lib";
  247. $cflags.=" -DOPENSSL_USE_APPLINK -I.";
  248. # I'm open for better suggestions than overriding $banner...
  249. $banner=<<'___';
  250. @echo Building OpenSSL
  251. $(OBJ_D)\applink.obj: ms\applink.c
  252. $(CC) /Fo$(OBJ_D)\applink.obj $(APP_CFLAGS) -c ms\applink.c
  253. $(OBJ_D)\uplink.obj: ms\uplink.c ms\applink.c
  254. $(CC) /Fo$(OBJ_D)\uplink.obj $(SHLIB_CFLAGS) -c ms\uplink.c
  255. $(INCO_D)\applink.c: ms\applink.c
  256. $(CP) ms\applink.c $(INCO_D)\applink.c
  257. EXHEADER= $(EXHEADER) $(INCO_D)\applink.c
  258. LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj
  259. ___
  260. $banner .= "CRYPTOOBJ=\$(OBJ_D)\\uplink.obj \$(CRYPTOOBJ)\n";
  261. $banner.=<<'___' if ($FLAVOR =~ /WIN64/);
  262. CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ)
  263. ___
  264. }
  265. elsif ($shlib && $FLAVOR =~ /CE/)
  266. {
  267. $mlflags.=" $lflags /dll";
  268. $lib_cflag=" -D_WINDLL -D_DLL";
  269. $out_def='out32dll_$(TARGETCPU)';
  270. $tmp_def='tmp32dll_$(TARGETCPU)';
  271. }
  272. $cflags.=" /Fd$out_def";
  273. sub do_lib_rule
  274. {
  275. my($objs,$target,$name,$shlib,$ign,$base_addr) = @_;
  276. local($ret);
  277. $taget =~ s/\//$o/g if $o ne '/';
  278. my $base_arg;
  279. if ($base_addr ne "")
  280. {
  281. $base_arg= " /base:$base_addr";
  282. }
  283. else
  284. {
  285. $base_arg = "";
  286. }
  287. if ($target =~ /O_CRYPTO/ && $fipsdso)
  288. {
  289. $name = "/def:ms/libeayfips.def";
  290. }
  291. elsif ($name ne "")
  292. {
  293. $name =~ tr/a-z/A-Z/;
  294. $name = "/def:ms/${name}.def";
  295. }
  296. # $target="\$(LIB_D)$o$target";
  297. # $ret.="$target: $objs\n";
  298. if (!$shlib)
  299. {
  300. # $ret.="\t\$(RM) \$(O_$Name)\n";
  301. $ex =' ';
  302. $ret.="$target: $objs\n";
  303. $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n";
  304. }
  305. else
  306. {
  307. my $ex = "";
  308. if ($target !~ /O_CRYPTO/)
  309. {
  310. $ex .= " \$(L_CRYPTO)";
  311. #$ex .= " \$(L_FIPS)" if $fipsdso;
  312. }
  313. my $fipstarget;
  314. if ($fipsdso)
  315. {
  316. $fipstarget = "O_FIPS";
  317. }
  318. else
  319. {
  320. $fipstarget = "O_CRYPTO";
  321. }
  322. if ($name eq "")
  323. {
  324. $ex.= $oflow;
  325. if ($target =~ /capi/)
  326. {
  327. $ex.=' crypt32.lib advapi32.lib';
  328. }
  329. }
  330. elsif ($FLAVOR =~ /CE/)
  331. {
  332. $ex.=' winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib';
  333. }
  334. else
  335. {
  336. $ex.=' unicows.lib' if ($FLAVOR =~ /NT/);
  337. $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib';
  338. $ex.=' crypt32.lib';
  339. $ex.= $oflow;
  340. }
  341. $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
  342. if ($fips && $target =~ /$fipstarget/)
  343. {
  344. $ex.= $mwex unless $fipscanisterbuild;
  345. $ret.="$target: $objs \$(PREMAIN_DSO_EXE)";
  346. if ($fipsdso)
  347. {
  348. $ex.=" \$(OBJ_D)\\\$(LIBFIPS).res";
  349. $ret.=" \$(OBJ_D)\\\$(LIBFIPS).res";
  350. $ret.=" ms/\$(LIBFIPS).def";
  351. }
  352. $ret.="\n\tSET FIPS_LINK=\$(LINK)\n";
  353. $ret.="\tSET FIPS_CC=\$(CC)\n";
  354. $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
  355. $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n";
  356. $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
  357. $ret.="\tSET FIPS_TARGET=$target\n";
  358. $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
  359. $ret.="\t\$(FIPSLINK) \$(MLFLAGS) /fixed /map $base_arg $efile$target ";
  360. $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs ";
  361. $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n";
  362. }
  363. else
  364. {
  365. $ret.="$target: $objs";
  366. if ($target =~ /O_CRYPTO/ && $fipsdso)
  367. {
  368. $ret .= " \$(O_FIPS)";
  369. $ex .= " \$(L_FIPS)";
  370. }
  371. $ret.="\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
  372. }
  373. $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n";
  374. }
  375. $ret.="\n";
  376. return($ret);
  377. }
  378. sub do_link_rule
  379. {
  380. my($target,$files,$dep_libs,$libs,$standalone)=@_;
  381. local($ret,$_);
  382. $file =~ s/\//$o/g if $o ne '/';
  383. $n=&bname($targer);
  384. $ret.="$target: $files $dep_libs\n";
  385. if ($standalone == 1)
  386. {
  387. $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t";
  388. $ret.= "\$(EX_LIBS) " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild);
  389. $ret.="$files $libs\n<<\n";
  390. }
  391. elsif ($standalone == 2)
  392. {
  393. $ret.="\tSET FIPS_LINK=\$(LINK)\n";
  394. $ret.="\tSET FIPS_CC=\$(CC)\n";
  395. $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
  396. $ret.="\tSET PREMAIN_DSO_EXE=\n";
  397. $ret.="\tSET FIPS_TARGET=$target\n";
  398. $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
  399. $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
  400. $ret.="\t\$(FIPSLINK) \$(LFLAGS) /fixed /map $efile$target @<<\n";
  401. $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n";
  402. }
  403. else
  404. {
  405. $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
  406. $ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n";
  407. }
  408. $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
  409. return($ret);
  410. }
  411. sub do_rlink_rule
  412. {
  413. local($target,$rl_start, $rl_mid, $rl_end,$dep_libs,$libs)=@_;
  414. local($ret,$_);
  415. my $files = "$rl_start $rl_mid $rl_end";
  416. $file =~ s/\//$o/g if $o ne '/';
  417. $n=&bname($targer);
  418. $ret.="$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n";
  419. $ret.="\t\$(PERL) ms\\segrenam.pl \$\$a $rl_start\n";
  420. $ret.="\t\$(PERL) ms\\segrenam.pl \$\$b $rl_mid\n";
  421. $ret.="\t\$(PERL) ms\\segrenam.pl \$\$c $rl_end\n";
  422. $ret.="\t\$(MKLIB) $lfile$target @<<\n\t$files\n<<\n";
  423. $ret.="\t\$(FIPS_SHA1_EXE) $target > ${target}.sha1\n";
  424. $ret.="\t\$(PERL) util${o}copy.pl -stripcr fips${o}fips_premain.c \$(LIB_D)${o}fips_premain.c\n";
  425. $ret.="\t\$(CP) fips${o}fips_premain.c.sha1 \$(LIB_D)${o}fips_premain.c.sha1\n";
  426. $ret.="\n";
  427. return($ret);
  428. }
  429. sub do_sdef_rule
  430. {
  431. my $ret = "ms/\$(LIBFIPS).def: \$(O_FIPSCANISTER)\n";
  432. $ret.="\t\$(PERL) util/mksdef.pl \$(MLFLAGS) /out:dummy.dll /def:ms/libeay32.def @<<\n \$(O_FIPSCANISTER)\n<<\n";
  433. $ret.="\n";
  434. return $ret;
  435. }
  436. 1;