unified build scheme: add and document the "unified" driving engine
[openssl.git] / Configure
index 9954858f8cee4a516b3e51fd732d998f3b943e6d..c30204522a08fbb028eb7f94e7d480f49f098d8a 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -844,6 +844,9 @@ $target{nm} = "nm";
 $target{build_scheme} = [ $target{build_scheme} ]
     if ref($target{build_scheme}) ne "ARRAY";
 
+my ($builder, $builder_platform, @builder_opts) =
+    @{$target{build_scheme}};
+
 # if $config{prefix}/lib$target{multilib} is not an existing directory, then
 # assume that it's not searched by linker automatically, in
 # which case adding $target{multilib} suffix causes more grief than
@@ -976,7 +979,7 @@ if (!$config{no_shared})
                }
        }
 
-if ($target{build_scheme}->[0] ne "mk1mf")
+if ($builder ne "mk1mf")
        {
        # add {no-}static-engine to options to allow mkdef.pl to work without extra arguments
        if ($config{no_shared})
@@ -1163,7 +1166,17 @@ if ($strict_warnings)
 # If we use the unified build, collect information from build.info files
 my %unified_info = ();
 
-if ($target{build_scheme}->[0] eq "unified") {
+if ($builder eq "unified") {
+    # Store the name of the template file we will build the build file from
+    # in %config.  This may be useful for the build file itself.
+    my $build_file_template =
+        catfile($srcdir, "Configurations",
+                $builder_platform."-".$target{build_file}.".tmpl");
+    $build_file_template =
+        catfile($srcdir, "Configurations", $target{build_file}.".tmpl")
+        if (! -f $build_file_template);
+    $config{build_file_template} = $build_file_template;
+
     use lib catdir(dirname(__FILE__),"util");
     use with_fallback qw(Text::Template);
 
@@ -1323,7 +1336,7 @@ if ($target{build_scheme}->[0] eq "unified") {
                     next if @skip && $skip[$#skip] <= 0;
                     push @rawlines,  $_
                         if ($target_kind eq $target{build_file}
-                            || $target_kind eq $target{build_file}."(".$target{build_scheme}->[1].")");
+                            || $target_kind eq $target{build_file}."(".$builder_platform.")");
                 }
             },
             qr/^(?:#.*|\s*)$/ => sub { },
@@ -1601,7 +1614,7 @@ print OUT <<"EOF";
 );
 
 EOF
-if ($target{build_scheme}->[0] eq "unified") {
+if ($builder eq "unified") {
     my $recurse;
     $recurse = sub {
         my $indent = shift;
@@ -1646,7 +1659,7 @@ EOF
 print OUT "1;\n";
 close(OUT);
 
-die <<"EOF" if $target{build_scheme}->[0] ne "unified" && $srcdir ne $blddir;
+die <<"EOF" if $builder ne "unified" && $srcdir ne $blddir;
 
 ***** Trying building anywhere else than in the source tree will not
 ***** work for target $config{target}.  To make it possible, it needs
@@ -1654,7 +1667,7 @@ die <<"EOF" if $target{build_scheme}->[0] ne "unified" && $srcdir ne $blddir;
 
 EOF
 
-print "IsMK1MF       =", ($target{build_scheme}->[0] eq "mk1mf" ? "yes" : "no"), "\n";
+print "IsMK1MF       =", ($builder eq "mk1mf" ? "yes" : "no"), "\n";
 print "CC            =$target{cc}\n";
 print "CFLAG         =$config{cflags}\n";
 print "LFLAG         =$config{lflags}\n";
@@ -1735,7 +1748,20 @@ sub build_Makefile {
 
 my %builders = (
     unified => sub {
-        die "unified build currently does nothing";
+        run_dofile(catfile($blddir, $target{build_file}),
+                   $config{build_file_template},
+                   catfile($srcdir, "Configurations", "common.tmpl"));
+
+        my $make_command = "$make PERL=\'$config{perl}\'";
+        my $make_targets = "";
+        $make_targets .= " depend"
+            if $config{depflags} ne $default_depflags && $make_depend;
+        (system $make_command.$make_targets) == 0
+            or die "make $make_targets failed"
+            if $make_targets ne "";
+        if ($config{depflags} ne $default_depflags && !$make_depend) {
+            $warn_make_depend++;
+        }
     },
     unixmake => sub {
         build_Makefile();
@@ -1745,14 +1771,18 @@ my %builders = (
 
        my $make_command = "$make PERL=\'$config{perl}\'";
        my $make_targets = "";
-       $make_targets .= " depend" if $config{depflags} ne $default_depflags && $make_depend;
-       (system $make_command.$make_targets) == 0 or die "make $make_targets failed"
+       $make_targets .= " depend"
+           if $config{depflags} ne $default_depflags && $make_depend;
+       (system $make_command.$make_targets) == 0
+           or die "make $make_targets failed"
            if $make_targets ne "";
+
        if ($config{depflags} ne $default_depflags && !$make_depend) {
             $warn_make_depend++;
         }
     },
     mk1mf => sub {
+        my $platform = shift;
         # The only reason we do this is to have something to build MINFO from
         build_Makefile();
 
@@ -1769,7 +1799,7 @@ EOF
        close(OUT);
 
        # create the ms/version32.rc file if needed
-       if (! grep /^netware/, @{$target{build_scheme}}) {
+       if ($platform eq "netware") {
            my ($v1, $v2, $v3, $v4);
            if ($config{version_num} =~ /^0x([0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{1})L$/i) {
                $v1=hex $1;
@@ -1832,8 +1862,7 @@ EOF
     },
     );
 
-my ($builder, @builder_opts) = @{$target{build_scheme}};
-$builders{$builder}->(@builder_opts);
+$builders{$builder}->($builder_platform, @builder_opts);
 
 print <<"EOF";