# The only reason we do this is to have something to build MINFO from
build_Makefile();
- open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
- printf OUT <<"EOF";
-#ifndef MK1MF_BUILD
- /* auto-generated by Configure for crypto/cversion.c:
- * for Unix builds, crypto/Makefile.ssl generates functional definitions;
- * Windows builds (and other mk1mf builds) compile cversion.c with
- * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
- #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
-#endif
-EOF
- close(OUT);
-
# create the ms/version32.rc file if needed
if ($platform ne "netware") {
my ($v1, $v2, $v3, $v4);
--- /dev/null
+#! /usr/bin/perl
+
+my %MINFO_source = ();
+
+open my $minfo, "MINFO" or die "Couldn't open MINFO: $!\n";
+my $reldir = "";
+my $searchterm = "";
+my $goal = "";
+while (<$minfo>) {
+ chomp;
+
+ if (/^RELATIVE_DIRECTORY=(.*)$/) {
+ $reldir=$1;
+ next;
+ }
+
+ if (/^LIBSRC=(.*)$/) {
+ my @src = sort split(/\s+/, $1);
+ if ($reldir =~ m|^crypto(/.*)?$|) {
+ $MINFO_source{"libcrypto|$reldir"} = [ @src ];
+ } elsif ($reldir eq "ssl") {
+ $MINFO_source{"libssl|$reldir"} = [ @src ];
+ } elsif ($reldir ne "engines") {
+ warn "LIBSRC found in MINFO for $reldir";
+ }
+ next;
+ }
+
+ if (/^(?:TEST)?LIBNAMES=(.*)$/) {
+ my @names = sort split(/\s+/, $1);
+ if ($reldir eq "engines") {
+ push @{$MINFO_source{"engines|$reldir"}}, @names;
+ } else {
+ warn "(TEST)?LIBNAMES found in MINFO for $reldir";
+ }
+ next;
+ }
+
+ } elsif ($reldir eq "apps") {
+ $searchterm = "EXE_SRC";
+ $goal = "apps|openssl";
+ } elsif ($reldir eq "engines") {
+ $searchterm = "
PLATFORM => \$mf_platform,
CC => \$mf_cc,
CFLAG => \$mf_cflag,
+ CFLAG_Q => \$mf_cflag_q,
DEPFLAG => \$mf_depflag,
CPUID_OBJ => \$mf_cpuid_asm,
BN_ASM => \$mf_bn_asm,
my $asm_def = $orig_platform eq 'copy' ? "" : "ASM=$bin_dir$asm";
+$cflags =~ s/\((ENGINESDIR|OPENSSLDIR)\)/\(${1}_QQ\)/g;
+(my $cflags_q = $cflags) =~ s/([\\"])/\\$1/g;
+(my $INSTALLTOP_Q = $INSTALLTOP) =~ s/([\\"])/\\$1/g;
+(my $INSTALLTOP_QQ = $INSTALLTOP_Q) =~ s/\\/\\\\/g;
+(my $OPENSSLDIR_Q = $OPENSSLDIR) =~ s/([\\"])/\\$1/g;
+(my $OPENSSLDIR_QQ = $OPENSSLDIR_Q) =~ s/\\/\\\\/g;
+(my $ENGINESDIR_Q = $ENGINESDIR) =~ s/([\\"])/\\$1/g;
+(my $ENGINESDIR_QQ = $ENGINESDIR_Q) =~ s/\\/\\\\/g;
+
$defs= <<"EOF";
# N.B. You MUST use -j on FreeBSD.
# This makefile has been automatically generated from the OpenSSL distribution.
$defs.= <<"EOF";
INSTALLTOP=$INSTALLTOP
+INSTALLTOP_QQ=$INSTALLTOP_QQ
OPENSSLDIR=$OPENSSLDIR
+OPENSSLDIR_QQ=$OPENSSLDIR_QQ
ENGINESDIR=$ENGINESDIR
+ENGINESDIR_QQ=$ENGINESDIR_QQ
# Set your compiler options
PLATFORM=$platform
CC=$bin_dir${cc}
CFLAG=$cflags
+CFLAG_Q=$cflags_q
APP_CFLAG=$app_cflag
LIB_CFLAG=$lib_cflag
SHLIB_CFLAG=$shl_cflag
$rules .= &do_rehash_rule("rehash.time", "certs/demo apps tools");
$rules .= &do_test_rule("test", "rehash.time", "run_tests.pl");
-my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
-$platform_cpp_symbol =~ s/-/_/g;
-if (open(IN,"crypto/buildinf.h"))
- {
- # Remove entry for this platform in existing file buildinf.h.
-
- my $old_buildinf_h = "";
- while (<IN>)
- {
- if (/^\#ifdef $platform_cpp_symbol$/)
- {
- while (<IN>) { last if (/^\#endif/); }
- }
- else
- {
- $old_buildinf_h .= $_;
- }
- }
- close(IN);
-
- open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
- print OUT $old_buildinf_h;
- close(OUT);
- }
-
-open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h";
-printf OUT <<"EOF";
-#ifdef $platform_cpp_symbol
- /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
- #define CFLAGS "compiler: $cc $cflags"
- #define PLATFORM "$platform"
+$rules .= <<"EOF";
+crypto${o}buildinf.h : MINFO
+ \$(PERL) util${o}mkbuildinf.pl "\$(CC) \$(CFLAG_Q)" "\$(PLATFORM)" > crypto${o}buildinf.h
+$(OBJ_D)${o}cversion${obj} : crypto${o}buildinf.h
EOF
-printf OUT " #define DATE \"%s\"\n", scalar gmtime();
-printf OUT "#endif\n";
-close(OUT);
# Strip off trailing ' '
foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
local($target,$source,$ex_flags)=@_;
local($ret);
- $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/);
$target =~ s/\//$o/g if $o ne "/";
$source =~ s/\//$o/g if $o ne "/";
$ret ="$target: \$(SRC_D)$o$source\n\t";
$cflags = "compiler: $cflags";
$date = localtime();
print <<"END_OUTPUT";
-#ifndef MK1MF_BUILD
- /* auto-generated by util/mkbuildinf.pl for crypto/cversion.c */
- #define CFLAGS cflags
- /*
- * Generate CFLAGS as an array of individual characters. This is a
- * workaround for the situation where CFLAGS gets too long for a C90 string
- * literal
- */
- static const char cflags[] = {
+/* auto-generated by util/mkbuildinf.pl for crypto/cversion.c */
+#define CFLAGS cflags
+/*
+ * Generate CFLAGS as an array of individual characters. This is a
+ * workaround for the situation where CFLAGS gets too long for a C90 string
+ * literal
+ */
+static const char cflags[] = {
END_OUTPUT
my $ctr = 0;
foreach my $c (split //, $cflags) {
if ($ctr != 1) {
print "\n";
}
- print " ";
+ print " ";
}
print "'$c',";
}
print <<"END_OUTPUT";
'\\0'
- };
- #define PLATFORM "platform: $platform"
- #define DATE "built on: $date"
-#endif
+};
+#define PLATFORM "platform: $platform"
+#define DATE "built on: $date"
END_OUTPUT