diff --git a/src/plugins/projectexplorer/makestep.cpp b/src/plugins/projectexplorer/makestep.cpp index d4acb5629d8..e8220b04a7f 100644 --- a/src/plugins/projectexplorer/makestep.cpp +++ b/src/plugins/projectexplorer/makestep.cpp @@ -85,7 +85,7 @@ bool MakeStep::init() if (!bc) emit addTask(Task::buildConfigurationMissingTask()); - const CommandLine make = effectiveMakeCommand(); + const CommandLine make = effectiveMakeCommand(Execution); if (make.executable().isEmpty()) emit addTask(makeCommandMissingTask()); @@ -323,15 +323,27 @@ void MakeStep::setUserArguments(const QString &args) m_userArguments = args; } +QStringList MakeStep::displayArguments() const +{ + return {}; +} + FilePath MakeStep::makeCommand() const { return m_makeCommand; } -CommandLine MakeStep::effectiveMakeCommand() const +FilePath MakeStep::makeExecutable() const { - CommandLine cmd(m_makeCommand.isEmpty() ? defaultMakeCommand() : m_makeCommand); + return m_makeCommand.isEmpty() ? defaultMakeCommand() : m_makeCommand; +} +CommandLine MakeStep::effectiveMakeCommand(MakeCommandType type) const +{ + CommandLine cmd(makeExecutable()); + + if (type == Display) + cmd.addArgs(displayArguments()); cmd.addArgs(m_userArguments, CommandLine::Raw); cmd.addArgs(jobArguments()); cmd.addArgs(m_buildTargets); @@ -431,6 +443,8 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep) this, &MakeStepConfigWidget::updateDetails); connect(m_makeStep->buildConfiguration(), &BuildConfiguration::buildDirectoryChanged, this, &MakeStepConfigWidget::updateDetails); + connect(m_makeStep->project(), &Project::parsingFinished, + this, &MakeStepConfigWidget::updateDetails); Core::VariableChooser::addSupportForChildWidgets(this, m_makeStep->macroExpander()); } @@ -464,7 +478,7 @@ void MakeStepConfigWidget::updateDetails() else m_ui->makeLabel->setText(tr("Override %1:").arg(QDir::toNativeSeparators(defaultMake))); - const CommandLine make = m_makeStep->effectiveMakeCommand(); + const CommandLine make = m_makeStep->effectiveMakeCommand(MakeStep::Display); if (make.executable().isEmpty()) { setSummaryText(tr("Make: %1").arg(MakeStep::msgNoMakeCommand())); return; diff --git a/src/plugins/projectexplorer/makestep.h b/src/plugins/projectexplorer/makestep.h index 11cfb51bc3e..ad768017ece 100644 --- a/src/plugins/projectexplorer/makestep.h +++ b/src/plugins/projectexplorer/makestep.h @@ -45,6 +45,10 @@ class PROJECTEXPLORER_EXPORT MakeStep : public ProjectExplorer::AbstractProcessS Q_OBJECT public: + enum MakeCommandType { + Display, + Execution + }; explicit MakeStep(ProjectExplorer::BuildStepList *parent, Core::Id id); void setBuildTarget(const QString &buildTarget); @@ -59,7 +63,8 @@ public: void setUserArguments(const QString &args); Utils::FilePath makeCommand() const; void setMakeCommand(const Utils::FilePath &command); - Utils::CommandLine effectiveMakeCommand() const; + Utils::FilePath makeExecutable() const; + Utils::CommandLine effectiveMakeCommand(MakeCommandType type) const; void setClean(bool clean); bool isClean() const; @@ -88,6 +93,7 @@ public: protected: bool fromMap(const QVariantMap &map) override; void supportDisablingForSubdirs() { m_disablingForSubDirsSupported = true; } + virtual QStringList displayArguments() const; private: QVariantMap toMap() const override; diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 1d7cd11d9cc..0a5a157a93d 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -946,7 +946,7 @@ MakeInstallCommand Project::makeInstallCommand(const Target *target, const QStri if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) { if (const auto makeStep = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD) ->firstOfType()) { - cmd.command = makeStep->effectiveMakeCommand().executable(); + cmd.command = makeStep->makeExecutable(); } } cmd.arguments << "install" << ("INSTALL_ROOT=" + QDir::toNativeSeparators(installRoot)); diff --git a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp index 140ec975023..77aec206cfd 100644 --- a/src/plugins/qmakeprojectmanager/qmakemakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakemakestep.cpp @@ -69,7 +69,7 @@ bool QmakeMakeStep::init() if (!bc) emit addTask(Task::buildConfigurationMissingTask()); - const Utils::CommandLine unmodifiedMake = effectiveMakeCommand(); + const Utils::CommandLine unmodifiedMake = effectiveMakeCommand(Execution); const Utils::FilePath makeExecutable = unmodifiedMake.executable(); if (makeExecutable.isEmpty()) emit addTask(makeCommandMissingTask()); @@ -212,6 +212,14 @@ void QmakeMakeStep::finish(bool success) MakeStep::finish(success); } +QStringList QmakeMakeStep::displayArguments() const +{ + const auto bc = static_cast(buildConfiguration()); + if (bc && !bc->makefile().isEmpty()) + return {"-f", bc->makefile()}; + return {}; +} + /// // QmakeMakeStepFactory /// diff --git a/src/plugins/qmakeprojectmanager/qmakemakestep.h b/src/plugins/qmakeprojectmanager/qmakemakestep.h index a1bd2b16493..21cd2f0d91c 100644 --- a/src/plugins/qmakeprojectmanager/qmakemakestep.h +++ b/src/plugins/qmakeprojectmanager/qmakemakestep.h @@ -53,6 +53,7 @@ private: void finish(bool success) override; bool init() override; void doRun() override; + QStringList displayArguments() const override; bool m_scriptTarget = false; QString m_makeFileToCheck; diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 44b96519fdd..d55dfa15d3e 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -443,8 +443,9 @@ void QMakeStep::setSeparateDebugInfo(bool enable) FilePath QMakeStep::makeCommand() const { - auto ms = stepList()->firstOfType(); - return ms ? ms->effectiveMakeCommand().executable() : FilePath(); + if (auto ms = stepList()->firstOfType()) + return ms->makeExecutable(); + return FilePath(); } QString QMakeStep::makeArguments(const QString &makefile) const diff --git a/src/plugins/remotelinux/makeinstallstep.cpp b/src/plugins/remotelinux/makeinstallstep.cpp index ccc19418fe3..7ddb4c9083f 100644 --- a/src/plugins/remotelinux/makeinstallstep.cpp +++ b/src/plugins/remotelinux/makeinstallstep.cpp @@ -214,7 +214,7 @@ void MakeInstallStep::updateFullCommandLine() // FIXME: Only executable? static_cast(aspect(FullCommandLineAspectId))->setValue( QDir::toNativeSeparators( - QtcProcess::quoteArg(effectiveMakeCommand().executable().toString())) + QtcProcess::quoteArg(makeExecutable().toString())) + ' ' + userArguments()); }