#!/usr/local/bin/perl
# A bit of an evil hack but it post processes the file ../MINFO which
# is generated by `make files` in the top directory.
# This script outputs one mega makefile that has no shell stuff or any
# funny stuff (if the target is not "copy").
# If the target is "copy", then it tries to create a makefile that can be
# safely used with the -j flag and that is compatible with the top-level
# Makefile, in the sense that it uses the same options and assembler files etc.
use Cwd;
$INSTALLTOP="/usr/local/ssl";
$OPENSSLDIR="/usr/local/ssl";
$OPTIONS="";
$ssl_version="";
$banner="\t\@echo Building OpenSSL";
my $no_static_engine = 1;
my $engines = "";
my $otherlibs = "";
local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
local $zlib_lib = "";
local $perl_asm = 0; # 1 to autobuild asm files from perl scripts
my $ex_l_libs = "";
# Options to import from top level Makefile
my %mf_import = (
VERSION => \$ssl_version,
OPTIONS => \$OPTIONS,
INSTALLTOP => \$INSTALLTOP,
OPENSSLDIR => \$OPENSSLDIR,
PLATFORM => \$mf_platform,
CC => \$mf_cc,
CFLAG => \$mf_cflag,
DEPFLAG => \$mf_depflag,
CPUID_OBJ => \$mf_cpuid_asm,
BN_ASM => \$mf_bn_asm,
DES_ENC => \$mf_des_asm,
AES_ENC => \$mf_aes_asm,
BF_ENC => \$mf_bf_asm,
CAST_ENC => \$mf_cast_asm,
RC4_ENC => \$mf_rc4_asm,
RC5_ENC => \$mf_rc5_asm,
MD5_ASM_OBJ => \$mf_md5_asm,
SHA1_ASM_OBJ => \$mf_sha_asm,
RMD160_ASM_OBJ => \$mf_rmd_asm,
WP_ASM_OBJ => \$mf_wp_asm,
CMLL_ENC => \$mf_cm_asm,
MODES_ASM_OBJ => \$mf_modes_asm,
ENGINES_ASM_OBJ=> \$mf_engines_asm,
BASEADDR => \$baseaddr,
FIPSDIR => \$fipsdir,
);
open(IN,"<Makefile") || die "unable to open Makefile!\n";
while(<IN>) {
my ($mf_opt, $mf_ref);
while (($mf_opt, $mf_ref) =