Communicate Configure generated header files to build files
authorRichard Levitte <levitte@openssl.org>
Mon, 16 May 2016 12:54:39 +0000 (14:54 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 24 May 2016 22:46:00 +0000 (00:46 +0200)
Add Configure generated header files to $unified_info{generate}.  This
makes sure the build files will pick them up with the rest for the
GENERATED macro, and thereby make sure they get cleaned away by 'make
clean'

Reviewed-by: Rich Salz <rsalz@openssl.org>
Configurations/common.tmpl
Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl
Configure

index af1746a14485222cbfbf19800643821421871d1a..e3f49e776ab0d1d187562ba6f4be174ad72c4305 100644 (file)
@@ -42,6 +42,8 @@
      my $bin = shift;
      my %opts = @_;
      if ($unified_info{generate}->{$src}) {
      my $bin = shift;
      my %opts = @_;
      if ($unified_info{generate}->{$src}) {
+         die "$src is generated by Configure, should not appear in build file\n"
+             if ref $unified_info{generate}->{$src} eq "";
          my $script = $unified_info{generate}->{$src}->[0];
          $OUT .= generatesrc(src => $src,
                              generator => $unified_info{generate}->{$src},
          my $script = $unified_info{generate}->{$src}->[0];
          $OUT .= generatesrc(src => $src,
                              generator => $unified_info{generate}->{$src},
index 469bd323d8f3b84ba4f82e12d21417a9dfef81db..8c27ba98ec3ef5f8dde6518e4c7fd63783c328ad 100644 (file)
@@ -84,7 +84,12 @@ DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
                   grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
                   keys %{$unified_info{sources}}); -}
 {- output_on() if $disabled{makedepend}; "" -}
                   grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
                   keys %{$unified_info{sources}}); -}
 {- output_on() if $disabled{makedepend}; "" -}
-GENERATED={- join(" ", map { (my $x = $_) =~ s|\.S$|\.s|; $x } keys %{$unified_info{generate}}) -}
+GENERATED={- join(" ",
+                  ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
+                    grep { defined $unified_info{generate}->{$_} }
+                    map { @{$unified_info{sources}->{$_}} }
+                    grep { /\.o$/ } keys %{$unified_info{sources}} ),
+                  ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
 
 {- output_off() if $disabled{apps}; "" -}
 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
 
 {- output_off() if $disabled{apps}; "" -}
 BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
index d72c7bc50e90440db1198733688e3095388f81b1..e48aa2273dd4a57362a772154dc9cbc3354c83a9 100644 (file)
@@ -77,6 +77,12 @@ DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
                   grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
                   keys %{$unified_info{sources}}); -}
 {- output_on() if $disabled{makedepend}; "" -}
                   grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
                   keys %{$unified_info{sources}}); -}
 {- output_on() if $disabled{makedepend}; "" -}
+GENERATED={- join(" ",
+                  ( map { (my $x = $_) =~ s|\.[sS]$|\.asm|; $x }
+                    grep { defined $unified_info{generate}->{$_} }
+                    map { @{$unified_info{sources}->{$_}} }
+                    grep { /\.o$/ } keys %{$unified_info{sources}} ),
+                  ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
 
 # Do not edit these manually. Use Configure with --prefix or --openssldir
 # to change this!  Short explanation in the top comment in Configure
 
 # Do not edit these manually. Use Configure with --prefix or --openssldir
 # to change this!  Short explanation in the top comment in Configure
@@ -176,7 +182,7 @@ libclean:
 
 clean: libclean
        -del /Q /F $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
 
 clean: libclean
        -del /Q /F $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
-       -del /Q /S /F *.asm
+       -del /Q /S /F $(GENERATED)
        -del /Q /S /F *.d
        -del /Q /S /F *.obj
        -del /Q /S /F *.pdb
        -del /Q /S /F *.d
        -del /Q /S /F *.obj
        -del /Q /S /F *.pdb
index 215ffb87f2c7f300599f6e51a86b245163552d38..95d457c1712d71ed0f8c757d2c5ce888416485ca 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1731,6 +1731,13 @@ EOF
         }
     }
 
         }
     }
 
+    ### Add information about files generated by Configure
+    foreach (map { abs2rel($_) } @generated_headers) {
+        die "Configure gerenerated header file $_ has a GENERATE in a build.info\n"
+            if $unified_info{generate}->{$_};
+        $unified_info{generate}->{$_} = "Generated by Configure";
+    }
+
     ### Make unified_info a bit more efficient
     # One level structures
     foreach (("programs", "libraries", "engines", "scripts", "extra", "overrides")) {
     ### Make unified_info a bit more efficient
     # One level structures
     foreach (("programs", "libraries", "engines", "scripts", "extra", "overrides")) {