]> git.draconx.ca Git - dxcommon.git/commitdiff
Move all Gnulib CLEANFILES variables to the end of the makefile.
authorNick Bowler <nbowler@draconx.ca>
Mon, 19 Sep 2011 22:44:47 +0000 (18:44 -0400)
committerNick Bowler <nbowler@draconx.ca>
Wed, 21 Sep 2011 23:25:09 +0000 (19:25 -0400)
This makes the clean procedure independent of the configuration.

scripts/fix-gnulib.pl

index 1f50d4954b4c203dd90eb5d122b3c85768f1f115..3876f93e4b8639fcc0420ef51f17f8fc8f9a6c85 100755 (executable)
@@ -30,6 +30,7 @@ open STDIN,  "<", $input  or die "$input: $!\n"  if (defined $input);
 
 my $printed_header = 0;
 my (%allvars, %sourcevars);
+my @cleanfiles;
 
 sub drop {
        undef $_;
@@ -140,6 +141,16 @@ EOF
                $_ = mangle_target($_);
        }
 
+       # When using conditional-dependencies, *CLEANFILES can end up
+       # depending on the configuration.  This means that "make distclean"
+       # may not actually delete everything if the configuration changes
+       # after building the package.  Stash all the variables for later so
+       # they can be moved outside of any conditional.
+       if (/CLEANFILES/) {
+               push(@cleanfiles, $_);
+               drop;
+       }
+
        # Finally, references to $(srcdir) and $(builddir) need to be fixed up.
        s:\$\(srcdir\):\$\(top_srcdir\)/lib:g;
        s:\$\(builddir\):\$\(top_builddir\)/lib:g;
@@ -149,6 +160,7 @@ print <<'EOF';
 gnulib_lt_objects = $(libgnu_la_OBJECTS) $(gl_LTLIBOBJS)
 $(gnulib_lt_objects): $(gnulib_headers)
 EOF
+print @cleanfiles;
 
 # Some filenames are AC_SUBSTed by the Gnulib macros, and thus we need to
 # prepend lib/ if and only if they're not empty.  Unfortunately, make is not