summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/util/pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/util/pl')
-rw-r--r--src/lib/libcrypto/util/pl/VC-32.pl180
-rw-r--r--src/lib/libcrypto/util/pl/netware.pl526
2 files changed, 543 insertions, 163 deletions
diff --git a/src/lib/libcrypto/util/pl/VC-32.pl b/src/lib/libcrypto/util/pl/VC-32.pl
index 730c2083bd..1e254119e6 100644
--- a/src/lib/libcrypto/util/pl/VC-32.pl
+++ b/src/lib/libcrypto/util/pl/VC-32.pl
@@ -4,26 +4,12 @@
4# 4#
5 5
6$ssl= "ssleay32"; 6$ssl= "ssleay32";
7 7$crypto="libeay32";
8if ($fips && !$shlib)
9 {
10 $crypto="libeayfips32";
11 $crypto_compat = "libeaycompat32.lib";
12 }
13else
14 {
15 $crypto="libeay32";
16 }
17
18if ($fipscanisterbuild)
19 {
20 $fips_canister_path = "\$(LIB_D)\\fipscanister.lib";
21 }
22 8
23$o='\\'; 9$o='\\';
24$cp='$(PERL) util/copy.pl'; 10$cp='$(PERL) util/copy.pl';
25$mkdir='$(PERL) util/mkdir-p.pl'; 11$mkdir='$(PERL) util/mkdir-p.pl';
26$rm='del /Q'; 12$rm='del';
27 13
28$zlib_lib="zlib1.lib"; 14$zlib_lib="zlib1.lib";
29 15
@@ -110,7 +96,7 @@ else # Win32
110 $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32'; 96 $base_cflags=' /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32';
111 $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8 97 $base_cflags.=' -D_CRT_SECURE_NO_DEPRECATE'; # shut up VC8
112 $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8 98 $base_cflags.=' -D_CRT_NONSTDC_NO_DEPRECATE'; # shut up VC8
113 my $f = $shlib || $fips ?' /MD':' /MT'; 99 my $f = $shlib?' /MD':' /MT';
114 $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib 100 $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
115 $opt_cflags=$f.' /Ox /O2 /Ob2'; 101 $opt_cflags=$f.' /Ox /O2 /Ob2';
116 $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG'; 102 $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
@@ -179,17 +165,12 @@ if ($nasm) {
179 # pick newest version 165 # pick newest version
180 $asm=($ver gt $vew?"nasm":"nasmw")." -f win32"; 166 $asm=($ver gt $vew?"nasm":"nasmw")." -f win32";
181 $afile='-o '; 167 $afile='-o ';
182} elsif ($ml64) {
183 $asm='ml64 /c /Cp /Cx';
184 $asm.=' /Zi' if $debug;
185 $afile='/Fo';
186} else { 168} else {
187 $asm='ml /Cp /coff /c /Cx'; 169 $asm='ml /Cp /coff /c /Cx';
188 $asm.=" /Zi" if $debug; 170 $asm.=" /Zi" if $debug;
189 $afile='/Fo'; 171 $afile='/Fo';
190} 172}
191 173
192$aes_asm_obj='';
193$bn_asm_obj=''; 174$bn_asm_obj='';
194$bn_asm_src=''; 175$bn_asm_src='';
195$des_enc_obj=''; 176$des_enc_obj='';
@@ -198,13 +179,11 @@ $bf_enc_obj='';
198$bf_enc_src=''; 179$bf_enc_src='';
199 180
200if (!$no_asm) 181if (!$no_asm)
201 {
202 if ($FLAVOR =~ "WIN32")
203 { 182 {
204 $aes_asm_obj='crypto\aes\asm\a_win32.obj'; 183 $aes_asm_obj='crypto\aes\asm\a_win32.obj';
205 $aes_asm_src='crypto\aes\asm\a_win32.asm'; 184 $aes_asm_src='crypto\aes\asm\a_win32.asm';
206 $bn_asm_obj='crypto\bn\asm\bn_win32.obj crypto\bn\asm\mt_win32.obj'; 185 $bn_asm_obj='crypto\bn\asm\bn_win32.obj';
207 $bn_asm_src='crypto\bn\asm\bn_win32.asm crypto\bn\asm\mt_win32.asm'; 186 $bn_asm_src='crypto\bn\asm\bn_win32.asm';
208 $bnco_asm_obj='crypto\bn\asm\co_win32.obj'; 187 $bnco_asm_obj='crypto\bn\asm\co_win32.obj';
209 $bnco_asm_src='crypto\bn\asm\co_win32.asm'; 188 $bnco_asm_src='crypto\bn\asm\co_win32.asm';
210 $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj'; 189 $des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
@@ -225,26 +204,12 @@ if (!$no_asm)
225 $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm'; 204 $rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
226 $cpuid_asm_obj='crypto\cpu_win32.obj'; 205 $cpuid_asm_obj='crypto\cpu_win32.obj';
227 $cpuid_asm_src='crypto\cpu_win32.asm'; 206 $cpuid_asm_src='crypto\cpu_win32.asm';
228 $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"; 207 $cflags.=" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
229 } 208 }
230 elsif ($FLAVOR =~ "WIN64A")
231 {
232 $aes_asm_obj='$(OBJ_D)\aes-x86_64.obj';
233 $aes_asm_src='crypto\aes\asm\aes-x86_64.asm';
234 $bn_asm_obj='$(OBJ_D)\x86_64-mont.obj $(OBJ_D)\bn_asm.obj';
235 $bn_asm_src='crypto\bn\asm\x86_64-mont.asm';
236 $sha1_asm_obj='$(OBJ_D)\sha1-x86_64.obj $(OBJ_D)\sha256-x86_64.obj $(OBJ_D)\sha512-x86_64.obj';
237 $sha1_asm_src='crypto\sha\asm\sha1-x86_64.asm crypto\sha\asm\sha256-x86_64.asm crypto\sha\asm\sha512-x86_64.asm';
238 $cpuid_asm_obj='$(OBJ_D)\cpuid-x86_64.obj';
239 $cpuid_asm_src='crypto\cpuid-x86_64.asm';
240 $cflags.=" -DOPENSSL_CPUID_OBJ -DAES_ASM -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM";
241 }
242 }
243 209
244if ($shlib && $FLAVOR !~ /CE/) 210if ($shlib && $FLAVOR !~ /CE/)
245 { 211 {
246 $mlflags.=" $lflags /dll"; 212 $mlflags.=" $lflags /dll";
247# $cflags =~ s| /MD| /MT|;
248 $lib_cflag=" -D_WINDLL"; 213 $lib_cflag=" -D_WINDLL";
249 $out_def="out32dll"; 214 $out_def="out32dll";
250 $tmp_def="tmp32dll"; 215 $tmp_def="tmp32dll";
@@ -267,8 +232,8 @@ $(INCO_D)\applink.c: ms\applink.c
267EXHEADER= $(EXHEADER) $(INCO_D)\applink.c 232EXHEADER= $(EXHEADER) $(INCO_D)\applink.c
268 233
269LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj 234LIBS_DEP=$(LIBS_DEP) $(OBJ_D)\applink.obj
235CRYPTOOBJ=$(OBJ_D)\uplink.obj $(CRYPTOOBJ)
270___ 236___
271$banner .= "CRYPTOOBJ=\$(OBJ_D)\\uplink.obj \$(CRYPTOOBJ)\n";
272 $banner.=<<'___' if ($FLAVOR =~ /WIN64/); 237 $banner.=<<'___' if ($FLAVOR =~ /WIN64/);
273CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ) 238CRYPTOOBJ=ms\uptable.obj $(CRYPTOOBJ)
274___ 239___
@@ -285,57 +250,26 @@ $cflags.=" /Fd$out_def";
285 250
286sub do_lib_rule 251sub do_lib_rule
287 { 252 {
288 my($objs,$target,$name,$shlib,$ign,$base_addr) = @_; 253 local($objs,$target,$name,$shlib)=@_;
289 local($ret); 254 local($ret);
290 255
291 $taget =~ s/\//$o/g if $o ne '/'; 256 $taget =~ s/\//$o/g if $o ne '/';
292 my $base_arg; 257 if ($name ne "")
293 if ($base_addr ne "")
294 {
295 $base_arg= " /base:$base_addr";
296 }
297 else
298 {
299 $base_arg = "";
300 }
301 if ($target =~ /O_CRYPTO/ && $fipsdso)
302 {
303 $name = "/def:ms/libeayfips.def";
304 }
305 elsif ($name ne "")
306 { 258 {
307 $name =~ tr/a-z/A-Z/; 259 $name =~ tr/a-z/A-Z/;
308 $name = "/def:ms/${name}.def"; 260 $name = "/def:ms/${name}.def";
309 } 261 }
310
311# $target="\$(LIB_D)$o$target"; 262# $target="\$(LIB_D)$o$target";
312# $ret.="$target: $objs\n"; 263 $ret.="$target: $objs\n";
313 if (!$shlib) 264 if (!$shlib)
314 { 265 {
315# $ret.="\t\$(RM) \$(O_$Name)\n"; 266# $ret.="\t\$(RM) \$(O_$Name)\n";
316 $ex =' '; 267 $ex =' ';
317 $ret.="$target: $objs\n";
318 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; 268 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n";
319 } 269 }
320 else 270 else
321 { 271 {
322 my $ex = ""; 272 local($ex)=($target =~ /O_CRYPTO/)?'':' $(L_CRYPTO)';
323 if ($target =~ /O_SSL/)
324 {
325 $ex .= " \$(L_CRYPTO)";
326 #$ex .= " \$(L_FIPS)" if $fipsdso;
327 }
328 my $fipstarget;
329 if ($fipsdso)
330 {
331 $fipstarget = "O_FIPS";
332 }
333 else
334 {
335 $fipstarget = "O_CRYPTO";
336 }
337
338
339 if ($name eq "") 273 if ($name eq "")
340 { 274 {
341 $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); 275 $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/);
@@ -356,39 +290,7 @@ sub do_lib_rule
356 $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); 290 $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/);
357 } 291 }
358 $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/; 292 $ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
359 293 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
360 if ($fips && $target =~ /$fipstarget/)
361 {
362 $ex.= $mwex unless $fipscanisterbuild;
363 $ret.="$target: $objs \$(PREMAIN_DSO_EXE)";
364 if ($fipsdso)
365 {
366 $ex.=" \$(OBJ_D)\\\$(LIBFIPS).res";
367 $ret.=" \$(OBJ_D)\\\$(LIBFIPS).res";
368 $ret.=" ms/\$(LIBFIPS).def";
369 }
370 $ret.="\n\tSET FIPS_LINK=\$(LINK)\n";
371 $ret.="\tSET FIPS_CC=\$(CC)\n";
372 $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
373 $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n";
374 $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
375 $ret.="\tSET FIPS_TARGET=$target\n";
376 $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
377 $ret.="\t\$(FIPSLINK) \$(MLFLAGS) /map $base_arg $efile$target ";
378 $ret.="$name @<<\n \$(SHLIB_EX_OBJ) $objs ";
379 $ret.="\$(OBJ_D)${o}fips_premain.obj $ex\n<<\n";
380 }
381 else
382 {
383 $ret.="$target: $objs";
384 if ($target =~ /O_CRYPTO/ && $fipsdso)
385 {
386 $ret .= " \$(O_FIPS)";
387 $ex .= " \$(L_FIPS)";
388 }
389 $ret.="\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
390 }
391
392 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n"; 294 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n";
393 } 295 }
394 $ret.="\n"; 296 $ret.="\n";
@@ -397,64 +299,16 @@ sub do_lib_rule
397 299
398sub do_link_rule 300sub do_link_rule
399 { 301 {
400 my($target,$files,$dep_libs,$libs,$standalone)=@_; 302 local($target,$files,$dep_libs,$libs)=@_;
401 local($ret,$_); 303 local($ret,$_);
304
402 $file =~ s/\//$o/g if $o ne '/'; 305 $file =~ s/\//$o/g if $o ne '/';
403 $n=&bname($targer); 306 $n=&bname($targer);
404 $ret.="$target: $files $dep_libs\n"; 307 $ret.="$target: $files $dep_libs\n";
405 if ($standalone == 1) 308 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
406 { 309 $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n";
407 $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; 310 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
408 $ret.= "$mwex advapi32.lib " if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild);
409 $ret.="$files $libs\n<<\n";
410 }
411 elsif ($standalone == 2)
412 {
413 $ret.="\tSET FIPS_LINK=\$(LINK)\n";
414 $ret.="\tSET FIPS_CC=\$(CC)\n";
415 $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
416 $ret.="\tSET PREMAIN_DSO_EXE=\n";
417 $ret.="\tSET FIPS_TARGET=$target\n";
418 $ret.="\tSET FIPS_SHA1_EXE=\$(FIPS_SHA1_EXE)\n";
419 $ret.="\tSET FIPSLIB_D=\$(FIPSLIB_D)\n";
420 $ret.="\t\$(FIPSLINK) \$(LFLAGS) /map $efile$target @<<\n";
421 $ret.="\t\$(APP_EX_OBJ) $files \$(OBJ_D)${o}fips_premain.obj $libs\n<<\n";
422 }
423 else
424 {
425 $ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n";
426 $ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n";
427 }
428 $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";
429 return($ret); 311 return($ret);
430 } 312 }
431 313
432sub do_rlink_rule
433 {
434 local($target,$rl_start, $rl_mid, $rl_end,$dep_libs,$libs)=@_;
435 local($ret,$_);
436 my $files = "$rl_start $rl_mid $rl_end";
437
438 $file =~ s/\//$o/g if $o ne '/';
439 $n=&bname($targer);
440 $ret.="$target: $files $dep_libs \$(FIPS_SHA1_EXE)\n";
441 $ret.="\t\$(PERL) ms\\segrenam.pl \$\$a $rl_start\n";
442 $ret.="\t\$(PERL) ms\\segrenam.pl \$\$b $rl_mid\n";
443 $ret.="\t\$(PERL) ms\\segrenam.pl \$\$c $rl_end\n";
444 $ret.="\t\$(MKLIB) $lfile$target @<<\n\t$files\n<<\n";
445 $ret.="\t\$(FIPS_SHA1_EXE) $target > ${target}.sha1\n";
446 $ret.="\t\$(PERL) util${o}copy.pl -stripcr fips${o}fips_premain.c \$(LIB_D)${o}fips_premain.c\n";
447 $ret.="\t\$(CP) fips${o}fips_premain.c.sha1 \$(LIB_D)${o}fips_premain.c.sha1\n";
448 $ret.="\n";
449 return($ret);
450 }
451
452sub do_sdef_rule
453 {
454 my $ret = "ms/\$(LIBFIPS).def: \$(O_FIPSCANISTER)\n";
455 $ret.="\t\$(PERL) util/mksdef.pl \$(MLFLAGS) /out:dummy.dll /def:ms/libeay32.def @<<\n \$(O_FIPSCANISTER)\n<<\n";
456 $ret.="\n";
457 return $ret;
458 }
459
4601; 3141;
diff --git a/src/lib/libcrypto/util/pl/netware.pl b/src/lib/libcrypto/util/pl/netware.pl
new file mode 100644
index 0000000000..173c9919f2
--- /dev/null
+++ b/src/lib/libcrypto/util/pl/netware.pl
@@ -0,0 +1,526 @@
1# Metrowerks Codewarrior or gcc / nlmconv for NetWare
2#
3
4$version_header = "crypto/opensslv.h";
5open(IN, "$version_header") or die "Couldn't open $version_header: $!";
6while (<IN>) {
7 if (/^#define[\s\t]+OPENSSL_VERSION_NUMBER[\s\t]+0x(\d)(\d{2})(\d{2})(\d{2})/)
8 {
9 # die "OpenSSL version detected: $1.$2.$3.$4\n";
10 #$nlmvernum = "$1,$2,$3";
11 $nlmvernum = "$1,".($2*10+$3).",".($4*1);
12 #$nlmverstr = "$1.".($2*1).".".($3*1).($4?(chr(96+$4)):"");
13 break;
14 }
15}
16close(IN) or die "Couldn't close $version_header: $!";
17
18$readme_file = "README";
19open(IN, $readme_file) or die "Couldn't open $readme_file: $!";
20while (<IN>) {
21 if (/^[\s\t]+OpenSSL[\s\t]+(\d)\.(\d{1,2})\.(\d{1,2})([a-z])(.*)/)
22 {
23 #$nlmvernum = "$1,$2,$3";
24 #$nlmvernum = "$1,".($2*10+$3).",".($4*1);
25 $nlmverstr = "$1.$2.$3$4$5";
26 }
27 elsif (/^[\s\t]+(Copyright \(c\) \d{4}\-\d{4} The OpenSSL Project)$/)
28 {
29 $nlmcpystr = $1;
30 }
31 break if ($nlmvernum && $nlmcpystr);
32}
33close(IN) or die "Couldn't close $readme_file: $!";
34
35# Define stacksize here
36$nlmstack = "32768";
37
38# some default settings here in case we failed to find them in README
39$nlmvernum = "1,0,0" if (!$nlmvernum);
40$nlmverstr = "OpenSSL" if (!$nlmverstr);
41$nlmcpystr = "Copyright (c) 1998-now The OpenSSL Project" if (!$nlmcpystr);
42
43# die "OpenSSL copyright: $nlmcpystr\nOpenSSL verstring: $nlmverstr\nOpenSSL vernumber: $nlmvernum\n";
44
45# The import files and other misc imports needed to link
46@misc_imports = ("GetProcessSwitchCount", "RunningProcess",
47 "GetSuperHighResolutionTimer");
48if ($LIBC)
49{
50 @import_files = ("libc.imp");
51 @module_files = ("libc");
52 $libarch = "LIBC";
53}
54else
55{
56 # clib build
57 @import_files = ("clib.imp");
58 push(@import_files, "socklib.imp") if ($BSDSOCK);
59 @module_files = ("clib");
60 # push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16");
61 $libarch = "CLIB";
62}
63if ($BSDSOCK)
64{
65 $libarch .= "-BSD";
66}
67else
68{
69 $libarch .= "-WS2";
70 push(@import_files, "ws2nlm.imp");
71}
72
73# The "IMPORTS" environment variable must be set and point to the location
74# where import files (*.imp) can be found.
75# Example: set IMPORTS=c:\ndk\nwsdk\imports
76$import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n");
77
78
79# The "PRELUDE" environment variable must be set and point to the location
80# and name of the prelude source to link with ( nwpre.obj is recommended ).
81# Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj
82$prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n");
83
84# The "INCLUDES" environment variable must be set and point to the location
85# where import files (*.imp) can be found.
86$include_path = $ENV{"INCLUDE"} || die ("INCLUDES environment variable not set\n");
87$include_path =~ s/\\/\//g;
88$include_path = join(" -I", split(/;/, $include_path));
89
90# check for gcc compiler
91$gnuc = $ENV{"GNUC"};
92
93#$ssl= "ssleay32";
94#$crypto="libeay32";
95
96if ($gnuc)
97{
98 # C compiler
99 $cc='gcc';
100 # Linker
101 $link='nlmconv';
102 # librarian
103 $mklib='ar';
104 $o='/';
105 # cp command
106 $cp='cp -af';
107 # rm command
108 $rm='rm -f';
109 # mv command
110 $mv='mv -f';
111 # mkdir command
112 $mkdir='gmkdir';
113 #$ranlib='ranlib';
114}
115else
116{
117 # C compiler
118 $cc='mwccnlm';
119 # Linker
120 $link='mwldnlm';
121 # librarian
122 $mklib='mwldnlm';
123 # Path separator
124 $o='\\';
125 # cp command
126 $cp='copy >nul:';
127 # rm command
128 $rm='del /f /q';
129}
130
131# assembler
132if ($nw_nasm)
133{
134 if ($gnuc)
135 {
136 $asm="nasmw -s -f elf";
137 }
138 else
139 {
140 $asm="nasmw -s -f coff";
141 }
142 $afile="-o ";
143 $asm.=" -g" if $debug;
144}
145elsif ($nw_mwasm)
146{
147 $asm="mwasmnlm -maxerrors 20";
148 $afile="-o ";
149 $asm.=" -g" if $debug;
150}
151elsif ($nw_masm)
152{
153# masm assembly settings - it should be possible to use masm but haven't
154# got it working.
155# $asm='ml /Cp /coff /c /Cx';
156# $asm.=" /Zi" if $debug;
157# $afile='/Fo';
158 die("Support for masm assembler not yet functional\n");
159}
160else
161{
162 $asm="";
163 $afile="";
164}
165
166
167
168if ($gnuc)
169{
170 # compile flags for GNUC
171 # additional flags based upon debug | non-debug
172 if ($debug)
173 {
174 $cflags="-g -DDEBUG";
175 }
176 else
177 {
178 $cflags="-O2";
179 }
180 $cflags.=" -nostdinc -I$include_path \\
181 -fno-builtin -fpcc-struct-return -fno-strict-aliasing \\
182 -funsigned-char -Wall -Wno-unused -Wno-uninitialized";
183
184 # link flags
185 $lflags="-T";
186}
187else
188{
189 # compile flags for CodeWarrior
190 # additional flags based upon debug | non-debug
191 if ($debug)
192 {
193 $cflags="-opt off -g -sym internal -DDEBUG";
194 }
195 else
196 {
197 # CodeWarrior compiler has a problem with optimizations for floating
198 # points - no optimizations until further investigation
199 # $cflags="-opt all";
200 }
201
202 # NOTES: Several c files in the crypto subdirectory include headers from
203 # their local directories. Metrowerks wouldn't find these h files
204 # without adding individual include directives as compile flags
205 # or modifying the c files. Instead of adding individual include
206 # paths for each subdirectory a recursive include directive
207 # is used ( -ir crypto ).
208 #
209 # A similar issue exists for the engines and apps subdirectories.
210 #
211 # Turned off the "possible" warnings ( -w nopossible ). Metrowerks
212 # complained a lot about various stuff. May want to turn back
213 # on for further development.
214 $cflags.=" -nostdinc -ir crypto -ir engines -ir apps -I$include_path \\
215 -msgstyle gcc -align 4 -processor pentium -char unsigned \\
216 -w on -w nolargeargs -w nopossible -w nounusedarg -w nounusedexpr \\
217 -w noimplicitconv -relax_pointers -nosyspath -maxerrors 20";
218
219 # link flags
220 $lflags="-msgstyle gcc -zerobss -nostdlib -sym internal -commandfile";
221}
222
223# common defines
224$cflags.=" -DL_ENDIAN -DOPENSSL_SYSNAME_NETWARE -U_WIN32";
225
226# If LibC build add in NKS_LIBC define and set the entry/exit
227# routines - The default entry/exit routines are for CLib and don't exist
228# in LibC
229if ($LIBC)
230{
231 $cflags.=" -DNETWARE_LIBC";
232 $nlmstart = "_LibCPrelude";
233 $nlmexit = "_LibCPostlude";
234 @nlm_flags = ("pseudopreemption", "flag_on 64");
235}
236else
237{
238 $cflags.=" -DNETWARE_CLIB";
239 $nlmstart = "_Prelude";
240 $nlmexit = "_Stop";
241}
242
243# If BSD Socket support is requested, set a define for the compiler
244if ($BSDSOCK)
245{
246 $cflags.=" -DNETWARE_BSDSOCK";
247 if (!$LIBC)
248 {
249 $cflags.=" -DNETDB_USE_INTERNET";
250 }
251}
252
253
254# linking stuff
255# for the output directories use the mk1mf.pl values with "_nw" appended
256if ($shlib)
257{
258 if ($LIBC)
259 {
260 $out_def.="_nw_libc_nlm";
261 $tmp_def.="_nw_libc_nlm";
262 $inc_def.="_nw_libc_nlm";
263 }
264 else # NETWARE_CLIB
265 {
266 $out_def.="_nw_clib_nlm";
267 $tmp_def.="_nw_clib_nlm";
268 $inc_def.="_nw_clib_nlm";
269 }
270}
271else
272{
273 if ($gnuc) # GNUC Tools
274 {
275 $libp=".a";
276 $shlibp=".a";
277 $lib_flags="-cr";
278 }
279 else # CodeWarrior
280 {
281 $libp=".lib";
282 $shlibp=".lib";
283 $lib_flags="-nodefaults -type library -o";
284 }
285 if ($LIBC)
286 {
287 $out_def.="_nw_libc";
288 $tmp_def.="_nw_libc";
289 $inc_def.="_nw_libc";
290 }
291 else # NETWARE_CLIB
292 {
293 $out_def.="_nw_clib";
294 $tmp_def.="_nw_clib";
295 $inc_def.="_nw_clib";
296 }
297}
298
299# used by mk1mf.pl
300$obj='.o';
301$ofile='-o ';
302$efile='';
303$exep='.nlm';
304$ex_libs='';
305
306if (!$no_asm)
307{
308 $bn_asm_obj="\$(OBJ_D)${o}bn-nw${obj}";
309 $bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm";
310 $bnco_asm_obj="\$(OBJ_D)${o}co-nw${obj}";
311 $bnco_asm_src="crypto${o}bn${o}asm${o}co-nw.asm";
312 $aes_asm_obj="\$(OBJ_D)${o}a-nw${obj}";
313 $aes_asm_src="crypto${o}aes${o}asm${o}a-nw.asm";
314 $des_enc_obj="\$(OBJ_D)${o}d-nw${obj} \$(OBJ_D)${o}y-nw${obj}";
315 $des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm";
316 $bf_enc_obj="\$(OBJ_D)${o}b-nw${obj}";
317 $bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm";
318 $cast_enc_obj="\$(OBJ_D)${o}c-nw${obj}";
319 $cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm";
320 $rc4_enc_obj="\$(OBJ_D)${o}r4-nw${obj}";
321 $rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm";
322 $rc5_enc_obj="\$(OBJ_D)${o}r5-nw${obj}";
323 $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm";
324 $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}";
325 $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm";
326 $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj}";
327 $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm";
328 $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}";
329 $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm";
330 $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}";
331 $cpuid_asm_src="crypto${o}x86cpuid-nw.asm";
332 $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DSHA1_ASM";
333 $cflags.=" -DAES_ASM -DRMD160_ASM";
334}
335else
336{
337 $bn_asm_obj='';
338 $bn_asm_src='';
339 $bnco_asm_obj='';
340 $bnco_asm_src='';
341 $aes_asm_obj='';
342 $aes_asm_src='';
343 $des_enc_obj='';
344 $des_enc_src='';
345 $bf_enc_obj='';
346 $bf_enc_src='';
347 $cast_enc_obj='';
348 $cast_enc_src='';
349 $rc4_enc_obj='';
350 $rc4_enc_src='';
351 $rc5_enc_obj='';
352 $rc5_enc_src='';
353 $md5_asm_obj='';
354 $md5_asm_src='';
355 $sha1_asm_obj='';
356 $sha1_asm_src='';
357 $rmd160_asm_obj='';
358 $rmd160_asm_src='';
359 $cpuid_asm_obj='';
360 $cpuid_asm_src='';
361}
362
363# create the *.def linker command files in \openssl\netware\ directory
364sub do_def_file
365{
366 # strip off the leading path
367 my($target) = bname(shift);
368 my($i);
369
370 if ($target =~ /(.*).nlm/)
371 {
372 $target = $1;
373 }
374
375 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
376 if ($target =~ /E_EXE/)
377 {
378 $target =~ s/\$\(E_EXE\)/openssl/;
379 }
380
381 # Note: originally tried to use full path ( \openssl\netware\$target.def )
382 # Metrowerks linker choked on this with an assertion failure. bug???
383 #
384 my($def_file) = "netware${o}$target.def";
385
386 open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n");
387
388 print( DEF_OUT "# command file generated by netware.pl for NLM target.\n" );
389 print( DEF_OUT "# do not edit this file - all your changes will be lost!!\n" );
390 print( DEF_OUT "#\n");
391 print( DEF_OUT "DESCRIPTION \"$target ($libarch) - OpenSSL $nlmverstr\"\n");
392 print( DEF_OUT "COPYRIGHT \"$nlmcpystr\"\n");
393 print( DEF_OUT "VERSION $nlmvernum\n");
394 print( DEF_OUT "STACK $nlmstack\n");
395 print( DEF_OUT "START $nlmstart\n");
396 print( DEF_OUT "EXIT $nlmexit\n");
397
398 # special case for openssl
399 if ($target eq "openssl")
400 {
401 print( DEF_OUT "SCREENNAME \"OpenSSL $nlmverstr\"\n");
402 }
403 else
404 {
405 print( DEF_OUT "SCREENNAME \"DEFAULT\"\n");
406 }
407
408 foreach $i (@misc_imports)
409 {
410 print( DEF_OUT "IMPORT $i\n");
411 }
412
413 foreach $i (@import_files)
414 {
415 print( DEF_OUT "IMPORT \@$import_path${o}$i\n");
416 }
417
418 foreach $i (@module_files)
419 {
420 print( DEF_OUT "MODULE $i\n");
421 }
422
423 foreach $i (@nlm_flags)
424 {
425 print( DEF_OUT "$i\n");
426 }
427
428 if ($gnuc)
429 {
430 if ($target =~ /openssl/)
431 {
432 print( DEF_OUT "INPUT ${tmp_def}${o}openssl${obj}\n");
433 print( DEF_OUT "INPUT ${tmp_def}${o}openssl${libp}\n");
434 }
435 else
436 {
437 print( DEF_OUT "INPUT ${tmp_def}${o}${target}${obj}\n");
438 }
439 print( DEF_OUT "INPUT $prelude\n");
440 print( DEF_OUT "INPUT ${out_def}${o}${ssl}${libp} ${out_def}${o}${crypto}${libp}\n");
441 print( DEF_OUT "OUTPUT $target.nlm\n");
442 }
443
444 close(DEF_OUT);
445 return($def_file);
446}
447
448sub do_lib_rule
449{
450 my($objs,$target,$name,$shlib)=@_;
451 my($ret);
452
453 $ret.="$target: $objs\n";
454 if (!$shlib)
455 {
456 $ret.="\t\@echo Building Lib: $name\n";
457 $ret.="\t\$(MKLIB) $lib_flags $target $objs\n";
458 $ret.="\t\@echo .\n"
459 }
460 else
461 {
462 die( "Building as NLM not currently supported!" );
463 }
464
465 $ret.="\n";
466 return($ret);
467}
468
469sub do_link_rule
470{
471 my($target,$files,$dep_libs,$libs)=@_;
472 my($ret);
473 my($def_file) = do_def_file($target);
474
475 $ret.="$target: $files $dep_libs\n";
476
477 # NOTE: When building the test nlms no screen name is given
478 # which causes the console screen to be used. By using the console
479 # screen there is no "<press any key to continue>" message which
480 # requires user interaction. The test script ( do_tests.pl ) needs
481 # to be able to run the tests without requiring user interaction.
482 #
483 # However, the sample program "openssl.nlm" is used by the tests and is
484 # a interactive sample so a screen is desired when not be run by the
485 # tests. To solve the problem, two versions of the program are built:
486 # openssl2 - no screen used by tests
487 # openssl - default screen - use for normal interactive modes
488 #
489
490 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
491 if ($target =~ /E_EXE/)
492 {
493 my($target2) = $target;
494
495 $target2 =~ s/\(E_EXE\)/\(E_EXE\)2/;
496
497 # openssl2
498 my($def_file2) = do_def_file($target2);
499
500 if ($gnuc)
501 {
502 $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n";
503 $ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n";
504 $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n";
505 }
506 else
507 {
508 $ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n";
509 }
510 }
511 if ($gnuc)
512 {
513 $ret.="\t\$(LINK) \$(LFLAGS) $def_file\n";
514 $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n";
515 }
516 else
517 {
518 $ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n";
519 }
520
521 $ret.="\n";
522 return($ret);
523
524}
525
5261;