2 # A bit of an evil hack but it post processes the file ../MINFO which
3 # is generated by `make files` in the top directory.
4 # This script outputs one mega makefile that has no shell stuff or any
8 $INSTALLTOP="/usr/local/ssl";
11 $banner="\t\@echo Building OpenSSL";
13 open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n";
15 $ssl_version=$1 if (/^VERSION=(.*)$/);
16 $OPTIONS=$1 if (/^OPTIONS=(.*)$/);
17 $INSTALLTOP=$1 if (/^INSTALLTOP=(.*$)/);
21 die "Makefile.ssl is not the toplevel Makefile!\n" if $ssl_version eq "";
26 "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X",
27 "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY",
28 "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286",
29 "VC-WIN16", "Alias for VC-W31-32",
30 "VC-W31-32", "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+",
31 "VC-MSDOS","Microsoft Visual C++ 1.52 - MSDOS",
32 "Mingw32", "GNU C++ - Windows NT or 9x",
33 "Mingw32-files", "Create files with DOS copy ...",
34 "BC-NT", "Borland C++ 4.5 - Windows NT",
35 "BC-W31", "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING",
36 "BC-MSDOS","Borland C++ 4.5 - MSDOS",
37 "linux-elf","Linux elf",
38 "ultrix-mips","DEC mips ultrix",
39 "FreeBSD","FreeBSD distribution",
40 "default","cc under unix",
46 if (!&read_options && !defined($ops{$_}))
48 print STDERR "unknown option - $_\n";
49 print STDERR "usage: perl mk1mf.pl [options] [system]\n";
50 print STDERR "\nwhere [system] can be one of the following\n";
51 foreach $i (sort keys %ops)
52 { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; }
54 and [options] can be one of
55 no-md2 no-md5 no-sha no-mdc2 no-ripemd - Skip this digest
56 no-rc2 no-rc4 no-idea no-des no-bf no-cast - Skip this symetric cipher
58 no-rsa no-dsa no-dh - Skip this public key cipher
59 no-ssl2 no-ssl3 - Skip this version of SSL
60 just-ssl - remove all non-ssl keys/digest
62 nasm - Use NASM for x86 asm
63 gaswin - Use GNU as with Mingw32
64 no-socks - No socket code
65 no-err - No error strings
66 dll/shlib - Build shared libraries (MS)
68 profile - Profiling build
70 rsaref - Build to require RSAref
72 Values that can be set
73 TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler
75 -L<ex_lib_path> -l<ex_lib> - extra library flags (unix)
76 -<ex_cc_flags> - extra 'cc' flags,
77 added (MS), or replace (unix)
83 foreach (split / /, $OPTIONS)
85 print STDERR "unknown option - $_\n" if !&read_options;
88 $no_mdc2=1 if ($no_des);
90 $no_ssl3=1 if ($no_md5 || $no_sha);
91 $no_ssl3=1 if ($no_rsa && $no_dh);
93 $no_ssl2=1 if ($no_md5 || $no_rsa);
94 $no_ssl2=1 if ($no_rsa);
102 ($ssl,$crypto)=("ssl","crypto");
104 $ranlib="echo ranlib";
106 $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
107 $src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.';
108 $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
110 # $bin_dir.=$o causes a core dump on my sparc :-(
114 push(@INC,"util/pl","pl");
115 if ($platform eq "VC-MSDOS")
121 elsif ($platform eq "VC-W31-16")
127 elsif (($platform eq "VC-W31-32") || ($platform eq "VC-WIN16"))
133 elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT"))
135 $NT = 1 if $platform eq "VC-NT";
138 elsif ($platform eq "Mingw32")
140 require 'Mingw32.pl';
142 elsif ($platform eq "Mingw32-files")
144 require 'Mingw32f.pl';
146 elsif ($platform eq "BC-NT")
151 elsif ($platform eq "BC-W31")
157 elsif ($platform eq "BC-Q16")
159 $msdos=1; $w16=1; $shlib=0; $qw=1;
162 elsif ($platform eq "BC-MSDOS")
168 elsif ($platform eq "FreeBSD")
171 $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer';
173 elsif ($platform eq "linux-elf")
179 elsif ($platform eq "ultrix-mips")
190 $cflags.=' -DTERMIO';
193 $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
194 $tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:$tmp_def.($debug?".dbg":"");
195 $inc_dir=(defined($VARS{'INC'}))?$VARS{'INC'}:$inc_def;
197 $bin_dir=$bin_dir.$o unless ((substr($bin_dir,-1,1) eq $o) || ($bin_dir eq ''));
199 $cflags.=" -DNO_IDEA" if $no_idea;
200 $cflags.=" -DNO_RC2" if $no_rc2;
201 $cflags.=" -DNO_RC4" if $no_rc4;
202 $cflags.=" -DNO_RC5" if $no_rc5;
203 $cflags.=" -DNO_MD2" if $no_md2;
204 $cflags.=" -DNO_MD5" if $no_md5;
205 $cflags.=" -DNO_SHA" if $no_sha;
206 $cflags.=" -DNO_SHA1" if $no_sha1;
207 $cflags.=" -DNO_RIPEMD" if $no_rmd160;
208 $cflags.=" -DNO_MDC2" if $no_mdc2;
209 $cflags.=" -DNO_BF" if $no_bf;
210 $cflags.=" -DNO_CAST" if $no_cast;
211 $cflags.=" -DNO_DES" if $no_des;
212 $cflags.=" -DNO_RSA" if $no_rsa;
213 $cflags.=" -DNO_DSA" if $no_dsa;
214 $cflags.=" -DNO_DH" if $no_dh;
215 $cflags.=" -DNO_SOCK" if $no_sock;
216 $cflags.=" -DNO_SSL2" if $no_ssl2;
217 $cflags.=" -DNO_SSL3" if $no_ssl3;
218 $cflags.=" -DNO_ERR" if $no_err;
219 $cflags.=" -DRSAref" if $rsaref ne "";
222 ## { $cflags="$c_flags" if ($c_flags ne ""); }
224 { $cflags="$c_flags$cflags" if ($c_flags ne ""); }
226 $ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
230 $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n";
231 $banner.="\t\@echo top level directory, if you don't have perl, you will\n";
232 $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n";
233 $banner.="\t\@echo documentation for details.\n";
236 # have to do this to allow $(CC) under unix
237 $link="$bin_dir$link" if ($link !~ /^\$/);
239 $INSTALLTOP =~ s|/|$o|g;
242 # This makefile has been automatically generated from the OpenSSL distribution.
243 # This single makefile will build the complete OpenSSL distribution and
244 # by default leave the 'intertesting' output files in .${o}out and the stuff
245 # that needs deleting in .${o}tmp.
246 # The file was generated by running 'make makefile.one', which
247 # does a 'make files', which writes all the environment variables from all
248 # the makefiles to the file call MINFO. This file is used by
249 # util${o}mk1mf.pl to generate makefile.one.
250 # The 'makefile per directory' system suites me when developing this
251 # library and also so I can 'distribute' indervidual library sections.
252 # The one monster makefile better suits building in non-unix
255 INSTALLTOP=$INSTALLTOP
257 # Set your compiler options
263 SHLIB_CFLAG=$shl_cflag
264 APP_EX_OBJ=$app_ex_obj
265 SHLIB_EX_OBJ=$shlib_ex_obj
266 # add extra libraries to this define, for solaris -lsocket -lnsl would
270 # The OpenSSL directory
276 BN_ASM_OBJ=$bn_asm_obj
277 BN_ASM_SRC=$bn_asm_src
278 BNCO_ASM_OBJ=$bnco_asm_obj
279 BNCO_ASM_SRC=$bnco_asm_src
280 DES_ENC_OBJ=$des_enc_obj
281 DES_ENC_SRC=$des_enc_src
282 BF_ENC_OBJ=$bf_enc_obj
283 BF_ENC_SRC=$bf_enc_src
284 CAST_ENC_OBJ=$cast_enc_obj
285 CAST_ENC_SRC=$cast_enc_src
286 RC4_ENC_OBJ=$rc4_enc_obj
287 RC4_ENC_SRC=$rc4_enc_src
288 RC5_ENC_OBJ=$rc5_enc_obj
289 RC5_ENC_SRC=$rc5_enc_src
290 MD5_ASM_OBJ=$md5_asm_obj
291 MD5_ASM_SRC=$md5_asm_src
292 SHA1_ASM_OBJ=$sha1_asm_obj
293 SHA1_ASM_SRC=$sha1_asm_src
294 RMD160_ASM_OBJ=$rmd160_asm_obj
295 RMD160_ASM_SRC=$rmd160_asm_src
297 # The output directory for everything intersting
299 # The output directory for all the temporary muck
301 # The output directory for the header files
303 INCO_D=$inc_dir${o}openssl
313 ######################################################
314 # You should not need to touch anything below this point
315 ######################################################
322 # BIN_D - Binary output directory
323 # TEST_D - Binary test file output directory
324 # LIB_D - library output directory
325 # Note: if you change these point to different directories then uncomment out
326 # the lines around the 'NB' comment below.
332 # INCL_D - local library directory
333 # OBJ_D - temp object file directory
337 O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp
338 O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp
339 O_RSAGLUE= \$(LIB_D)$o$plib\$(RSAGLUE)$libp
340 SO_SSL= $plib\$(SSL)$so_shlibp
341 SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp
342 L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp
343 L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp
345 L_LIBS= \$(L_SSL) \$(L_CRYPTO)
346 #L_LIBS= \$(O_SSL) \$(O_RSAGLUE) -lrsaref \$(O_CRYPTO)
348 ######################################################
349 # Don't touch anything below this point
350 ######################################################
352 INC=-I\$(INC_D) -I\$(INCL_D)
353 APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG)
354 LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG)
355 SHLIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) \$(SHLIB_CFLAG)
356 LIBS_DEP=\$(O_CRYPTO) \$(O_RSAGLUE) \$(O_SSL)
358 #############################################
362 all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe
367 # Generate perlasm output files
369 (cd \$(\@D)/..; PERL=perl make -f Makefile.ssl asm/\$(\@F))
373 # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different
375 # \$(MKDIR) \$(BIN_D)
378 # \$(MKDIR) \$(TEST_D)
383 \$(INCO_D): \$(INC_D)
389 headers: \$(HEADER) \$(EXHEADER)
394 exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep
397 \$(MKDIR) \$(INSTALLTOP)
398 \$(MKDIR) \$(INSTALLTOP)${o}bin
399 \$(MKDIR) \$(INSTALLTOP)${o}include
400 \$(MKDIR) \$(INSTALLTOP)${o}include${o}openssl
401 \$(MKDIR) \$(INSTALLTOP)${o}lib
402 \$(CP) \$(INCO_D)${o}*.\[ch\] \$(INSTALLTOP)${o}include${o}openssl
403 \$(CP) \$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin
404 \$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib
405 \$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib
408 \$(RM) \$(TMP_D)$o*.*
411 \$(RM) \$(TMP_D)$o*.*
412 \$(RM) \$(OUT_D)$o*.*
416 my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
417 $platform_cpp_symbol =~ s/-/_/g;
418 if (open(IN,"crypto/buildinf.h"))
420 # Remove entry for this platform in existing file buildinf.h.
422 my $old_buildinf_h = "";
425 if (/^\#ifdef $platform_cpp_symbol$/)
427 while (<IN>) { last if (/^\#endif/); }
431 $old_buildinf_h .= $_;
436 open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
437 print OUT $old_buildinf_h;
441 open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h";
443 #ifdef $platform_cpp_symbol
444 /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
445 #define CFLAGS "$cc $cflags"
446 #define PLATFORM "$platform"
448 printf OUT " #define DATE \"%s\"\n", scalar gmtime();
449 printf OUT "#endif\n";
452 #############################################
453 # We parse in input file and 'store' info for later printing.
454 open(IN,"<$infile") || die "unable to open $infile:$!\n";
460 ($key,$val)=/^([^=]+)=(.*)/;
461 if ($key eq "RELATIVE_DIRECTORY")
466 $uc =~ s/^lib(.*)\.a/$1/;
469 $lib_obj{$uc}.=$libobj." ";
471 last if ($val eq "FINISHED");
478 { $test.=&var_add($dir,$val); }
480 if (($key eq "PROGS") || ($key eq "E_OBJ"))
481 { $e_exe.=&var_add($dir,$val); }
486 $lib =~ s/^.*\/([^\/]+)$/$1/;
489 if ($key eq "EXHEADER")
490 { $exheader.=&var_add($dir,$val); }
492 if ($key eq "HEADER")
493 { $header.=&var_add($dir,$val); }
495 if ($key eq "LIBOBJ")
496 { $libobj=&var_add($dir,$val); }
499 { $_="RELATIVE_DIRECTORY=FINISHED\n"; }
503 # Strip of trailing ' '
504 foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
505 $test=&clean_up_ws($test);
506 $e_exe=&clean_up_ws($e_exe);
507 $exheader=&clean_up_ws($exheader);
508 $header=&clean_up_ws($header);
510 # First we strip the exheaders from the headers list
511 foreach (split(/\s+/,$exheader)){ $h{$_}=1; }
512 foreach (split(/\s+/,$header)) { $h.=$_." " unless $h{$_}; }
513 chop($h); $header=$h;
515 $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",".h");
516 $rules.=&do_copy_rule("\$(INCL_D)",$header,".h");
518 $defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",".h");
519 $rules.=&do_copy_rule("\$(INCO_D)",$exheader,".h");
521 $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj);
522 $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)");
524 $defs.=&do_defs("E_OBJ",$e_exe,"\$(OBJ_D)",$obj);
525 $rules.=&do_compile_rule("\$(OBJ_D)",$e_exe,'-DMONOLITH $(APP_CFLAGS)');
527 foreach (values %lib_nam)
529 $lib_obj=$lib_obj{$_};
532 $slib=0 if ($_ eq "RSAGLUE");
534 if (($_ eq "SSL") && $no_ssl2 && $no_ssl3)
536 $rules.="\$(O_SSL):\n\n";
540 if (($_ eq "RSAGLUE") && $no_rsa)
542 $rules.="\$(O_RSAGLUE):\n\n";
546 if (($bn_asm_obj ne "") && ($_ eq "CRYPTO"))
548 $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/;
549 $rules.=&do_asm_rule($bn_asm_obj,$bn_asm_src);
551 if (($bnco_asm_obj ne "") && ($_ eq "CRYPTO"))
553 $lib_obj .= "\$(BNCO_ASM_OBJ)";
554 $rules.=&do_asm_rule($bnco_asm_obj,$bnco_asm_src);
556 if (($des_enc_obj ne "") && ($_ eq "CRYPTO"))
558 $lib_obj =~ s/\s\S*des_enc\S*/ \$(DES_ENC_OBJ)/;
559 $lib_obj =~ s/\s\S*\/fcrypt_b\S*\s*/ /;
560 $rules.=&do_asm_rule($des_enc_obj,$des_enc_src);
562 if (($bf_enc_obj ne "") && ($_ eq "CRYPTO"))
564 $lib_obj =~ s/\s\S*\/bf_enc\S*/ \$(BF_ENC_OBJ)/;
565 $rules.=&do_asm_rule($bf_enc_obj,$bf_enc_src);
567 if (($cast_enc_obj ne "") && ($_ eq "CRYPTO"))
569 $lib_obj =~ s/(\s\S*\/c_enc\S*)/ \$(CAST_ENC_OBJ)/;
570 $rules.=&do_asm_rule($cast_enc_obj,$cast_enc_src);
572 if (($rc4_enc_obj ne "") && ($_ eq "CRYPTO"))
574 $lib_obj =~ s/\s\S*\/rc4_enc\S*/ \$(RC4_ENC_OBJ)/;
575 $rules.=&do_asm_rule($rc4_enc_obj,$rc4_enc_src);
577 if (($rc5_enc_obj ne "") && ($_ eq "CRYPTO"))
579 $lib_obj =~ s/\s\S*\/rc5_enc\S*/ \$(RC5_ENC_OBJ)/;
580 $rules.=&do_asm_rule($rc5_enc_obj,$rc5_enc_src);
582 if (($md5_asm_obj ne "") && ($_ eq "CRYPTO"))
584 $lib_obj =~ s/\s(\S*\/md5_dgst\S*)/ $1 \$(MD5_ASM_OBJ)/;
585 $rules.=&do_asm_rule($md5_asm_obj,$md5_asm_src);
587 if (($sha1_asm_obj ne "") && ($_ eq "CRYPTO"))
589 $lib_obj =~ s/\s(\S*\/sha1dgst\S*)/ $1 \$(SHA1_ASM_OBJ)/;
590 $rules.=&do_asm_rule($sha1_asm_obj,$sha1_asm_src);
592 if (($rmd160_asm_obj ne "") && ($_ eq "CRYPTO"))
594 $lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/;
595 $rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src);
597 $defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
598 $lib=($slib)?" \$(SHLIB_CFLAGS)":" \$(LIB_CFLAGS)";
599 $rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
602 $defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
603 foreach (split(/\s+/,$test))
606 $tt="\$(OBJ_D)${o}$t${obj}";
607 $rules.=&do_link_rule("\$(TEST_D)$o$t$exep",$tt,"\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
610 $rules.= &do_lib_rule("\$(SSLOBJ)","\$(O_SSL)",$ssl,$shlib,"\$(SO_SSL)");
611 $rules.= &do_lib_rule("\$(RSAGLUEOBJ)","\$(O_RSAGLUE)",$RSAglue,0,"")
613 $rules.= &do_lib_rule("\$(CRYPTOOBJ)","\$(O_CRYPTO)",$crypto,$shlib,"\$(SO_CRYPTO)");
615 $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)");
618 print "###################################################################\n";
621 ###############################################
622 # strip off any trailing .[och] and append the relative directory
623 # also remembering to do nothing if we are in one of the dropped
630 return("") if $no_idea && $dir =~ /\/idea/;
631 return("") if $no_rc2 && $dir =~ /\/rc2/;
632 return("") if $no_rc4 && $dir =~ /\/rc4/;
633 return("") if $no_rc5 && $dir =~ /\/rc5/;
634 return("") if $no_rsa && $dir =~ /\/rsa/;
635 return("") if $no_rsa && $dir =~ /^rsaref/;
636 return("") if $no_dsa && $dir =~ /\/dsa/;
637 return("") if $no_dh && $dir =~ /\/dh/;
638 if ($no_des && $dir =~ /\/des/)
640 if ($val =~ /read_pwd/)
641 { return("$dir/read_pwd "); }
645 return("") if $no_mdc2 && $dir =~ /\/mdc2/;
646 return("") if $no_sock && $dir =~ /\/proxy/;
647 return("") if $no_bf && $dir =~ /\/bf/;
648 return("") if $no_cast && $dir =~ /\/cast/;
650 $val =~ s/^\s*(.*)\s*$/$1/;
651 @a=split(/\s+/,$val);
652 grep(s/\.[och]$//,@a);
654 @a=grep(!/^e_.*_3d$/,@a) if $no_des;
655 @a=grep(!/^e_.*_d$/,@a) if $no_des;
656 @a=grep(!/^e_.*_i$/,@a) if $no_idea;
657 @a=grep(!/^e_.*_r2$/,@a) if $no_rc2;
658 @a=grep(!/^e_.*_r5$/,@a) if $no_rc5;
659 @a=grep(!/^e_.*_bf$/,@a) if $no_bf;
660 @a=grep(!/^e_.*_c$/,@a) if $no_cast;
661 @a=grep(!/^e_rc4$/,@a) if $no_rc4;
663 @a=grep(!/(^s2_)|(^s23_)/,@a) if $no_ssl2;
664 @a=grep(!/(^s3_)|(^s23_)/,@a) if $no_ssl3;
666 @a=grep(!/(_sock$)|(_acpt$)|(_conn$)|(^pxy_)/,@a) if $no_sock;
668 @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2;
669 @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5;
670 @a=grep(!/(rmd)|(ripemd)/,@a) if $no_rmd160;
672 @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
673 @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
674 @a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
676 @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
677 @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
679 @a=grep(!/^n_pkey$/,@a) if $no_rsa || $no_rc4;
681 @a=grep(!/_dhp$/,@a) if $no_dh;
683 @a=grep(!/(^sha[^1])|(_sha$)|(m_dss$)/,@a) if $no_sha;
684 @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
685 @a=grep(!/_mdc2$/,@a) if $no_mdc2;
687 @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa;
688 @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa;
689 @a=grep(!/^gendsa$/,@a) if $no_sha1;
690 @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh;
692 @a=grep(!/(^dh)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1;
694 grep($_="$dir/$_",@a);
695 @a=grep(!/(^|\/)s_/,@a) if $no_sock;
696 @a=grep(!/(^|\/)bio_sock/,@a) if $no_sock;
697 $ret=join(' ',@a)." ";
701 # change things so that each 'token' is only separated by one space
706 $w =~ s/^\s*(.*)\s*$/$1/;
713 local($var,$files,$location,$postfix)=@_;
717 $files =~ s/\//$o/g if $o ne '/';
721 foreach (split(/ /,$files))
724 $_=&bname($_) unless /^\$/;
730 if (($_ =~ /bss_file/) && ($postfix eq ".h"))
732 else { $pf=$postfix; }
733 if ($_ =~ /BN_ASM/) { $t="$_ "; }
734 elsif ($_ =~ /BNCO_ASM/){ $t="$_ "; }
735 elsif ($_ =~ /DES_ENC/) { $t="$_ "; }
736 elsif ($_ =~ /BF_ENC/) { $t="$_ "; }
737 elsif ($_ =~ /CAST_ENC/){ $t="$_ "; }
738 elsif ($_ =~ /RC4_ENC/) { $t="$_ "; }
739 elsif ($_ =~ /RC5_ENC/) { $t="$_ "; }
740 elsif ($_ =~ /MD5_ASM/) { $t="$_ "; }
741 elsif ($_ =~ /SHA1_ASM/){ $t="$_ "; }
742 elsif ($_ =~ /RMD160_ASM/){ $t="$_ "; }
743 else { $t="$location${o}$_$pf "; }
753 # return the name with the leading path removed
757 $ret =~ s/^.*[\\\/]([^\\\/]+)$/$1/;
762 ##############################################################
763 # do a rule for each file that says 'compile' to new direcory
764 # compile the files in '$files' into $to
767 local($to,$files,$ex)=@_;
770 $files =~ s/\//$o/g if $o ne '/';
771 foreach (split(/\s+/,$files))
774 $ret.=&cc_compile_target("$to${o}$n$obj","${_}.c",$ex)
779 ##############################################################
780 # do a rule for each file that says 'compile' to new direcory
781 sub cc_compile_target
783 local($target,$source,$ex_flags)=@_;
786 $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/);
787 $target =~ s/\//$o/g if $o ne "/";
788 $source =~ s/\//$o/g if $o ne "/";
789 $ret ="$target: \$(SRC_D)$o$source\n\t";
790 $ret.="\$(CC) ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
794 ##############################################################
797 local($target,$src)=@_;
798 local($ret,@s,@t,$i);
800 $target =~ s/\//$o/g if $o ne "/";
801 $src =~ s/\//$o/g if $o ne "/";
803 @s=split(/\s+/,$src);
804 @t=split(/\s+/,$target);
806 for ($i=0; $i<=$#s; $i++)
808 $ret.="$t[$i]: $s[$i]\n";
809 $ret.="\t\$(ASM) $afile$t[$i] \$(SRC_D)$o$s[$i]\n\n";
820 ($nn=$n) =~ tr/a-z/A-Z/;
821 $ret.="$n.dll: \$(${nn}OBJ)\n";
824 $ret.="\t\$(MKSHLIB) $efile$n.dll $def @<<\n \$(${nn}OBJ_F)\n<<\n";
830 # do a rule for each file that says 'copy' to new direcory on change
833 local($to,$files,$p)=@_;
834 local($ret,$_,$n,$pp);
836 $files =~ s/\//$o/g if $o ne '/';
837 foreach (split(/\s+/,$files))
840 if ($n =~ /bss_file/)
843 $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \$(SRC_D)$o$_$pp $to${o}$n$pp\n\n";
850 if (/^no-rc2$/) { $no_rc2=1; }
851 elsif (/^no-rc4$/) { $no_rc4=1; }
852 elsif (/^no-rc5$/) { $no_rc5=1; }
853 elsif (/^no-idea$/) { $no_idea=1; }
854 elsif (/^no-des$/) { $no_des=1; }
855 elsif (/^no-bf$/) { $no_bf=1; }
856 elsif (/^no-cast$/) { $no_cast=1; }
857 elsif (/^no-md2$/) { $no_md2=1; }
858 elsif (/^no-md5$/) { $no_md5=1; }
859 elsif (/^no-sha$/) { $no_sha=1; }
860 elsif (/^no-sha1$/) { $no_sha1=1; }
861 elsif (/^no-ripemd$/) { $no_ripemd=1; }
862 elsif (/^no-mdc2$/) { $no_mdc2=1; }
863 elsif (/^no-patents$/) { $no_rc2=$no_rc4=$no_rc5=$no_idea=$no_rsa=1; }
864 elsif (/^no-rsa$/) { $no_rsa=1; }
865 elsif (/^no-dsa$/) { $no_dsa=1; }
866 elsif (/^no-dh$/) { $no_dh=1; }
867 elsif (/^no-hmac$/) { $no_hmac=1; }
868 elsif (/^no-asm$/) { $no_asm=1; }
869 elsif (/^nasm$/) { $nasm=1; }
870 elsif (/^gaswin$/) { $gaswin=1; }
871 elsif (/^no-ssl2$/) { $no_ssl2=1; }
872 elsif (/^no-ssl3$/) { $no_ssl3=1; }
873 elsif (/^no-err$/) { $no_err=1; }
874 elsif (/^no-sock$/) { $no_sock=1; }
876 elsif (/^just-ssl$/) { $no_rc2=$no_idea=$no_des=$no_bf=$no_cast=1;
877 $no_md2=$no_sha=$no_mdc2=$no_dsa=$no_dh=1;
878 $no_ssl2=$no_err=$no_rmd160=$no_rc5=1; }
880 elsif (/^rsaref$/) { $rsaref=1; }
881 elsif (/^gcc$/) { $gcc=1; }
882 elsif (/^debug$/) { $debug=1; }
883 elsif (/^profile$/) { $profile=1; }
884 elsif (/^shlib$/) { $shlib=1; }
885 elsif (/^dll$/) { $shlib=1; }
886 elsif (/^shared$/) { } # We just need to ignore it for now...
887 elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; }
888 elsif (/^-[lL].*$/) { $l_flags.="$_ "; }
889 elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/)