1 # Metrowerks Codewarrior for NetWare
4 # The import files and other misc imports needed to link
7 @import_files = ("libc.imp", "ws2nlm.imp");
8 @module_files = ("libc");
13 @import_files = ("clib.imp", "ws2nlm.imp");
14 @module_files = ("clib");
16 @misc_imports = ("GetProcessSwitchCount", "RunningProcess",
17 "GetSuperHighResolutionTimer" );
19 # The "IMPORTS" environment variable must be set and point to the location
20 # where import files (*.imp) can be found.
21 # Example: set IMPORTS=c:\ndk\nwsdk\imports
22 $import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n");
25 # The "PRELUDE" environment variable must be set and point to the location
26 # and name of the prelude source to link with ( nwpre.obj is recommended ).
27 # Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj
28 $prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n");
49 $asm="nasmw -s -f coff";
51 $asm.=" -g" if $debug;
55 $asm="mwasmnlm -maxerrors 20";
57 $asm.=" -g" if $debug;
61 # masm assembly settings - it should be possible to use masm but haven't
63 # $asm='ml /Cp /coff /c /Cx';
64 # $asm.=" /Zi" if $debug;
66 die("Support for masm assembler not yet functional\n");
78 # NOTES: Several c files in the crypto subdirectory include headers from
79 # their local directories. Metrowerks wouldn't find these h files
80 # without adding individual include directives as compile flags
81 # or modifying the c files. Instead of adding individual include
82 # paths for each subdirectory a recursive include directive
83 # is used ( -ir crypto ).
85 # Turned off the "possible" warnings ( -w nopossible ). Metrowerks
86 # complained a lot about various stuff. May want to turn back
87 # on for further development.
88 $cflags="-ir crypto -msgstyle gcc -align 4 -processor pentium \\
89 -char unsigned -w on -w nolargeargs -w nopossible -w nounusedarg \\
90 -w noimplicitconv -relax_pointers -nosyspath -DL_ENDIAN \\
91 -DOPENSSL_SYSNAME_NETWARE -U_WIN32 -maxerrors 20 ";
94 $lflags="-msgstyle gcc -zerobss -stacksize 32768 -nostdlib -sym internal ";
97 # additional flags based upon debug | non-debug
100 $cflags.=" -opt off -g -sym internal -DDEBUG";
104 # CodeWarrior compiler has a problem with optimizations for floating
105 # points - no optimizations until further investigation
106 # $cflags.=" -opt all";
109 # If LibC build add in NKS_LIBC define and set the entry/exit
110 # routines - The default entry/exit routines are for CLib and don't exist
114 $cflags.=" -DNETWARE_LIBC";
115 $lflags.=" -entry _LibCPrelude -exit _LibCPostlude -flags pseudopreemption";
119 $cflags.=" -DNETWARE_CLIB";
120 $lflags.=" -entry _Prelude -exit _Stop";
125 # for the output directories use the mk1mf.pl values with "_nw" appended
130 $out_def.="_nw_libc_nlm";
131 $tmp_def.="_nw_libc_nlm";
132 $inc_def.="_nw_libc_nlm";
136 $out_def.="_nw_clib_nlm";
137 $tmp_def.="_nw_clib_nlm";
138 $inc_def.="_nw_clib_nlm";
145 $lib_flags="-nodefaults -type library";
148 $out_def.="_nw_libc";
149 $tmp_def.="_nw_libc";
150 $inc_def.="_nw_libc";
154 $out_def.="_nw_clib";
155 $tmp_def.="_nw_clib";
156 $inc_def.="_nw_clib";
169 $bn_asm_obj="crypto${o}bn${o}asm${o}bn-nw.obj";
170 $bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm";
171 $des_enc_obj="crypto${o}des${o}asm${o}d-nw.obj crypto${o}des${o}asm${o}y-nw.obj";
172 $des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm";
173 $bf_enc_obj="crypto${o}bf${o}asm${o}b-nw.obj";
174 $bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm";
175 $cast_enc_obj="crypto${o}cast${o}asm${o}c-nw.obj";
176 $cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm";
177 $rc4_enc_obj="crypto${o}rc4${o}asm${o}r4-nw.obj";
178 $rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm";
179 $rc5_enc_obj="crypto${o}rc5${o}asm${o}r5-nw.obj";
180 $rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm";
181 $md5_asm_obj="crypto${o}md5${o}asm${o}m5-nw.obj";
182 $md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm";
183 $sha1_asm_obj="crypto${o}sha${o}asm${o}s1-nw.obj";
184 $sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm";
185 $rmd160_asm_obj="crypto${o}ripemd${o}asm${o}rm-nw.obj";
186 $rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm";
187 $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
211 # create the *.def linker command files in \openssl\netware\ directory
214 # strip off the leading path
215 my($target) = bname(@_);
220 if ($target =~ /(.*).nlm/)
225 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
226 if ($target =~ /E_EXE/)
231 # Note: originally tried to use full path ( \openssl\netware\$target.def )
232 # Metrowerks linker choked on this with an assertion failure. bug???
234 $def_file = "netware\\$target.def";
236 open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n");
238 print( DEF_OUT "# command file generated by netware.pl for Metrowerks build\n" );
239 print( DEF_OUT "#\n");
240 print( DEF_OUT "DESCRIPTION \"$target\"\n");
242 foreach $i (@misc_imports)
244 print( DEF_OUT "IMPORT $i\n");
247 foreach $i (@import_files)
249 print( DEF_OUT "IMPORT \@$import_path\\$i\n");
252 foreach $i (@module_files)
254 print( DEF_OUT "MODULE $i\n");
263 my($objs,$target,$name,$shlib)=@_;
266 $ret.="$target: $objs\n";
269 $ret.="\t\@echo Building Lib: $name\n";
270 $ret.="\t\$(MKLIB) $lib_flags -o $target $objs\n";
275 die( "Building as NLM not currently supported!" );
284 my($target,$files,$dep_libs,$libs)=@_;
288 $def_file = do_def_file($target);
290 # special case for openssl - the mk1mf.pl defines E_EXE = openssl
292 # NOTE: When building the test nlms no screen name is given
293 # which causes the console screen to be used. By using the console
294 # screen there is no "<press any key to continue>" message which
295 # requires user interaction. The test script ( tests.pl ) needs to be
296 # able to run the tests without requiring user interaction.
298 # However, the sample program "openssl.nlm" is used by the tests and is
299 # a interactive sample so a screen is desired when not be run by the
300 # tests. To solve the problem, two versions of the program are built:
301 # openssl2 - no screen used by tests
302 # openssl - default screen - use for normal interactive modes
304 if ($target =~ /E_EXE/)
306 my($target2) = $target;
308 $target2 =~ s/\(E_EXE\)/\(E_EXE\)2/;
310 $ret.="$target: $files $dep_libs\n";
313 $ret.="\t\$(LINK) \$(LFLAGS) -screenname openssl -commandfile $def_file $files \"$prelude\" $libs -o $target\n";
315 $ret.="\t\$(LINK) \$(LFLAGS) -commandfile $def_file $files \"$prelude\" $libs -o $target2\n";
319 $ret.="$target: $files $dep_libs\n";
320 $ret.="\t\$(LINK) \$(LFLAGS) -commandfile $def_file $files \"$prelude\" $libs -o $target\n";