--- qt-everywhere-opensource-src-5.9.7/qtbase/qmake/generators/makefile.cpp	2018-10-29 05:36:11.673392800 -0500
+++ work/qtbase/qmake/generators/makefile.cpp	2018-10-29 05:35:34.612771800 -0500
@@ -893,7 +893,7 @@
     if (meta_file.isEmpty())
         return false;
     QMakeMetaInfo libinfo(project);
-    debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData());
+    debug_msg(1, "Processing PRL file: %s, try_replace_file: %d", meta_file.toLatin1().constData(), try_replace_file);
     if (!libinfo.readLib(meta_file)) {
         fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData());
         return false;
of this hack is located in
+        // work/qtbase/mkspecs/features/qt.prf
+        if (lib.endsWith(".lib"))
+            return escapeFilePath(lib.mid(2));
         return escapeFilePath(lib.mid(2) + QLatin1String(".lib"));
+    }
     if (lib.startsWith("-L"))  // Lib search path. Needed only by -l above.
         return QLatin1String("/LIBPATH:")
                 + escapeFilePath(Option::fixPathToTargetOS(lib.mid(2).toQString(), false));
@@ -101,6 +108,25 @@
             (*it) = "-L" + lp.real();
         } else if (type == LibFlagLib) {
             QString lib = arg.toQString();
+#ifdef QT_LIBINFIX
+            QString libinfix = QLatin1String(QT_LIBINFIX);
+#else
+            QString libinfix = project->propertyValue(ProKey("QT_LIBINFIX")).toQString();
+#endif
+            debug_msg(1, "findLibraries (prl): lib %s", lib.toLatin1().constData());
+            if (libinfix.length()) {
+                if (lib.endsWith(libinfix + QLatin1String(".lib"))) {
+                    lib = lib.mid(0, lib.length() - libinfix.length() - 5);
+                } else if (lib.endsWith(libinfix + QLatin1String("d.lib"))) {
+                    lib = lib.mid(0, lib.length() - libinfix.length() - 6);
+                } else if (lib.endsWith(libinfix + QLatin1String("d"))) {
+                    lib = lib.mid(0, lib.length() - libinfix.length() - 1) + QLatin1String("d");
+                } else if (lib.endsWith(libinfix)) {
+                    lib = lib.mid(0, lib.length() - libinfix.length() - 1);
+                }
+                debug_msg(1, "findLibraries (prl): Replacing lib: %s (filename stub) due to libinfix: %s",
+                          lib.toLatin1().constData(), libinfix.toLatin1().constData());
+            }
             ProString verovr =
                     project->first(ProKey("QMAKE_" + lib.toUpper() + "_VERSION_OVERRIDE"));
             for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin();

--- work/qtbase/qmake/generators/win32/winmakefile.cpp.orig	2018-10-27 17:11:20.236181800 -0500
+++ work/qtbase/qmake/generators/win32/winmakefile.cpp	2018-10-27 17:11:20.251806100 -0500
--- qt-everywhere-opensource-src-5.9.7/qtbase/qmake/generators/win32/winmakefile.cpp	2018-10-29 05:37:03.676652900 -0500
+++ work/qtbase/qmake/generators/win32/winmakefile.cpp	2018-10-29 05:37:03.707917900 -0500
@@ -46,8 +47,14 @@
 
 ProString Win32MakefileGenerator::fixLibFlag(const ProString &lib)
 {
-    if (lib.startsWith("-l"))  // Fallback for unresolved -l libs.
+    if (lib.startsWith("-l")) {  // Fallback for unresolved -l libs.
+        // Complete hack in an attempt to allow -qtlibinfix to work
+        // on Windows. The other side of this hack is located in
+        // work/qtbase/mkspecs/features/qt.prf
+//        if (lib.endsWith(".lib"))
+//            return escapeFilePath(lib.mid(2));
         return escapeFilePath(lib.mid(2) + QLatin1String(".lib"));
+    }
     if (lib.startsWith("-L"))  // Lib search path. Needed only by -l above.
         return QLatin1String("/LIBPATH:")
                 + escapeFilePath(Option::fixPathToTargetOS(lib.mid(2).toQString(), false));
@@ -101,6 +108,25 @@
             (*it) = "-L" + lp.real();
         } else if (type == LibFlagLib) {
             QString lib = arg.toQString();
+#ifdef QT_LIBINFIX
+            QString libinfix = QLatin1String(QT_LIBINFIX);
+#else
+            QString libinfix = project->propertyValue(ProKey("QT_LIBINFIX")).toQString();
+#endif
+            debug_msg(1, "findLibraries (prl): lib %s", lib.toLatin1().constData());
+            if (libinfix.length()) {
+                if (lib.endsWith(libinfix + QLatin1String(".lib"))) {
+                    lib = lib.mid(0, lib.length() - libinfix.length() - 5);
+                } else if (lib.endsWith(libinfix + QLatin1String("d.lib"))) {
+                    lib = lib.mid(0, lib.length() - libinfix.length() - 6);
+                } else if (lib.endsWith(libinfix + QLatin1String("d"))) {
+                    lib = lib.mid(0, lib.length() - libinfix.length() - 1) + QLatin1String("d");
+                } else if (lib.endsWith(libinfix)) {
+                    lib = lib.mid(0, lib.length() - libinfix.length() - 1);
+                }
+                debug_msg(1, "findLibraries (prl): Replacing lib: %s (filename stub) due to libinfix: %s",
+                          lib.toLatin1().constData(), libinfix.toLatin1().constData());
+            }
             ProString verovr =
                     project->first(ProKey("QMAKE_" + lib.toUpper() + "_VERSION_OVERRIDE"));
             for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin();
--- qt-everywhere-opensource-src-5.9.7/qtbase/qmake/generators/makefile.cpp	2018-10-29 05:36:11.673392800 -0500
+++ work/qtbase/qmake/generators/makefile.cpp	2018-10-29 06:11:28.894199700 -0500
@@ -893,7 +893,7 @@
     if (meta_file.isEmpty())
         return false;
     QMakeMetaInfo libinfo(project);
-    debug_msg(1, "Processing PRL file: %s", meta_file.toLatin1().constData());
+    debug_msg(1, "Processing PRL file: %s, try_replace_file: %d", meta_file.toLatin1().constData(), try_replace_file);
     if (!libinfo.readLib(meta_file)) {
         fprintf(stderr, "Error processing meta file %s\n", meta_file.toLatin1().constData());
         return false;
@@ -1084,6 +1084,7 @@
     int slsh = ret.lastIndexOf(Option::dir_sep);
     if(slsh != -1)
         ret.remove(0, slsh);
+    debug_msg(1, "MakefileGenerator::prlFileName :: fixify: %d (ret): %s", fixify, ret.toLatin1().constData());
     if(!ret.endsWith(Option::prl_ext)) {
         int dot = ret.indexOf('.');
         if(dot != -1)
@@ -1097,6 +1098,7 @@
             ret.prepend(project->first("DESTDIR").toQString());
         ret = fileFixify(ret, FileFixifyBackwards);
     }
+    debug_msg(1, "MakefileGenerator::prlFileName :: filename(ret): %s", ret.toLatin1().constData());
     return ret;
 }
 
a());
         return false;
@@ -1084,6 +1084,7 @@
     int slsh = ret.lastIndexOf(Option::dir_sep);
     if(slsh != -1)
         ret.remove(0, slsh);
+    debug_msg(1, "MakefileGenerator::prlFileName :: fixify: %d (ret): %s", fixify, ret.toLatin1().constData());
     if(!ret.endsWith(Option::prl_ext)) {
         int dot = ret.indexOf('.');
         if(dot != -1)
@@ -1097,6 +1098,7 @@
             ret.prepend(project->first("DESTDIR").toQString());
         ret = fileFixify(ret, FileFixifyBackwards);
     }
+    debug_msg(1, "MakefileGenerator::prlFileName :: filename(ret): %s", ret.toLatin1().constData());
     return ret;
 }
 
