]> git.donarmstrong.com Git - debhelper.git/commitdiff
makefile: Support the (asking for trouble) case of MAKE being set to something with...
authorJoey Hess <joey@gnu.kitenet.net>
Sun, 3 Jan 2010 19:51:05 +0000 (14:51 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Sun, 3 Jan 2010 19:51:05 +0000 (14:51 -0500)
Debian/Debhelper/Buildsystem/makefile.pm
debian/changelog

index 47814296b342c30fd14c9671130a665907bbbd39..2c14c15184b92bcd26301676a8e33648509b6cf9 100644 (file)
@@ -10,24 +10,21 @@ use strict;
 use Debian::Debhelper::Dh_Lib qw(escape_shell clean_jobserver_makeflags);
 use base 'Debian::Debhelper::Buildsystem';
 
-sub get_makecmd_C {
-       my $this=shift;
-       my $buildpath = $this->get_buildpath();
-       if ($buildpath ne '.') {
-               return $this->{makecmd} . " -C " . escape_shell($buildpath);
-       }
-       return $this->{makecmd};
-}
-
 sub exists_make_target {
        my ($this, $target) = @_;
-       my $makecmd=$this->get_makecmd_C();
 
        # Use make -n to check to see if the target would do
        # anything. There's no good way to test if a target exists.
-       my $ret=`$makecmd -s -n --no-print-directory $target 2>/dev/null | head -n 1`;
-       chomp $ret;
-       return length($ret);
+       my @opts=("-s", "-n", "--no-print-directory");
+       my $buildpath = $this->get_buildpath();
+       unshift @opts, "-C", $buildpath if $buildpath ne ".";
+       open(SAVEDERR, ">&STDERR");
+       close STDERR;
+       open(MAKE, "-|", $this->{makecmd}, @opts, $target);
+       my $output=<MAKE>;
+       close MAKE;
+       open(STDERR, ">&SAVEDERR");
+       return defined $output && length $output;
 }
 
 sub do_make {
index 0f60a0d02708cbcf1bc354ac97ac4d9a41ad1529..bb8563cc48826e97c773a6e54ed42ed79b463f79 100644 (file)
@@ -1,6 +1,8 @@
 debhelper (7.4.12) UNRELEASED; urgency=low
 
   * dh_bugfiles: Doc typo. Closes: #563269
+  * makefile: Support the (asking for trouble) case of MAKE being set to
+    something with a space in it. Closes: #563557
 
  -- Joey Hess <joeyh@debian.org>  Fri, 01 Jan 2010 13:00:22 -0500