Index: trunk/qmake/cachekeys.h
===================================================================
--- trunk/qmake/cachekeys.h	(revision 356)
+++ trunk/qmake/cachekeys.h	(revision 362)
@@ -48,4 +48,5 @@
 #include <qfile.h>
 #include <qfileinfo.h>
+#include <qdir.h>
 #include <qhash.h>
 
@@ -107,4 +108,7 @@
             return true;
 
+#ifdef Q_OS_OS2
+        return QDir::isRelativePath(file);
+#else
         const QChar c0 = file.at(0);
         const QChar c1 = length >= 2 ? file.at(1) : QChar(0);
@@ -114,4 +118,5 @@
                 || (c0 == QLatin1Char('/') && c1 == QLatin1Char('/'))
                 || (c0 == QLatin1Char('\\') && c1 == QLatin1Char('\\')));
+#endif    
     }
 };
Index: trunk/qmake/generators/makefile.cpp
===================================================================
--- trunk/qmake/generators/makefile.cpp	(revision 356)
+++ trunk/qmake/generators/makefile.cpp	(revision 362)
@@ -125,5 +125,5 @@
     }
     bool ret = true;
-#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
+#if defined(Q_OS_WIN)
     bool driveExists = true;
     if(!QDir::isRelativePath(path)) {
@@ -138,4 +138,11 @@
     }
     if(driveExists)
+#elif defined(Q_OS_OS2)
+    path = QFileInfo(path).absoluteFilePath();
+    QString drv = path.left(3);
+    if (!QFile::exists(drv))
+        warn_msg(WarnLogic, "Cannot access drive '%s' (%s)",
+                 drv.toLocal8Bit().data(), path.toLocal8Bit().data());
+    else
 #endif
     {
@@ -341,12 +348,8 @@
                         vpath += Option::output_dir;
                 }
-                for(QStringList::Iterator vpath_it = vpath.begin();
-                    vpath_it != vpath.end(); ++vpath_it) {
-                    QString real_dir = Option::fixPathToLocalOS((*vpath_it));
-                    if(exists(real_dir + QDir::separator() + val)) {
-                        QString dir = (*vpath_it);
-                        if(dir.right(Option::dir_sep.length()) != Option::dir_sep)
-                            dir += Option::dir_sep;
-                        val = dir + val;
+                foreach(const QString &vp, vpath) {
+                    QString real_val = QDir(vp).absoluteFilePath(val);
+                    if (exists(real_val)) {
+                        val = real_val;
                         if(!(flags & VPATH_NoFixify))
                             val = fileFixify(val);
@@ -850,5 +853,5 @@
                     file = libinfo.first("QMAKE_PRL_TARGET");
                     if(QDir::isRelativePath(file))
-                        file.prepend(dir);
+                        file = QDir(dir).absoluteFilePath(file);
                 }
             }
@@ -2782,5 +2785,5 @@
     if(fix == FileFixifyAbsolute || (fix == FileFixifyDefault && project->isActiveConfig("no_fixpath"))) {
         if(fix == FileFixifyAbsolute && QDir::isRelativePath(ret)) //already absolute
-            ret.prepend(pwd);
+            ret = QDir(pwd).absoluteFilePath(ret);
         ret = Option::fixPathToTargetOS(ret, false, canon);
     } else { //fix it..
@@ -2800,5 +2803,5 @@
         if(out_dir != in_dir || !qfileinfo.isRelative()) {
             if(qfileinfo.isRelative()) {
-                ret = in_dir + "/" + qfile;
+                ret = QDir(in_dir).absoluteFilePath(qfile);
                 qfileinfo.setFile(ret);
             }
@@ -3022,5 +3025,5 @@
         if(!file.fileName().isEmpty()) {
             if(QDir::isRelativePath(file.fileName()))
-                file.setFileName(Option::output_dir + "/" + file.fileName()); //pwd when qmake was run
+                file.setFileName(QDir(Option::output_dir).absoluteFilePath(file.fileName())); //pwd when qmake was run
             QFileInfo fi(fileInfo(file.fileName()));
             if(fi.isDir())
@@ -3035,9 +3038,5 @@
     }
     if(QDir::isRelativePath(file.fileName())) {
-        QString fname = Option::output_dir;  //pwd when qmake was run
-        if(!fname.endsWith("/"))
-            fname += "/";
-        fname += file.fileName();
-        file.setFileName(fname);
+        file.setFileName(QDir(Option::output_dir).absoluteFilePath(file.fileName())); //pwd when qmake was run
     }
     if(!build.isEmpty())
@@ -3057,5 +3056,5 @@
         od = Option::fixPathToTargetOS(od);
         if(QDir::isRelativePath(od))
-            od.prepend(Option::output_dir);
+            od = QDir(Option::output_dir).absoluteFilePath(od);
         Option::output_dir = od;
         return true;
Index: trunk/qmake/generators/makefiledeps.cpp
===================================================================
--- trunk/qmake/generators/makefiledeps.cpp	(revision 356)
+++ trunk/qmake/generators/makefiledeps.cpp	(revision 362)
@@ -625,9 +625,5 @@
                     if(try_local) {
                         QString dir = findFileInfo(file->file).path();
-                        if(QDir::isRelativePath(dir))
-                            dir.prepend(qmake_getpwd() + "/");
-                        if(!dir.endsWith("/"))
-                            dir += "/";
-                        QMakeLocalFileName f(dir + lfn.local());
+                        QMakeLocalFileName f(QDir(dir).absoluteFilePath(lfn.local()));
                         if(findFileInfo(f).exists()) {
                             lfn = fixPathForFile(f);
@@ -636,6 +632,6 @@
                     }
                     if(!exists) { //path lookup
-                        for(QList<QMakeLocalFileName>::Iterator it = depdirs.begin(); it != depdirs.end(); ++it) {
-                            QMakeLocalFileName f((*it).real() + Option::dir_sep + lfn.real());
+                        foreach(const QMakeLocalFileName &dd, depdirs) {
+                            QMakeLocalFileName f(QDir(dd.real()).absoluteFilePath(lfn.real()));
                             QFileInfo fi(findFileInfo(f));
                             if(fi.exists() && !fi.isDir()) {
Index: trunk/qmake/generators/metamakefile.cpp
===================================================================
--- trunk/qmake/generators/metamakefile.cpp	(revision 356)
+++ trunk/qmake/generators/metamakefile.cpp	(revision 362)
@@ -325,5 +325,5 @@
             sub->input_dir = subdir.absolutePath();
             if(subdir.isRelative() && old_output_dir != oldpwd) {
-                sub->output_dir = old_output_dir + "/" + subdir.path();
+                sub->output_dir = QDir(old_output_dir).absoluteFilePath(subdir.path());
                 printf("Reading %s [%s]\n", subdir.absoluteFilePath().toLatin1().constData(), sub->output_dir.toLatin1().constData());
             } else { //what about shadow builds?
Index: trunk/qmake/generators/win32/winmakefile.cpp
===================================================================
--- trunk/qmake/generators/win32/winmakefile.cpp	(revision 356)
+++ trunk/qmake/generators/win32/winmakefile.cpp	(revision 362)
@@ -246,5 +246,5 @@
                         tmp = opt;
                     for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) {
-                        QString prl = (*it).local() + Option::dir_sep + tmp;
+                        QString prl = QDir((*it).local()).absoluteFilePath(tmp);
                         // the original is used as the key
                         QString orgprl = prl;
Index: trunk/qmake/main.cpp
===================================================================
--- trunk/qmake/main.cpp	(revision 356)
+++ trunk/qmake/main.cpp	(revision 362)
@@ -127,5 +127,5 @@
             Option::output_dir = dir;
         if(QDir::isRelativePath(Option::output_dir))
-            Option::output_dir.prepend(oldpwd);
+            Option::output_dir = QDir(oldpwd).absoluteFilePath(Option::output_dir);
         Option::output_dir = QDir::cleanPath(Option::output_dir);
     }
Index: trunk/qmake/meta.cpp
===================================================================
--- trunk/qmake/meta.cpp	(revision 356)
+++ trunk/qmake/meta.cpp	(revision 362)
@@ -163,5 +163,5 @@
                         QString targ = dirs[i] + (*lst_it);
                         if(QDir::isRelativePath(targ))
-                            targ.prepend(qmake_getpwd() + QDir::separator());
+                            targ = QDir(qmake_getpwd()).absoluteFilePath(targ);
                         vars["QMAKE_PRL_TARGET"] << targ;
                         found = true;
Index: trunk/qmake/project.cpp
===================================================================
--- trunk/qmake/project.cpp	(revision 356)
+++ trunk/qmake/project.cpp	(revision 362)
@@ -1457,20 +1457,23 @@
                 if (QFile::exists(qmakespec+"/qmake.conf")) {
                     Option::mkfile::qmakespec = QFileInfo(Option::mkfile::qmakespec).absoluteFilePath();
-                } else if (QFile::exists(Option::output_dir+"/"+qmakespec+"/qmake.conf")) {
-                    qmakespec = Option::mkfile::qmakespec = QFileInfo(Option::output_dir+"/"+qmakespec).absoluteFilePath();
                 } else {
-                    bool found_mkspec = false;
-                    for(QStringList::ConstIterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) {
-                        QString mkspec = (*it) + QDir::separator() + qmakespec;
-                        if(QFile::exists(mkspec)) {
-                            found_mkspec = true;
-                            Option::mkfile::qmakespec = qmakespec = mkspec;
-                            break;
+                    QString tmp = QDir(Option::output_dir).absoluteFilePath(qmakespec);
+                    if (QFile::exists(tmp+"/qmake.conf"))
+                        qmakespec = Option::mkfile::qmakespec = tmp;
+                    else {
+                        bool found_mkspec = false;
+                        foreach(const QString &root, mkspec_roots) {
+                            QString mkspec = QDir(root).absoluteFilePath(qmakespec);
+                            if(QFile::exists(mkspec)) {
+                                found_mkspec = true;
+                                Option::mkfile::qmakespec = qmakespec = mkspec;
+                                break;
+                            }
                         }
-                    }
-                    if(!found_mkspec) {
-                        fprintf(stderr, "Could not find mkspecs for your QMAKESPEC(%s) after trying:\n\t%s\n",
-                                qmakespec.toLatin1().constData(), mkspec_roots.join("\n\t").toLatin1().constData());
-                        return false;
+                        if(!found_mkspec) {
+                            fprintf(stderr, "Could not find mkspecs for your QMAKESPEC(%s) after trying:\n\t%s\n",
+                                    qmakespec.toLatin1().constData(), mkspec_roots.join("\n\t").toLatin1().constData());
+                            return false;
+                        }
                     }
                 }
@@ -1775,9 +1778,6 @@
             include_roots << qmake_getpwd();
         include_roots << Option::output_dir;
-        for(int root = 0; root < include_roots.size(); ++root) {
-            QString testName = QDir::toNativeSeparators(include_roots[root]);
-            if (!testName.endsWith(QString(QDir::separator())))
-                testName += QDir::separator();
-            testName += file;
+        foreach(const QString &root, include_roots) {
+            QString testName = QDir(root).absoluteFilePath(file);
             if(QFile::exists(testName)) {
                 file = testName;
