Index: /trunk/qmake/generators/makefile.cpp
===================================================================
--- /trunk/qmake/generators/makefile.cpp	(revision 28)
+++ /trunk/qmake/generators/makefile.cpp	(revision 29)
@@ -100,5 +100,5 @@
         ret += dir;
     ret += " ";
-    if(isWindowsShell())
+    if(isDosLikeShell())
         ret += "$(MKDIR)";
     else
@@ -125,5 +125,5 @@
     }
     bool ret = true;
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
     bool driveExists = true;
     if(!QDir::isRelativePath(path)) {
@@ -1191,5 +1191,5 @@
 {
     QString rm_dir_contents("-$(DEL_FILE)");
-    if (!isWindowsShell()) //ick
+    if (!isDosLikeShell()) //ick
         rm_dir_contents = "-$(DEL_FILE) -r";
 
@@ -1342,5 +1342,5 @@
             for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) {
                 QString tmp_dst = fileFixify((*pit), FileFixifyAbsolute, false);
-                if (!isWindowsShell() && tmp_dst.right(1) != Option::dir_sep)
+                if (!isDosLikeShell() && tmp_dst.right(1) != Option::dir_sep)
                     tmp_dst += Option::dir_sep;
                 t << mkdir_p_asstring(filePrefixRoot(root, tmp_dst)) << "\n\t";
Index: /trunk/qmake/generators/makefile.h
===================================================================
--- /trunk/qmake/generators/makefile.h	(revision 28)
+++ /trunk/qmake/generators/makefile.h	(revision 29)
@@ -245,5 +245,6 @@
     virtual bool mergeBuildProject(MakefileGenerator * /*other*/) { return false; }
     virtual bool openOutput(QFile &, const QString &build) const;
-    virtual bool isWindowsShell() const { return Option::target_mode == Option::TARG_WIN_MODE; }
+    virtual bool isDosLikeShell() const { return Option::target_mode == Option::TARG_WIN_MODE ||
+                                                 Option::target_mode == Option::TARG_OS2_MODE; }
 };
 
Index: /trunk/qmake/generators/metamakefile.cpp
===================================================================
--- /trunk/qmake/generators/metamakefile.cpp	(revision 28)
+++ /trunk/qmake/generators/metamakefile.cpp	(revision 29)
@@ -421,4 +421,5 @@
 #include "unixmake.h"
 #include "mingw_make.h"
+#include "gnumake.h"
 #include "projectgenerator.h"
 #include "pbuilder_pbx.h"
@@ -447,4 +448,6 @@
     } else if(gen == "MINGW") {
         mkfile = new MingwMakefileGenerator;
+    } else if(gen == "GNUMAKE") {
+        mkfile = new GNUMakefileGenerator;
     } else if(gen == "PROJECTBUILDER" || gen == "XCODE") {
         mkfile = new ProjectBuilderMakefileGenerator;
Index: /trunk/qmake/generators/os2/gnumake.cpp
===================================================================
--- /trunk/qmake/generators/os2/gnumake.cpp	(revision 28)
+++ /trunk/qmake/generators/os2/gnumake.cpp	(revision 29)
@@ -60,10 +60,10 @@
 }
 
-bool GNUMakefileGenerator::isWindowsShell() const
-{
-#ifdef Q_OS_WIN
+bool GNUMakefileGenerator::isDosLikeShell() const
+{
+#ifdef Q_OS_OS2
     return Option::shellPath.isEmpty();
 #else
-    return Win32MakefileGenerator::isWindowsShell();
+    return Win32MakefileGenerator::isDosLikeShell();
 #endif
 }
@@ -162,4 +162,5 @@
  }
 
+/* @todo remove
 void createLdObjectScriptFile(const QString &fileName, const QStringList &objList)
 {
@@ -199,4 +200,5 @@
     }
 }
+*/
 
 void GNUMakefileGenerator::writeGNUParts(QTextStream &t)
@@ -368,5 +370,7 @@
 	    ar_script_file += "." + var("BUILD_NAME");
 	}
+/* @todo remove
 	createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
+*/
         objectsLinkLine = "ar -M < " + ar_script_file;
     } else {
@@ -375,5 +379,7 @@
 	    ld_script_file += "." + var("BUILD_NAME");
 	}
+/* @todo remove
 	createLdObjectScriptFile(ld_script_file, project->values("OBJECTS"));
+*/
         objectsLinkLine = ld_script_file;
     }
Index: /trunk/qmake/generators/os2/gnumake.h
===================================================================
--- /trunk/qmake/generators/os2/gnumake.h	(revision 28)
+++ /trunk/qmake/generators/os2/gnumake.h	(revision 29)
@@ -58,5 +58,5 @@
     QString getLibTarget();
 private:
-    bool isWindowsShell() const;
+    bool isDosLikeShell() const;
     void writeGNUParts(QTextStream &);
     void writeIncPart(QTextStream &t);
Index: /trunk/qmake/generators/win32/mingw_make.cpp
===================================================================
--- /trunk/qmake/generators/win32/mingw_make.cpp	(revision 28)
+++ /trunk/qmake/generators/win32/mingw_make.cpp	(revision 29)
@@ -58,10 +58,10 @@
 }
 
-bool MingwMakefileGenerator::isWindowsShell() const
+bool MingwMakefileGenerator::isDosLikeShell() const
 {
 #ifdef Q_OS_WIN
     return Option::shellPath.isEmpty();
 #else
-    return Win32MakefileGenerator::isWindowsShell();
+    return Win32MakefileGenerator::isDosLikeShell();
 #endif
 }
Index: /trunk/qmake/generators/win32/mingw_make.h
===================================================================
--- /trunk/qmake/generators/win32/mingw_make.h	(revision 28)
+++ /trunk/qmake/generators/win32/mingw_make.h	(revision 29)
@@ -56,5 +56,5 @@
     QString getLibTarget();
 private:
-    bool isWindowsShell() const;
+    bool isDosLikeShell() const;
     void writeMingwParts(QTextStream &);
     void writeIncPart(QTextStream &t);
Index: /trunk/qmake/main.cpp
===================================================================
--- /trunk/qmake/main.cpp	(revision 28)
+++ /trunk/qmake/main.cpp	(revision 29)
@@ -97,5 +97,5 @@
     QString reporterPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator()
                            + "qtusagereporter";
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
     reporterPath += ".exe";
 #endif
@@ -105,5 +105,5 @@
 
     QString oldpwd = qmake_getpwd();
-#ifdef Q_WS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
     if(!(oldpwd.length() == 3 && oldpwd[0].isLetter() && oldpwd.endsWith(":/")))
 #endif
Index: /trunk/qmake/option.cpp
===================================================================
--- /trunk/qmake/option.cpp	(revision 28)
+++ /trunk/qmake/option.cpp	(revision 29)
@@ -343,5 +343,5 @@
 }
 
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN)
 static QStringList detectShellPath()
 {
@@ -356,4 +356,12 @@
     }
     return paths;
+}
+#elif defined(Q_OS_OS2)
+static QStringList detectShellPath()
+{
+    /* @todo check if sh is actually the active shell of the process; relying on
+     * the presence of sh.exe in PATH as done for Windows above is obviously not
+     * enough */
+    return QStringList();
 }
 #endif
@@ -375,5 +383,5 @@
     Option::h_ext << ".h" << ".hpp" << ".hh" << ".hxx";
     Option::c_ext << ".c";
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(Q_OS_OS2)
     Option::h_ext << ".H";
 #endif
@@ -381,5 +389,5 @@
     Option::h_moc_ext = ".cpp";
     Option::cpp_ext << ".cpp" << ".cc" << ".cxx";
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN) && !defined(Q_OS_OS2)
     Option::cpp_ext << ".C";
 #endif
@@ -387,5 +395,5 @@
     Option::yacc_ext = ".y";
     Option::pro_ext = ".pro";
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
     Option::dirlist_sep = ";";
     Option::shellPath = detectShellPath();
@@ -404,5 +412,5 @@
             Option::qmake_abslocation = argv0;
         } else if (argv0.contains(QLatin1Char('/'))
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
 		   || argv0.contains(QLatin1Char('\\'))
 #endif
@@ -412,5 +420,5 @@
             QByteArray pEnv = qgetenv("PATH");
             QDir currentDir = QDir::current();
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
             QStringList paths = QString::fromLocal8Bit(pEnv).split(QLatin1String(";"));
 #else
@@ -421,5 +429,5 @@
                     continue;
                 QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0);
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
                 candidate += ".exe";
 #endif
@@ -625,5 +633,5 @@
     Q_ASSERT(!((flags & Option::FixPathToLocalSeparators) && (flags & Option::FixPathToTargetSeparators)));
     if(flags & Option::FixPathToLocalSeparators) {
-#if defined(Q_OS_WIN32)
+#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
         string = string.replace('/', '\\');
 #else
@@ -719,8 +727,14 @@
 #endif
 
+#ifdef Q_OS_OS2
+# include <qt_os2.h>
+
+QT_USE_NAMESPACE
+#endif
+
 QString qmake_libraryInfoFile()
 {
     QString ret;
-#if defined( Q_OS_WIN )
+#if defined(Q_OS_WIN)
     QFileInfo filePath;
     QT_WA({
@@ -733,4 +747,14 @@
         filePath = QString::fromLocal8Bit(module_name);
     });
+    ret = filePath.filePath();
+#elif defined(Q_OS_OS2)
+    QFileInfo filePath;
+    static char appFileName[CCHMAXPATH] = "\0";
+    if (!appFileName[0]) {
+        PPIB ppib;
+        DosGetInfoBlocks(NULL, &ppib);
+        DosQueryModuleName(ppib->pib_hmte, sizeof(appFileName), appFileName);
+    }
+    filePath = QString::fromLocal8Bit(appFileName);
     ret = filePath.filePath();
 #else
Index: /trunk/qmake/project.cpp
===================================================================
--- /trunk/qmake/project.cpp	(revision 28)
+++ /trunk/qmake/project.cpp	(revision 29)
@@ -59,4 +59,6 @@
 #elif defined(Q_OS_WIN32)
 #include <Windows.h>
+#elif defined(Q_OS_OS2)
+#include <qt_os2.h>
 #endif
 #include <stdio.h>
@@ -3176,4 +3178,35 @@
             }
         }
+#elif defined(Q_OS_OS2)
+        if(type == "os") {
+            ret = "OS2";
+        } else if(type == "name") {
+            ret = QString::fromLocal8Bit(qgetenv("HOSTNAME"));
+        } else if(type == "version" || type == "version_string") {
+            ULONG buf [3];
+            DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_REVISION,
+                            &buf, sizeof(buf));
+            if(type == "version")
+                ret = QString().sprintf("%u.%u.%u", buf[0], buf[1], buf[2]);
+            else {
+                /* Warp 3 is reported as 20.30 */
+                /* Warp 4 is reported as 20.40 */
+                /* Aurora and eCS are reported as 20.45 */
+                if (buf[0] == 20 && buf[1] == 30)
+                    ret = "Warp3";
+                else if (buf[0] == 20 && buf[1] == 40)
+                    ret = "Warp4";
+                else if (buf[0] == 20 && buf[1] == 45) {
+                    if (QString::fromLocal8Bit(qgetenv("OS")) == "ecs")
+                        ret = "eComStation";
+                    else
+                        ret = "Aurora";
+                }
+                else
+                    ret = "Unknown";
+            }
+        } else if(type == "arch") {
+            ret = "x86";
+        }
 #elif defined(Q_OS_UNIX)
         struct utsname name;
