From 33fea7e7a9155632f7ac3804a1a6d1d35324b6d0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 8 Jun 2018 16:00:44 +0200 Subject: qmake: use consistent path separators in makefile dependencies Task-number: QTBUG-65072 Change-Id: I3456d9b2cdfa9c65be5933f592abb640f81c39f2 Reviewed-by: Liang Qi Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 17 ++++++++++++++--- qmake/generators/makefile.h | 2 ++ qmake/generators/unix/unixmake2.cpp | 4 ++-- qmake/generators/win32/mingw_make.cpp | 4 ++-- qmake/generators/win32/msvc_nmake.cpp | 4 ++-- 5 files changed, 22 insertions(+), 9 deletions(-) (limited to 'qmake/generators') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 99aecdd8ce..dda323535d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -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 { diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 4ced3bd121..6341a141b9 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -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(); diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 5468285c2e..3cb3be474a 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -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); diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index d6d6b04148..6140debf05 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -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; diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index ccc2ea6d2b..680d3736c2 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -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; } -- cgit v1.2.3