diff options
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 40 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.h | 6 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 16 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 23 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.h | 11 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 1 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.h | 2 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 22 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 129 | ||||
-rw-r--r-- | qmake/generators/win32/winmakefile.h | 10 |
10 files changed, 118 insertions, 142 deletions
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 2175841264..878291fae9 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -38,10 +38,6 @@ QT_BEGIN_NAMESPACE -MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator() -{ -} - QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const { QString ret = path; @@ -97,18 +93,6 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) project->first("TEMPLATE") == "aux") { if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") writePkgConfigFile(); - - if(Option::mkfile::do_stub_makefile) { - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); - for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) - t << escapeDependencyPath(*it) << ' '; - t << "first all clean install distclean uninstall: qmake\n" - << "qmake_all:\n"; - writeMakeQmake(t); - t << "FORCE:\n\n"; - return true; - } writeMingwParts(t); return MakefileGenerator::writeMakefile(t); } @@ -148,7 +132,7 @@ static void createResponseFile(const QString &fileName, const ProStringList &obj .replace(QLatin1Char('\t'), QLatin1String("\\\t")) .replace(QLatin1Char('"'), QLatin1String("\\\"")) .replace(QLatin1Char('\''), QLatin1String("\\'")); - t << path << endl; + t << path << Qt::endl; } t.flush(); file.close(); @@ -166,13 +150,13 @@ void MingwMakefileGenerator::writeMingwParts(QTextStream &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; + << ' ' << escapeFilePath(header) << Qt::endl << Qt::endl; QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++"; t << escapeDependencyPath(cppHeader) << ": " << escapeDependencyPath(header) << " " << 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; + << ' ' << escapeFilePath(header) << Qt::endl << Qt::endl; } } @@ -257,21 +241,21 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t) t << "-I"; t << escapeFilePath(inc) << ' '; } - t << endl; + t << Qt::endl; } void MingwMakefileGenerator::writeLibsPart(QTextStream &t) { if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - t << "LIB = " << var("QMAKE_LIB") << endl; + t << "LIB = " << var("QMAKE_LIB") << Qt::endl; } else { - t << "LINKER = " << var("QMAKE_LINK") << endl; - t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; + t << "LINKER = " << var("QMAKE_LINK") << Qt::endl; + t << "LFLAGS = " << var("QMAKE_LFLAGS") << Qt::endl; t << "LIBS = " << fixLibFlags("LIBS").join(' ') << ' ' << fixLibFlags("LIBS_PRIVATE").join(' ') << ' ' << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' - << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; + << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << Qt::endl; } } @@ -332,7 +316,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" <<var("QMAKE_POST_LINK"); - t << endl; + t << Qt::endl; } void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) @@ -358,7 +342,11 @@ void MingwMakefileGenerator::writeRcFilePart(QTextStream &t) if (defines.isEmpty()) defines = ProString(" $(DEFINES)"); - t << escapeDependencyPath(var("RES_FILE")) << ": " << escapeDependencyPath(rc_file) << "\n\t" + addSourceFile(rc_file, QMakeSourceFileInfo::SEEK_DEPS); + const QStringList rcDeps = QStringList(rc_file) << dependencies(rc_file); + + t << escapeDependencyPath(var("RES_FILE")) << ": " + << escapeDependencyPaths(rcDeps).join(' ') << "\n\t" << var("QMAKE_RC") << " -i " << escapeFilePath(rc_file) << " -o " << fileVar("RES_FILE") << incPathStr << defines << "\n\n"; } diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index 5da5b24088..8cae28a78b 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h @@ -35,9 +35,6 @@ QT_BEGIN_NAMESPACE class MingwMakefileGenerator : public Win32MakefileGenerator { -public: - MingwMakefileGenerator(); - ~MingwMakefileGenerator(); protected: using MakefileGenerator::escapeDependencyPath; QString escapeDependencyPath(const QString &path) const override; @@ -65,9 +62,6 @@ private: QString objectsLinkLine; }; -inline MingwMakefileGenerator::~MingwMakefileGenerator() -{ } - QT_END_NAMESPACE #endif // MINGW_MAKE_H diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 08a8c2168d..0515c7404f 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -34,6 +34,7 @@ #include <qscopedpointer.h> #include <qstringlist.h> #include <qfileinfo.h> +#include <qregexp.h> QT_BEGIN_NAMESPACE @@ -299,14 +300,17 @@ inline XmlOutput::xml_output valueTagT( const triState v) return valueTag(v == _True ? "true" : "false"); } -static QString vcxCommandSeparator() +static QString commandLinesForOutput(QStringList commands) { // MSBuild puts the contents of the custom commands into a batch file and calls it. // As we want every sub-command to be error-checked (as is done by makefile-based // backends), we insert the checks ourselves, using the undocumented jump target. - static QString cmdSep = - QLatin1String("
if errorlevel 1 goto VCEnd
"); - return cmdSep; + static QString errchk = QStringLiteral("if errorlevel 1 goto VCEnd"); + for (int i = commands.count() - 2; i >= 0; --i) { + if (!commands.at(i).startsWith("rem", Qt::CaseInsensitive)) + commands.insert(i + 1, errchk); + } + return commands.join('\n'); } static QString unquote(const QString &value) @@ -1657,7 +1661,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool) { xml << tag("Command") << attrTag("Condition", condition) - << valueTag(tool.CommandLine.join(vcxCommandSeparator())); + << valueTag(commandLinesForOutput(tool.CommandLine)); } if ( !tool.Description.isEmpty() ) @@ -1711,7 +1715,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCEventTool &tool) { xml << tag(tool.EventName) - << tag(_Command) << valueTag(tool.CommandLine.join(vcxCommandSeparator())) + << tag(_Command) << valueTag(commandLinesForOutput(tool.CommandLine)) << tag(_Message) << valueTag(tool.Description) << closetag(tool.EventName); } diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index fd90cfcb2a..2fb24201bd 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -38,11 +38,6 @@ QT_BEGIN_NAMESPACE -NmakeMakefileGenerator::NmakeMakefileGenerator() : usePCH(false), usePCHC(false) -{ - -} - bool NmakeMakefileGenerator::writeMakefile(QTextStream &t) { @@ -53,10 +48,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib" || project->first("TEMPLATE") == "aux") { -#if 0 - if(Option::mkfile::do_stub_makefile) - return MakefileGenerator::writeStubMakefile(t); -#endif writeNmakeParts(t); return MakefileGenerator::writeMakefile(t); } @@ -143,7 +134,7 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) t << escapeDependencyPath(precompObj) << ": " << escapeDependencyPath(precompH) << ' ' << finalizeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t") << "\n\t$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " - << escapeFilePath(precompH) << endl << endl; + << escapeFilePath(precompH) << Qt::endl << Qt::endl; } if (usePCHC) { QString precompRuleC = QString("-c -Yc -Fp%1 -Fo%2") @@ -151,7 +142,7 @@ void NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) t << escapeDependencyPath(precompObjC) << ": " << escapeDependencyPath(precompH) << ' ' << finalizeDependencyPaths(findDependencies(precompH)).join(" \\\n\t\t") << "\n\t$(CC) " + precompRuleC +" $(CFLAGS) $(INCPATH) -TC " - << escapeFilePath(precompH) << endl << endl; + << escapeFilePath(precompH) << Qt::endl << Qt::endl; } } @@ -310,7 +301,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) t << " " << (*cit); for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) t << " " << (*cppit); - t << endl << endl; + t << Qt::endl << Qt::endl; bool useInferenceRules = !project->isActiveConfig("no_batch"); QSet<QString> source_directories; @@ -342,7 +333,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) QHash<QString, QString> fileNames; bool duplicatesFound = false; const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter(); - QStringList fixifiedSourceDirs = fileFixify(source_directories.toList(), FileFixifyAbsolute); + QStringList fixifiedSourceDirs = fileFixify(QList<QString>(source_directories.constBegin(), source_directories.constEnd()), FileFixifyAbsolute); fixifiedSourceDirs.removeDuplicates(); for (const QString &sourceDir : qAsConst(fixifiedSourceDirs)) { QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot); @@ -389,9 +380,9 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) } } else { for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) - t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; + t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << Qt::endl << Qt::endl; for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit) - t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; + t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << Qt::endl << Qt::endl; } } @@ -494,7 +485,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(!project->isEmpty("QMAKE_POST_LINK")) { t << "\n\t" << var("QMAKE_POST_LINK"); } - t << endl; + t << Qt::endl; } void NmakeMakefileGenerator::writeLinkCommand(QTextStream &t, const QString &extraFlags, const QString &extraInlineFileContent) diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 5bfdba2bbc..3064f06521 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h @@ -54,17 +54,10 @@ protected: QString var(const ProKey &value) const override; QString precompH, precompObj, precompPch; QString precompObjC, precompPchC; - bool usePCH, usePCHC; - -public: - NmakeMakefileGenerator(); - ~NmakeMakefileGenerator(); - + bool usePCH = false; + bool usePCHC = false; }; -inline NmakeMakefileGenerator::~NmakeMakefileGenerator() -{ } - QT_END_NAMESPACE #endif // MSVC_NMAKE_H diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 5fb6bfb320..5396eba72e 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -34,6 +34,7 @@ #include <qscopedpointer.h> #include <qfileinfo.h> +#include <qregexp.h> using namespace QMakeInternal; diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index b356f1bb73..33eff0d914 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -923,7 +923,7 @@ struct VCFilterFile inline QDebug operator<<(QDebug dbg, const VCFilterFile &p) { dbg.nospace() << "VCFilterFile(file(" << p.file - << ") excludeFromBuild(" << p.excludeFromBuild << "))" << endl; + << ") excludeFromBuild(" << p.excludeFromBuild << "))" << Qt::endl; return dbg.space(); } #endif diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index df4876ace7..e45beca459 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -209,7 +209,9 @@ bool VcprojGenerator::writeProjectMakefile() struct VcsolutionDepend { QString uuid; - QString vcprojFile, orig_target, target; + QString vcprojFile; + QString projectName; + QString target; Target targetType; QStringList dependencies; }; @@ -433,7 +435,8 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt Option::qmake_mode = old_mode; // We assume project filename is [QMAKE_PROJECT_NAME].vcproj - QString vcproj = tmp_vcproj.project->first("QMAKE_PROJECT_NAME") + project->first("VCPROJ_EXTENSION"); + const ProString projectName = tmp_vcproj.project->first("QMAKE_PROJECT_NAME"); + const QString vcproj = projectName + project->first("VCPROJ_EXTENSION"); QString vcprojDir = Option::output_dir; // If file doesn't exsist, then maybe the users configuration @@ -445,14 +448,14 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt VcsolutionDepend *newDep = new VcsolutionDepend; newDep->vcprojFile = vcprojDir + Option::dir_sep + vcproj; - newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET").toQString(); + newDep->projectName = projectName.toQString(); newDep->target = tmp_proj.first("MSVCPROJ_TARGET").toQString().section(Option::dir_sep, -1); newDep->targetType = tmp_vcproj.projectTarget; newDep->uuid = tmp_proj.isEmpty("QMAKE_UUID") ? getProjectUUID(Option::fixPathToLocalOS(vcprojDir + QDir::separator() + vcproj)).toString().toUpper(): tmp_proj.first("QMAKE_UUID").toQString(); // We want to store it as the .lib name. if (newDep->target.endsWith(".dll")) newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; - projGuids.insert(newDep->orig_target, newDep->target); + projGuids.insert(newDep->projectName, newDep->target); if (tmpList.size()) { const ProStringList depends = tmpList; @@ -591,7 +594,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t) for (QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) { // ### quoting rules? t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid - << "\"" << (*it)->orig_target << "\", \"" << (*it)->vcprojFile + << "\"" << (*it)->projectName << "\", \"" << (*it)->vcprojFile << "\", \"" << (*it)->uuid << "\""; debug_msg(1, "Project %s has dependencies: %s", (*it)->target.toLatin1().constData(), (*it)->dependencies.join(" ").toLatin1().constData()); @@ -937,6 +940,15 @@ void VcprojGenerator::initProject() vcProject.SccProjectName = project->first("SCCPROJECTNAME").toQString(); vcProject.SccLocalPath = project->first("SCCLOCALPATH").toQString(); vcProject.flat_files = project->isActiveConfig("flat"); + + // Set up the full target path for target conflict checking. + const QChar slash = QLatin1Char('/'); + QString destdir = QDir::fromNativeSeparators(var("DESTDIR")); + if (!destdir.endsWith(slash)) + destdir.append(slash); + project->values("DEST_TARGET") = ProStringList(destdir + + project->first("TARGET") + + project->first("TARGET_EXT")); } void VcprojGenerator::initConfiguration() diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 266bae7e64..27d2a7c0a5 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -40,10 +40,6 @@ QT_BEGIN_NAMESPACE -Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator() -{ -} - ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib) { if (lib.startsWith("-l")) // Fallback for unresolved -l libs. @@ -83,7 +79,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) ProStringList impexts = project->values("QMAKE_LIB_EXTENSIONS"); if (impexts.isEmpty()) impexts = project->values("QMAKE_EXTENSION_STATICLIB"); - QList<QMakeLocalFileName> dirs; + QVector<QMakeLocalFileName> dirs; int libidx = 0; for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS")) dirs.append(QMakeLocalFileName(dlib.toQString())); @@ -108,8 +104,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) QString lib = arg.toQString(); ProString verovr = project->first(ProKey("QMAKE_" + lib.toUpper() + "_VERSION_OVERRIDE")); - for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); - dir_it != dirs.end(); ++dir_it) { + for (auto dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { QString cand = (*dir_it).real() + Option::dir_sep + lib; if (linkPrl && processPrlFile(cand, true)) { (*it) = cand; @@ -132,8 +127,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) if (processPrlFile(lib, false)) (*it) = lib; } else { - for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); - dir_it != dirs.end(); ++dir_it) { + for (auto dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { QString cand = (*dir_it).real() + Option::dir_sep + lib; if (processPrlFile(cand, false)) { (*it) = cand; @@ -320,11 +314,11 @@ void Win32MakefileGenerator::processRcFileVar() int rcCodePage = project->intValue("RC_CODEPAGE", 1200); // default: Unicode ts << "#include <windows.h>\n"; - ts << endl; + ts << Qt::endl; if (!rcIcons.isEmpty()) { for (int i = 0; i < rcIcons.size(); ++i) - ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << endl; - ts << endl; + ts << QString("IDI_ICON%1\tICON\tDISCARDABLE\t%2").arg(i + 1).arg(cQuoted(rcIcons[i])) << Qt::endl; + ts << Qt::endl; } if (!manifestFile.isEmpty()) { QString manifestResourceId; @@ -335,8 +329,8 @@ void Win32MakefileGenerator::processRcFileVar() ts << manifestResourceId << " RT_MANIFEST \"" << manifestFile << "\"\n"; } ts << "VS_VERSION_INFO VERSIONINFO\n"; - ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl; - ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl; + ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << Qt::endl; + ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << Qt::endl; ts << "\tFILEFLAGSMASK 0x3fL\n"; ts << "#ifdef _DEBUG\n"; ts << "\tFILEFLAGS VS_FF_DEBUG\n"; @@ -369,11 +363,11 @@ void Win32MakefileGenerator::processRcFileVar() ts << "\t\tBEGIN\n"; ts << "\t\t\tVALUE \"Translation\", " << QString("0x%1").arg(rcLang, 4, 16, QLatin1Char('0')) - << ", " << QString("%1").arg(rcCodePage, 4) << endl; + << ", " << QString("%1").arg(rcCodePage, 4) << Qt::endl; ts << "\t\tEND\n"; ts << "\tEND\n"; ts << "/* End of Version info */\n"; - ts << endl; + ts << Qt::endl; ts.flush(); @@ -470,7 +464,7 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) } } } - t << endl << endl; + t << Qt::endl << Qt::endl; t << "distclean: clean " << depVar("DISTCLEAN_DEPS"); { @@ -503,9 +497,9 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t) { QString ofile = fileFixify(Option::output.fileName()); if(!ofile.isEmpty()) - t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << endl; + t << "\t-$(DEL_FILE) " << escapeFilePath(ofile) << Qt::endl; } - t << endl; + t << Qt::endl; } void Win32MakefileGenerator::writeIncPart(QTextStream &t) @@ -519,7 +513,7 @@ void Win32MakefileGenerator::writeIncPart(QTextStream &t) if(!inc.isEmpty()) t << "-I" << escapeFilePath(inc) << ' '; } - t << endl; + t << Qt::endl; } void Win32MakefileGenerator::writeStandardParts(QTextStream &t) @@ -527,51 +521,29 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) writeExportedVariables(t); t << "####### Compiler, tools and options\n\n"; - t << "CC = " << var("QMAKE_CC") << endl; - t << "CXX = " << var("QMAKE_CXX") << endl; + t << "CC = " << var("QMAKE_CC") << Qt::endl; + t << "CXX = " << var("QMAKE_CXX") << Qt::endl; t << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("DEFINES","-D"," -D","") << endl; + << varGlue("DEFINES","-D"," -D","") << Qt::endl; t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n"; t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n"; writeIncPart(t); writeLibsPart(t); - - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : var("QMAKE_IDC")) - << endl; - t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : var("QMAKE_IDL")) - << endl; - t << "ZIP = " << var("QMAKE_ZIP") << endl; - t << "DEF_FILE = " << fileVar("DEF_FILE") << endl; - t << "RES_FILE = " << fileVar("RES_FILE") << endl; // Not on mingw, can't see why not though... - t << "COPY = " << var("QMAKE_COPY") << endl; - t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl; - t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; - t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; - t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; - t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; - t << "QINSTALL = " << var("QMAKE_QMAKE") << " -install qinstall" << endl; - t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall -exe" << endl; - t << endl; + writeDefaultVariables(t); + t << Qt::endl; t << "####### Output directory\n\n"; if(!project->values("OBJECTS_DIR").isEmpty()) - t << "OBJECTS_DIR = " << escapeFilePath(var("OBJECTS_DIR").remove(QRegExp("\\\\$"))) << endl; + t << "OBJECTS_DIR = " << escapeFilePath(var("OBJECTS_DIR").remove(QRegExp("\\\\$"))) << Qt::endl; else t << "OBJECTS_DIR = . \n"; - t << endl; + t << Qt::endl; t << "####### Files\n\n"; t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES"))) - << " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl; + << " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << Qt::endl; // do this here so we can set DEST_TARGET to be the complete path to the final target if it is needed. QString orgDestDir = var("DESTDIR"); @@ -587,14 +559,14 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) writeExtraVariables(t); t << "DIST = " << fileVarList("DISTFILES") << ' ' - << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << endl; - t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << endl; // unused + << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << Qt::endl; + t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << Qt::endl; // unused // The comment is important to maintain variable compatibility with Unix // Makefiles, while not interpreting a trailing-slash as a linebreak t << "DESTDIR = " << escapeFilePath(destDir) << " #avoid trailing-slash linebreak\n"; - t << "TARGET = " << escapeFilePath(target) << endl; - t << "DESTDIR_TARGET = " << fileVar("DEST_TARGET") << endl; - t << endl; + t << "TARGET = " << escapeFilePath(target) << Qt::endl; + t << "DESTDIR_TARGET = " << fileVar("DEST_TARGET") << Qt::endl; + t << Qt::endl; writeImplicitRulesPart(t); @@ -606,10 +578,10 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) const ProStringList &dlldirs = project->values("DLLDESTDIR"); for (ProStringList::ConstIterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) { t << "\t-$(COPY_FILE) $(DESTDIR_TARGET) " - << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << endl; + << escapeFilePath(Option::fixPathToTargetOS((*dlldir).toQString(), false)) << Qt::endl; } } - t << endl; + t << Qt::endl; writeRcFilePart(t); } @@ -642,33 +614,33 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) } } } - t << endl << endl; + t << Qt::endl << Qt::endl; writeCleanParts(t); writeExtraTargets(t); writeExtraCompilerTargets(t); - t << endl << endl; + t << Qt::endl << Qt::endl; } void Win32MakefileGenerator::writeLibsPart(QTextStream &t) { if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - t << "LIBAPP = " << var("QMAKE_LIB") << endl; - t << "LIBFLAGS = " << var("QMAKE_LIBFLAGS") << endl; + t << "LIBAPP = " << var("QMAKE_LIB") << Qt::endl; + t << "LIBFLAGS = " << var("QMAKE_LIBFLAGS") << Qt::endl; } else { - t << "LINKER = " << var("QMAKE_LINK") << endl; - t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; + t << "LINKER = " << var("QMAKE_LINK") << Qt::endl; + t << "LFLAGS = " << var("QMAKE_LFLAGS") << Qt::endl; t << "LIBS = " << fixLibFlags("LIBS").join(' ') << ' ' << fixLibFlags("LIBS_PRIVATE").join(' ') << ' ' << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' - << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; + << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << Qt::endl; } } void Win32MakefileGenerator::writeObjectsPart(QTextStream &t) { // Used in both deps and commands. - t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << endl; + t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << Qt::endl; } void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &) @@ -695,6 +667,9 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) incPathStr += escapeFilePath(path); } + addSourceFile(rc_file, QMakeSourceFileInfo::SEEK_DEPS); + const QStringList rcDeps = QStringList(rc_file) << dependencies(rc_file); + // The resource tool may use defines. This might be the same defines passed in as the // compiler, since you may use these defines in the .rc file itself. // As the escape syntax for the command line defines for RC is different from that for CL, @@ -706,11 +681,12 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t) // Also, we need to add the _DEBUG define manually since the compiler defines this symbol // by itself, and we use it in the automatically created rc file when VERSION is defined // in the .pro file. - t << escapeDependencyPath(res_file) << ": " << escapeDependencyPath(rc_file) << "\n\t" + t << escapeDependencyPath(res_file) << ": " + << escapeDependencyPaths(rcDeps).join(' ') << "\n\t" << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") << defines << incPathStr << " -fo " << escapeFilePath(res_file) << ' ' << escapeFilePath(rc_file); - t << endl << endl; + t << Qt::endl << Qt::endl; } } @@ -789,6 +765,20 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) return ret; } +void Win32MakefileGenerator::writeDefaultVariables(QTextStream &t) +{ + MakefileGenerator::writeDefaultVariables(t); + t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") : var("QMAKE_IDC")) + << Qt::endl; + t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") : var("QMAKE_IDL")) + << Qt::endl; + t << "ZIP = " << var("QMAKE_ZIP") << Qt::endl; + t << "DEF_FILE = " << fileVar("DEF_FILE") << Qt::endl; + t << "RES_FILE = " << fileVar("RES_FILE") << Qt::endl; // Not on mingw, can't see why not though... + t << "SED = " << var("QMAKE_STREAM_EDITOR") << Qt::endl; + t << "MOVE = " << var("QMAKE_MOVE") << Qt::endl; +} + QString Win32MakefileGenerator::escapeFilePath(const QString &path) const { QString ret = path; @@ -827,4 +817,9 @@ QString Win32MakefileGenerator::getManifestFileForRcFile() const return QString(); } +ProKey Win32MakefileGenerator::fullTargetVariable() const +{ + return "DEST_TARGET"; +} + QT_END_NAMESPACE diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 4416951a09..09984fe355 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h @@ -35,11 +35,9 @@ QT_BEGIN_NAMESPACE class Win32MakefileGenerator : public MakefileGenerator { -public: - Win32MakefileGenerator(); - ~Win32MakefileGenerator(); protected: QString defaultInstall(const QString &) override; + void writeDefaultVariables(QTextStream &t) override; virtual void writeCleanParts(QTextStream &t); virtual void writeStandardParts(QTextStream &t); virtual void writeIncPart(QTextStream &t); @@ -66,10 +64,10 @@ protected: void processRcFileVar(); static QString cQuoted(const QString &str); virtual QString getManifestFileForRcFile() const; -}; -inline Win32MakefileGenerator::~Win32MakefileGenerator() -{ } +public: + ProKey fullTargetVariable() const override; +}; QT_END_NAMESPACE |