qmake: use consistent path separators in makefile dependencies

Task-number: QTBUG-65072
Change-Id: I3456d9b2cdfa9c65be5933f592abb640f81c39f2
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oswald Buddenhagen 2018-06-08 16:00:44 +02:00
parent 8cc27590bd
commit 33fea7e7a9
5 changed files with 22 additions and 9 deletions

View File

@ -1141,7 +1141,7 @@ MakefileGenerator::writeObj(QTextStream &t, const char *src)
QString srcf = (*sit).toQString();
QString dstf = (*oit).toQString();
t << escapeDependencyPath(dstf) << ": " << escapeDependencyPath(srcf)
<< " " << escapeDependencyPaths(findDependencies(srcf)).join(" \\\n\t\t");
<< " " << finalizeDependencyPaths(findDependencies(srcf)).join(" \\\n\t\t");
ProKey comp;
for (const ProString &compiler : project->values("QMAKE_BUILTIN_COMPILERS")) {
@ -2013,7 +2013,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
if (config.indexOf("explicit_dependencies") != -1) {
t << " " << valList(escapeDependencyPaths(fileFixify(tmp_dep, FileFixifyFromOutdir)));
} else {
t << " " << valList(escapeDependencyPaths(inputs)) << " " << valList(escapeDependencyPaths(deps));
t << " " << valList(escapeDependencyPaths(inputs)) << " " << valList(finalizeDependencyPaths(deps));
}
t << "\n\t" << cmd << endl << endl;
continue;
@ -2133,7 +2133,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
else
++i;
}
t << escapeDependencyPath(out) << ": " << valList(escapeDependencyPaths(deps)) << "\n\t"
t << escapeDependencyPath(out) << ": " << valList(finalizeDependencyPaths(deps)) << "\n\t"
<< cmd << endl << endl;
}
}
@ -2851,6 +2851,17 @@ MakefileGenerator::escapeDependencyPaths(const ProStringList &paths) const
return ret;
}
QStringList
MakefileGenerator::finalizeDependencyPaths(const QStringList &paths) const
{
QStringList ret;
const int size = paths.size();
ret.reserve(size);
for (int i = 0; i < size; ++i)
ret.append(escapeDependencyPath(Option::fixPathToTargetOS(paths.at(i), false)));
return ret;
}
QStringList
MakefileGenerator::fileFixify(const QStringList &files, FileFixifyTypes fix, bool canon) const
{

View File

@ -139,6 +139,8 @@ protected:
QStringList escapeDependencyPaths(const QStringList &paths) const;
ProStringList escapeDependencyPaths(const ProStringList &paths) const;
QStringList finalizeDependencyPaths(const QStringList &paths) const;
//initialization
void verifyCompilers();
virtual void init();

View File

@ -375,7 +375,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QStringList deps = findDependencies((*it).toQString()).filter(QRegExp(
"((^|/)" + Option::h_moc_mod + "|" + Option::cpp_moc_ext + "$)"));
if(!deps.isEmpty())
t << d_file_d << ": " << escapeDependencyPaths(deps).join(' ') << endl;
t << d_file_d << ": " << finalizeDependencyPaths(deps).join(' ') << endl;
t << "-include " << d_file_d << endl;
project->values("QMAKE_DISTCLEAN") += d_file;
}
@ -1191,7 +1191,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "EXPORT_QMAKE_XARCH_LFLAGS = $(EXPORT_QMAKE_XARCH_LFLAGS_" << arch << ")" << "\n\n";
}
t << pchFilePath_d << ": " << escapeDependencyPath(pchInput) << ' '
<< escapeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t");
<< finalizeDependencyPaths(findDependencies(pchInput)).join(" \\\n\t\t");
if (project->isActiveConfig("icc_pch_style")) {
QString sourceFile = pchArchOutput + Option::cpp_ext.first();
QString sourceFile_f = escapeFilePath(sourceFile);

View File

@ -165,13 +165,13 @@ void MingwMakefileGenerator::writeMingwParts(QTextStream &t)
QString header = project->first("PRECOMPILED_HEADER").toQString();
QString cHeader = preCompHeaderOut + Option::dir_sep + "c";
t << escapeDependencyPath(cHeader) << ": " << escapeDependencyPath(header) << " "
<< escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")
<< finalizeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")
<< "\n\t" << mkdir_p_asstring(preCompHeaderOut)
<< "\n\t$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << escapeFilePath(cHeader)
<< ' ' << escapeFilePath(header) << endl << endl;
QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++";
t << escapeDependencyPath(cppHeader) << ": " << escapeDependencyPath(header) << " "
<< escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")
<< finalizeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")
<< "\n\t" << mkdir_p_asstring(preCompHeaderOut)
<< "\n\t$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << escapeFilePath(cppHeader)
<< ' ' << escapeFilePath(header) << endl << endl;

View File

@ -321,7 +321,7 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
QString precompRule = QString("-c -Yc -Fp%1 -Fo%2")
.arg(escapeFilePath(precompPch), escapeFilePath(precompObj));
t << escapeDependencyPath(precompObj) << ": " << escapeDependencyPath(precompH) << ' '
<< escapeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t")
<< finalizeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t")
<< "\n\t$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP "
<< escapeFilePath(precompH) << endl << endl;
}
@ -329,7 +329,7 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
QString precompRuleC = QString("-c -Yc -Fp%1 -Fo%2")
.arg(escapeFilePath(precompPchC), escapeFilePath(precompObjC));
t << escapeDependencyPath(precompObjC) << ": " << escapeDependencyPath(precompH) << ' '
<< escapeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t")
<< finalizeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t")
<< "\n\t$(CC) " + precompRuleC +" $(CFLAGS) $(INCPATH) -TC "
<< escapeFilePath(precompH) << endl << endl;
}