From 085d1335d16210467cbd29f44e046a0f5fe8970f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 28 May 2019 13:22:39 +0200 Subject: Warn about invalid SUBDIRS content Invalid SUBDIRS values like SUBDIRS += foo \ bar \ \ baz would produce a Makefile with a sub-- target that will call the make on the same Makefile again recursively, letting make run forever. Ignore values like this and print a warning message. Fixes: QTBUG-76068 Change-Id: I6ca0f8c8238249f1be02d8c311b4c148fd80e707 Reviewed-by: Oliver Wolff --- qmake/generators/makefile.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'qmake/generators/makefile.cpp') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index d53dbf9fa5..bfef31f17e 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2400,8 +2400,15 @@ MakefileGenerator::findSubDirsSubTargets() const st->profile = file; } } else { - if(!file.isEmpty() && !project->isActiveConfig("subdir_first_pro")) - st->profile = file.section(Option::dir_sep, -1) + Option::pro_ext; + if (!file.isEmpty() && !project->isActiveConfig("subdir_first_pro")) { + const QString baseName = file.section(Option::dir_sep, -1); + if (baseName.isEmpty()) { + warn_msg(WarnLogic, "Ignoring invalid SUBDIRS entry %s", + subdirs[subdir].toLatin1().constData()); + continue; + } + st->profile = baseName + Option::pro_ext; + } st->in_directory = file; } while(st->in_directory.endsWith(Option::dir_sep)) -- cgit v1.2.3 From 60136b1a846ca5aedeb588edaa178927abb002ec Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 3 Jun 2019 14:39:07 +0200 Subject: Fix meta file replacements if matches are empty QMake code like rplc.match = QMAKE_PRL_INSTALL_REPLACE += rplc led to the generation of invalid sed calls in the Makefile. It is already actively checked for empty matches, but if *all* matches are empty, the sed call looks like sed foo > bar which is invalid. Task-number: QTBUG-75901 Change-Id: I173ed99826414dcf06253a15a247f7d067ee3977 Reviewed-by: Thiago Macieira --- qmake/generators/makefile.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'qmake/generators/makefile.cpp') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index bfef31f17e..6edaf1f70e 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -3437,19 +3437,23 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt || project->isActiveConfig("no_sed_meta_install")) { ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); } else { - ret += "-$(SED)"; + QString sedargs; const ProStringList &replace_rules = project->values(replace_rule); for (int r = 0; r < replace_rules.size(); ++r) { const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")), replace = project->first(ProKey(replace_rules.at(r) + ".replace")); if (!match.isEmpty() /*&& match != replace*/) { - ret += " -e " + shellQuote("s," + match + "," + replace + ",g"); + sedargs += " -e " + shellQuote("s," + match + "," + replace + ",g"); if (isWindowsShell() && project->first(ProKey(replace_rules.at(r) + ".CONFIG")).contains("path")) - ret += " -e " + shellQuote("s," + windowsifyPath(match.toQString()) + sedargs += " -e " + shellQuote("s," + windowsifyPath(match.toQString()) + "," + windowsifyPath(replace.toQString()) + ",gi"); } } - ret += ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst); + if (sedargs.isEmpty()) { + ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst); + } else { + ret += "-$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst); + } } return ret; } -- cgit v1.2.3 From c64f8ca232cc1f2131282d9eb6279ef9b565be88 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 3 Jun 2019 14:52:49 +0200 Subject: Do not write 'Libs:' into .pc files if TEMPLATE is not 'lib' Especially for header modules we don't want a 'Libs:' entry in their .pc file. Task-number: QTBUG-75901 Change-Id: I39037d3132e39dd360532e1425f794ebec28e0bd Reviewed-by: Thiago Macieira --- qmake/generators/makefile.cpp | 74 ++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 36 deletions(-) (limited to 'qmake/generators/makefile.cpp') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 6edaf1f70e..4a99a60892 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -3359,42 +3359,44 @@ MakefileGenerator::writePkgConfigFile() if (!version.isEmpty()) t << "Version: " << version << endl; - // libs - t << "Libs: "; - QString pkgConfiglibName; - if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) { - if (libDir != QLatin1String("/Library/Frameworks")) - t << "-F${libdir} "; - ProString bundle; - if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME")) - bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"); - else - bundle = project->first("TARGET"); - int suffix = bundle.lastIndexOf(".framework"); - if (suffix != -1) - bundle = bundle.left(suffix); - t << "-framework "; - pkgConfiglibName = bundle.toQString(); - } else { - if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir)) - t << "-L${libdir} "; - pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET"); - if (project->isActiveConfig("shared")) - pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString(); - } - t << shellQuote(pkgConfiglibName) << " \n"; - - if (project->isActiveConfig("staticlib")) { - ProStringList libs; - libs << "LIBS"; // FIXME: this should not be conditional on staticlib - libs << "LIBS_PRIVATE"; - libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib - libs << "QMAKE_LIBS_PRIVATE"; - libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? - t << "Libs.private:"; - for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) - t << ' ' << fixLibFlags((*it).toKey()).join(' '); - t << endl; + if (project->first("TEMPLATE") == "lib") { + // libs + t << "Libs: "; + QString pkgConfiglibName; + if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) { + if (libDir != QLatin1String("/Library/Frameworks")) + t << "-F${libdir} "; + ProString bundle; + if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME")) + bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"); + else + bundle = project->first("TARGET"); + int suffix = bundle.lastIndexOf(".framework"); + if (suffix != -1) + bundle = bundle.left(suffix); + t << "-framework "; + pkgConfiglibName = bundle.toQString(); + } else { + if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir)) + t << "-L${libdir} "; + pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET"); + if (project->isActiveConfig("shared")) + pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString(); + } + t << shellQuote(pkgConfiglibName) << " \n"; + + if (project->isActiveConfig("staticlib")) { + ProStringList libs; + libs << "LIBS"; // FIXME: this should not be conditional on staticlib + libs << "LIBS_PRIVATE"; + libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib + libs << "QMAKE_LIBS_PRIVATE"; + libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? + t << "Libs.private:"; + for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) + t << ' ' << fixLibFlags((*it).toKey()).join(' '); + t << endl; + } } // flags -- cgit v1.2.3 From 4da47d0fba04e5d50bf6b63e73bc0de986560f42 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 3 Jun 2019 14:59:16 +0200 Subject: Make sure .pc, .prl and .la files are created for header_only modules Those modules are TEMPLATE=aux, so they weren't triggering the file creation here. To make this work properly we have to: - check for TEMPLATE aux in the right places - add a dummy target to INSTALLS to actually trigger the creation - initialize PRL_TARGET for aux templates Fixes: QTBUG-75901 Started-by: Thiago Macieira Change-Id: Idce141629dd34287808bfffd159f92ac28c6c8b1 Reviewed-by: Thiago Macieira --- qmake/generators/makefile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qmake/generators/makefile.cpp') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4a99a60892..caaf6e71b6 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1120,7 +1120,8 @@ MakefileGenerator::writePrlFile() && project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty() && project->isActiveConfig("create_prl") && (project->first("TEMPLATE") == "lib" - || project->first("TEMPLATE") == "vclib") + || project->first("TEMPLATE") == "vclib" + || project->first("TEMPLATE") == "aux") && (!project->isActiveConfig("plugin") || project->isActiveConfig("static"))) { //write prl file QString local_prl = prlFileName(); QString prl = fileFixify(local_prl); -- cgit v1.2.3 From 5f30fd64269822d4696ac071e17a39ae62a7b50f Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 5 Jun 2019 10:47:28 +0200 Subject: qmake: Cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix clang warnings that are disabled in the default build. Change-Id: I4e773a24884db94acdc6c295d3f66da07cd8a5bd Reviewed-by: Jörg Bornemann Reviewed-by: Albert Astals Cid --- qmake/generators/makefile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmake/generators/makefile.cpp') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index caaf6e71b6..bc59eaaea2 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -900,7 +900,7 @@ MakefileGenerator::processPrlFile(QString &file, bool baseOnly) bool MakefileGenerator::processPrlFileBase(QString &origFile, const QStringRef &origName, - const QStringRef &fixedBase, int slashOff) + const QStringRef &fixedBase, int /*slashOff*/) { return processPrlFileCore(origFile, origName, fixedBase + Option::prl_ext); } -- cgit v1.2.3