diff options
Diffstat (limited to 'qmake/generators/makefile.cpp')
-rw-r--r-- | qmake/generators/makefile.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index cdbd84b8cc..2f8c653d62 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; } } @@ -2823,6 +2823,19 @@ MakefileGenerator::escapeFilePaths(const ProStringList &paths) const return ret; } +QString +MakefileGenerator::escapeDependencyPath(const QString &path) const +{ + QString ret = path; + if (!ret.isEmpty()) { + // Unix make semantics, to be inherited by unix and mingw generators. + static const QRegExp criticalChars(QStringLiteral("([\t :#])")); + ret.replace(criticalChars, QStringLiteral("\\\\1")); + debug_msg(2, "escapeDependencyPath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData()); + } + return ret; +} + ProString MakefileGenerator::escapeDependencyPath(const ProString &path) const { @@ -2852,6 +2865,17 @@ MakefileGenerator::escapeDependencyPaths(const ProStringList &paths) const } 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 { if(files.isEmpty()) |