From e90696686c7709d968464c58efce4eb543b3c429 Mon Sep 17 00:00:00 2001
From: dt <qtc-committer@nokia.com>
Date: Wed, 1 Jul 2009 16:33:25 +0200
Subject: [PATCH] Check for a Makefile before running make clean in the
 debugging helper directory

Fixes smart make scripts that try to guess the correct working directory
for make.
---
 .../projectexplorer/debugginghelper.cpp        | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/plugins/projectexplorer/debugginghelper.cpp b/src/plugins/projectexplorer/debugginghelper.cpp
index 680d42567cd..fbbab7f5f3a 100644
--- a/src/plugins/projectexplorer/debugginghelper.cpp
+++ b/src/plugins/projectexplorer/debugginghelper.cpp
@@ -164,14 +164,16 @@ QString DebuggingHelperLibrary::buildDebuggingHelperLibrary(const QString &direc
     output += "\n";
 
     QString makeFullPath = env.searchInPath(makeCommand);
-    if (!makeFullPath.isEmpty()) {
-        output += QString("Running %1 clean...\n").arg(makeFullPath);
-        proc.start(makeFullPath, QStringList() << "clean");
-        proc.waitForFinished();
-        output += proc.readAll();
-    } else {
-        output += QString("%1 not found in PATH\n").arg(makeCommand);
-        return output;
+    if (QFileInfo(directory + "/Makefile").exists()) {
+        if (!makeFullPath.isEmpty()) {
+            output += QString("Running %1 clean...\n").arg(makeFullPath);
+            proc.start(makeFullPath, QStringList() << "clean");
+            proc.waitForFinished();
+            output += proc.readAll();
+        } else {
+            output += QString("%1 not found in PATH\n").arg(makeCommand);
+            return output;
+        }
     }
 
     output += QString("\nRunning %1 ...\n").arg(qmakeCommand);
-- 
GitLab