[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Sat Jun 4 18:34:55 UTC 2016


The branch master has been updated
       via  0ad1d94df4f844eec8eb7ff404582253b4a3cfae (commit)
      from  578b55144121b83a96e780f241f614759c75d1b5 (commit)


- Log -----------------------------------------------------------------
commit 0ad1d94df4f844eec8eb7ff404582253b4a3cfae
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat Apr 2 22:26:38 2016 +0200

    Add developer targets for each subdirectory we have something to build in
    
    Previous build scheme allowed building just the stuff in one
    subdirectory, like this:
    
        make -C crypto/aes
    
    Because the unified only has a top-level Makefile, this is not
    possible with it.  This change adds a replacement where each directory
    we have something to build in becomes a target in its own right,
    allowing building something like this:
    
        make crypto/aes
    
    The exception is the directory test, because we already have such a
    target.
    
    Reviewed-by: Stephen Henson <steve at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 Configurations/common.tmpl           | 46 ++++++++++++++++++++++++++++++++++--
 Configurations/unix-Makefile.tmpl    | 35 +++++++++++++++++++++++++++
 Configurations/windows-makefile.tmpl | 36 ++++++++++++++++++++++++++++
 3 files changed, 115 insertions(+), 2 deletions(-)

diff --git a/Configurations/common.tmpl b/Configurations/common.tmpl
index e3f49e7..ae6e4a1 100644
--- a/Configurations/common.tmpl
+++ b/Configurations/common.tmpl
@@ -1,7 +1,9 @@
 {- # -*- Mode: perl -*-
 
-     # A cache of objects for which a recipe has already been generated
-     my %cache;
+ use File::Basename;
+
+ # A cache of objects for which a recipe has already been generated
+ my %cache;
 
  # resolvedepends and reducedepends work in tandem to make sure
  # there are no duplicate dependencies and that they are in the
@@ -158,9 +160,47 @@
      $cache{$script} = 1;
  }
 
+ sub dodir {
+     my $dir = shift;
+     return "" if !exists(&generatedir) or $cache{$dir};
+     $OUT .= generatedir(dir => $dir,
+                         deps => $unified_info{dirinfo}->{$dir}->{deps},
+                         %{$unified_info{dirinfo}->{$_}->{products}});
+     $cache{$dir} = 1;
+ }
+
  # Start with populating the cache with all the overrides
  %cache = map { $_ => 1 } @{$unified_info{overrides}};
 
+ # For convenience collect information regarding directories where
+ # files are generated, those generated files and the end product
+ # they end up in where applicable.  Then, add build rules for those
+ # directories
+ if (exists &generatedir) {
+     my %loopinfo = ( "dso" => [ @{$unified_info{engines}} ],
+                      "lib" => [ @{$unified_info{libraries}} ],
+                      "bin" => [ @{$unified_info{programs}} ],
+                      "script" => [ @{$unified_info{scripts}} ] );
+     foreach my $type (keys %loopinfo) {
+         foreach my $product (@{$loopinfo{$type}}) {
+             my %dirs = ();
+             my $pd = dirname($product);
+             foreach (@{$unified_info{sources}->{$product}}) {
+                 my $d = dirname($_);
+                 next if $d eq "test";    # we already have a test target
+                 next if $d eq ".";       # current directory is just silly
+                 $dirs{$d} = 1;
+                 push @{$unified_info{dirinfo}->{$d}->{deps}}, $_
+                     if $d ne $pd;
+             }
+             foreach (keys %dirs) {
+                 push @{$unified_info{dirinfo}->{$_}->{products}->{$type}},
+                 $product;
+             }
+         }
+     }
+ }
+
  # Build all known libraries, engines, programs and scripts.
  # Everything else will be handled as a consequence.
  foreach (@{$unified_info{libraries}}) { dolib($_);    }
@@ -168,6 +208,8 @@
  foreach (@{$unified_info{programs}})  { dobin($_);    }
  foreach (@{$unified_info{scripts}})   { doscript($_); }
 
+ foreach (sort keys %{$unified_info{dirinfo}})  { dodir($_); }
+
  # Finally, should there be any applicable BEGINRAW/ENDRAW sections,
  # they are added here.
  $OUT .= $_."\n" foreach @{$unified_info{rawlines}};
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 7cdad23..217625d 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -1054,5 +1054,40 @@ $script: $sources
 	chmod a+x $script
 EOF
   }
+  sub generatedir {
+      my %args = @_;
+      my $dir = $args{dir};
+      my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
+      my @actions = ();
+      my %extinfo = ( dso => $dsoext,
+                      lib => $libext,
+                      bin => $exeext );
+
+      foreach my $type (("dso", "lib", "bin", "script")) {
+          next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
+          if ($type eq "lib") {
+              foreach my $lib (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
+                  push @actions, <<"EOF";
+	\$(AR) $lib$libext \$\?
+	\$(RANLIB) $lib$libext || echo Never mind.
+EOF
+              }
+          } else {
+              foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
+                  if (dirname($prod) eq $dir) {
+                      push @deps, $prod.$extinfo{$type};
+                  } else {
+                      push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
+                  }
+              }
+          }
+      }
+
+      my $deps = join(" ", @deps);
+      my $actions = join("\n", "", @actions);
+      return <<"EOF";
+$args{dir} $args{dir}/: $deps$actions
+EOF
+  }
   ""    # Important!  This becomes part of the template result.
 -}
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 3dae414..081e20b 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -490,5 +490,41 @@ $script: $sources
 	    "-o$target{build_file}" $sources > "$script"
 EOF
   }
+  sub generatedir {
+      my %args = @_;
+      my $dir = $args{dir};
+      my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
+      my @actions = ();
+      my %extinfo = ( dso => $dsoext,
+                      lib => $libext,
+                      bin => $exeext );
+
+      foreach my $type (("dso", "lib", "bin", "script")) {
+          next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
+          if ($type eq "lib") {
+              foreach my $lib (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
+                  push @actions, <<"EOF";
+	\$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib$libext @<<
+\$\?
+<<
+EOF
+              }
+          } else {
+              foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
+                  if (dirname($prod) eq $dir) {
+                      push @deps, $prod.$extinfo{$type};
+                  } else {
+                      push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
+                  }
+              }
+          }
+      }
+
+      my $deps = join(" ", @deps);
+      my $actions = join("\n", "", @actions);
+      return <<"EOF";
+$args{dir} $args{dir}\\ : $deps$actions
+EOF
+  }
   ""    # Important!  This becomes part of the template result.
 -}


More information about the openssl-commits mailing list