Commit d4605727 authored by Richard Levitte's avatar Richard Levitte
Browse files

Pass down inclusion directories to source file generators



The source file generators sometimes use $(CC) to post-process
generated source, and getting the inclusion directories may be
necessary at times, so we pass them down.

RT#4406

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
parent 8cffddc0
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -32,17 +32,24 @@
     @newlist;
 }

 # dogenerate is responsible for producing all the recipes that build
 # generated source files.  It recurses in case a dependency is also a
 # generated source file.
 sub dogenerate {
     my $src = shift;
     return "" if $cache{$src};
     my $obj = shift;
     my $bin = shift;
     my %opts = @_;
     if ($unified_info{generate}->{$src}) {
         $OUT .= generatesrc(src => $src,
                             generator => $unified_info{generate}->{$src},
                             deps => $unified_info{depends}->{$src},
                             incs => [ @{$unified_info{includes}->{$bin}},
                                       @{$unified_info{includes}->{$obj}} ],
                             %opts);
         foreach (@{$unified_info{depends}->{$src}}) {
             dogenerate($_, %opts);
             dogenerate($_, $obj, $bin, %opts);
         }
     }
     $cache{$src} = 1;
@@ -65,7 +72,7 @@
                         %opts);
         foreach ((@{$unified_info{sources}->{$obj}},
                   @{$unified_info{depends}->{$obj}})) {
             dogenerate($_, %opts);
             dogenerate($_, $obj, $bin, %opts);
         }
     }
     $cache{$obj} = 1;
+3 −2
Original line number Diff line number Diff line
@@ -825,6 +825,7 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configurations/commo
  sub generatesrc {
      my %args = @_;
      my $generator = join(" ", @{$args{generator}});
      my $incs = join("", map { " -I".$_ } @{$args{incs}});

      if ($args{src} !~ /\.[sS]$/) {
          return <<"EOF";
@@ -851,7 +852,7 @@ EOF
$target: $args{generator}->[0]
	( trap "rm -f \$@.S" INT; \\
	  $generator \$@.S; \\
	  \$(CC) \$(CFLAGS) -E -P \$@.S > \$@ && rm -f \$@.S )
	  \$(CC) \$(CFLAGS) $incs -E -P \$@.S > \$@ && rm -f \$@.S )
EOF
              }
              # Otherwise....
@@ -862,7 +863,7 @@ EOF
          }
          return <<"EOF";
$args{src}: $args{generator}->[0]
	\$(CC) \$(CFLAGS) -E -P \$< > \$@
	\$(CC) \$(CFLAGS) $incs -E -P \$< > \$@
EOF
      }
  }
+3 −2
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)\Configure
      my %args = @_;
      (my $target = $args{src}) =~ s/\.[sS]$/.asm/;
      my $generator = join(" ", @{$args{generator}});
      my $incs = join("", map { " /I ".$_ } @{$args{incs}});

      if ($target !~ /\.asm$/) {
          return <<"EOF";
@@ -195,7 +196,7 @@ $target: $args{generator}->[0]
	set ASM=\$(AS)
	set CC=\$(CC)
	$generator \$@.S
	\$(CC) \$(CFLAGS) /EP /C \$@.S > \$@
	\$(CC) \$(CFLAGS) $incs /EP /C \$@.S > \$@
        del /Q \$@.S
EOF
              }
@@ -209,7 +210,7 @@ EOF
          }
          return <<"EOF";
$target: $args{generator}->[0]
	\$(CC) \$(CFLAGS) /EP /C \$< > \$@
	\$(CC) \$(CFLAGS) $incs /EP /C \$< > \$@
EOF
      }
  }