Ignore machine-check MSRs
[freebsd-src/fkvm-freebsd.git] / crypto / openssl / util / pl / netware.pl
blobc05789b22f9ae0eb6f95ffc48e3951bd70f154d9
1 # Metrowerks Codewarrior for NetWare
4 # The import files and other misc imports needed to link
5 @misc_imports = ("GetProcessSwitchCount", "RunningProcess",
6 "GetSuperHighResolutionTimer");
7 if ($LIBC)
9 @import_files = ("libc.imp");
10 @module_files = ("libc");
12 else
14 # clib build
15 @import_files = ("clib.imp");
16 @module_files = ("clib");
17 push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16");
19 if (!$BSDSOCK)
21 push(@import_files, "ws2nlm.imp");
25 # The "IMPORTS" environment variable must be set and point to the location
26 # where import files (*.imp) can be found.
27 # Example: set IMPORTS=c:\ndk\nwsdk\imports
28 $import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n");
31 # The "PRELUDE" environment variable must be set and point to the location
32 # and name of the prelude source to link with ( nwpre.obj is recommended ).
33 # Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj
34 $prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n");
36 #$ssl= "ssleay32";
37 #$crypto="libeay32";
39 $o='\\\\';
40 $cp='copy >nul:';
41 $rm='del';
43 # C compiler
44 $cc="mwccnlm";
46 # Linker
47 $link="mwldnlm";
49 # librarian
50 $mklib="mwldnlm";
52 # assembler
53 if ($nw_nasm)
55 $asm="nasmw -s -f coff";
56 $afile="-o ";
57 $asm.=" -g" if $debug;
59 elsif ($nw_mwasm)
61 $asm="mwasmnlm -maxerrors 20";
62 $afile="-o ";
63 $asm.=" -g" if $debug;
65 elsif ($nw_masm)
67 # masm assembly settings - it should be possible to use masm but haven't
68 # got it working.
69 # $asm='ml /Cp /coff /c /Cx';
70 # $asm.=" /Zi" if $debug;
71 # $afile='/Fo';
72 die("Support for masm assembler not yet functional\n");
74 else
76 $asm="";
77 $afile="";
82 # compile flags
84 # NOTES: Several c files in the crypto subdirectory include headers from
85 # their local directories. Metrowerks wouldn't find these h files
86 # without adding individual include directives as compile flags
87 # or modifying the c files. Instead of adding individual include
88 # paths for each subdirectory a recursive include directive
89 # is used ( -ir crypto ).
91 # A similar issue exists for the engines and apps subdirectories.
93 # Turned off the "possible" warnings ( -w nopossible ). Metrowerks
94 # complained a lot about various stuff. May want to turn back
95 # on for further development.
96 $cflags="-ir crypto -ir engines -ir apps -msgstyle gcc -align 4 -processor pentium \\
97 -char unsigned -w on -w nolargeargs -w nopossible -w nounusedarg \\
98 -w noimplicitconv -relax_pointers -nosyspath -DL_ENDIAN \\
99 -DOPENSSL_SYSNAME_NETWARE -U_WIN32 -maxerrors 20 ";
101 # link flags
102 $lflags="-msgstyle gcc -zerobss -stacksize 32768 -nostdlib -sym internal ";
105 # additional flags based upon debug | non-debug
106 if ($debug)
108 $cflags.=" -opt off -g -sym internal -DDEBUG";
110 else
112 # CodeWarrior compiler has a problem with optimizations for floating
113 # points - no optimizations until further investigation
114 # $cflags.=" -opt all";
117 # If LibC build add in NKS_LIBC define and set the entry/exit
118 # routines - The default entry/exit routines are for CLib and don't exist
119 # in LibC
120 if ($LIBC)
122 $cflags.=" -DNETWARE_LIBC";
123 $lflags.=" -entry _LibCPrelude -exit _LibCPostlude -flags pseudopreemption";
125 else
127 $cflags.=" -DNETWARE_CLIB";
128 $lflags.=" -entry _Prelude -exit _Stop";
131 # If BSD Socket support is requested, set a define for the compiler
132 if ($BSDSOCK)
134 $cflags.=" -DNETWARE_BSDSOCK";
138 # linking stuff
139 # for the output directories use the mk1mf.pl values with "_nw" appended
140 if ($shlib)
142 if ($LIBC)
144 $out_def.="_nw_libc_nlm";
145 $tmp_def.="_nw_libc_nlm";
146 $inc_def.="_nw_libc_nlm";
148 else # NETWARE_CLIB
150 $out_def.="_nw_clib_nlm";
151 $tmp_def.="_nw_clib_nlm";
152 $inc_def.="_nw_clib_nlm";
155 else
157 $libp=".lib";
158 $shlibp=".lib";
159 $lib_flags="-nodefaults -type library";
160 if ($LIBC)
162 $out_def.="_nw_libc";
163 $tmp_def.="_nw_libc";
164 $inc_def.="_nw_libc";
166 else # NETWARE_CLIB
168 $out_def.="_nw_clib";
169 $tmp_def.="_nw_clib";
170 $inc_def.="_nw_clib";
174 # used by mk1mf.pl
175 $obj='.obj';
176 $ofile='-o ';
177 $efile='';
178 $exep='.nlm';
179 $ex_libs='';
181 if (!$no_asm)
183 $bn_asm_obj="crypto${o}bn${o}asm${o}bn-nw.obj";
184 $bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm";
185 $des_enc_obj="crypto${o}des${o}asm${o}d-nw.obj crypto${o}des${o}asm${o}y-nw.obj";
186 $des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm";
187 $bf_enc_obj="crypto${o}bf${o}asm${o}b-nw.obj";
188 $bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm";
189 $cast_enc_obj="crypto${o}cast${o}asm${o}c-nw.obj";
190 $cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm";
191 $rc4_enc_obj="crypto${o}rc4${o}asm${o}r4-nw.obj";
192 $rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm";
193 $rc5_enc_obj="crypto${o}rc5${o}asm${o}r5-nw.obj";
194 $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm";
195 $md5_asm_obj="crypto${o}md5${o}asm${o}m5-nw.obj";
196 $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm";
197 $sha1_asm_obj="crypto${o}sha${o}asm${o}s1-nw.obj";
198 $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm";
199 $rmd160_asm_obj="crypto${o}ripemd${o}asm${o}rm-nw.obj";
200 $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm";
201 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
203 else
205 $bn_asm_obj='';
206 $bn_asm_src='';
207 $des_enc_obj='';
208 $des_enc_src='';
209 $bf_enc_obj='';
210 $bf_enc_src='';
211 $cast_enc_obj='';
212 $cast_enc_src='';
213 $rc4_enc_obj='';
214 $rc4_enc_src='';
215 $rc5_enc_obj='';
216 $rc5_enc_src='';
217 $md5_asm_obj='';
218 $md5_asm_src='';
219 $sha1_asm_obj='';
220 $sha1_asm_src='';
221 $rmd160_asm_obj='';
222 $rmd160_asm_src='';
225 # create the *.def linker command files in \openssl\netware\ directory
226 sub do_def_file
228 # strip off the leading path
229 my($target) = bname(@_);
230 my($def_file);
231 my($mod_file);
232 my($i);
234 if ($target =~ /(.*).nlm/)
236 $target = $1;
239 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
240 if ($target =~ /E_EXE/)
242 $target = "openssl";
245 # Note: originally tried to use full path ( \openssl\netware\$target.def )
246 # Metrowerks linker choked on this with an assertion failure. bug???
248 $def_file = "netware\\$target.def";
250 open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n");
252 print( DEF_OUT "# command file generated by netware.pl for Metrowerks build\n" );
253 print( DEF_OUT "#\n");
254 print( DEF_OUT "DESCRIPTION \"$target\"\n");
256 foreach $i (@misc_imports)
258 print( DEF_OUT "IMPORT $i\n");
261 foreach $i (@import_files)
263 print( DEF_OUT "IMPORT \@$import_path\\$i\n");
266 foreach $i (@module_files)
268 print( DEF_OUT "MODULE $i\n");
271 close(DEF_OUT);
272 return($def_file);
275 sub do_lib_rule
277 my($objs,$target,$name,$shlib)=@_;
278 my($ret);
280 $ret.="$target: $objs\n";
281 if (!$shlib)
283 $ret.="\t\@echo Building Lib: $name\n";
284 $ret.="\t\$(MKLIB) $lib_flags -o $target $objs\n";
285 $ret.="\t\@echo .\n"
287 else
289 die( "Building as NLM not currently supported!" );
292 $ret.="\n";
293 return($ret);
296 sub do_link_rule
298 my($target,$files,$dep_libs,$libs)=@_;
299 my($ret);
300 my($def_file);
302 $def_file = do_def_file($target);
304 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
306 # NOTE: When building the test nlms no screen name is given
307 # which causes the console screen to be used. By using the console
308 # screen there is no "<press any key to continue>" message which
309 # requires user interaction. The test script ( tests.pl ) needs to be
310 # able to run the tests without requiring user interaction.
312 # However, the sample program "openssl.nlm" is used by the tests and is
313 # a interactive sample so a screen is desired when not be run by the
314 # tests. To solve the problem, two versions of the program are built:
315 # openssl2 - no screen used by tests
316 # openssl - default screen - use for normal interactive modes
318 if ($target =~ /E_EXE/)
320 my($target2) = $target;
322 $target2 =~ s/\(E_EXE\)/\(E_EXE\)2/;
324 $ret.="$target: $files $dep_libs\n";
326 # openssl
327 $ret.="\t\$(LINK) \$(LFLAGS) -screenname openssl -commandfile $def_file $files \"$prelude\" $libs -o $target\n";
328 # openssl2
329 $ret.="\t\$(LINK) \$(LFLAGS) -commandfile $def_file $files \"$prelude\" $libs -o $target2\n";
331 else
333 $ret.="$target: $files $dep_libs\n";
334 $ret.="\t\$(LINK) \$(LFLAGS) -commandfile $def_file $files \"$prelude\" $libs -o $target\n";
337 $ret.="\n";
338 return($ret);