summaryrefslogtreecommitdiffstats
path: root/qmake/generators/makefile.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2019-01-11 11:27:19 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2019-01-15 12:43:06 +0000
commitb95a4bbe84e5216d8dba9a0c077062fbb0efb30b (patch)
tree0261a5df1b95b269add80a59c5d316460289f8bd /qmake/generators/makefile.cpp
parentaf99497bdbcfb5202bd226b76910de9fd82e0625 (diff)
MakefileGenerator: deduplicate code
Factor out a resolveDependency method. We will enhance it in a subsequent commit. Change-Id: I4eead8bd03066c2ccbc9d9276acbc9f6c3bc6b97 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'qmake/generators/makefile.cpp')
-rw-r--r--qmake/generators/makefile.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 99455e7cb5..45684b5225 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -1839,6 +1839,18 @@ static QStringList splitDeps(const QString &indeps, bool lineMode)
return deps;
}
+QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &file)
+{
+ const QList<QMakeLocalFileName> &depdirs = QMakeSourceFileInfo::dependencyPaths();
+ for (const auto &depdir : depdirs) {
+ const QString &local = depdir.local();
+ QString lf = outDir.absoluteFilePath(local + '/' + file);
+ if (exists(lf))
+ return lf;
+ }
+ return {};
+}
+
void
MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
{
@@ -1991,16 +2003,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
} else if (exists(absFile)) {
file = absFile;
} else {
- QString localFile;
- QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths();
- for (QList<QMakeLocalFileName>::Iterator dit = depdirs.begin();
- dit != depdirs.end(); ++dit) {
- QString lf = outDir.absoluteFilePath((*dit).local() + '/' + file);
- if (exists(lf)) {
- localFile = lf;
- break;
- }
- }
+ QString localFile = resolveDependency(outDir, file);
if (localFile.isEmpty()) {
if (exists(file))
warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
@@ -2088,16 +2091,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
} else if (exists(absFile)) {
file = absFile;
} else {
- QString localFile;
- QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths();
- for (QList<QMakeLocalFileName>::Iterator dit = depdirs.begin();
- dit != depdirs.end(); ++dit) {
- QString lf = outDir.absoluteFilePath((*dit).local() + '/' + file);
- if (exists(lf)) {
- localFile = lf;
- break;
- }
- }
+ QString localFile = resolveDependency(outDir, file);
if (localFile.isEmpty()) {
if (exists(file))
warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"