diff --git a/src/plugins/madde/maemodeploybymountsteps.cpp b/src/plugins/madde/maemodeploybymountsteps.cpp
index 132b5be02f02009578e90e18a0c2efaf437e8912..116a949ac0f3a73d7409ff86a540790aafe5b373 100644
--- a/src/plugins/madde/maemodeploybymountsteps.cpp
+++ b/src/plugins/madde/maemodeploybymountsteps.cpp
@@ -199,8 +199,7 @@ void AbstractMaemoDeployByMountService::doDeploy()
     }
 
     m_state = Mounting;
-    m_mounter->setupMounts(connection(), deviceConfiguration(), mountSpecifications(),
-        qt4BuildConfiguration());
+    m_mounter->setupMounts(connection(), deviceConfiguration(), mountSpecifications(), profile());
 }
 
 void AbstractMaemoDeployByMountService::stopDeployment()
diff --git a/src/plugins/madde/maemodeploymentmounter.cpp b/src/plugins/madde/maemodeploymentmounter.cpp
index f85bb7d576ddf915d76a12cd5ae8998eef2509c9..5830284e1e72a69c400955473c25add43f8976cf 100644
--- a/src/plugins/madde/maemodeploymentmounter.cpp
+++ b/src/plugins/madde/maemodeploymentmounter.cpp
@@ -34,14 +34,13 @@
 #include "maemoremotemounter.h"
 
 #include <projectexplorer/target.h>
-#include <qt4projectmanager/qt4buildconfiguration.h>
 #include <qtsupport/qtprofileinformation.h>
 #include <remotelinux/linuxdeviceconfiguration.h>
 #include <remotelinux/remotelinuxusedportsgatherer.h>
 #include <utils/qtcassert.h>
 #include <ssh/sshconnection.h>
 
-using namespace Qt4ProjectManager;
+using namespace ProjectExplorer;
 using namespace RemoteLinux;
 using namespace QSsh;
 
@@ -73,7 +72,7 @@ MaemoDeploymentMounter::~MaemoDeploymentMounter() {}
 void MaemoDeploymentMounter::setupMounts(SshConnection *connection,
     const LinuxDeviceConfiguration::ConstPtr &devConf,
     const QList<MaemoMountSpecification> &mountSpecs,
-    const Qt4BuildConfiguration *bc)
+    const Profile *profile)
 {
     QTC_ASSERT(m_state == Inactive, return);
 
@@ -81,7 +80,7 @@ void MaemoDeploymentMounter::setupMounts(SshConnection *connection,
     m_connection = connection;
     m_devConf = devConf;
     m_mounter->setConnection(m_connection, m_devConf);
-    m_buildConfig = bc;
+    m_profile = profile;
     connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
     setState(UnmountingOldDirs);
     unmount();
@@ -102,7 +101,7 @@ void MaemoDeploymentMounter::setupMounter()
     setState(UnmountingCurrentDirs);
 
     m_mounter->resetMountSpecifications();
-    m_mounter->setBuildConfiguration(m_buildConfig);
+    m_mounter->setProfile(m_profile);
     foreach (const MaemoMountSpecification &mountSpec, m_mountSpecs)
         m_mounter->addMountSpecification(mountSpec, true);
     unmount();
@@ -173,7 +172,7 @@ void MaemoDeploymentMounter::handlePortListReady()
         return;
 
     setState(Mounting);
-    m_freePorts = MaemoGlobal::freePorts(m_devConf, QtSupport::QtProfileInformation::qtVersion(m_buildConfig->target()->profile()));
+    m_freePorts = MaemoGlobal::freePorts(m_devConf, QtSupport::QtProfileInformation::qtVersion(m_profile));
     m_mounter->mount(&m_freePorts, m_portsGatherer);
 }
 
diff --git a/src/plugins/madde/maemodeploymentmounter.h b/src/plugins/madde/maemodeploymentmounter.h
index 974abb64fd5e07591b7998683b7cc6169344cec2..469fc9dfb7b94dd2bedb8c936c7bce84e3e247dd 100644
--- a/src/plugins/madde/maemodeploymentmounter.h
+++ b/src/plugins/madde/maemodeploymentmounter.h
@@ -40,7 +40,7 @@
 #include <QSharedPointer>
 
 namespace QSsh { class SshConnection; }
-namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
+namespace ProjectExplorer { class Profile; }
 
 namespace RemoteLinux {
 class LinuxDeviceConfiguration;
@@ -62,7 +62,7 @@ public:
     void setupMounts(QSsh::SshConnection *connection,
         const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
         const QList<MaemoMountSpecification> &mountSpecs,
-        const Qt4ProjectManager::Qt4BuildConfiguration *bc);
+        const ProjectExplorer::Profile *profile);
     void tearDownMounts();
 
 signals:
@@ -97,7 +97,7 @@ private:
     RemoteLinux::RemoteLinuxUsedPortsGatherer * const m_portsGatherer;
     Utils::PortList m_freePorts;
     QList<MaemoMountSpecification> m_mountSpecs;
-    const Qt4ProjectManager::Qt4BuildConfiguration *m_buildConfig;
+    const ProjectExplorer::Profile *m_profile;
 };
 
 } // namespace Internal
diff --git a/src/plugins/madde/maemoremotemounter.cpp b/src/plugins/madde/maemoremotemounter.cpp
index 695a27e98f6ae48e43bdd3f6e5423668b25971ab..8ed3ac55f59b2cb80242c06d790135f0a30db1ab 100644
--- a/src/plugins/madde/maemoremotemounter.cpp
+++ b/src/plugins/madde/maemoremotemounter.cpp
@@ -37,9 +37,6 @@
 #include <projectexplorer/target.h>
 #include <ssh/sshconnection.h>
 #include <ssh/sshremoteprocess.h>
-#include <qt4projectmanager/qt4buildconfiguration.h>
-#include <qtsupport/baseqtversion.h>
-#include <remotelinux/linuxdeviceconfiguration.h>
 #include <remotelinux/remotelinuxusedportsgatherer.h>
 #include <utils/qtcassert.h>
 
@@ -47,7 +44,6 @@
 
 using namespace ProjectExplorer;
 using namespace QSsh;
-using namespace Qt4ProjectManager;
 using namespace RemoteLinux;
 using namespace Utils;
 
@@ -76,13 +72,13 @@ void MaemoRemoteMounter::setConnection(SshConnection *connection,
     m_devConf = devConf;
 }
 
-void MaemoRemoteMounter::setBuildConfiguration(const Qt4BuildConfiguration *bc)
+void MaemoRemoteMounter::setProfile(const Profile *profile)
 {
     QTC_ASSERT(m_state == Inactive, return);
 
-    Core::Id typeId = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(bc->target()->profile());
+    Core::Id typeId = DeviceTypeProfileInformation::deviceTypeId(profile);
     m_remoteMountsAllowed = MaddeDevice::allowsRemoteMounts(typeId);
-    m_maddeRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(bc->target()->profile());
+    m_maddeRoot = SysRootProfileInformation::sysRoot(profile);
 }
 
 void MaemoRemoteMounter::addMountSpecification(const MaemoMountSpecification &mountSpec,
diff --git a/src/plugins/madde/maemoremotemounter.h b/src/plugins/madde/maemoremotemounter.h
index 42423afcefb6f22d28561214b752e5055f41f8a2..6ade8dbe34de7d7b8a28888f197cd7d34d933f59 100644
--- a/src/plugins/madde/maemoremotemounter.h
+++ b/src/plugins/madde/maemoremotemounter.h
@@ -49,9 +49,9 @@ class SshConnection;
 class SshRemoteProcess;
 }
 
-namespace Utils { class PortList; }
-namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
+namespace ProjectExplorer { class Profile; }
 namespace RemoteLinux { class RemoteLinuxUsedPortsGatherer; }
+namespace Utils { class PortList; }
 
 namespace Madde {
 namespace Internal {
@@ -67,7 +67,7 @@ public:
     void setConnection(QSsh::SshConnection *connection,
         const ProjectExplorer::IDevice::ConstPtr &devConf);
 
-    void setBuildConfiguration(const Qt4ProjectManager::Qt4BuildConfiguration *bc);
+    void setProfile(const ProjectExplorer::Profile *profile);
     void addMountSpecification(const MaemoMountSpecification &mountSpec,
         bool mountAsRoot);
     bool hasValidMountSpecifications() const;
diff --git a/src/plugins/madde/maemosshrunner.cpp b/src/plugins/madde/maemosshrunner.cpp
index e6c0acf4350ded74447b035e9a1ed642d6764216..d177d6017033105388f468f85696746582d1c9cf 100644
--- a/src/plugins/madde/maemosshrunner.cpp
+++ b/src/plugins/madde/maemosshrunner.cpp
@@ -40,6 +40,7 @@
 #include <utils/qtcassert.h>
 #include <ssh/sshconnection.h>
 
+using namespace ProjectExplorer;
 using namespace Qt4ProjectManager;
 using namespace RemoteLinux;
 using namespace QSsh;
@@ -53,9 +54,10 @@ MaemoSshRunner::MaemoSshRunner(QObject *parent, MaemoRunConfiguration *runConfig
       m_mountSpecs(runConfig->remoteMounts()->mountSpecs()),
       m_mountState(InactiveMountState)
 {
-    const Qt4BuildConfiguration * const bc = runConfig->activeQt4BuildConfiguration();
-    m_qtId = bc ? QtSupport::QtProfileInformation::qtVersionId(bc->target()->profile()) : -1;
-    m_mounter->setBuildConfiguration(bc);
+    const BuildConfiguration * const bc = runConfig->target()->activeBuildConfiguration();
+    Profile *profile  = bc ? bc->target()->profile() : 0;
+    m_qtId = QtSupport::QtProfileInformation::qtVersionId(profile);
+    m_mounter->setProfile(profile);
     connect(m_mounter, SIGNAL(mounted()), this, SLOT(handleMounted()));
     connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
     connect(m_mounter, SIGNAL(error(QString)), this,
diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
index 2b6f2c8b6c805b95968240f8fd2e88c34545cda9..ccc988dbd62d938fa34f058af2e8ce189f94098d 100644
--- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
+++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.cpp
@@ -84,10 +84,11 @@ class AbstractRemoteLinuxDeployServicePrivate
 {
 public:
     AbstractRemoteLinuxDeployServicePrivate()
-        : connection(0), state(Inactive), stopRequested(false) {}
+        : profile(0), connection(0), state(Inactive), stopRequested(false) {}
 
     LinuxDeviceConfiguration::ConstPtr deviceConfiguration;
     QPointer<Qt4BuildConfiguration> buildConfiguration;
+    ProjectExplorer::Profile *profile;
     SshConnection *connection;
     State state;
     bool stopRequested;
@@ -113,6 +114,11 @@ const Qt4BuildConfiguration *AbstractRemoteLinuxDeployService::qt4BuildConfigura
     return d->buildConfiguration;
 }
 
+const ProjectExplorer::Profile *AbstractRemoteLinuxDeployService::profile() const
+{
+    return d->profile;
+}
+
 LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxDeployService::deviceConfiguration() const
 {
     return d->deviceConfiguration;
@@ -128,10 +134,10 @@ void AbstractRemoteLinuxDeployService::saveDeploymentTimeStamp(const DeployableF
     if (!d->buildConfiguration)
         return;
     const QtSupport::BaseQtVersion *const qtVersion
-            = QtSupport::QtProfileInformation::qtVersion(d->buildConfiguration->target()->profile());
+            = QtSupport::QtProfileInformation::qtVersion(d->profile);
     QString systemRoot;
-    if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(d->buildConfiguration->target()->profile()))
-        systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(d->buildConfiguration->target()->profile()).toString();
+    if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(d->profile))
+        systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(d->profile).toString();
     if (!qtVersion || !qtVersion->isValid())
         return;
     d->lastDeployed.insert(DeployParameters(deployableFile,
@@ -145,12 +151,12 @@ bool AbstractRemoteLinuxDeployService::hasChangedSinceLastDeployment(const Deplo
     if (!d->buildConfiguration)
         return true;
     const QtSupport::BaseQtVersion *const qtVersion
-            = QtSupport::QtProfileInformation::qtVersion(d->buildConfiguration->target()->profile());
+            = QtSupport::QtProfileInformation::qtVersion(d->profile);
     if (!qtVersion || !qtVersion->isValid())
         return true;
     QString systemRoot;
-    if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(d->buildConfiguration->target()->profile()))
-        systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(d->buildConfiguration->target()->profile()).toString();
+    if (ProjectExplorer::SysRootProfileInformation::hasSysRoot(d->profile))
+        systemRoot = ProjectExplorer::SysRootProfileInformation::sysRoot(d->profile).toString();
     const QDateTime &lastDeployed = d->lastDeployed.value(DeployParameters(deployableFile,
         deviceConfiguration()->sshParameters().host, systemRoot));
     return !lastDeployed.isValid()
@@ -165,6 +171,10 @@ void AbstractRemoteLinuxDeployService::setDeviceConfiguration(const LinuxDeviceC
 void AbstractRemoteLinuxDeployService::setBuildConfiguration(Qt4BuildConfiguration *bc)
 {
     d->buildConfiguration = bc;
+    if (bc && bc->target())
+        d->profile = bc->target()->profile();
+    else
+        d->profile = 0;
 }
 
 void AbstractRemoteLinuxDeployService::start()
diff --git a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h
index cba3a87f5e52729729917db2e721ca8d758d1cb6..b54a34b2e6223fdee38d365c54ffc1f32e88bb40 100644
--- a/src/plugins/remotelinux/abstractremotelinuxdeployservice.h
+++ b/src/plugins/remotelinux/abstractremotelinuxdeployservice.h
@@ -35,13 +35,10 @@
 #include <QObject>
 #include <QSharedPointer>
 #include <QVariantMap>
-QT_FORWARD_DECLARE_CLASS(QString)
 
 namespace QSsh { class SshConnection; }
-
-namespace Qt4ProjectManager {
-class Qt4BuildConfiguration;
-}
+namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
+namespace ProjectExplorer { class Profile; }
 
 namespace RemoteLinux {
 class DeployableFile;
@@ -79,6 +76,7 @@ signals:
 
 protected:
     const Qt4ProjectManager::Qt4BuildConfiguration *qt4BuildConfiguration() const;
+    const ProjectExplorer::Profile *profile() const;
     QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
     QSsh::SshConnection *connection() const;