diff options
Diffstat (limited to 'qmake')
39 files changed, 571 insertions, 625 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 0f69b6b487..68f173cd1b 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -28,9 +28,9 @@ QOBJS = \ qmetatype.o qsystemerror.o qvariant.o \ quuid.o \ qarraydata.o qbitarray.o qbytearray.o qbytearraymatcher.o \ - qcryptographichash.o qdatetime.o qhash.o qlinkedlist.o qlist.o \ + qcryptographichash.o qdatetime.o qhash.o qlist.o \ qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o \ - qstringbuilder.o qstring_compat.o qstring.o qstringlist.o qversionnumber.o \ + qstringbuilder.o qstring.o qstringlist.o qversionnumber.o \ qvsnprintf.o qxmlstream.o qxmlutils.o \ $(QTOBJS) $(QTOBJS2) # QTOBJS and QTOBJS2 are populated by Makefile.unix.* as for QTSRC (see below). @@ -105,26 +105,24 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/serialization/qtextstream.cpp \ $(SOURCE_PATH)/src/corelib/serialization/qxmlstream.cpp \ $(SOURCE_PATH)/src/corelib/serialization/qxmlutils.cpp \ + $(SOURCE_PATH)/src/corelib/text/qbytearray.cpp\ + $(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp \ + $(SOURCE_PATH)/src/corelib/text/qlocale.cpp \ + $(SOURCE_PATH)/src/corelib/text/qlocale_tools.cpp \ + $(SOURCE_PATH)/src/corelib/text/qregexp.cpp \ + $(SOURCE_PATH)/src/corelib/text/qstringbuilder.cpp \ + $(SOURCE_PATH)/src/corelib/text/qstring.cpp \ + $(SOURCE_PATH)/src/corelib/text/qstringlist.cpp \ + $(SOURCE_PATH)/src/corelib/text/qvsnprintf.cpp \ + $(SOURCE_PATH)/src/corelib/time/qdatetime.cpp \ $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp \ $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp\ - $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp \ $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \ $(SOURCE_PATH)/src/corelib/tools/qhash.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlist.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \ $(SOURCE_PATH)/src/corelib/tools/qmap.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp \ $(SOURCE_PATH)/src/corelib/tools/qringbuffer.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qstring_compat.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qstring.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp \ $(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp \ $(QTSRCS) $(QTSRCS2) # QTSRCS and QTSRCS2 come from Makefile.unix.* (concatenated with this # by configure); QTSRCS2 may include *.mm entries on macOS. @@ -304,13 +302,13 @@ qglobal.o: $(SOURCE_PATH)/src/corelib/global/qglobal.cpp qarraydata.o: $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qbytearray.o: $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp +qbytearray.o: $(SOURCE_PATH)/src/corelib/text/qbytearray.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp +qvsnprintf.o: $(SOURCE_PATH)/src/corelib/text/qvsnprintf.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp +qbytearraymatcher.o: $(SOURCE_PATH)/src/corelib/text/qbytearraymatcher.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< qmetatype.o: $(SOURCE_PATH)/src/corelib/kernel/qmetatype.cpp @@ -340,25 +338,22 @@ qcore_foundation.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp +qstring.o: $(SOURCE_PATH)/src/corelib/text/qstring.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qstring_compat.o: $(SOURCE_PATH)/src/corelib/tools/qstring_compat.cpp +qstringbuilder.o: $(SOURCE_PATH)/src/corelib/text/qstringbuilder.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qstringbuilder.o: $(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp +qlocale.o: $(SOURCE_PATH)/src/corelib/text/qlocale.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qlocale.o: $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp +qlocale_tools.o: $(SOURCE_PATH)/src/corelib/text/qlocale_tools.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qlocale_tools.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp +qlocale_unix.o: $(SOURCE_PATH)/src/corelib/text/qlocale_unix.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qlocale_unix.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_unix.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $< - -qlocale_win.o: $(SOURCE_PATH)/src/corelib/tools/qlocale_win.cpp +qlocale_win.o: $(SOURCE_PATH)/src/corelib/text/qlocale_win.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< qversionnumber.o: $(SOURCE_PATH)/src/corelib/tools/qversionnumber.cpp @@ -412,7 +407,7 @@ qabstractfileengine.o: $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp +qregexp.o: $(SOURCE_PATH)/src/corelib/text/qregexp.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< qbitarray.o: $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp @@ -430,10 +425,10 @@ quuid.o: $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp qfileinfo.o: $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qdatetime.o: $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp +qdatetime.o: $(SOURCE_PATH)/src/corelib/time/qdatetime.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qstringlist.o: $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp +qstringlist.o: $(SOURCE_PATH)/src/corelib/text/qstringlist.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< qmap.o: $(SOURCE_PATH)/src/corelib/tools/qmap.cpp @@ -442,9 +437,6 @@ qmap.o: $(SOURCE_PATH)/src/corelib/tools/qmap.cpp qhash.o: $(SOURCE_PATH)/src/corelib/tools/qhash.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< -qlinkedlist.o: $(SOURCE_PATH)/src/corelib/tools/qlinkedlist.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $< - qcryptographichash.o: $(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp $(CXX) -c -o $@ $(CXXFLAGS) $< diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index 506e9deb19..43059f9af0 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -24,10 +24,8 @@ LINKER = link CFLAGS_EXTRA = /MP /wd4577 $(CFLAGS_CRT) !endif # !win32-icc -!if "$(QMAKESPEC)" != "win32-clang-msvc" CFLAGS_PCH = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch PCH_OBJECT = qmake_pch.obj -!endif CFLAGS_BARE = -c -Fo./ -Fdqmake.pdb \ -W2 -nologo -O2 \ @@ -90,7 +88,6 @@ QTOBJS= \ qringbuffer.obj \ qdebug.obj \ qlist.obj \ - qlinkedlist.obj \ qlocale.obj \ qlocale_tools.obj \ qlocale_win.obj \ @@ -102,7 +99,6 @@ QTOBJS= \ qregexp.obj \ qutfcodec.obj \ qstring.obj \ - qstring_compat.obj \ qstringlist.obj \ qstringbuilder.obj \ qsystemerror.obj \ @@ -200,13 +196,16 @@ qmake_pch.obj: {$(SOURCE_PATH)\src\corelib\serialization}.cpp{}.obj:: $(CXX) $(CXXFLAGS) $< -{$(SOURCE_PATH)\src\corelib\tools}.cpp{}.obj:: +{$(SOURCE_PATH)\src\corelib\text}.cpp{}.obj:: + $(CXX) $(CXXFLAGS) $< + +{$(SOURCE_PATH)\src\corelib\time}.cpp{}.obj:: $(CXX) $(CXXFLAGS) $< -# Make sure qstring_compat.obj and qlibraryinfo.obj aren't compiled with PCH enabled -qstring_compat.obj: $(SOURCE_PATH)\src\corelib\tools\qstring_compat.cpp - $(CXX) -c $(CXXFLAGS_BARE) $(SOURCE_PATH)\src\corelib\tools\qstring_compat.cpp +{$(SOURCE_PATH)\src\corelib\tools}.cpp{}.obj:: + $(CXX) $(CXXFLAGS) $< +# Make sure qlibraryinfo.obj isn't compiled with PCH enabled qlibraryinfo.obj: $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp $(CXX) $(CXXFLAGS_BARE) -DQT_BUILD_QMAKE_BOOTSTRAP $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index d5994639b3..28cf02344d 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -60,11 +60,6 @@ static QString qtSha1(const QByteArray &src) return QString::fromLatin1(digest.toHex()); } -ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator() : UnixMakefileGenerator() -{ - -} - bool ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t) { @@ -540,7 +535,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData()); QTextStream mkt(&mkf); writeHeader(mkt); - mkt << "QMAKE = " << var("QMAKE_QMAKE") << endl; + mkt << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl; project->values("QMAKE_MAKE_QMAKE_EXTRA_COMMANDS") << "@echo 'warning: Xcode project has been regenerated, custom settings have been lost. " \ "Use CONFIG+=no_autoqmake to prevent this behavior in the future, " \ @@ -738,15 +733,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData()); QTextStream mkt(&mkf); writeHeader(mkt); - mkt << "MOC = " << var("QMAKE_MOC") << endl; - mkt << "UIC = " << var("QMAKE_UIC") << endl; - mkt << "LEX = " << var("QMAKE_LEX") << endl; - mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; - mkt << "YACC = " << var("QMAKE_YACC") << endl; - mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl; + mkt << "MOC = " << var("QMAKE_MOC") << Qt::endl; + mkt << "UIC = " << var("QMAKE_UIC") << Qt::endl; + mkt << "LEX = " << var("QMAKE_LEX") << Qt::endl; + mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << Qt::endl; + mkt << "YACC = " << var("QMAKE_YACC") << Qt::endl; + mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << Qt::endl; mkt << "DEFINES = " << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") - << varGlue("DEFINES","-D"," -D","") << endl; + << varGlue("DEFINES","-D"," -D","") << Qt::endl; mkt << "INCPATH ="; { const ProStringList &incs = project->values("INCLUDEPATH"); @@ -755,9 +750,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS")) mkt << " " << var("QMAKE_FRAMEWORKPATH_FLAGS"); - mkt << endl; - mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl; + mkt << Qt::endl; + mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl; + mkt << "MOVE = " << var("QMAKE_MOVE") << Qt::endl << Qt::endl; mkt << "preprocess: compilers\n"; mkt << "clean preprocess_clean: compiler_clean\n\n"; writeExtraTargets(mkt); @@ -787,7 +782,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } } } - mkt << endl; + mkt << Qt::endl; writeExtraCompilerTargets(mkt); writingUnixMakefileGenerator = false; } @@ -992,12 +987,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) tmp = project->values("SUBLIBS"); for(int i = 0; i < tmp.count(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") << ' '; - t << endl << endl; + t << Qt::endl << Qt::endl; mkt << "sublibs: $(SUBLIBS)\n\n"; tmp = project->values("SUBLIBS"); for(int i = 0; i < tmp.count(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") + ":\n\t" - << var(ProKey("MAKELIB" + tmp[i])) << endl << endl; + << var(ProKey("MAKELIB" + tmp[i])) << Qt::endl << Qt::endl; mkt.flush(); mkf.close(); writingUnixMakefileGenerator = false; @@ -1234,9 +1229,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" << "\t\t};\n"; - QMapIterator<ProString, ProStringList> it(embedded_plugins); - while (it.hasNext()) { - it.next(); + for (auto it = embedded_plugins.cbegin(), end = embedded_plugins.cend(); it != end; ++it) { QString suffix = !it.key().isEmpty() ? (" (" + it.key() + ")") : QString(); QString grp3("Embed PlugIns" + suffix), key3 = keyFor(grp3); project->values("QMAKE_PBX_BUILDPHASES").append(key3); @@ -1472,7 +1465,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("name", "Qt Test") << ";\n" << "\t\t};\n"; - QLatin1Literal testTargetID("TestTargetID"); + QLatin1String testTargetID("TestTargetID"); project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + testTargetKey + "_" + testTargetID)).append(keyFor(pbx_dir + "QMAKE_PBX_TARGET")); project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + testTargetKey)).append(ProKey(testTargetID)); } diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h index f15c814cb4..ac0d63606d 100644 --- a/qmake/generators/mac/pbuilder_pbx.h +++ b/qmake/generators/mac/pbuilder_pbx.h @@ -61,19 +61,12 @@ class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator QString writeSettings(const QString &var, const ProStringList &vals, int flags=0, int indent_level=0); public: - ProjectBuilderMakefileGenerator(); - ~ProjectBuilderMakefileGenerator(); - bool supportsMetaBuild() override { return false; } bool openOutput(QFile &, const QString &) const override; protected: bool doPrecompiledHeaders() const override { return false; } bool doDepends() const override { return writingUnixMakefileGenerator && UnixMakefileGenerator::doDepends(); } }; - -inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator() -{ } - QT_END_NAMESPACE #endif // PBUILDER_PBX_H diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index a45b676d5f..ec73ccfe54 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -94,13 +94,6 @@ bool MakefileGenerator::mkdir(const QString &in_path) const return QDir().mkpath(path); } -// ** base makefile generator -MakefileGenerator::MakefileGenerator() : - no_io(false), project(nullptr) -{ -} - - void MakefileGenerator::verifyCompilers() { @@ -174,14 +167,8 @@ MakefileGenerator::initOutPaths() ProString &pathRef = v[dkey].first(); pathRef = fileFixify(pathRef.toQString(), FileFixifyFromOutdir); -#ifdef Q_OS_WIN - // We don't want to add a separator for DLLDESTDIR on Windows (###why?) - if (dkey != "DLLDESTDIR") -#endif - { - if(!pathRef.endsWith(Option::dir_sep)) - pathRef += Option::dir_sep; - } + if (!pathRef.endsWith(Option::dir_sep)) + pathRef += Option::dir_sep; if (noIO() || (project->first("TEMPLATE") == "subdirs")) continue; @@ -206,7 +193,6 @@ MakefileGenerator::initOutPaths() ProStringList &inputs = project->values((*it2).toKey()); for (ProStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { QString finp = fileFixify((*input).toQString(), FileFixifyFromOutdir); - *input = ProString(finp); QString path = replaceExtraCompilerVariables(tmp_out, finp, QString(), NoShell); path = Option::normalizePath(path); int slash = path.lastIndexOf('/'); @@ -778,7 +764,7 @@ MakefileGenerator::init() ProStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; if(project->isActiveConfig("depend_includepath")) incDirs += v["INCLUDEPATH"]; - QList<QMakeLocalFileName> deplist; + QVector<QMakeLocalFileName> deplist; deplist.reserve(incDirs.size()); for (ProStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) deplist.append(QMakeLocalFileName((*it).toQString())); @@ -994,25 +980,25 @@ MakefileGenerator::writePrlFile(QTextStream &t) QString bdir = Option::output_dir; if(bdir.isEmpty()) bdir = qmake_getpwd(); - t << "QMAKE_PRL_BUILD_DIR =" << qv(bdir) << endl; + t << "QMAKE_PRL_BUILD_DIR =" << qv(bdir) << Qt::endl; - t << "QMAKE_PRO_INPUT =" << qv(project->projectFile().section('/', -1)) << endl; + t << "QMAKE_PRO_INPUT =" << qv(project->projectFile().section('/', -1)) << Qt::endl; if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) - t << "QMAKE_PRL_SOURCE_DIR =" << qv(project->first("QMAKE_ABSOLUTE_SOURCE_PATH")) << endl; - t << "QMAKE_PRL_TARGET =" << qv(project->first("LIB_TARGET")) << endl; + t << "QMAKE_PRL_SOURCE_DIR =" << qv(project->first("QMAKE_ABSOLUTE_SOURCE_PATH")) << Qt::endl; + t << "QMAKE_PRL_TARGET =" << qv(project->first("LIB_TARGET")) << Qt::endl; if(!project->isEmpty("PRL_EXPORT_DEFINES")) - t << "QMAKE_PRL_DEFINES =" << qv(project->values("PRL_EXPORT_DEFINES")) << endl; + t << "QMAKE_PRL_DEFINES =" << qv(project->values("PRL_EXPORT_DEFINES")) << Qt::endl; if(!project->isEmpty("PRL_EXPORT_CFLAGS")) - t << "QMAKE_PRL_CFLAGS =" << qv(project->values("PRL_EXPORT_CFLAGS")) << endl; + t << "QMAKE_PRL_CFLAGS =" << qv(project->values("PRL_EXPORT_CFLAGS")) << Qt::endl; if(!project->isEmpty("PRL_EXPORT_CXXFLAGS")) - t << "QMAKE_PRL_CXXFLAGS =" << qv(project->values("PRL_EXPORT_CXXFLAGS")) << endl; + t << "QMAKE_PRL_CXXFLAGS =" << qv(project->values("PRL_EXPORT_CXXFLAGS")) << Qt::endl; if(!project->isEmpty("CONFIG")) - t << "QMAKE_PRL_CONFIG =" << qv(project->values("CONFIG")) << endl; + t << "QMAKE_PRL_CONFIG =" << qv(project->values("CONFIG")) << Qt::endl; if(!project->isEmpty("TARGET_VERSION_EXT")) - t << "QMAKE_PRL_VERSION = " << project->first("TARGET_VERSION_EXT") << endl; + t << "QMAKE_PRL_VERSION = " << project->first("TARGET_VERSION_EXT") << Qt::endl; else if(!project->isEmpty("VERSION")) - t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl; + t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << Qt::endl; if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { ProStringList libs; if (!project->isActiveConfig("staticlib")) @@ -1022,7 +1008,7 @@ MakefileGenerator::writePrlFile(QTextStream &t) t << "QMAKE_PRL_LIBS ="; for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it) t << qv(project->values((*it).toKey())); - t << endl; + t << Qt::endl; t << "QMAKE_PRL_LIBS_FOR_CMAKE = "; QString sep; @@ -1030,7 +1016,7 @@ MakefileGenerator::writePrlFile(QTextStream &t) t << sep << project->values((*it).toKey()).join(';').replace('\\', "\\\\"); sep = ';'; } - t << endl; + t << Qt::endl; } } @@ -1061,17 +1047,17 @@ MakefileGenerator::writeProjectMakefile() //install t << "install: "; - for(it = targets.begin(); it != targets.end(); ++it) - t << (*it)->target << "-install "; - t << endl; + for (SubTarget *s : qAsConst(targets)) + t << s->target << '-'; + t << "install " << Qt::endl; //uninstall t << "uninstall: "; for(it = targets.begin(); it != targets.end(); ++it) t << (*it)->target << "-uninstall "; - t << endl; + t << Qt::endl; } else { - t << "first: " << targets.first()->target << endl + t << "first: " << targets.first()->target << Qt::endl << "install: " << targets.first()->target << "-install\n" << "uninstall: " << targets.first()->target << "-uninstall\n"; } @@ -1080,7 +1066,7 @@ MakefileGenerator::writeProjectMakefile() if(!project->isActiveConfig("no_autoqmake")) { QString mkf = escapeDependencyPath(fileFixify(Option::output.fileName())); for(QList<SubTarget*>::Iterator it = targets.begin(); it != targets.end(); ++it) - t << escapeDependencyPath((*it)->makefile) << ": " << mkf << endl; + t << escapeDependencyPath((*it)->makefile) << ": " << mkf << Qt::endl; } qDeleteAll(targets); return true; @@ -1195,7 +1181,7 @@ MakefileGenerator::writeObj(QTextStream &t, const char *src) p.replace(stringObj, escapeFilePath(dstf)); t << "\n\t" << p; } - t << endl << endl; + t << Qt::endl << Qt::endl; } } @@ -1310,9 +1296,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) dst_file += fi.fileName(); QString cmd; if (is_target || (!fi.isDir() && fi.isExecutable())) - cmd = QLatin1String("-$(QINSTALL_PROGRAM)"); + cmd = QLatin1String("$(QINSTALL_PROGRAM)"); else - cmd = QLatin1String("-$(QINSTALL)"); + cmd = QLatin1String("$(QINSTALL)"); cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file); inst << cmd; if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") && @@ -1332,9 +1318,9 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) dst_file += filestr; QString cmd; if (installConfigValues.contains("executable")) - cmd = QLatin1String("-$(QINSTALL_PROGRAM)"); + cmd = QLatin1String("$(QINSTALL_PROGRAM)"); else - cmd = QLatin1String("-$(QINSTALL)"); + cmd = QLatin1String("$(QINSTALL)"); cmd += " " + escapeFilePath(wild) + " " + escapeFilePath(dst_file); inst << cmd; uninst.append(rm_dir_contents + " " + escapeFilePath(filePrefixRoot(root, fileFixify(dst_dir + filestr, FileFixifyAbsolute, false)))); @@ -1347,7 +1333,7 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) if (!dst_file.endsWith(Option::dir_sep)) dst_file += Option::dir_sep; dst_file += fi.fileName(); - QString cmd = QLatin1String("-$(QINSTALL) ") + + QString cmd = QLatin1String("$(QINSTALL) ") + escapeFilePath(dirstr + file) + " " + escapeFilePath(dst_file); inst << cmd; if (!noStrip && !project->isActiveConfig("debug_info") && !project->isActiveConfig("nostrip") && @@ -1389,14 +1375,14 @@ MakefileGenerator::writeInstalls(QTextStream &t, bool noBuild) QString tmp_dst = fileFixify((*pit).toQString(), FileFixifyAbsolute, false); t << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)) << "\n\t"; } - t << target << endl << endl; + t << target << Qt::endl << Qt::endl; if(!uninst.isEmpty()) { t << "uninstall_" << (*it) << ": FORCE"; for (int i = uninst.size(); --i >= 0; ) t << "\n\t" << uninst.at(i); t << "\n\t-$(DEL_DIR) " << escapeFilePath(filePrefixRoot(root, dst)) << " \n\n"; } - t << endl; + t << Qt::endl; if (installConfigValues.indexOf("no_default_install") == -1) { all_installs += QString("install_") + (*it) + " "; @@ -1833,7 +1819,7 @@ MakefileGenerator::writeExtraTargets(QTextStream &t) t << escapeDependencyPath(targ) << ":" << deps; if(!cmd.isEmpty()) t << "\n\t" << cmd; - t << endl << endl; + t << Qt::endl << Qt::endl; } } @@ -1853,7 +1839,7 @@ static QStringList splitDeps(const QString &indeps, bool lineMode) QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &file) { - const QList<QMakeLocalFileName> &depdirs = QMakeSourceFileInfo::dependencyPaths(); + const QVector<QMakeLocalFileName> &depdirs = QMakeSourceFileInfo::dependencyPaths(); for (const auto &depdir : depdirs) { const QString &local = depdir.local(); QString lf = outDir.absoluteFilePath(local + '/' + file); @@ -1878,6 +1864,55 @@ QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString & return {}; } +void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCompiler, + const QString &dep_cd_cmd, + const QString &tmp_dep_cmd, + const QString &inpf, + const QString &tmp_out, + bool dep_lines, + QStringList *deps) +{ + char buff[256]; + QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell); + dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); + if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { + QByteArray depData; + while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc)) + depData.append(buff, read_in); + QT_PCLOSE(proc); + const QString indeps = QString::fromLocal8Bit(depData); + if (indeps.isEmpty()) + return; + QDir outDir(Option::output_dir); + QStringList dep_cmd_deps = splitDeps(indeps, dep_lines); + for (int i = 0; i < dep_cmd_deps.count(); ++i) { + QString &file = dep_cmd_deps[i]; + const QString absFile = outDir.absoluteFilePath(file); + if (absFile == file) { + // already absolute; don't do any checks. + } else if (exists(absFile)) { + file = absFile; + } else { + const QString localFile = resolveDependency(outDir, file); + if (localFile.isEmpty()) { + if (exists(file)) { + warn_msg(WarnDeprecated, ".depend_command for extra compiler %s" + " prints paths relative to source directory", + extraCompiler.toLatin1().constData()); + } else { + file = absFile; // fallback for generated resources + } + } else { + file = localFile; + } + } + if (!file.isEmpty()) + file = fileFixify(file); + } + deps->append(dep_cmd_deps); + } +} + void MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) { @@ -1925,7 +1960,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) FileFixifyFromOutdir)); } } - t << endl; + t << Qt::endl; if (config.indexOf("no_clean") == -1) { QStringList raw_clean = project->values(ProKey(*it + ".clean")).toQStringList(); @@ -1990,7 +2025,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } } } - t << endl; + t << Qt::endl; } QStringList tmp_dep = project->values(ProKey(*it + ".depends")).toQStringList(); if (config.indexOf("combine") != -1) { @@ -2007,44 +2042,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) deps += findDependencies(inpf); inputs += Option::fixPathToTargetOS(inpf, false); if(!tmp_dep_cmd.isEmpty() && doDepends()) { - char buff[256]; - QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell); - dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); - if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { - QByteArray depData; - while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc)) - depData.append(buff, read_in); - QT_PCLOSE(proc); - const QString indeps = QString::fromLocal8Bit(depData); - if(!indeps.isEmpty()) { - QDir outDir(Option::output_dir); - QStringList dep_cmd_deps = splitDeps(indeps, dep_lines); - for(int i = 0; i < dep_cmd_deps.count(); ++i) { - QString &file = dep_cmd_deps[i]; - QString absFile = outDir.absoluteFilePath(file); - if (absFile == file) { - // already absolute; don't do any checks. - } else if (exists(absFile)) { - file = absFile; - } else { - QString localFile = resolveDependency(outDir, file); - if (localFile.isEmpty()) { - if (exists(file)) - warn_msg(WarnDeprecated, ".depend_command for extra compiler %s" - " prints paths relative to source directory", - (*it).toLatin1().constData()); - else - file = absFile; // fallback for generated resources - } else { - file = localFile; - } - } - if(!file.isEmpty()) - file = fileFixify(file); - } - deps += dep_cmd_deps; - } - } + callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf, + tmp_out, dep_lines, &deps); } } for(int i = 0; i < inputs.size(); ) { @@ -2071,7 +2070,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } else { t << " " << valList(escapeDependencyPaths(inputs)) << " " << valList(finalizeDependencyPaths(deps)); } - t << "\n\t" << cmd << endl << endl; + t << "\n\t" << cmd << Qt::endl << Qt::endl; continue; } for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) { @@ -2092,44 +2091,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) for (ProStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3) cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); if(!tmp_dep_cmd.isEmpty() && doDepends()) { - char buff[256]; - QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell); - dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); - if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) { - QByteArray depData; - while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc)) - depData.append(buff, read_in); - QT_PCLOSE(proc); - const QString indeps = QString::fromLocal8Bit(depData); - if(!indeps.isEmpty()) { - QDir outDir(Option::output_dir); - QStringList dep_cmd_deps = splitDeps(indeps, dep_lines); - for(int i = 0; i < dep_cmd_deps.count(); ++i) { - QString &file = dep_cmd_deps[i]; - QString absFile = outDir.absoluteFilePath(file); - if (absFile == file) { - // already absolute; don't do any checks. - } else if (exists(absFile)) { - file = absFile; - } else { - QString localFile = resolveDependency(outDir, file); - if (localFile.isEmpty()) { - if (exists(file)) - warn_msg(WarnDeprecated, ".depend_command for extra compiler %s" - " prints paths relative to source directory", - (*it).toLatin1().constData()); - else - file = absFile; // fallback for generated resources - } else { - file = localFile; - } - } - if(!file.isEmpty()) - file = fileFixify(file); - } - deps += dep_cmd_deps; - } - } + callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf, + tmp_out, dep_lines, &deps); //use the depend system to find includes of these included files QStringList inc_deps; for(int i = 0; i < deps.size(); ++i) { @@ -2180,10 +2143,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) ++i; } t << escapeDependencyPath(out) << ": " << valList(finalizeDependencyPaths(deps)) << "\n\t" - << cmd << endl << endl; + << cmd << Qt::endl << Qt::endl; } } - t << "compiler_clean: " << clean_targets << endl << endl; + t << "compiler_clean: " << clean_targets << Qt::endl << Qt::endl; } void @@ -2199,17 +2162,17 @@ MakefileGenerator::writeExtraCompilerVariables(QTextStream &t) first = false; } t << "QMAKE_COMP_" << (*varit) << " = " - << valList(project->values((*varit).toKey())) << endl; + << valList(project->values((*varit).toKey())) << Qt::endl; } } if(!first) - t << endl; + t << Qt::endl; } void MakefileGenerator::writeExtraVariables(QTextStream &t) { - t << endl; + t << Qt::endl; ProStringList outlist; const ProValueMap &vars = project->variables(); @@ -2223,7 +2186,7 @@ MakefileGenerator::writeExtraVariables(QTextStream &t) } if (!outlist.isEmpty()) { t << "####### Custom Variables\n"; - t << outlist.join('\n') << endl << endl; + t << outlist.join('\n') << Qt::endl << Qt::endl; } } @@ -2239,11 +2202,11 @@ MakefileGenerator::writeExportedVariables(QTextStream &t) const ProString &name = project->first(ProKey(exp + ".name")); const ProString &value = project->first(ProKey(exp + ".value")); if (!value.isEmpty()) - t << name << " = " << value << endl; + t << name << " = " << value << Qt::endl; else t << name << " =\n"; } - t << endl; + t << Qt::endl; } bool @@ -2251,7 +2214,7 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t) { if (project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) return false; - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl; const ProStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); for (ProStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) t << *it << " "; @@ -2265,21 +2228,6 @@ MakefileGenerator::writeDummyMakefile(QTextStream &t) } bool -MakefileGenerator::writeStubMakefile(QTextStream &t) -{ - 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 << *it << " "; - //const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName())); - t << "first all clean install distclean uninstall: qmake\n" - << "qmake_all:\n"; - writeMakeQmake(t); - t << "FORCE:\n\n"; - return true; -} - -bool MakefileGenerator::writeMakefile(QTextStream &t) { t << "####### Compile\n\n"; @@ -2296,22 +2244,22 @@ MakefileGenerator::writeMakefile(QTextStream &t) void MakefileGenerator::writeDefaultVariables(QTextStream &t) { - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - t << "COPY = " << var("QMAKE_COPY") << endl; - t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; - t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << 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 << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; + t << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl; + t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << Qt::endl; + t << "MKDIR = " << var("QMAKE_MKDIR") << Qt::endl; + t << "COPY = " << var("QMAKE_COPY") << Qt::endl; + t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << Qt::endl; + t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << Qt::endl; + t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << Qt::endl; + t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << Qt::endl; + t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << Qt::endl; + t << "QINSTALL = " << var("QMAKE_QMAKE") << " -install qinstall" << Qt::endl; + t << "QINSTALL_PROGRAM = " << var("QMAKE_QMAKE") << " -install qinstall -exe" << Qt::endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl; + t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << Qt::endl; + t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << Qt::endl; + t << "MOVE = " << var("QMAKE_MOVE") << Qt::endl; } QString MakefileGenerator::buildArgs(bool withExtra) @@ -2330,9 +2278,9 @@ QString MakefileGenerator::buildArgs(bool withExtra) //could get stored argv, but then it would have more options than are //probably necesary this will try to guess the bare minimum.. -QString MakefileGenerator::build_args() +QString MakefileGenerator::fullBuildArgs() { - QString ret = "$(QMAKE)"; + QString ret; //output QString ofile = fileFixify(Option::output.fileName()); @@ -2352,18 +2300,18 @@ void MakefileGenerator::writeHeader(QTextStream &t) { t << "#############################################################################\n"; - t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << endl; + t << "# Makefile for building: " << escapeFilePath(var("TARGET")) << Qt::endl; t << "# Generated by qmake (" QMAKE_VERSION_STR ") (Qt " QT_VERSION_STR ")\n"; - t << "# Project: " << fileFixify(project->projectFile()) << endl; - t << "# Template: " << var("TEMPLATE") << endl; + t << "# Project: " << fileFixify(project->projectFile()) << Qt::endl; + t << "# Template: " << var("TEMPLATE") << Qt::endl; if(!project->isActiveConfig("build_pass")) - t << "# Command: " << build_args().replace(QLatin1String("$(QMAKE)"), var("QMAKE_QMAKE")) << endl; + t << "# Command: " << var("QMAKE_QMAKE") << fullBuildArgs() << Qt::endl; t << "#############################################################################\n"; - t << endl; + t << Qt::endl; QString ofile = Option::fixPathToTargetOS(Option::output.fileName()); if (ofile.lastIndexOf(Option::dir_sep) != -1) ofile.remove(0, ofile.lastIndexOf(Option::dir_sep) +1); - t << "MAKEFILE = " << escapeFilePath(ofile) << endl << endl; + t << "MAKEFILE = " << escapeFilePath(ofile) << Qt::endl << Qt::endl; t << "EQ = =\n\n"; } @@ -2502,7 +2450,7 @@ MakefileGenerator::writeSubDirs(QTextStream &t) void MakefileGenerator::writeSubMakeCall(QTextStream &t, const QString &callPrefix, const QString &makeArguments) { - t << callPrefix << "$(MAKE)" << makeArguments << endl; + t << callPrefix << "$(MAKE)" << makeArguments << Qt::endl; } void @@ -2521,20 +2469,30 @@ MakefileGenerator::writeSubTargetCall(QTextStream &t, writeSubMakeCall(t, out_directory_cdin + pfx, makefilein); } +static void chopEndLines(QString *s) +{ + while (!s->isEmpty()) { + const ushort c = s->at(s->size() - 1).unicode(); + if (c != '\n' && c != '\r') + break; + s->chop(1); + } +} + void MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags) { // blasted includes const ProStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); for (ProStringList::ConstIterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it) - t << "include " << (*qeui_it) << endl; + t << "include " << (*qeui_it) << Qt::endl; if (!(flags & SubTargetSkipDefaultVariables)) { writeDefaultVariables(t); t << "SUBTARGETS = "; // subtargets are sub-directory for(int target = 0; target < targets.size(); ++target) t << " \\\n\t\t" << targets.at(target)->target; - t << endl << endl; + t << Qt::endl << Qt::endl; } writeExtraVariables(t); @@ -2546,6 +2504,14 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT << QString((flags & SubTargetInstalls) ? "uninstall_subtargets" : "uninstall"); } + struct SequentialInstallData + { + QString targetPrefix; + QString commands; + QTextStream commandsStream; + SequentialInstallData() : commandsStream(&commands) {} + }; + std::unique_ptr<SequentialInstallData> sequentialInstallData; bool dont_recurse = project->isActiveConfig("dont_recurse"); // generate target rules @@ -2590,7 +2556,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT if (!dont_recurse) writeSubMakeCall(t, out_directory_cdin, makefilein + " qmake_all"); else - t << endl; + t << Qt::endl; } { //actually compile @@ -2614,6 +2580,16 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT else if(s == "make_first") s = QString(); + if (project->isActiveConfig("build_all") && s == "install") { + if (!sequentialInstallData) + sequentialInstallData.reset(new SequentialInstallData); + sequentialInstallData->targetPrefix += subtarget->target + '-'; + writeSubTargetCall(sequentialInstallData->commandsStream, in_directory, in, + out_directory, out, out_directory_cdin, + makefilein + " " + s); + chopEndLines(&sequentialInstallData->commands); + } + if(flags & SubTargetOrdered) { t << subtarget->target << "-" << targetSuffixes.at(suffix) << "-ordered:"; if(target) @@ -2631,7 +2607,12 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT out_directory_cdin, makefilein + " " + s); } } - t << endl; + t << Qt::endl; + + if (sequentialInstallData) { + t << sequentialInstallData->targetPrefix << "install: FORCE" + << sequentialInstallData->commands << Qt::endl << Qt::endl; + } if (!(flags & SubTargetSkipDefaultTargets)) { writeMakeQmake(t, true); @@ -2680,7 +2661,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT } else if(suffix == "distclean") { 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 << fixFileVarGlue("QMAKE_DISTCLEAN", "\t-$(DEL_FILE) ", " ", "\n"); } } @@ -2693,7 +2674,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT cmd = var(ProKey(*qut_it + ".commands")), deps; if(targ.isEmpty()) targ = (*qut_it).toQString(); - t << endl; + t << Qt::endl; const ProStringList &deplist = project->values(ProKey(*qut_it + ".depends")); for (ProStringList::ConstIterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { @@ -2706,7 +2687,8 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT QSet<QString> recurse; const ProKey rkey(*qut_it + ".recurse"); if (project->isSet(rkey)) { - recurse = project->values(rkey).toQStringList().toSet(); + const QStringList values = project->values(rkey).toQStringList(); + recurse = QSet<QString>(values.begin(), values.end()); } else { for(int target = 0; target < targets.size(); ++target) recurse.insert(targets.at(target)->name); @@ -2768,7 +2750,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT deps += " FORCE"; t << escapeDependencyPath(Option::fixPathToTargetOS(targ, false)) << ":" << deps << "\n"; if(!cmd.isEmpty()) - t << "\t" << cmd << endl; + t << "\t" << cmd << Qt::endl; } if(flags & SubTargetInstalls) { @@ -2786,10 +2768,10 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll) if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { QStringList files = escapeFilePaths(fileFixify(Option::mkfile::project_files)); t << escapeDependencyPath(project->first("QMAKE_INTERNAL_PRL_FILE").toQString()) << ": \n\t" - << "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << endl; + << "@$(QMAKE) -prl " << files.join(' ') << ' ' << buildArgs(true) << Qt::endl; } - QString qmake = build_args(); + QString qmake = "$(QMAKE)" + fullBuildArgs(); if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) { t << escapeDependencyPath(ofile) << ": " << escapeDependencyPath(fileFixify(project->projectFile())) << " "; @@ -2805,10 +2787,10 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll) } const ProStringList &included = escapeDependencyPaths(project->values("QMAKE_INTERNAL_INCLUDED_FILES")); t << included.join(QString(" \\\n\t\t")) << "\n\t" - << qmake << endl; + << qmake << Qt::endl; const ProStringList &extraCommands = project->values("QMAKE_MAKE_QMAKE_EXTRA_COMMANDS"); if (!extraCommands.isEmpty()) - t << "\t" << extraCommands.join(QString("\n\t")) << endl; + t << "\t" << extraCommands.join(QString("\n\t")) << Qt::endl; for(int include = 0; include < included.size(); ++include) { const ProString &i = included.at(include); if(!i.isEmpty()) @@ -2816,7 +2798,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll) } } if(project->first("QMAKE_ORIG_TARGET") != "qmake") { - t << "qmake: FORCE\n\t@" << qmake << endl << endl; + t << "qmake: FORCE\n\t@" << qmake << Qt::endl << Qt::endl; if (!noDummyQmakeAll) t << "qmake_all: FORCE\n\n"; } @@ -3123,7 +3105,7 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca if(Option::output_dir != qmake_getpwd() && QDir::isRelativePath(dep.real())) { //is it from the shadow tree - QList<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths(); + QVector<QMakeLocalFileName> depdirs = QMakeSourceFileInfo::dependencyPaths(); depdirs.prepend(fileInfo(file.real()).absoluteDir().path()); QString pwd = qmake_getpwd(); if(pwd.at(pwd.length()-1) != '/') @@ -3308,11 +3290,11 @@ MakefileGenerator::writePkgConfigFile() if(includeDir.isEmpty()) includeDir = prefix + "/include"; - t << "prefix=" << prefix << endl; + t << "prefix=" << prefix << Qt::endl; t << "exec_prefix=${prefix}\n" << "libdir=" << pkgConfigFixPath(libDir) << "\n" - << "includedir=" << pkgConfigFixPath(includeDir) << endl; - t << endl; + << "includedir=" << pkgConfigFixPath(includeDir) << Qt::endl; + t << Qt::endl; //extra PKGCONFIG variables const ProStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES"); @@ -3333,17 +3315,17 @@ MakefileGenerator::writePkgConfigFile() } } if (!val.isEmpty()) - t << var << "=" << val << endl; + t << var << "=" << val << Qt::endl; } - t << endl; + t << Qt::endl; QString name = project->first("QMAKE_PKGCONFIG_NAME").toQString(); if(name.isEmpty()) { name = project->first("QMAKE_ORIG_TARGET").toQString().toLower(); name.replace(0, 1, name[0].toUpper()); } - t << "Name: " << name << endl; + t << "Name: " << name << Qt::endl; QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(' '); if(desc.isEmpty()) { if(name.isEmpty()) { @@ -3361,12 +3343,12 @@ MakefileGenerator::writePkgConfigFile() desc += " Application"; } } - t << "Description: " << desc << endl; + t << "Description: " << desc << Qt::endl; ProString version = project->first("QMAKE_PKGCONFIG_VERSION"); if (version.isEmpty()) version = project->first("VERSION"); if (!version.isEmpty()) - t << "Version: " << version << endl; + t << "Version: " << version << Qt::endl; if (project->first("TEMPLATE") == "lib") { // libs @@ -3404,7 +3386,7 @@ MakefileGenerator::writePkgConfigFile() t << "Libs.private:"; for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it) t << ' ' << fixLibFlags((*it).toKey()).join(' '); - t << endl; + t << Qt::endl; } } @@ -3423,15 +3405,15 @@ MakefileGenerator::writePkgConfigFile() && libDir != QLatin1String("/Library/Frameworks")) { t << " -F${libdir}"; } - t << endl; + t << Qt::endl; // requires const QString requiresString = project->values("QMAKE_PKGCONFIG_REQUIRES").join(' '); if (!requiresString.isEmpty()) { - t << "Requires: " << requiresString << endl; + t << "Requires: " << requiresString << Qt::endl; } - t << endl; + t << Qt::endl; } static QString windowsifyPath(const QString &str) @@ -3446,7 +3428,7 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt QString ret; if (project->isEmpty(replace_rule) || project->isActiveConfig("no_sed_meta_install")) { - ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); + ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); } else { QString sedargs; const ProStringList &replace_rules = project->values(replace_rule); @@ -3461,9 +3443,9 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt } } if (sedargs.isEmpty()) { - ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); + ret += "$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); } else { - ret += "-$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst); + ret += "$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst); } } return ret; @@ -3474,4 +3456,13 @@ QString MakefileGenerator::shellQuote(const QString &str) return isWindowsShell() ? IoUtils::shellQuoteWin(str) : IoUtils::shellQuoteUnix(str); } +/* + * Returns the name of the variable that contains the fully resolved target + * (including DESTDIR) of this generator. + */ +ProKey MakefileGenerator::fullTargetVariable() const +{ + return "TARGET"; +} + QT_END_NAMESPACE diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 350ebd377a..45250a6aa2 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -54,11 +54,11 @@ struct ReplaceExtraCompilerCacheKey; class MakefileGenerator : protected QMakeSourceFileInfo { QString spec; - bool no_io; + bool no_io = false; bool resolveDependenciesInFrameworks = false; QHash<QString, bool> init_compiler_already; QString makedir, chkexists; - QString build_args(); + QString fullBuildArgs(); //internal caches mutable QHash<QString, QMakeLocalFileName> depHeuristicsCache; @@ -84,10 +84,12 @@ protected: void writeExtraVariables(QTextStream &t); void writeExtraTargets(QTextStream &t); QString resolveDependency(const QDir &outDir, const QString &file); + void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &dep_cd_cmd, + const QString &tmp_dep_cmd, const QString &inpf, + const QString &tmp_out, bool dep_lines, QStringList *deps); void writeExtraCompilerTargets(QTextStream &t); void writeExtraCompilerVariables(QTextStream &t); bool writeDummyMakefile(QTextStream &t); - virtual bool writeStubMakefile(QTextStream &t); virtual bool writeMakefile(QTextStream &t); virtual void writeDefaultVariables(QTextStream &t); @@ -131,7 +133,7 @@ protected: QMakeLocalFileName fixPathForFile(const QMakeLocalFileName &, bool) override; QMakeLocalFileName findFileForDep(const QMakeLocalFileName &, const QMakeLocalFileName &) override; QFileInfo findFileInfo(const QMakeLocalFileName &) override; - QMakeProject *project; + QMakeProject *project = nullptr; //escape virtual QString escapeFilePath(const QString &path) const = 0; @@ -256,8 +258,6 @@ protected: const QString &fixedFile); public: - MakefileGenerator(); - ~MakefileGenerator(); QMakeProject *projectFile() const; void setProjectFile(QMakeProject *p); @@ -276,6 +276,7 @@ public: virtual bool openOutput(QFile &, const QString &build) const; bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); } QString shellQuote(const QString &str); + virtual ProKey fullTargetVariable() const; }; Q_DECLARE_TYPEINFO(MakefileGenerator::Compiler, Q_MOVABLE_TYPE); Q_DECLARE_OPERATORS_FOR_FLAGS(MakefileGenerator::FileFixifyTypes) @@ -295,9 +296,6 @@ inline QString MakefileGenerator::installRoot() const inline bool MakefileGenerator::findLibraries(bool, bool) { return true; } -inline MakefileGenerator::~MakefileGenerator() -{ } - struct ReplaceExtraCompilerCacheKey { mutable uint hash; diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 1995cf63ba..10fcc1493c 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -199,10 +199,10 @@ void QMakeSourceFileInfo::dependTreeWalker(SourceFile *node, SourceDependChildre } } -void QMakeSourceFileInfo::setDependencyPaths(const QList<QMakeLocalFileName> &l) +void QMakeSourceFileInfo::setDependencyPaths(const QVector<QMakeLocalFileName> &l) { // Ensure that depdirs does not contain the same paths several times, to minimize the stats - QList<QMakeLocalFileName> ll; + QVector<QMakeLocalFileName> ll; for (int i = 0; i < l.count(); ++i) { if (!ll.contains(l.at(i))) ll.append(l.at(i)); @@ -853,8 +853,8 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) } } if(!exists) { //path lookup - for(QList<QMakeLocalFileName>::Iterator it = depdirs.begin(); it != depdirs.end(); ++it) { - QMakeLocalFileName f((*it).real() + Option::dir_sep + lfn.real()); + for (const QMakeLocalFileName &depdir : qAsConst(depdirs)) { + QMakeLocalFileName f(depdir.real() + Option::dir_sep + lfn.real()); QFileInfo fi(findFileInfo(f)); if(fi.exists() && !fi.isDir()) { lfn = fixPathForFile(f); @@ -946,10 +946,12 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) debug_msg(2, "findMocs: %s", file->file.local().toLatin1().constData()); int line_count = 1; - bool ignore[3] = { false, false, false }; // [0] for Q_OBJECT, [1] for Q_GADGET, [2] for Q_NAMESPACE + // [0] for Q_OBJECT, [1] for Q_GADGET, [2] for Q_NAMESPACE, [3] for Q_NAMESPACE_EXPORT + bool ignore[4] = { false, false, false, false }; /* qmake ignore Q_GADGET */ /* qmake ignore Q_OBJECT */ /* qmake ignore Q_NAMESPACE */ + /* qmake ignore Q_NAMESPACE_EXPORT */ for(int x = 0; x < buffer_len; x++) { #define SKIP_BSNL(pos) skipEscapedLineEnds(buffer, buffer_len, (pos), &line_count) x = SKIP_BSNL(x); @@ -988,6 +990,12 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) file->file.real().toLatin1().constData(), line_count); x += 23; ignore[2] = true; + } else if (buffer_len >= (x + 30) && + !strncmp(buffer + x + 1, "make ignore Q_NAMESPACE_EXPORT", 30)) { + debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_NAMESPACE_EXPORT\"", + file->file.real().toLatin1().constData(), line_count); + x += 30; + ignore[3] = true; } } else if (buffer[x] == '*') { extralines = 0; @@ -1015,8 +1023,8 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) int morelines = 0; int y = skipEscapedLineEnds(buffer, buffer_len, x + 1, &morelines); if (buffer[y] == 'Q') { - static const char interesting[][12] = { "Q_OBJECT", "Q_GADGET", "Q_NAMESPACE"}; - for (int interest = 0; interest < 3; ++interest) { + static const char interesting[][19] = { "Q_OBJECT", "Q_GADGET", "Q_NAMESPACE", "Q_NAMESPACE_EXPORT" }; + for (int interest = 0; interest < 4; ++interest) { if (ignore[interest]) continue; diff --git a/qmake/generators/makefiledeps.h b/qmake/generators/makefiledeps.h index 034197fd31..b91a3e0a0f 100644 --- a/qmake/generators/makefiledeps.h +++ b/qmake/generators/makefiledeps.h @@ -33,6 +33,7 @@ #include <qstringlist.h> #include <qfileinfo.h> +#include <qvector.h> QT_BEGIN_NAMESPACE @@ -42,7 +43,8 @@ class SourceFiles; class QMakeLocalFileName { bool is_null; - mutable QString real_name, local_name; + QString real_name; + mutable QString local_name; public: QMakeLocalFileName() : is_null(true) {} QMakeLocalFileName(const QString &); @@ -64,7 +66,7 @@ private: //quick project lookups SourceFiles *files, *includes; bool files_changed; - QList<QMakeLocalFileName> depdirs; + QVector<QMakeLocalFileName> depdirs; QStringList systemIncludes; //sleezy buffer code @@ -90,8 +92,8 @@ public: QMakeSourceFileInfo(const QString &cachefile=""); virtual ~QMakeSourceFileInfo(); - QList<QMakeLocalFileName> dependencyPaths() const { return depdirs; } - void setDependencyPaths(const QList<QMakeLocalFileName> &); + QVector<QMakeLocalFileName> dependencyPaths() const { return depdirs; } + void setDependencyPaths(const QVector<QMakeLocalFileName> &); enum DependencyMode { Recursive, NonRecursive }; inline void setDependencyMode(DependencyMode mode) { dep_mode = mode; } diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 8ebd0c61ce..22a72100f7 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -27,13 +27,16 @@ ****************************************************************************/ #include "metamakefile.h" -#include "qregexp.h" #include "qdir.h" #include "qdebug.h" #include "makefile.h" #include "project.h" #include "cachekeys.h" +#include <algorithm> +#include <iterator> +#include <utility> + #define BUILDSMETATYPE 1 #define SUBDIRSMETATYPE 2 @@ -58,6 +61,8 @@ private: QList<Build *> makefiles; void clearBuilds(); MakefileGenerator *processBuild(const ProString &); + void accumulateVariableFromBuilds(const ProKey &name, Build *build) const; + void checkForConflictingTargets() const; public: @@ -96,9 +101,6 @@ BuildsMetaMakefileGenerator::init() if(builds.count() > 1 && Option::output.fileName() == "-") { use_single_build = true; warn_msg(WarnLogic, "Cannot direct to stdout when using multiple BUILDS."); - } else if(0 && !use_single_build && project->first("TEMPLATE") == "subdirs") { - use_single_build = true; - warn_msg(WarnLogic, "Cannot specify multiple builds with TEMPLATE subdirs."); } if(!use_single_build) { for(int i = 0; i < builds.count(); i++) { @@ -189,6 +191,8 @@ BuildsMetaMakefileGenerator::write() if(!build->makefile) { ret = false; } else if(build == glue) { + checkForConflictingTargets(); + accumulateVariableFromBuilds("QMAKE_INTERNAL_INCLUDED_FILES", build); ret = build->makefile->writeProjectMakefile(); } else { ret = build->makefile->write(); @@ -231,6 +235,49 @@ MakefileGenerator return nullptr; } +void BuildsMetaMakefileGenerator::accumulateVariableFromBuilds(const ProKey &name, Build *dst) const +{ + ProStringList &values = dst->makefile->projectFile()->values(name); + for (auto build : makefiles) { + if (build != dst) + values += build->makefile->projectFile()->values(name); + } + values.removeDuplicates(); +} + +void BuildsMetaMakefileGenerator::checkForConflictingTargets() const +{ + if (makefiles.count() < 3) { + // Checking for conflicts only makes sense if we have more than one BUILD, + // and the last entry in makefiles is the "glue" Build. + return; + } + using TargetInfo = std::pair<Build *, ProString>; + QVector<TargetInfo> targets; + const int last = makefiles.count() - 1; + targets.resize(last); + for (int i = 0; i < last; ++i) { + Build *b = makefiles.at(i); + auto mkf = b->makefile; + auto prj = mkf->projectFile(); + targets[i] = std::make_pair(b, prj->first(mkf->fullTargetVariable())); + } + std::stable_sort(targets.begin(), targets.end(), + [](const TargetInfo &lhs, const TargetInfo &rhs) + { + return lhs.second < rhs.second; + }); + for (auto prev = targets.begin(), it = std::next(prev); it != targets.end(); ++prev, ++it) { + if (prev->second == it->second) { + warn_msg(WarnLogic, "Targets of builds '%s' and '%s' conflict: %s.", + qPrintable(prev->first->build), + qPrintable(it->first->build), + qPrintable(prev->second.toQString())); + break; + } + } +} + class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator { protected: @@ -328,17 +375,13 @@ SubdirsMetaMakefileGenerator::init() hasError |= tmpError; } sub->makefile = MetaMakefileGenerator::createMetaGenerator(sub_proj, sub_name); - if(0 && sub->makefile->type() == SUBDIRSMETATYPE) { - subs.append(sub); - } else { - const QString output_name = Option::output.fileName(); - Option::output.setFileName(sub->output_file); - hasError |= !sub->makefile->write(); - delete sub; - qmakeClearCaches(); - sub = nullptr; - Option::output.setFileName(output_name); - } + const QString output_name = Option::output.fileName(); + Option::output.setFileName(sub->output_file); + hasError |= !sub->makefile->write(); + delete sub; + qmakeClearCaches(); + sub = nullptr; + Option::output.setFileName(output_name); Option::output_dir = old_output_dir; qmake_setpwd(oldpwd); diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index ef34955eb1..c43f6b4e4a 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -50,10 +50,6 @@ QString project_builtin_regx() //calculate the builtin regular expression.. return ret; } -ProjectGenerator::ProjectGenerator() : MakefileGenerator() -{ -} - void ProjectGenerator::init() { @@ -219,7 +215,7 @@ ProjectGenerator::init() } //setup deplist - QList<QMakeLocalFileName> deplist; + QVector<QMakeLocalFileName> deplist; { const ProStringList &d = v["DEPENDPATH"]; for(int i = 0; i < d.size(); ++i) @@ -324,14 +320,14 @@ ProjectGenerator::init() bool ProjectGenerator::writeMakefile(QTextStream &t) { - t << "######################################################################" << endl; - t << "# Automatically generated by qmake (" QMAKE_VERSION_STR ") " << QDateTime::currentDateTime().toString() << endl; - t << "######################################################################" << endl << endl; + t << "######################################################################" << Qt::endl; + t << "# Automatically generated by qmake (" QMAKE_VERSION_STR ") " << QDateTime::currentDateTime().toString() << Qt::endl; + t << "######################################################################" << Qt::endl << Qt::endl; if (!Option::globals->extra_cmds[QMakeEvalBefore].isEmpty()) - t << Option::globals->extra_cmds[QMakeEvalBefore] << endl; + t << Option::globals->extra_cmds[QMakeEvalBefore] << Qt::endl; t << getWritableVar("TEMPLATE_ASSIGN", false); if(project->first("TEMPLATE_ASSIGN") == "subdirs") { - t << endl << "# Directories" << "\n" + t << Qt::endl << "# Directories" << "\n" << getWritableVar("SUBDIRS"); } else { //figure out target @@ -343,7 +339,7 @@ ProjectGenerator::writeMakefile(QTextStream &t) t << getWritableVar("TARGET_ASSIGN") << getWritableVar("CONFIG", false) << getWritableVar("CONFIG_REMOVE", false) - << getWritableVar("INCLUDEPATH") << endl; + << getWritableVar("INCLUDEPATH") << Qt::endl; t << "# You can make your code fail to compile if you use deprecated APIs.\n" "# In order to do so, uncomment the following line.\n" @@ -362,7 +358,7 @@ ProjectGenerator::writeMakefile(QTextStream &t) << getWritableVar("TRANSLATIONS"); } if (!Option::globals->extra_cmds[QMakeEvalAfter].isEmpty()) - t << Option::globals->extra_cmds[QMakeEvalAfter] << endl; + t << Option::globals->extra_cmds[QMakeEvalAfter] << Qt::endl; return true; } diff --git a/qmake/generators/projectgenerator.h b/qmake/generators/projectgenerator.h index 02a331bd4f..374bad98c7 100644 --- a/qmake/generators/projectgenerator.h +++ b/qmake/generators/projectgenerator.h @@ -46,15 +46,10 @@ protected: QString escapeFilePath(const QString &) const override { Q_ASSERT(false); return QString(); } public: - ProjectGenerator(); - ~ProjectGenerator(); bool supportsMetaBuild() override { return false; } bool openOutput(QFile &, const QString &) const override; }; -inline ProjectGenerator::~ProjectGenerator() -{ } - QT_END_NAMESPACE #endif // PROJECTGENERATOR_H diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index d7c9413290..664c81296c 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -28,7 +28,6 @@ #include "unixmake.h" #include "option.h" -#include <qregexp.h> #include <qfile.h> #include <qhash.h> #include <qdir.h> @@ -393,7 +392,7 @@ UnixMakefileGenerator::fixLibFlag(const ProString &lib) bool UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) { - QList<QMakeLocalFileName> libdirs, frameworkdirs; + QVector<QMakeLocalFileName> libdirs, frameworkdirs; int libidx = 0, fwidx = 0; for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS")) libdirs.append(QMakeLocalFileName(dlib.toQString())); @@ -419,9 +418,8 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) libdirs.insert(libidx++, f); } else if(opt.startsWith("-l")) { QString lib = opt.mid(2); - for (QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin(); - dep_it != libdirs.end(); ++dep_it) { - QString libBase = (*dep_it).local() + '/' + for (const QMakeLocalFileName &libdir : qAsConst(libdirs)) { + QString libBase = libdir.local() + '/' + project->first("QMAKE_PREFIX_SHLIB") + lib; if (linkPrl && processPrlFile(libBase, true)) goto found; @@ -604,7 +602,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) dst = escapeFilePath(filePrefixRoot(root, targetdir + src.section('/', -1))); if(!ret.isEmpty()) ret += "\n\t"; - ret += "-$(QINSTALL) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst; + ret += "$(QINSTALL) " + escapeFilePath(Option::fixPathToTargetOS(src, false)) + ' ' + dst; if(!uninst.isEmpty()) uninst.append("\n\t"); uninst.append("-$(DEL_FILE) " + dst); @@ -640,16 +638,16 @@ UnixMakefileGenerator::defaultInstall(const QString &t) QString copy_cmd; if (bundle == SolidBundle) { - copy_cmd += "-$(QINSTALL) " + src_targ + ' ' + plain_targ; + copy_cmd += "$(QINSTALL) " + src_targ + ' ' + plain_targ; } else if (project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) { - copy_cmd += "-$(QINSTALL) " + src_targ + ' ' + dst_targ; + copy_cmd += "$(QINSTALL) " + src_targ + ' ' + dst_targ; } else if (!isAux) { if (bundle == SlicedBundle) { if (!ret.isEmpty()) ret += "\n\t"; ret += mkdir_p_asstring("\"`dirname " + dst_targ + "`\"", false); } - copy_cmd += "-$(QINSTALL_PROGRAM) " + src_targ + ' ' + dst_targ; + copy_cmd += "$(QINSTALL_PROGRAM) " + src_targ + ' ' + dst_targ; } if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && project->values(ProKey(t + ".CONFIG")).indexOf("fix_rpath") != -1) { @@ -702,7 +700,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t) ret += "\n\t"; ret += mkdir_p_asstring("\"`dirname " + dst + "`\"", false) + "\n\t"; ret += "-$(DEL_FILE) " + dst + "\n\t"; // Can't overwrite symlinks to directories - ret += "-$(QINSTALL) " + escapeFilePath(src) + " " + dst; + ret += "$(QINSTALL) " + escapeFilePath(src) + " " + dst; if (!uninst.isEmpty()) uninst.append("\n\t"); uninst.append("-$(DEL_FILE) " + dst); diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index 5b0766855b..79b161f6da 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h @@ -35,18 +35,13 @@ QT_BEGIN_NAMESPACE class UnixMakefileGenerator : public MakefileGenerator { - bool include_deps; + bool include_deps = false; QString libtoolFileName(bool fixify=true); void writeLibtoolFile(); // for libtool void writePrlFile(QTextStream &) override; -public: - UnixMakefileGenerator(); - ~UnixMakefileGenerator(); - protected: virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); } - bool doDepends() const override { return !Option::mkfile::do_stub_makefile && MakefileGenerator::doDepends(); } #ifdef Q_OS_WIN // MinGW x-compiling for QNX QString installRoot() const override; #endif @@ -69,9 +64,6 @@ private: ProStringList libdirToFlags(const ProKey &key); }; -inline UnixMakefileGenerator::~UnixMakefileGenerator() -{ } - QT_END_NAMESPACE #endif // UNIXMAKE_H diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index c326692ded..8b4f2bf58f 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -39,11 +39,6 @@ QT_BEGIN_NAMESPACE -UnixMakefileGenerator::UnixMakefileGenerator() : MakefileGenerator(), include_deps(false) -{ - -} - void UnixMakefileGenerator::writePrlFile(QTextStream &t) { @@ -71,8 +66,6 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) if (project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib" || project->first("TEMPLATE") == "aux") { - if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t)) - return true; writeMakeParts(t); return MakefileGenerator::writeMakefile(t); } else if (project->first("TEMPLATE") == "subdirs") { @@ -86,8 +79,8 @@ void UnixMakefileGenerator::writeDefaultVariables(QTextStream &t) { MakefileGenerator::writeDefaultVariables(t); - t << "TAR = " << var("QMAKE_TAR") << endl; - t << "COMPRESS = " << var("QMAKE_GZIP") << endl; + t << "TAR = " << var("QMAKE_TAR") << Qt::endl; + t << "COMPRESS = " << var("QMAKE_GZIP") << Qt::endl; if (project->isEmpty("QMAKE_DISTNAME")) { ProString distname = project->first("QMAKE_ORIG_TARGET"); @@ -95,13 +88,13 @@ UnixMakefileGenerator::writeDefaultVariables(QTextStream &t) distname += project->first("VERSION"); project->values("QMAKE_DISTNAME") = distname; } - t << "DISTNAME = " << fileVar("QMAKE_DISTNAME") << endl; + t << "DISTNAME = " << fileVar("QMAKE_DISTNAME") << Qt::endl; if (project->isEmpty("QMAKE_DISTDIR")) project->values("QMAKE_DISTDIR") = project->first("QMAKE_DISTNAME"); t << "DISTDIR = " << escapeFilePath(fileFixify( (project->isEmpty("OBJECTS_DIR") ? ProString(".tmp/") : project->first("OBJECTS_DIR")) + project->first("QMAKE_DISTDIR"), - FileFixifyFromOutdir | FileFixifyAbsolute)) << endl; + FileFixifyFromOutdir | FileFixifyAbsolute)) << Qt::endl; } void @@ -109,10 +102,10 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator:: { MakefileGenerator::writeSubTargets(t, targets, flags); - t << "dist: distdir FORCE" << endl; + t << "dist: distdir FORCE" << Qt::endl; t << "\t(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)" " && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)"; - t << endl << endl; + t << Qt::endl << Qt::endl; t << "distdir:"; for (int target = 0; target < targets.size(); ++target) { @@ -121,7 +114,7 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator:: } t << " FORCE\n\t" << mkdir_p_asstring("$(DISTDIR)", false) << "\n\t" - << "$(COPY_FILE) --parents " << fileVar("DISTFILES") << " $(DISTDIR)" << Option::dir_sep << endl << endl; + << "$(COPY_FILE) --parents " << fileVar("DISTFILES") << " $(DISTDIR)" << Option::dir_sep << Qt::endl << Qt::endl; const QString abs_source_path = project->first("QMAKE_ABSOLUTE_SOURCE_PATH").toQString(); for (int target = 0; target < targets.size(); ++target) { @@ -154,7 +147,7 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator:: t << subtarget->target << "-distdir: FORCE"; writeSubTargetCall(t, in_directory, in, out_directory, escapeFilePath(out), out_directory_cdin, makefilein); - t << endl; + t << Qt::endl; } } @@ -196,11 +189,11 @@ UnixMakefileGenerator::writeMakeParts(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"; t << "INCPATH ="; @@ -221,38 +214,38 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS")) t << " " << var("QMAKE_FRAMEWORKPATH_FLAGS"); - t << endl; + t << Qt::endl; writeDefaultVariables(t); if(!project->isActiveConfig("staticlib")) { - t << "LINK = " << var("QMAKE_LINK") << endl; - t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; + t << "LINK = " << var("QMAKE_LINK") << Qt::endl; + t << "LFLAGS = " << var("QMAKE_LFLAGS") << Qt::endl; t << "LIBS = $(SUBLIBS) " << fixLibFlags("LIBS").join(' ') << ' ' << fixLibFlags("LIBS_PRIVATE").join(' ') << ' ' << fixLibFlags("QMAKE_LIBS").join(' ') << ' ' - << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl; + << fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << Qt::endl; } - t << "AR = " << var("QMAKE_AR") << endl; - t << "RANLIB = " << var("QMAKE_RANLIB") << endl; - t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl; - t << "STRIP = " << var("QMAKE_STRIP") << endl; + t << "AR = " << var("QMAKE_AR") << Qt::endl; + t << "RANLIB = " << var("QMAKE_RANLIB") << Qt::endl; + t << "SED = " << var("QMAKE_STREAM_EDITOR") << Qt::endl; + t << "STRIP = " << var("QMAKE_STRIP") << Qt::endl; - t << endl; + t << Qt::endl; t << "####### Output directory\n\n"; // This is used in commands by some .prf files. if (! project->values("OBJECTS_DIR").isEmpty()) - t << "OBJECTS_DIR = " << escapeDir(fileVar("OBJECTS_DIR")) << endl; + t << "OBJECTS_DIR = " << escapeDir(fileVar("OBJECTS_DIR")) << Qt::endl; else t << "OBJECTS_DIR = ./\n"; - t << endl; + t << Qt::endl; /* files */ t << "####### Files\n\n"; // This is used by the dist target. - t << "SOURCES = " << fileVarList("SOURCES") << ' ' << fileVarList("GENERATED_SOURCES") << endl; + t << "SOURCES = " << fileVarList("SOURCES") << ' ' << fileVarList("GENERATED_SOURCES") << Qt::endl; if(do_incremental) { const ProStringList &objs = project->values("OBJECTS"); const ProStringList &incrs = project->values("QMAKE_INCREMENTAL"); @@ -272,53 +265,53 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\\\n\t\t" << (*objit); } if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! - t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << endl; + t << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl; } else if(!incrs_out.count()) { - t << endl; + t << Qt::endl; } else { src_incremental = true; - t << endl; + t << Qt::endl; t << "INCREMENTAL_OBJECTS = " - << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << endl; + << escapeFilePaths(incrs_out).join(QString(" \\\n\t\t")) << Qt::endl; } } else { // Used all over the place in both deps and commands. - t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << endl; + t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << Qt::endl; } if(do_incremental && !src_incremental) do_incremental = false; t << "DIST = " << valList(fileFixify(project->values("DISTFILES").toQStringList())) << " " - << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << endl; - t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << endl; - t << "DESTDIR = " << escapeDir(fileVar("DESTDIR")) << endl; - t << "TARGET = " << fileVar("TARGET") << endl; + << fileVarList("HEADERS") << ' ' << fileVarList("SOURCES") << Qt::endl; + t << "QMAKE_TARGET = " << fileVar("QMAKE_ORIG_TARGET") << Qt::endl; + t << "DESTDIR = " << escapeDir(fileVar("DESTDIR")) << Qt::endl; + t << "TARGET = " << fileVar("TARGET") << Qt::endl; if(project->isActiveConfig("plugin")) { - t << "TARGETD = " << fileVar("TARGET") << endl; + t << "TARGETD = " << fileVar("TARGET") << Qt::endl; } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty()) { - t << "TARGETA = " << fileVar("TARGETA") << endl; + t << "TARGETA = " << fileVar("TARGETA") << Qt::endl; if(!project->isEmpty("QMAKE_BUNDLE")) { - t << "TARGETD = " << fileVar("TARGET_x.y") << endl; - t << "TARGET0 = " << fileVar("TARGET_") << endl; + t << "TARGETD = " << fileVar("TARGET_x.y") << Qt::endl; + t << "TARGET0 = " << fileVar("TARGET_") << Qt::endl; } else if (!project->isActiveConfig("unversioned_libname")) { - t << "TARGET0 = " << fileVar("TARGET_") << endl; + t << "TARGET0 = " << fileVar("TARGET_") << Qt::endl; if (project->isEmpty("QMAKE_HPUX_SHLIB")) { - t << "TARGETD = " << fileVar("TARGET_x.y.z") << endl; - t << "TARGET1 = " << fileVar("TARGET_x") << endl; - t << "TARGET2 = " << fileVar("TARGET_x.y") << endl; + t << "TARGETD = " << fileVar("TARGET_x.y.z") << Qt::endl; + t << "TARGET1 = " << fileVar("TARGET_x") << Qt::endl; + t << "TARGET2 = " << fileVar("TARGET_x.y") << Qt::endl; } else { - t << "TARGETD = " << fileVar("TARGET_x") << endl; + t << "TARGETD = " << fileVar("TARGET_x") << Qt::endl; } } } writeExtraCompilerVariables(t); writeExtraVariables(t); - t << endl; + t << Qt::endl; // blasted includes const ProStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); ProStringList::ConstIterator it; for(it = qeui.begin(); it != qeui.end(); ++it) - t << "include " << escapeDependencyPath(*it) << endl; + t << "include " << escapeDependencyPath(*it) << Qt::endl; /* rules */ t << "first:" << (!project->isActiveConfig("no_default_goal_deps") ? " all" : "") << "\n"; @@ -328,7 +321,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) ProStringList objects = project->values("OBJECTS"); for (ProStringList::Iterator it = objects.begin(); it != objects.end(); ++it) { QString d_file = (*it).toQString().replace(QRegExp(Option::obj_ext + "$"), ".d"); - t << "-include " << escapeDependencyPath(d_file) << endl; + t << "-include " << escapeDependencyPath(d_file) << Qt::endl; project->values("QMAKE_DISTCLEAN") << d_file; } } else { @@ -386,8 +379,8 @@ 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 << ": " << finalizeDependencyPaths(deps).join(' ') << endl; - t << "-include " << d_file_d << endl; + t << d_file_d << ": " << finalizeDependencyPaths(deps).join(' ') << Qt::endl; + t << "-include " << d_file_d << Qt::endl; project->values("QMAKE_DISTCLEAN") += d_file; } } @@ -406,7 +399,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) t << escapeFilePath(libdir + project->first("QMAKE_PREFIX_STATICLIB") + (*it) + '.' + project->first("QMAKE_EXTENSION_STATICLIB")) << ' '; - t << endl << endl; + t << Qt::endl << Qt::endl; } QString target_deps; if ((project->isActiveConfig("depend_prl") || project->isActiveConfig("fast_depend_prl")) @@ -511,7 +504,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } else { t << depVar("TARGET") << ": " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << target_deps << ' ' << depVar("POST_TARGETDEPS") << "\n\t"; @@ -524,7 +517,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if (!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); } - t << endl << endl; + t << Qt::endl << Qt::endl; } allDeps = ' ' + depVar("TARGET"); } else if(!project->isActiveConfig("staticlib")) { @@ -555,7 +548,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) //actual target const QString link_deps = "$(OBJECTS) "; t << incr_target_dir_d << ": " << link_deps << "\n\t" - << "ld -r -o " << incr_target_dir_f << ' ' << link_deps << endl; + << "ld -r -o " << incr_target_dir_f << ' ' << link_deps << Qt::endl; //communicated below ProStringList &cmd = project->values("QMAKE_LINK_SHLIB_CMD"); cmd[0] = cmd.at(0).toQString().replace(QLatin1String("$(OBJECTS) "), QLatin1String("$(INCREMENTAL_OBJECTS)")); //ick @@ -613,7 +606,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-$(MOVE) $(TARGET) " << destdir << "$(TARGET)"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } else if(!project->isEmpty("QMAKE_BUNDLE")) { bundledFiles << destdir_r + var("TARGET"); t << "\n\t" @@ -627,7 +620,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) " Versions/Current/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { t << "\n\t"; @@ -661,7 +654,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } else { t << "\n\t" << "-$(DEL_FILE) $(TARGET) $(TARGET0)\n\t" @@ -675,9 +668,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-$(MOVE) $(TARGET0) " << destdir << "$(TARGET0)\n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); - t << endl << endl; + t << Qt::endl << Qt::endl; } - t << endl << endl; + t << Qt::endl << Qt::endl; if (! project->isActiveConfig("plugin")) { t << "staticlib: " << depVar("TARGETA") << "\n\n"; @@ -695,7 +688,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\n\t" << var("QMAKE_POST_LINK"); if(!project->isEmpty("QMAKE_RANLIB")) t << "\n\t$(RANLIB) $(TARGETA)"; - t << endl << endl; + t << Qt::endl << Qt::endl; } } else { QString destdir_r = project->first("DESTDIR").toQString(); @@ -715,7 +708,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t" << var("QMAKE_POST_LINK") << "\n"; if (!project->isEmpty("QMAKE_RANLIB")) t << "\t$(RANLIB) " << destdir << "$(TARGET)\n"; - t << endl << endl; + t << Qt::endl << Qt::endl; } writeMakeQmake(t); @@ -729,7 +722,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } if(!meta_files.isEmpty()) t << escapeDependencyPaths(meta_files).join(" ") << ": \n\t" - << "@$(QMAKE) -prl " << escapeFilePath(project->projectFile()) << ' ' << buildArgs(true) << endl; + << "@$(QMAKE) -prl " << escapeFilePath(project->projectFile()) << ' ' << buildArgs(true) << Qt::endl; } if (!project->isEmpty("QMAKE_BUNDLE")) { @@ -750,7 +743,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "@echo \"APPL" << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) - << "\" > " << pkginfo_f << endl; + << "\" > " << pkginfo_f << Qt::endl; } if (!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) { ProString resources = project->first("QMAKE_BUNDLE_RESOURCE_FILE"); @@ -859,7 +852,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-e \"s,\\$${EXECUTABLE_NAME}," << (app_bundle_name.isEmpty() ? app_bundle_name : plugin_bundle_name) << ",g\" " << "-e \"s,@TYPEINFO@,"<< typeInfo << ",g\" " << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO},"<< typeInfo << ",g\" " - << "" << info_plist << " >" << info_plist_out << endl; + << "" << info_plist << " >" << info_plist_out << Qt::endl; //copy the icon if (!project->isEmpty("ICON")) { QString dir = bundle_dir + "Contents/Resources/"; @@ -870,7 +863,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << escapeDependencyPath(icon_path) << ": " << escapeDependencyPath(icon) << "\n\t" << mkdir_p_asstring(dir) << "\n\t" << "@$(DEL_FILE) " << icon_path_f << "\n\t" - << "@$(COPY_FILE) " << escapeFilePath(icon) << ' ' << icon_path_f << endl; + << "@$(COPY_FILE) " << escapeFilePath(icon) << ' ' << icon_path_f << Qt::endl; } } else { ProString lib_bundle_name = var("QMAKE_FRAMEWORK_BUNDLE_NAME"); @@ -887,7 +880,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "-e \"s,\\$${EXECUTABLE_NAME}," << lib_bundle_name << ",g\" " << "-e \"s,@TYPEINFO@," << typeInfo << ",g\" " << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO}," << typeInfo << ",g\" " - << "" << info_plist << " >" << info_plist_out << endl; + << "" << info_plist << " >" << info_plist_out << Qt::endl; } break; } // project->isActiveConfig("no_plist") @@ -931,10 +924,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QFileInfo fi(fileInfo(fn)); if(fi.isDir()) t << "@$(DEL_FILE) -r " << dst << "\n\t" - << "@$(COPY_DIR) " << src << " " << dst << endl; + << "@$(COPY_DIR) " << src << " " << dst << Qt::endl; else t << "@$(DEL_FILE) " << dst << "\n\t" - << "@$(COPY_FILE) " << src << " " << dst << endl; + << "@$(COPY_FILE) " << src << " " << dst << Qt::endl; } } } @@ -947,7 +940,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) alldeps << symIt.key(); t << escapeDependencyPath(symIt.key()) << ":\n\t" << mkdir_p_asstring(bundle_dir) << "\n\t" - << "@$(SYMLINK) " << escapeFilePath(symIt.value()) << ' ' << bundle_dir_f << endl; + << "@$(SYMLINK) " << escapeFilePath(symIt.value()) << ' ' << bundle_dir_f << Qt::endl; } if (!project->isActiveConfig("shallow_bundle")) { @@ -959,24 +952,24 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << mkdir_p_asstring(bundle_dir + "Versions") << "\n\t" << "@-$(DEL_FILE) " << currentLink_f << "\n\t" << "@$(SYMLINK) " << project->first("QMAKE_FRAMEWORK_VERSION") - << ' ' << currentLink_f << endl; + << ' ' << currentLink_f << Qt::endl; } } } - t << endl << "all: " << deps + t << Qt::endl << "all: " << deps << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")), " \\\n\t\t", " \\\n\t\t", "") - << allDeps << endl << endl; + << allDeps << Qt::endl << Qt::endl; t << "dist: distdir FORCE\n\t"; t << "(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)" " && $(MOVE) `dirname $(DISTDIR)`" << Option::dir_sep << "$(DISTNAME).tar.gz ." " && $(DEL_FILE) -r $(DISTDIR)"; - t << endl << endl; + t << Qt::endl << Qt::endl; t << "distdir: FORCE\n\t" << mkdir_p_asstring("$(DISTDIR)", false) << "\n\t" - << "$(COPY_FILE) --parents $(DIST) $(DISTDIR)" << Option::dir_sep << endl; + << "$(COPY_FILE) --parents $(DIST) $(DISTDIR)" << Option::dir_sep << Qt::endl; if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { @@ -986,20 +979,20 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(val.isEmpty()) continue; t << "\t$(COPY_FILE) --parents " << escapeFilePaths(val).join(' ') - << " $(DISTDIR)" << Option::dir_sep << endl; + << " $(DISTDIR)" << Option::dir_sep << Qt::endl; } } } if(!project->isEmpty("TRANSLATIONS")) - t << "\t$(COPY_FILE) --parents " << fileVar("TRANSLATIONS") << " $(DISTDIR)" << Option::dir_sep << endl; - t << endl << endl; + t << "\t$(COPY_FILE) --parents " << fileVar("TRANSLATIONS") << " $(DISTDIR)" << Option::dir_sep << Qt::endl; + t << Qt::endl << Qt::endl; QString clean_targets = " compiler_clean " + depVar("CLEAN_DEPS"); if(do_incremental) { t << "incrclean:\n"; if(src_incremental) t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)\n"; - t << endl; + t << Qt::endl; } t << "clean:" << clean_targets << "\n\t"; @@ -1067,7 +1060,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)\n\t"; t << fileVarGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") << "-$(DEL_FILE) *~ core *.core\n" - << fileVarGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; + << fileVarGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << Qt::endl << Qt::endl; ProString destdir = project->first("DESTDIR"); if (!destdir.isEmpty() && !destdir.endsWith(Option::dir_sep)) @@ -1075,7 +1068,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "distclean: clean " << depVar("DISTCLEAN_DEPS") << '\n'; if(!project->isEmpty("QMAKE_BUNDLE")) { QString bundlePath = escapeFilePath(destdir + project->first("QMAKE_BUNDLE")); - t << "\t-$(DEL_FILE) -r " << bundlePath << endl; + t << "\t-$(DEL_FILE) -r " << bundlePath << Qt::endl; } else if (project->isActiveConfig("staticlib") || project->isActiveConfig("plugin")) { t << "\t-$(DEL_FILE) " << escapeFilePath(destdir) << "$(TARGET) \n"; } else if (project->values("QMAKE_APP_FLAG").isEmpty()) { @@ -1094,9 +1087,9 @@ UnixMakefileGenerator::writeMakeParts(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 << endl; + t << Qt::endl << Qt::endl; t << "####### Sub-libraries\n\n"; if (!project->values("SUBLIBS").isEmpty()) { @@ -1107,7 +1100,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) for (it = l.begin(); it != l.end(); ++it) t << escapeDependencyPath(libdir + project->first("QMAKE_PREFIX_STATICLIB") + (*it) + '.' + project->first("QMAKE_EXTENSION_STATICLIB")) << ":\n\t" - << var(ProKey("MAKELIB" + *it)) << endl << endl; + << var(ProKey("MAKELIB" + *it)) << Qt::endl << Qt::endl; } if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) { @@ -1191,7 +1184,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) compilerExecutable = "$(CXX)"; // compile command - t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchArchFlags << endl << endl; + t << "\n\t" << compilerExecutable << cflags << " $(INCPATH) " << pchArchFlags << Qt::endl << Qt::endl; } } } 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..3116238aa0 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 diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 63d89a5388..67b478ae28 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; } } @@ -314,7 +305,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; @@ -346,7 +337,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); @@ -393,9 +384,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; } } @@ -498,7 +489,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 38253e3a8f..b6fe683d2c 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/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 diff --git a/qmake/generators/xmloutput.cpp b/qmake/generators/xmloutput.cpp index 5d96128442..7fc1b081c7 100644 --- a/qmake/generators/xmloutput.cpp +++ b/qmake/generators/xmloutput.cpp @@ -241,7 +241,7 @@ void XmlOutput::newTagOpen(const QString &tag) closeOpen(); if (format == NewLine) - xmlFile << endl << currentIndent; + xmlFile << Qt::endl << currentIndent; xmlFile << '<' << doConversion(tag); currentState = Attribute; tagStack.append(tag); @@ -275,7 +275,7 @@ void XmlOutput::closeTag() case Tag: decreaseIndent(); // <--- Pre-decrease indent if (format == NewLine) - xmlFile << endl << currentIndent; + xmlFile << Qt::endl << currentIndent; xmlFile << "</" << doConversion(tagStack.last()) << '>'; tagStack.pop_back(); break; @@ -347,7 +347,7 @@ void XmlOutput::addAttribute(const QString &attribute, const QString &value) break; } if (format == NewLine) - xmlFile << endl; + xmlFile << Qt::endl; xmlFile << currentIndent << doConversion(attribute) << "=\"" << doConversion(value) << "\""; } diff --git a/qmake/library/ioutils.cpp b/qmake/library/ioutils.cpp index 3e49a99cd5..d2171274d8 100644 --- a/qmake/library/ioutils.cpp +++ b/qmake/library/ioutils.cpp @@ -30,6 +30,7 @@ #include <qdir.h> #include <qfile.h> +#include <qregexp.h> #ifdef Q_OS_WIN # include <windows.h> diff --git a/qmake/library/proitems.cpp b/qmake/library/proitems.cpp index 41bed69f00..9330c2b1bf 100644 --- a/qmake/library/proitems.cpp +++ b/qmake/library/proitems.cpp @@ -238,7 +238,7 @@ ProString &ProString::append(const ProString &other, bool *pending) QChar *ptr; if (pending && !*pending) { ptr = prepareExtend(1 + other.m_length, 0, m_length); - *ptr++ = 32; + *ptr++ = QLatin1Char(' '); } else { ptr = prepareExtend(other.m_length, 0, m_length); } @@ -276,7 +276,7 @@ ProString &ProString::append(const ProStringList &other, bool *pending, bool ski QChar *ptr = prepareExtend(totalLength, 0, m_length); for (int i = startIdx; i < sz; ++i) { if (putSpace) - *ptr++ = 32; + *ptr++ = QLatin1Char(' '); else putSpace = true; const ProString &str = other.at(i); diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h index 936c729ff8..4569d7c3ff 100644 --- a/qmake/library/proitems.h +++ b/qmake/library/proitems.h @@ -68,6 +68,7 @@ class ProString { public: ProString(); ProString(const ProString &other); + ProString &operator=(const ProString &) = default; PROITEM_EXPLICIT ProString(const QString &str); PROITEM_EXPLICIT ProString(const QStringRef &str); PROITEM_EXPLICIT ProString(const char *str); @@ -430,7 +431,7 @@ class ProFunctionDef { public: ProFunctionDef(ProFile *pro, int offset) : m_pro(pro), m_offset(offset) { m_pro->ref(); } ProFunctionDef(const ProFunctionDef &o) : m_pro(o.m_pro), m_offset(o.m_offset) { m_pro->ref(); } - ProFunctionDef(ProFunctionDef &&other) Q_DECL_NOTHROW + ProFunctionDef(ProFunctionDef &&other) noexcept : m_pro(other.m_pro), m_offset(other.m_offset) { other.m_pro = nullptr; } ~ProFunctionDef() { if (m_pro) m_pro->deref(); } ProFunctionDef &operator=(const ProFunctionDef &o) @@ -444,13 +445,13 @@ public: } return *this; } - ProFunctionDef &operator=(ProFunctionDef &&other) Q_DECL_NOTHROW + ProFunctionDef &operator=(ProFunctionDef &&other) noexcept { ProFunctionDef moved(std::move(other)); swap(moved); return *this; } - void swap(ProFunctionDef &other) Q_DECL_NOTHROW + void swap(ProFunctionDef &other) noexcept { qSwap(m_pro, other.m_pro); qSwap(m_offset, other.m_offset); diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index dd7766c8e0..866915bdfd 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -882,8 +882,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( ret += values(map(args.at(0))); break; case E_LIST: { - QString tmp; - tmp.sprintf(".QMAKE_INTERNAL_TMP_variableName_%d", m_listCount++); + QString tmp(QString::asprintf(".QMAKE_INTERNAL_TMP_variableName_%d", m_listCount++)); ret = ProStringList(ProString(tmp)); ProStringList lst; for (const ProString &arg : args) @@ -1458,15 +1457,15 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } case T_EXPORT: { const ProKey &var = map(args.at(0)); - for (ProValueMapStack::Iterator vmi = m_valuemapStack.end(); + for (ProValueMapStack::iterator vmi = m_valuemapStack.end(); --vmi != m_valuemapStack.begin(); ) { ProValueMap::Iterator it = (*vmi).find(var); if (it != (*vmi).end()) { if (it->constBegin() == statics.fakeValue.constBegin()) { // This is stupid, but qmake doesn't propagate deletions - m_valuemapStack.first()[var] = ProStringList(); + m_valuemapStack.front()[var] = ProStringList(); } else { - m_valuemapStack.first()[var] = *it; + m_valuemapStack.front()[var] = *it; } (*vmi).erase(it); while (--vmi != m_valuemapStack.begin()) @@ -1477,7 +1476,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( return ReturnTrue; } case T_DISCARD_FROM: { - if (m_valuemapStack.count() != 1) { + if (m_valuemapStack.size() != 1) { evalError(fL1S("discard_from() cannot be called from functions.")); return ReturnFalse; } @@ -1487,7 +1486,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( int pro = m_vfs->idForFileName(fn, flags | QMakeVfs::VfsAccessedOnly); if (!pro) return ReturnFalse; - ProValueMap &vmap = m_valuemapStack.first(); + ProValueMap &vmap = m_valuemapStack.front(); for (auto vit = vmap.begin(); vit != vmap.end(); ) { if (!vit->isEmpty()) { auto isFrom = [pro](const ProString &s) { @@ -1515,7 +1514,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( else ++fit; } - ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")]; + ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")]; int idx = iif.indexOf(ProString(fn)); if (idx >= 0) iif.removeAt(idx); diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index ade8e15a39..70897214b2 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -601,14 +601,16 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock( case TokBypassNesting: blockLen = getBlockLen(tokPtr); if ((m_cumulative || okey != or_op) && blockLen) { - ProValueMapStack savedValuemapStack = m_valuemapStack; + ProValueMapStack savedValuemapStack = std::move(m_valuemapStack); m_valuemapStack.clear(); - m_valuemapStack.append(savedValuemapStack.takeFirst()); + m_valuemapStack.splice(m_valuemapStack.end(), + savedValuemapStack, savedValuemapStack.begin()); traceMsg("visiting nesting-bypassing block"); ret = visitProBlock(tokPtr); traceMsg("visited nesting-bypassing block"); - savedValuemapStack.prepend(m_valuemapStack.first()); - m_valuemapStack = savedValuemapStack; + savedValuemapStack.splice(savedValuemapStack.begin(), + m_valuemapStack, m_valuemapStack.begin()); + m_valuemapStack = std::move(savedValuemapStack); } else { traceMsg("skipped nesting-bypassing block"); ret = ReturnTrue; @@ -1439,7 +1441,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( for (ProValueMap::ConstIterator it = m_extraVars.constBegin(); it != m_extraVars.constEnd(); ++it) - m_valuemapStack.first().insert(it.key(), it.value()); + m_valuemapStack.front().insert(it.key(), it.value()); // In case default_pre needs to make decisions based on the current // build pass configuration. @@ -1568,8 +1570,8 @@ void QMakeEvaluator::updateFeaturePaths() } for (int i = 0; i < feature_roots.count(); ++i) - if (!feature_roots.at(i).endsWith((ushort)'/')) - feature_roots[i].append((ushort)'/'); + if (!feature_roots.at(i).endsWith(QLatin1Char('/'))) + feature_roots[i].append(QLatin1Char('/')); feature_roots.removeDuplicates(); @@ -1707,9 +1709,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFunction( { VisitReturn vr; - if (m_valuemapStack.count() >= 100) { + if (m_valuemapStack.size() >= 100) { evalError(fL1S("Ran into infinite recursion (depth > 100).")); - vr = ReturnFalse; + vr = ReturnError; } else { m_valuemapStack.push(ProValueMap()); m_locationStack.push(m_current); @@ -1859,7 +1861,7 @@ static bool isFunctParam(const ProKey &variableName) ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap::Iterator *rit) { - ProValueMapStack::Iterator vmi = m_valuemapStack.end(); + ProValueMapStack::iterator vmi = m_valuemapStack.end(); for (bool first = true; ; first = false) { --vmi; ProValueMap::Iterator it = (*vmi).find(variableName); @@ -1886,7 +1888,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName) return *it; } if (!isFunctParam(variableName)) { - ProValueMapStack::Iterator vmi = m_valuemapStack.end(); + ProValueMapStack::iterator vmi = m_valuemapStack.end(); if (--vmi != m_valuemapStack.begin()) { do { --vmi; @@ -1905,7 +1907,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName) ProStringList QMakeEvaluator::values(const ProKey &variableName) const { - ProValueMapStack::ConstIterator vmi = m_valuemapStack.constEnd(); + ProValueMapStack::const_iterator vmi = m_valuemapStack.cend(); for (bool first = true; ; first = false) { --vmi; ProValueMap::ConstIterator it = (*vmi).constFind(variableName); @@ -1914,7 +1916,7 @@ ProStringList QMakeEvaluator::values(const ProKey &variableName) const break; return *it; } - if (vmi == m_valuemapStack.constBegin()) + if (vmi == m_valuemapStack.cbegin()) break; if (first && isFunctParam(variableName)) break; @@ -1942,7 +1944,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFile( m_current = m_locationStack.pop(); pro->deref(); if (ok == ReturnTrue && !(flags & LoadHidden)) { - ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")]; + ProStringList &iif = m_valuemapStack.front()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")]; ProString ifn(fileName); if (!iif.contains(ifn)) iif << ifn; @@ -2071,7 +2073,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateFileInto( return ret; *values = visitor.m_valuemapStack.top(); ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES"); - ProStringList &iif = m_valuemapStack.first()[qiif]; + ProStringList &iif = m_valuemapStack.front()[qiif]; const auto ifns = values->value(qiif); for (const ProString &ifn : ifns) if (!iif.contains(ifn)) diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index f617681cbb..9f702b9182 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -38,7 +38,6 @@ #include "ioutils.h" #include <qlist.h> -#include <qlinkedlist.h> #include <qmap.h> #include <qset.h> #include <qstack.h> @@ -54,6 +53,8 @@ # include <qmutex.h> #endif +#include <list> + QT_BEGIN_NAMESPACE class QMakeGlobals; @@ -94,15 +95,15 @@ public: #endif }; -// We use a QLinkedList based stack instead of a QVector based one (QStack), so that +// We use a list-based stack instead of a vector-based one, so that // the addresses of value maps stay constant. The qmake generators rely on that. -class QMAKE_EXPORT ProValueMapStack : public QLinkedList<ProValueMap> +class QMAKE_EXPORT ProValueMapStack : public std::list<ProValueMap> { public: - inline void push(const ProValueMap &t) { append(t); } - inline ProValueMap pop() { return takeLast(); } - ProValueMap &top() { return last(); } - const ProValueMap &top() const { return last(); } + inline void push(const ProValueMap &t) { push_back(t); } + inline ProValueMap pop() { auto r = std::move(back()); pop_back(); return r; } + ProValueMap &top() { return back(); } + const ProValueMap &top() const { return back(); } }; namespace QMakeInternal { struct QMakeBuiltin; } diff --git a/qmake/library/qmakeevaluator_p.h b/qmake/library/qmakeevaluator_p.h index f888bc5765..da83ff0de2 100644 --- a/qmake/library/qmakeevaluator_p.h +++ b/qmake/library/qmakeevaluator_p.h @@ -31,8 +31,6 @@ #include "proitems.h" -#include <qregexp.h> - #define debugMsg if (!m_debugLevel) {} else debugMsgInternal #define traceMsg if (!m_debugLevel) {} else traceMsgInternal #ifdef PROEVALUATOR_DEBUG diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp index daf4707779..1d76cecc45 100644 --- a/qmake/library/qmakeglobals.cpp +++ b/qmake/library/qmakeglobals.cpp @@ -38,7 +38,6 @@ #include <qfile.h> #include <qfileinfo.h> #include <qlist.h> -#include <qregexp.h> #include <qset.h> #include <qstack.h> #include <qstring.h> diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index 4c8360b459..ffe90ebda7 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -621,7 +621,7 @@ void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar if (c != term) { parseError(fL1S("Missing %1 terminator [found %2]") .arg(QChar(term)) - .arg(c ? QString(c) : QString::fromLatin1("end-of-line"))); + .arg(c ? QString(QChar(c)) : QString::fromLatin1("end-of-line"))); m_inError = true; // Just parse on, as if there was a terminator ... } else { diff --git a/qmake/library/qmakeparser.h b/qmake/library/qmakeparser.h index 7b96d4e88f..c8c5c7718e 100644 --- a/qmake/library/qmakeparser.h +++ b/qmake/library/qmakeparser.h @@ -111,7 +111,6 @@ private: struct BlockScope { BlockScope() : start(nullptr), braceLevel(0), special(false), inBranch(false), nest(NestNone) {} - BlockScope(const BlockScope &other) { *this = other; } ushort *start; // Where this block started; store length here int braceLevel; // Nesting of braces in scope bool special; // Single-line conditionals inside loops, etc. cannot have else branches diff --git a/qmake/option.cpp b/qmake/option.cpp index dcebeadcb8..1e31ecd6b7 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -93,7 +93,6 @@ bool Option::mkfile::do_deps = true; bool Option::mkfile::do_mocs = true; bool Option::mkfile::do_dep_heuristics = true; bool Option::mkfile::do_preprocess = false; -bool Option::mkfile::do_stub_makefile = false; QStringList Option::mkfile::project_files; static Option::QMAKE_MODE default_mode(QString progname) @@ -254,8 +253,6 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state) Option::mkfile::do_deps = false; } else if (arg == "-nomoc") { Option::mkfile::do_mocs = false; - } else if (arg == "-createstub") { - Option::mkfile::do_stub_makefile = true; } else if (arg == "-nodependheuristics") { Option::mkfile::do_dep_heuristics = false; } else if (arg == "-E") { diff --git a/qmake/option.h b/qmake/option.h index 25b2d64aaa..d7f4e87c70 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -189,7 +189,6 @@ struct Option static bool do_mocs; static bool do_dep_heuristics; static bool do_preprocess; - static bool do_stub_makefile; static int cachefile_depth; static QStringList project_files; }; diff --git a/qmake/project.cpp b/qmake/project.cpp index 1bc9b352b5..931a337b71 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -143,15 +143,15 @@ ProString QMakeProject::expand(const QString &expr, const QString &where, int li bool QMakeProject::isEmpty(const ProKey &v) const { - ProValueMap::ConstIterator it = m_valuemapStack.first().constFind(v); - return it == m_valuemapStack.first().constEnd() || it->isEmpty(); + ProValueMap::ConstIterator it = m_valuemapStack.front().constFind(v); + return it == m_valuemapStack.front().constEnd() || it->isEmpty(); } void QMakeProject::dump() const { QStringList out; - for (ProValueMap::ConstIterator it = m_valuemapStack.first().begin(); - it != m_valuemapStack.first().end(); ++it) { + for (ProValueMap::ConstIterator it = m_valuemapStack.front().begin(); + it != m_valuemapStack.front().end(); ++it) { if (!it.key().startsWith('.')) { QString str = it.key() + " ="; for (const ProString &v : it.value()) diff --git a/qmake/project.h b/qmake/project.h index d7a5852bed..071b62424f 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -58,12 +58,12 @@ public: { m_current.clear(); return evaluateConditional(QStringRef(&v), file, line) == ReturnTrue; } bool test(const ProKey &func, const QList<ProStringList> &args); - bool isSet(const ProKey &v) const { return m_valuemapStack.first().contains(v); } + bool isSet(const ProKey &v) const { return m_valuemapStack.front().contains(v); } bool isEmpty(const ProKey &v) const; ProStringList &values(const ProKey &v) { return valuesRef(v); } int intValue(const ProKey &v, int defaultValue = 0) const; - const ProValueMap &variables() const { return m_valuemapStack.first(); } - ProValueMap &variables() { return m_valuemapStack.first(); } + const ProValueMap &variables() const { return m_valuemapStack.front(); } + ProValueMap &variables() { return m_valuemapStack.front(); } bool isActiveConfig(const QString &config, bool regex = false) { return QMakeEvaluator::isActiveConfig(QStringRef(&config), regex); } diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 5399e8c298..4681fbf764 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -96,7 +96,7 @@ HEADERS += \ bp = $$shadowed(..) INCLUDEPATH += \ $$bp/include $$bp/include/QtCore \ - $$bp/include/QtCore/$$QT_VERSION $$bp/include/QtCore/$$QT_VERSION/QtCore + $$bp/include/QtCore/$$QT_VERSION $$bp/include/QtCore/$$QT_VERSION/QtCore \ $$bp/src/corelib/global VPATH += \ @@ -136,7 +136,6 @@ SOURCES += \ qjsonparser.cpp \ qjsonvalue.cpp \ qlibraryinfo.cpp \ - qlinkedlist.cpp \ qlist.cpp \ qlocale.cpp \ qlocale_tools.cpp \ @@ -148,7 +147,6 @@ SOURCES += \ qregexp.cpp \ qsettings.cpp \ qstring.cpp \ - qstring_compat.cpp \ qstringlist.cpp \ qsystemerror.cpp \ qtemporaryfile.cpp \ @@ -182,18 +180,16 @@ HEADERS += \ qglobal.h \ qhash.h \ qiodevice.h \ - qjson.h \ + qjson_p.h \ qjsonarray.h \ qjsondocument.h \ qjsonobject.h \ - qjsonparser.h \ + qjsonparser_p.h \ qjsonvalue.h \ - qjsonwriter.h \ - qlinkedlist.h \ + qjsonwriter_p.h \ qlist.h \ qlocale.h \ qlocale_tools_p.h \ - qmalloc.h \ qmap.h \ qmetatype.h \ qnumeric.h \ @@ -204,12 +200,12 @@ HEADERS += \ qsystemerror_p.h \ qtemporaryfile.h \ qtextstream.h \ - qutfcodec.h \ + qutfcodec_p.h \ quuid.h \ qvector.h \ qversionnumber.h \ qxmlstream.h \ - qxmlutils.h + qxmlutils_p.h unix { SOURCES += \ |