diff options
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/doc/src/qmake-manual.qdoc | 2 | ||||
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 2 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 30 | ||||
-rw-r--r-- | qmake/generators/makefile.h | 6 | ||||
-rw-r--r-- | qmake/generators/makefiledeps.cpp | 6 | ||||
-rw-r--r-- | qmake/generators/projectgenerator.h | 3 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 4 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 7 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.h | 4 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 6 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 12 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.h | 4 |
12 files changed, 65 insertions, 21 deletions
diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 9968528b56..2b184887fe 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -3624,7 +3624,7 @@ \section2 mkpath(dirPath) Creates the directory path \c dirPath. This function is a wrapper around the - QDir::makepath function. + QDir::mkpath function. \section2 requires(condition) diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 18b62c5135..80891e682f 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1613,7 +1613,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) // The configuration build dir however is not treated as excluded, // so we can safely point it to the root output dir. t << "\t\t\t\t" << writeSettings("CONFIGURATION_BUILD_DIR", - Option::output_dir + Option::dir_sep + "$(CONFIGURATION)") << ";\n"; + Option::output_dir + Option::dir_sep + "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)") << ";\n"; if (!project->isEmpty("DESTDIR")) { ProString dir = project->first("DESTDIR"); 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()) diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 4ced3bd121..f32bec650e 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -130,15 +130,17 @@ protected: QMakeProject *project; //escape - virtual QString escapeFilePath(const QString &path) const { return path; } + virtual QString escapeFilePath(const QString &path) const = 0; ProString escapeFilePath(const ProString &path) const; QStringList escapeFilePaths(const QStringList &paths) const; ProStringList escapeFilePaths(const ProStringList &paths) const; - virtual QString escapeDependencyPath(const QString &path) const { return escapeFilePath(path); } + virtual QString escapeDependencyPath(const QString &path) const; ProString escapeDependencyPath(const ProString &path) const; 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/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index c68eeb13d6..ffccdefbe1 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -1050,7 +1050,7 @@ void QMakeSourceFileInfo::saveCache(const QString &cf) QFile file(QMakeLocalFileName(cf).local()); if(file.open(QIODevice::WriteOnly)) { QTextStream stream(&file); - stream << qmake_version() << endl << endl; //version + stream << QMAKE_VERSION_STR << endl << endl; //version { //cache verification QMap<QString, QStringList> verify = getCacheVerification(); stream << verify.count() << endl; @@ -1105,11 +1105,11 @@ void QMakeSourceFileInfo::loadCache(const QString &cf) return; QFile file; - if(!file.open(QIODevice::ReadOnly, fd)) + if (!file.open(fd, QIODevice::ReadOnly)) return; QTextStream stream(&file); - if(stream.readLine() == qmake_version()) { //version check + if (stream.readLine() == QMAKE_VERSION_STR) { //version check stream.skipWhiteSpace(); bool verified = true; diff --git a/qmake/generators/projectgenerator.h b/qmake/generators/projectgenerator.h index 587c415055..89c66f1ec8 100644 --- a/qmake/generators/projectgenerator.h +++ b/qmake/generators/projectgenerator.h @@ -42,6 +42,9 @@ class ProjectGenerator : public MakefileGenerator protected: virtual void init(); virtual bool writeMakefile(QTextStream &); + + virtual QString escapeFilePath(const QString &path) const { Q_ASSERT(false); return QString(); } + public: ProjectGenerator(); ~ProjectGenerator(); 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..6fcfe96380 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -46,8 +46,7 @@ QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const { QString ret = path; ret.replace('\\', "/"); // ### this shouldn't be here - ret.replace(' ', QLatin1String("\\ ")); - return ret; + return MakefileGenerator::escapeDependencyPath(ret); } QString MingwMakefileGenerator::getManifestFileForRcFile() const @@ -165,13 +164,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/mingw_make.h b/qmake/generators/win32/mingw_make.h index ab9e5a9961..6f041cfd4a 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -39,8 +39,8 @@ public: MingwMakefileGenerator(); ~MingwMakefileGenerator(); protected: - QString escapeDependencyPath(const QString &path) const; - ProString escapeDependencyPath(const ProString &path) const { return MakefileGenerator::escapeDependencyPath(path); } + using MakefileGenerator::escapeDependencyPath; + virtual QString escapeDependencyPath(const QString &path) const; virtual ProString fixLibFlag(const ProString &lib); virtual QString getManifestFileForRcFile() const; bool writeMakefile(QTextStream &); diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index ccc2ea6d2b..92b4eb5054 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; } @@ -619,6 +619,8 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) } } else { manifest = fileFixify(manifest); + if (linkerSupportsEmbedding) + extraLFlags = "/MANIFEST:embed /MANIFESTINPUT:" + escapeFilePath(manifest); } const QString resourceId = (templateName == "app") ? "1" : "2"; diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 75bb5d236d..bca27b7044 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -773,6 +773,18 @@ QString Win32MakefileGenerator::escapeFilePath(const QString &path) const return ret; } +QString Win32MakefileGenerator::escapeDependencyPath(const QString &path) const +{ + QString ret = path; + if (!ret.isEmpty()) { + static const QRegExp criticalChars(QStringLiteral("([\t #])")); + if (ret.contains(criticalChars)) + ret = "\"" + ret + "\""; + debug_msg(2, "EscapeDependencyPath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData()); + } + return ret; +} + QString Win32MakefileGenerator::cQuoted(const QString &str) { QString ret = str; diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 4d5ee9812b..b85a6b67df 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -47,8 +47,10 @@ protected: virtual void writeObjectsPart(QTextStream &t); virtual void writeImplicitRulesPart(QTextStream &t); virtual void writeBuildRulesPart(QTextStream &); + using MakefileGenerator::escapeFilePath; virtual QString escapeFilePath(const QString &path) const; - ProString escapeFilePath(const ProString &path) const { return MakefileGenerator::escapeFilePath(path); } + using MakefileGenerator::escapeDependencyPath; + virtual QString escapeDependencyPath(const QString &path) const; virtual void writeRcFilePart(QTextStream &t); |