]> git.donarmstrong.com Git - debhelper.git/commitdiff
makefile.pm: remove build directory even if Makefile does not exist yet.
authorModestas Vainius <modax@debian.org>
Thu, 21 Jul 2011 11:48:57 +0000 (14:48 +0300)
committerJoey Hess <joey@kitenet.net>
Fri, 5 Aug 2011 17:43:02 +0000 (13:43 -0400)
Assume that the package can be cleaned (i.e. the build directory can be
removed) as long as it is built out-of-source tree and can be configured. This
is useful for derivative buildsystems which generate Makefiles.

Debian/Debhelper/Buildsystem/makefile.pm
t/buildsystems/buildsystem_tests

index d4b68e4c1e2de7f943c6008021e249fc46b1ef66..f38387bdc22c4a7a7aff94cba3094e4d41d20664 100644 (file)
@@ -69,11 +69,23 @@ sub check_auto_buildable {
        my $this=shift;
        my ($step) = @_;
 
-       # This is always called in the source directory, but generally
-       # Makefiles are created (or live) in the the build directory.
-       return (-e $this->get_buildpath("Makefile") ||
-               -e $this->get_buildpath("makefile") ||
-               -e $this->get_buildpath("GNUmakefile")) ? 1 : 0;
+       if (-e $this->get_buildpath("Makefile") ||
+           -e $this->get_buildpath("makefile") ||
+           -e $this->get_buildpath("GNUmakefile"))
+       {
+               # This is always called in the source directory, but generally
+               # Makefiles are created (or live) in the the build directory.
+               return 1;
+       } elsif ($step eq "clean" && defined $this->get_builddir() &&
+                $this->check_auto_buildable("configure"))
+       {
+               # Assume that the package can be cleaned (i.e. the build directory can
+               # be removed) as long as it is built out-of-source tree and can be
+               # configured. This is useful for derivative buildsystems which
+               # generate Makefiles.
+               return 1;
+       }
+       return 0;
 }
 
 sub build {
index c6f23ca504a2489f87041adb2880cbf7d05ee4d6..3b45ac5e413af5567f7cae76bb4b6b6611982275 100755 (executable)
@@ -256,7 +256,7 @@ touch "$tmpdir/configure", 0755;
 test_check_auto_buildable($bs{autoconf}, "configure", { configure => 1 });
 
 touch "$tmpdir/CMakeLists.txt";
-test_check_auto_buildable($bs{cmake}, "CMakeLists.txt", { configure => 1 });
+test_check_auto_buildable($bs{cmake}, "CMakeLists.txt", { configure => 1, clean => 1 });
 
 touch "$tmpdir/Makefile.PL";
 test_check_auto_buildable($bs{perl_makemaker}, "Makefile.PL", { configure => 1 });