1194206Ssimon# Metrowerks Codewarrior or gcc / nlmconv for NetWare 2160814Ssimon# 3160814Ssimon 4194206Ssimon$version_header = "crypto/opensslv.h"; 5194206Ssimonopen(IN, "$version_header") or die "Couldn't open $version_header: $!"; 6194206Ssimonwhile (<IN>) { 7194206Ssimon if (/^#define[\s\t]+OPENSSL_VERSION_NUMBER[\s\t]+0x(\d)(\d{2})(\d{2})(\d{2})/) 8194206Ssimon { 9194206Ssimon # die "OpenSSL version detected: $1.$2.$3.$4\n"; 10194206Ssimon #$nlmvernum = "$1,$2,$3"; 11194206Ssimon $nlmvernum = "$1,".($2*10+$3).",".($4*1); 12194206Ssimon #$nlmverstr = "$1.".($2*1).".".($3*1).($4?(chr(96+$4)):""); 13194206Ssimon break; 14194206Ssimon } 15194206Ssimon} 16194206Ssimonclose(IN) or die "Couldn't close $version_header: $!"; 17194206Ssimon 18194206Ssimon$readme_file = "README"; 19194206Ssimonopen(IN, $readme_file) or die "Couldn't open $readme_file: $!"; 20194206Ssimonwhile (<IN>) { 21194206Ssimon if (/^[\s\t]+OpenSSL[\s\t]+(\d)\.(\d{1,2})\.(\d{1,2})([a-z])(.*)/) 22194206Ssimon { 23194206Ssimon #$nlmvernum = "$1,$2,$3"; 24194206Ssimon #$nlmvernum = "$1,".($2*10+$3).",".($4*1); 25194206Ssimon $nlmverstr = "$1.$2.$3$4$5"; 26194206Ssimon } 27194206Ssimon elsif (/^[\s\t]+(Copyright \(c\) \d{4}\-\d{4} The OpenSSL Project)$/) 28194206Ssimon { 29194206Ssimon $nlmcpystr = $1; 30194206Ssimon } 31194206Ssimon break if ($nlmvernum && $nlmcpystr); 32194206Ssimon} 33194206Ssimonclose(IN) or die "Couldn't close $readme_file: $!"; 34194206Ssimon 35194206Ssimon# Define stacksize here 36194206Ssimon$nlmstack = "32768"; 37194206Ssimon 38194206Ssimon# some default settings here in case we failed to find them in README 39194206Ssimon$nlmvernum = "1,0,0" if (!$nlmvernum); 40194206Ssimon$nlmverstr = "OpenSSL" if (!$nlmverstr); 41194206Ssimon$nlmcpystr = "Copyright (c) 1998-now The OpenSSL Project" if (!$nlmcpystr); 42194206Ssimon 43194206Ssimon# die "OpenSSL copyright: $nlmcpystr\nOpenSSL verstring: $nlmverstr\nOpenSSL vernumber: $nlmvernum\n"; 44194206Ssimon 45160814Ssimon# The import files and other misc imports needed to link 46194206Ssimon@misc_imports = ("GetProcessSwitchCount", "RunningProcess", 47160814Ssimon "GetSuperHighResolutionTimer"); 48160814Ssimonif ($LIBC) 49160814Ssimon{ 50160814Ssimon @import_files = ("libc.imp"); 51160814Ssimon @module_files = ("libc"); 52194206Ssimon $libarch = "LIBC"; 53160814Ssimon} 54160814Ssimonelse 55160814Ssimon{ 56160814Ssimon # clib build 57160814Ssimon @import_files = ("clib.imp"); 58194206Ssimon push(@import_files, "socklib.imp") if ($BSDSOCK); 59160814Ssimon @module_files = ("clib"); 60194206Ssimon # push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16"); 61194206Ssimon $libarch = "CLIB"; 62160814Ssimon} 63194206Ssimonif ($BSDSOCK) 64160814Ssimon{ 65194206Ssimon $libarch .= "-BSD"; 66194206Ssimon} 67194206Ssimonelse 68194206Ssimon{ 69194206Ssimon $libarch .= "-WS2"; 70160814Ssimon push(@import_files, "ws2nlm.imp"); 71160814Ssimon} 72160814Ssimon 73160814Ssimon# The "IMPORTS" environment variable must be set and point to the location 74160814Ssimon# where import files (*.imp) can be found. 75160814Ssimon# Example: set IMPORTS=c:\ndk\nwsdk\imports 76160814Ssimon$import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n"); 77160814Ssimon 78160814Ssimon 79160814Ssimon# The "PRELUDE" environment variable must be set and point to the location 80160814Ssimon# and name of the prelude source to link with ( nwpre.obj is recommended ). 81160814Ssimon# Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj 82160814Ssimon$prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n"); 83160814Ssimon 84194206Ssimon# The "INCLUDES" environment variable must be set and point to the location 85194206Ssimon# where import files (*.imp) can be found. 86194206Ssimon$include_path = $ENV{"INCLUDE"} || die ("INCLUDES environment variable not set\n"); 87194206Ssimon$include_path =~ s/\\/\//g; 88194206Ssimon$include_path = join(" -I", split(/;/, $include_path)); 89194206Ssimon 90194206Ssimon# check for gcc compiler 91194206Ssimon$gnuc = $ENV{"GNUC"}; 92194206Ssimon 93160814Ssimon#$ssl= "ssleay32"; 94160814Ssimon#$crypto="libeay32"; 95160814Ssimon 96194206Ssimonif ($gnuc) 97194206Ssimon{ 98194206Ssimon # C compiler 99194206Ssimon $cc='gcc'; 100194206Ssimon # Linker 101194206Ssimon $link='nlmconv'; 102194206Ssimon # librarian 103194206Ssimon $mklib='ar'; 104194206Ssimon $o='/'; 105194206Ssimon # cp command 106194206Ssimon $cp='cp -af'; 107194206Ssimon # rm command 108194206Ssimon $rm='rm -f'; 109194206Ssimon # mv command 110194206Ssimon $mv='mv -f'; 111194206Ssimon # mkdir command 112194206Ssimon $mkdir='gmkdir'; 113194206Ssimon #$ranlib='ranlib'; 114194206Ssimon} 115194206Ssimonelse 116194206Ssimon{ 117194206Ssimon # C compiler 118194206Ssimon $cc='mwccnlm'; 119194206Ssimon # Linker 120194206Ssimon $link='mwldnlm'; 121194206Ssimon # librarian 122194206Ssimon $mklib='mwldnlm'; 123194206Ssimon # Path separator 124194206Ssimon $o='\\'; 125194206Ssimon # cp command 126194206Ssimon $cp='copy >nul:'; 127194206Ssimon # rm command 128194206Ssimon $rm='del /f /q'; 129194206Ssimon} 130160814Ssimon 131194206Ssimon# assembler 132194206Ssimonif ($nw_nasm) 133160814Ssimon{ 134194206Ssimon if ($gnuc) 135194206Ssimon { 136194206Ssimon $asm="nasmw -s -f elf"; 137194206Ssimon } 138194206Ssimon else 139194206Ssimon { 140194206Ssimon $asm="nasmw -s -f coff"; 141194206Ssimon } 142160814Ssimon $afile="-o "; 143160814Ssimon $asm.=" -g" if $debug; 144160814Ssimon} 145194206Ssimonelsif ($nw_mwasm) 146160814Ssimon{ 147160814Ssimon $asm="mwasmnlm -maxerrors 20"; 148160814Ssimon $afile="-o "; 149160814Ssimon $asm.=" -g" if $debug; 150160814Ssimon} 151160814Ssimonelsif ($nw_masm) 152160814Ssimon{ 153194206Ssimon# masm assembly settings - it should be possible to use masm but haven't 154160814Ssimon# got it working. 155160814Ssimon# $asm='ml /Cp /coff /c /Cx'; 156160814Ssimon# $asm.=" /Zi" if $debug; 157160814Ssimon# $afile='/Fo'; 158160814Ssimon die("Support for masm assembler not yet functional\n"); 159160814Ssimon} 160194206Ssimonelse 161160814Ssimon{ 162160814Ssimon $asm=""; 163160814Ssimon $afile=""; 164160814Ssimon} 165160814Ssimon 166160814Ssimon 167160814Ssimon 168194206Ssimonif ($gnuc) 169194206Ssimon{ 170194206Ssimon # compile flags for GNUC 171194206Ssimon # additional flags based upon debug | non-debug 172194206Ssimon if ($debug) 173194206Ssimon { 174194206Ssimon $cflags="-g -DDEBUG"; 175194206Ssimon } 176194206Ssimon else 177194206Ssimon { 178194206Ssimon $cflags="-O2"; 179194206Ssimon } 180194206Ssimon $cflags.=" -nostdinc -I$include_path \\ 181194206Ssimon -fno-builtin -fpcc-struct-return -fno-strict-aliasing \\ 182194206Ssimon -funsigned-char -Wall -Wno-unused -Wno-uninitialized"; 183160814Ssimon 184194206Ssimon # link flags 185194206Ssimon $lflags="-T"; 186160814Ssimon} 187160814Ssimonelse 188160814Ssimon{ 189194206Ssimon # compile flags for CodeWarrior 190194206Ssimon # additional flags based upon debug | non-debug 191194206Ssimon if ($debug) 192194206Ssimon { 193194206Ssimon $cflags="-opt off -g -sym internal -DDEBUG"; 194194206Ssimon } 195194206Ssimon else 196194206Ssimon { 197194206Ssimon # CodeWarrior compiler has a problem with optimizations for floating 198194206Ssimon # points - no optimizations until further investigation 199194206Ssimon # $cflags="-opt all"; 200194206Ssimon } 201194206Ssimon 202194206Ssimon # NOTES: Several c files in the crypto subdirectory include headers from 203194206Ssimon # their local directories. Metrowerks wouldn't find these h files 204194206Ssimon # without adding individual include directives as compile flags 205194206Ssimon # or modifying the c files. Instead of adding individual include 206194206Ssimon # paths for each subdirectory a recursive include directive 207194206Ssimon # is used ( -ir crypto ). 208194206Ssimon # 209194206Ssimon # A similar issue exists for the engines and apps subdirectories. 210194206Ssimon # 211194206Ssimon # Turned off the "possible" warnings ( -w nopossible ). Metrowerks 212194206Ssimon # complained a lot about various stuff. May want to turn back 213194206Ssimon # on for further development. 214194206Ssimon $cflags.=" -nostdinc -ir crypto -ir engines -ir apps -I$include_path \\ 215194206Ssimon -msgstyle gcc -align 4 -processor pentium -char unsigned \\ 216194206Ssimon -w on -w nolargeargs -w nopossible -w nounusedarg -w nounusedexpr \\ 217194206Ssimon -w noimplicitconv -relax_pointers -nosyspath -maxerrors 20"; 218194206Ssimon 219194206Ssimon # link flags 220194206Ssimon $lflags="-msgstyle gcc -zerobss -nostdlib -sym internal -commandfile"; 221160814Ssimon} 222160814Ssimon 223194206Ssimon# common defines 224194206Ssimon$cflags.=" -DL_ENDIAN -DOPENSSL_SYSNAME_NETWARE -U_WIN32"; 225194206Ssimon 226160814Ssimon# If LibC build add in NKS_LIBC define and set the entry/exit 227160814Ssimon# routines - The default entry/exit routines are for CLib and don't exist 228160814Ssimon# in LibC 229160814Ssimonif ($LIBC) 230160814Ssimon{ 231160814Ssimon $cflags.=" -DNETWARE_LIBC"; 232194206Ssimon $nlmstart = "_LibCPrelude"; 233194206Ssimon $nlmexit = "_LibCPostlude"; 234194206Ssimon @nlm_flags = ("pseudopreemption", "flag_on 64"); 235160814Ssimon} 236160814Ssimonelse 237160814Ssimon{ 238160814Ssimon $cflags.=" -DNETWARE_CLIB"; 239194206Ssimon $nlmstart = "_Prelude"; 240194206Ssimon $nlmexit = "_Stop"; 241160814Ssimon} 242160814Ssimon 243160814Ssimon# If BSD Socket support is requested, set a define for the compiler 244160814Ssimonif ($BSDSOCK) 245160814Ssimon{ 246160814Ssimon $cflags.=" -DNETWARE_BSDSOCK"; 247194206Ssimon if (!$LIBC) 248194206Ssimon { 249194206Ssimon $cflags.=" -DNETDB_USE_INTERNET"; 250194206Ssimon } 251160814Ssimon} 252160814Ssimon 253160814Ssimon 254160814Ssimon# linking stuff 255160814Ssimon# for the output directories use the mk1mf.pl values with "_nw" appended 256160814Ssimonif ($shlib) 257160814Ssimon{ 258160814Ssimon if ($LIBC) 259160814Ssimon { 260160814Ssimon $out_def.="_nw_libc_nlm"; 261160814Ssimon $tmp_def.="_nw_libc_nlm"; 262160814Ssimon $inc_def.="_nw_libc_nlm"; 263160814Ssimon } 264160814Ssimon else # NETWARE_CLIB 265160814Ssimon { 266160814Ssimon $out_def.="_nw_clib_nlm"; 267160814Ssimon $tmp_def.="_nw_clib_nlm"; 268160814Ssimon $inc_def.="_nw_clib_nlm"; 269160814Ssimon } 270160814Ssimon} 271160814Ssimonelse 272160814Ssimon{ 273194206Ssimon if ($gnuc) # GNUC Tools 274194206Ssimon { 275194206Ssimon $libp=".a"; 276194206Ssimon $shlibp=".a"; 277194206Ssimon $lib_flags="-cr"; 278194206Ssimon } 279194206Ssimon else # CodeWarrior 280194206Ssimon { 281194206Ssimon $libp=".lib"; 282194206Ssimon $shlibp=".lib"; 283194206Ssimon $lib_flags="-nodefaults -type library -o"; 284194206Ssimon } 285160814Ssimon if ($LIBC) 286160814Ssimon { 287160814Ssimon $out_def.="_nw_libc"; 288160814Ssimon $tmp_def.="_nw_libc"; 289160814Ssimon $inc_def.="_nw_libc"; 290160814Ssimon } 291194206Ssimon else # NETWARE_CLIB 292160814Ssimon { 293160814Ssimon $out_def.="_nw_clib"; 294160814Ssimon $tmp_def.="_nw_clib"; 295160814Ssimon $inc_def.="_nw_clib"; 296160814Ssimon } 297160814Ssimon} 298160814Ssimon 299160814Ssimon# used by mk1mf.pl 300194206Ssimon$obj='.o'; 301160814Ssimon$ofile='-o '; 302160814Ssimon$efile=''; 303160814Ssimon$exep='.nlm'; 304160814Ssimon$ex_libs=''; 305160814Ssimon 306160814Ssimonif (!$no_asm) 307160814Ssimon{ 308194206Ssimon $bn_asm_obj="\$(OBJ_D)${o}bn-nw${obj}"; 309160814Ssimon $bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm"; 310194206Ssimon $bnco_asm_obj="\$(OBJ_D)${o}co-nw${obj}"; 311194206Ssimon $bnco_asm_src="crypto${o}bn${o}asm${o}co-nw.asm"; 312194206Ssimon $aes_asm_obj="\$(OBJ_D)${o}a-nw${obj}"; 313194206Ssimon $aes_asm_src="crypto${o}aes${o}asm${o}a-nw.asm"; 314194206Ssimon $des_enc_obj="\$(OBJ_D)${o}d-nw${obj} \$(OBJ_D)${o}y-nw${obj}"; 315160814Ssimon $des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm"; 316194206Ssimon $bf_enc_obj="\$(OBJ_D)${o}b-nw${obj}"; 317160814Ssimon $bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm"; 318194206Ssimon $cast_enc_obj="\$(OBJ_D)${o}c-nw${obj}"; 319160814Ssimon $cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm"; 320194206Ssimon $rc4_enc_obj="\$(OBJ_D)${o}r4-nw${obj}"; 321160814Ssimon $rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm"; 322194206Ssimon $rc5_enc_obj="\$(OBJ_D)${o}r5-nw${obj}"; 323160814Ssimon $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm"; 324194206Ssimon $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}"; 325160814Ssimon $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm"; 326194206Ssimon $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj}"; 327160814Ssimon $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm"; 328194206Ssimon $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}"; 329160814Ssimon $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm"; 330194206Ssimon $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}"; 331194206Ssimon $cpuid_asm_src="crypto${o}x86cpuid-nw.asm"; 332194206Ssimon $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DSHA1_ASM"; 333194206Ssimon $cflags.=" -DAES_ASM -DRMD160_ASM"; 334160814Ssimon} 335160814Ssimonelse 336160814Ssimon{ 337160814Ssimon $bn_asm_obj=''; 338160814Ssimon $bn_asm_src=''; 339194206Ssimon $bnco_asm_obj=''; 340194206Ssimon $bnco_asm_src=''; 341194206Ssimon $aes_asm_obj=''; 342194206Ssimon $aes_asm_src=''; 343160814Ssimon $des_enc_obj=''; 344160814Ssimon $des_enc_src=''; 345160814Ssimon $bf_enc_obj=''; 346160814Ssimon $bf_enc_src=''; 347160814Ssimon $cast_enc_obj=''; 348160814Ssimon $cast_enc_src=''; 349160814Ssimon $rc4_enc_obj=''; 350160814Ssimon $rc4_enc_src=''; 351160814Ssimon $rc5_enc_obj=''; 352160814Ssimon $rc5_enc_src=''; 353160814Ssimon $md5_asm_obj=''; 354160814Ssimon $md5_asm_src=''; 355160814Ssimon $sha1_asm_obj=''; 356160814Ssimon $sha1_asm_src=''; 357160814Ssimon $rmd160_asm_obj=''; 358160814Ssimon $rmd160_asm_src=''; 359194206Ssimon $cpuid_asm_obj=''; 360194206Ssimon $cpuid_asm_src=''; 361160814Ssimon} 362160814Ssimon 363160814Ssimon# create the *.def linker command files in \openssl\netware\ directory 364160814Ssimonsub do_def_file 365160814Ssimon{ 366160814Ssimon # strip off the leading path 367194206Ssimon my($target) = bname(shift); 368160814Ssimon my($i); 369160814Ssimon 370160814Ssimon if ($target =~ /(.*).nlm/) 371160814Ssimon { 372160814Ssimon $target = $1; 373160814Ssimon } 374160814Ssimon 375160814Ssimon # special case for openssl - the mk1mf.pl defines E_EXE = openssl 376160814Ssimon if ($target =~ /E_EXE/) 377160814Ssimon { 378194206Ssimon $target =~ s/\$\(E_EXE\)/openssl/; 379160814Ssimon } 380160814Ssimon 381160814Ssimon # Note: originally tried to use full path ( \openssl\netware\$target.def ) 382160814Ssimon # Metrowerks linker choked on this with an assertion failure. bug??? 383160814Ssimon # 384194206Ssimon my($def_file) = "netware${o}$target.def"; 385160814Ssimon 386160814Ssimon open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n"); 387160814Ssimon 388194206Ssimon print( DEF_OUT "# command file generated by netware.pl for NLM target.\n" ); 389194206Ssimon print( DEF_OUT "# do not edit this file - all your changes will be lost!!\n" ); 390160814Ssimon print( DEF_OUT "#\n"); 391194206Ssimon print( DEF_OUT "DESCRIPTION \"$target ($libarch) - OpenSSL $nlmverstr\"\n"); 392194206Ssimon print( DEF_OUT "COPYRIGHT \"$nlmcpystr\"\n"); 393194206Ssimon print( DEF_OUT "VERSION $nlmvernum\n"); 394194206Ssimon print( DEF_OUT "STACK $nlmstack\n"); 395194206Ssimon print( DEF_OUT "START $nlmstart\n"); 396194206Ssimon print( DEF_OUT "EXIT $nlmexit\n"); 397194206Ssimon 398194206Ssimon # special case for openssl 399194206Ssimon if ($target eq "openssl") 400194206Ssimon { 401194206Ssimon print( DEF_OUT "SCREENNAME \"OpenSSL $nlmverstr\"\n"); 402194206Ssimon } 403194206Ssimon else 404194206Ssimon { 405194206Ssimon print( DEF_OUT "SCREENNAME \"DEFAULT\"\n"); 406194206Ssimon } 407194206Ssimon 408160814Ssimon foreach $i (@misc_imports) 409160814Ssimon { 410160814Ssimon print( DEF_OUT "IMPORT $i\n"); 411160814Ssimon } 412194206Ssimon 413160814Ssimon foreach $i (@import_files) 414160814Ssimon { 415194206Ssimon print( DEF_OUT "IMPORT \@$import_path${o}$i\n"); 416160814Ssimon } 417194206Ssimon 418160814Ssimon foreach $i (@module_files) 419160814Ssimon { 420160814Ssimon print( DEF_OUT "MODULE $i\n"); 421160814Ssimon } 422160814Ssimon 423194206Ssimon foreach $i (@nlm_flags) 424194206Ssimon { 425194206Ssimon print( DEF_OUT "$i\n"); 426194206Ssimon } 427194206Ssimon 428194206Ssimon if ($gnuc) 429194206Ssimon { 430194206Ssimon if ($target =~ /openssl/) 431194206Ssimon { 432194206Ssimon print( DEF_OUT "INPUT ${tmp_def}${o}openssl${obj}\n"); 433194206Ssimon print( DEF_OUT "INPUT ${tmp_def}${o}openssl${libp}\n"); 434194206Ssimon } 435194206Ssimon else 436194206Ssimon { 437194206Ssimon print( DEF_OUT "INPUT ${tmp_def}${o}${target}${obj}\n"); 438194206Ssimon } 439194206Ssimon print( DEF_OUT "INPUT $prelude\n"); 440194206Ssimon print( DEF_OUT "INPUT ${out_def}${o}${ssl}${libp} ${out_def}${o}${crypto}${libp}\n"); 441194206Ssimon print( DEF_OUT "OUTPUT $target.nlm\n"); 442194206Ssimon } 443194206Ssimon 444160814Ssimon close(DEF_OUT); 445160814Ssimon return($def_file); 446160814Ssimon} 447160814Ssimon 448160814Ssimonsub do_lib_rule 449160814Ssimon{ 450160814Ssimon my($objs,$target,$name,$shlib)=@_; 451160814Ssimon my($ret); 452160814Ssimon 453160814Ssimon $ret.="$target: $objs\n"; 454160814Ssimon if (!$shlib) 455160814Ssimon { 456160814Ssimon $ret.="\t\@echo Building Lib: $name\n"; 457194206Ssimon $ret.="\t\$(MKLIB) $lib_flags $target $objs\n"; 458160814Ssimon $ret.="\t\@echo .\n" 459160814Ssimon } 460160814Ssimon else 461160814Ssimon { 462160814Ssimon die( "Building as NLM not currently supported!" ); 463160814Ssimon } 464160814Ssimon 465160814Ssimon $ret.="\n"; 466160814Ssimon return($ret); 467160814Ssimon} 468160814Ssimon 469160814Ssimonsub do_link_rule 470160814Ssimon{ 471160814Ssimon my($target,$files,$dep_libs,$libs)=@_; 472160814Ssimon my($ret); 473194206Ssimon my($def_file) = do_def_file($target); 474160814Ssimon 475194206Ssimon $ret.="$target: $files $dep_libs\n"; 476160814Ssimon 477160814Ssimon # NOTE: When building the test nlms no screen name is given 478160814Ssimon # which causes the console screen to be used. By using the console 479160814Ssimon # screen there is no "<press any key to continue>" message which 480194206Ssimon # requires user interaction. The test script ( do_tests.pl ) needs 481194206Ssimon # to be able to run the tests without requiring user interaction. 482160814Ssimon # 483160814Ssimon # However, the sample program "openssl.nlm" is used by the tests and is 484160814Ssimon # a interactive sample so a screen is desired when not be run by the 485160814Ssimon # tests. To solve the problem, two versions of the program are built: 486160814Ssimon # openssl2 - no screen used by tests 487160814Ssimon # openssl - default screen - use for normal interactive modes 488160814Ssimon # 489194206Ssimon 490194206Ssimon # special case for openssl - the mk1mf.pl defines E_EXE = openssl 491160814Ssimon if ($target =~ /E_EXE/) 492160814Ssimon { 493160814Ssimon my($target2) = $target; 494160814Ssimon 495160814Ssimon $target2 =~ s/\(E_EXE\)/\(E_EXE\)2/; 496160814Ssimon 497194206Ssimon # openssl2 498194206Ssimon my($def_file2) = do_def_file($target2); 499160814Ssimon 500194206Ssimon if ($gnuc) 501194206Ssimon { 502194206Ssimon $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n"; 503194206Ssimon $ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n"; 504194206Ssimon $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n"; 505194206Ssimon } 506194206Ssimon else 507194206Ssimon { 508194206Ssimon $ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n"; 509194206Ssimon } 510160814Ssimon } 511194206Ssimon if ($gnuc) 512194206Ssimon { 513194206Ssimon $ret.="\t\$(LINK) \$(LFLAGS) $def_file\n"; 514194206Ssimon $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n"; 515194206Ssimon } 516160814Ssimon else 517160814Ssimon { 518194206Ssimon $ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n"; 519160814Ssimon } 520160814Ssimon 521160814Ssimon $ret.="\n"; 522160814Ssimon return($ret); 523194206Ssimon 524160814Ssimon} 525160814Ssimon 526160814Ssimon1; 527