From 6e36396de0c7bd30863764a74103683393030d93 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Mon, 19 Sep 2011 18:44:47 -0400 Subject: [PATCH] Move all Gnulib CLEANFILES variables to the end of the makefile. This makes the clean procedure independent of the configuration. --- scripts/fix-gnulib.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/fix-gnulib.pl b/scripts/fix-gnulib.pl index 1f50d49..3876f93 100755 --- a/scripts/fix-gnulib.pl +++ b/scripts/fix-gnulib.pl @@ -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 -- 2.43.0