The branch master has been updated
       via  8458f1bfab1b30ce96a39593331a94b44efbe2b2 (commit)
      from  b2d6aed499e584e0da232fd109459cf7743f00fe (commit)


- Log -----------------------------------------------------------------
commit 8458f1bfab1b30ce96a39593331a94b44efbe2b2
Author: Richard Levitte <[email protected]>
Date:   Tue Mar 8 19:19:53 2016 +0100

    Redo the Unix source code generator
    
    For assembler, we want the final target to be foo.s (lowercase s).
    However, the build.info may have lines like this (note upper case S):
    
        GENERATE[foo.S]=foo.pl
    
    This indicates that foo.s (lowercase s) is still to be produced, but
    that producing it will take an extra step via $(CC) -E.  Therefore,
    the following variants (simplified for display) can be generated:
    
        GENERATE[foo.S]=foo.pl  =>  foo.s: foo.pl
                                        $(PERL) $foo.pl [email protected]; \
                                        $(CC) $(CFLAGS) -E -P [email protected] > $@ && \
                                        rm -f [email protected]
    
        GENERATE[foo.s]=foo.pl  =>  foo.s: foo.pl
                                        $(PERL) $foo.pl $@
    
        GENERATE[foo.S]=foo.m4  =>  foo.s: foo.m4
                                        m4 -B 8192 $foo.m4 > [email protected]; \
                                        $(CC) $(CFLAGS) -E -P [email protected] > $@ && \
                                        rm -f [email protected]
    
        GENERATE[foo.s]=foo.m4  =>  foo.s: foo.m4
                                        m4 -B 8192 $foo.m4 > $@
    
    Reviewed-by: Andy Polyakov <[email protected]>

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

Summary of changes:
 Configurations/unix-Makefile.tmpl | 49 +++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 20 deletions(-)

diff --git a/Configurations/unix-Makefile.tmpl 
b/Configurations/unix-Makefile.tmpl
index 9f4c1f2..d5a64b5 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -828,38 +828,47 @@ $args{src}: $args{generator}->[0]
        \$(PERL) $generator > \$@
 EOF
       } else {
-          if ($args{generator}->[0] =~ /\.[sS]$/) {
-              return <<"EOF";
-$args{src}: $args{generator}->[0]
-       \$(CC) \$(CFLAGS) -E \$< > \$@
-EOF
-          } elsif ($args{generator}->[0] =~ /\.pl$/) {
-             return <<"EOF";
-$args{src}: $args{generator}->[0]
+          if ($args{generator}->[0] =~ /\.pl$/) {
+              $generator = 'CC="$(CC)" $(PERL) '.$generator;
+          } elsif ($args{generator}->[0] =~ /\.m4$/) {
+              $generator = 'm4 -B 8192 '.$generator.' >'
+          } elsif ($args{generator}->[0] =~ /\.S$/) {
+              $generator = undef;
+          } else {
+              die "Generator type for $args{src} unknown: $generator\n";
+          }
+
+          if (defined($generator)) {
+              # If the target is named foo.S in build.info, we want to
+              # end up generating foo.s in two steps.
+              if ($args{src} =~ /\.S$/) {
+                   (my $target = $args{src}) =~ s|\.S$|.s|;
+                   return <<"EOF";
+$target: $args{generator}->[0]
        ( trap "rm -f \[email protected]" INT; \\
-         CC="\$(CC)" \$(PERL) $generator \[email protected]; \\
-         if grep '^#' \[email protected] >/dev/null; then \\
-             \$(CC) -E -P \[email protected] > \$@ && rm -f \[email protected]; \\
-         else \\
-             mv \[email protected] \$@; \\
-         fi )
+         $generator \[email protected]; \\
+         \$(CC) \$(CFLAGS) -E -P \[email protected] > \$@ && rm -f \[email protected] )
 EOF
-          } elsif ($args{generator}->[0] =~ /\.m4$/) {
+              }
+              # Otherwise....
               return <<"EOF";
 $args{src}: $args{generator}->[0]
-       m4 -B 8192 $generator > \$@
+       $generator \$@
 EOF
-          } else {
-              die "Generator type for $args{src} unknown: $args{generator}\n";
           }
+          return <<"EOF";
+$args{src}: $args{generator}->[0]
+       \$(CC) \$(CFLAGS) -E -P \$< > \$@
+EOF
       }
   }
 
   sub src2obj {
       my %args = @_;
       my $obj = $args{obj};
-      my $srcs = join(" ", @{$args{srcs}});
-      my $deps = join(" ", @{$args{srcs}}, @{$args{deps}});
+      my @srcs = map { (my $x = $_) =~ s/\.S$/.s/; $x } ( @{$args{srcs}} );
+      my $srcs = join(" ",  @srcs);
+      my $deps = join(" ", @srcs, @{$args{deps}});
       my $incs = join("", map { " -I".$_ } @{$args{incs}});
       my $ecflags = { lib => '$(SHARED_CFLAGS)',
                       dso => '$(DSO_CFLAGS)',
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to