Index: trunk/qmake/generators/os2/gnumake.cpp
===================================================================
--- trunk/qmake/generators/os2/gnumake.cpp	(revision 28)
+++ trunk/qmake/generators/os2/gnumake.cpp	(revision 66)
@@ -99,22 +99,24 @@
 
     t << "INCPATH	=	";
-    QStringList &incs = project->variables()["INCLUDEPATH"];
-    for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
-	QString inc = (*incit);
-//@@TODO (dmik): old, remove
-//	inc.replace(QRegExp("\\\\$"), "\\\\");
-	inc.replace(QRegExp("\\\\$"), "");
-	inc.replace(QRegExp("\""), "");
-	t << " " << var ("QMAKE_CFLAGS_INCDIR") << "\"" << inc << "\"";
-    }
-    t << " " << var ("QMAKE_CFLAGS_INCDIR") << "\"$(QMAKESPECDIR)\"" << endl;
+    {
+        QStringList &incs = project->variables()["INCLUDEPATH"];
+        QString incsSemicolon;
+        for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
+            QString inc = (*incit);
+            inc.replace(QRegExp("\\\\$"), "");
+            inc.replace(QRegExp("\""), "");
+            if ( inc.contains( QRegExp("[ +&;$%()]") ) )
+                inc = "\"" + inc + "\"";
+            t << " " << var ("QMAKE_CFLAGS_INCDIR") << inc;
+            incsSemicolon += inc + ";";
+        }
+        t << " " << var ("QMAKE_CFLAGS_INCDIR") << "\"$(QMAKESPECDIR)\"" << endl;
+        incsSemicolon += "\"$(QMAKESPECDIR)\"";
+        t << "INCLUDEPATH = " << incsSemicolon << endl;
+    }
     if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
 	t << "LINK	=	" << var("QMAKE_LINK") << endl;
 	t << "LFLAGS	=	" << var("QMAKE_LFLAGS") << endl;
 	t << "LIBS	=	";
-//@@TODO (dmik): old, remove
-//	if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
-//	    t << varGlue("QMAKE_LIBDIR","-L\"","\" -L\"","\"") << " ";
-//	t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl;
         QString flag = var ("QMAKE_LFLAGS_LIBDIR") + "\""; 
 	if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
@@ -134,6 +136,8 @@
     t << "IDC		=	" << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
 			      Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl;
-    t << "IDL		=	" << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
+    t << "IDL		=	" << (project->isEmpty("QMAKE_IDL") ? QString("") :
 			      Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl;
+    t << "RC		=	" << (project->isEmpty("QMAKE_RC") ? QString("rc") :
+			      Option::fixPathToTargetOS(var("QMAKE_RC"), FALSE)) << endl;
     t << "ZIP		=	" << var("QMAKE_ZIP") << endl;
     t << "COPY_FILE	=       " << var("QMAKE_COPY") << endl;
@@ -205,4 +209,11 @@
         t << "DEF_FILE	=	" << var( "DEF_FILE" ) << endl;
     }
+
+    if ( !project->isEmpty( "RC_FILE" ) ) {
+        t << "RC_FILE	=	" << var("RC_FILE") << endl;
+    }
+    if ( !project->isEmpty( "RES_FILE" ) ) {
+        t << "RES_FILE	=	" << var("RES_FILE") << endl;
+    }
     
     if ( project->isActiveConfig("dll") && !project->isEmpty( "QMAKE_RUN_IMPLIB" ) ) {
@@ -236,4 +247,6 @@
         else
             t << "\n\t" << var( "QMAKE_RUN_LINK" );
+        if ( !project->isEmpty( "RES_FILE" ) && !project->isEmpty( "QMAKE_RUN_RC_EXE" ) )
+            t << "\n\t" << var("QMAKE_RUN_RC_EXE");
         if ( project->isActiveConfig("dll") && !project->isEmpty( "QMAKE_RUN_IMPLIB" ) )
             t << "\n\t" << var( "QMAKE_RUN_IMPLIB" );
@@ -252,22 +265,4 @@
 	}
     }
-    QString targetfilename = project->variables()["TARGET"].first();
-    if(project->isActiveConfig("activeqt")) {
-	QString version = project->variables()["VERSION"].first();
-	if ( version.isEmpty() )
-	    version = "1.0";
-
-	if ( project->isActiveConfig("dll")) {
-	    t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version);
-	    t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
-	    t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
-	    t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
-	} else {
-	    t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version);
-	    t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
-	    t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
-	    t << "\n\t" << "-$(TARGET) -regserver";
-	}
-    }
     t << endl << endl;
 
@@ -278,9 +273,8 @@
     }
     
-    if(!project->variables()["RC_FILE"].isEmpty()) {
-	t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
-	  << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),Option::obj_ext) << " --include-dir=" << QFileInfo(var("RC_FILE")).dirPath() << endl << endl;
-    }
-	project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),Option::obj_ext);
+    if ( !project->isEmpty( "RC_FILE" ) && !project->isEmpty( "QMAKE_RUN_RC_RES" ) ) {
+        t << "$(RES_FILE): $(RC_FILE)\n\t";
+        t << var("QMAKE_RUN_RC_RES") << endl << endl;
+    }
 
     t << "mocables: $(SRCMOC)" << endl << endl;
@@ -303,5 +297,5 @@
         dist_files << fileFixify(*it);
     }
-//@@TODO (dmik): guess we don't need to zip this    
+/// @todo (dmik) guess we don't need to zip this    
 //    if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES"))
 //	dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"];
@@ -329,8 +323,4 @@
       << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","")
       << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","");
-    if ( project->isActiveConfig("activeqt")) {
-	t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl");
-	t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb");
-    }
     if(!project->isEmpty("IMAGES"))
 	t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", "");
@@ -552,6 +542,4 @@
                     project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
             } else {
-//@@TODO (dmik): old, remove            
-//	    if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
                 if(project->isActiveConfig("thread"))
                     project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD_DLL"];
@@ -563,22 +551,8 @@
 		if(hver != -1) {
 		    QString ver;
-//@@TODO (dmik): old, remove 
-//		    ver.sprintf("libqt%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver);
 		    ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver);
 		    QStringList &libs = project->variables()["QMAKE_LIBS"];
-//@@TODO (dmik): remove the comment below                    
-// @@@HGTODO maybe we must change the replace regexp if we understand what's going on
 		    for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
-//@@TODO (dmik): old, remove            
-//			(*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver);
-//			(*libit).replace(QRegExp("-lqt(-mt)?"), ver);
 			(*libit).replace(QRegExp("qt(-mt)?(\\.lib)?"), ver);
-		}
-	    }
-	    if ( project->isActiveConfig( "activeqt" ) ) {
-		project->variables().remove("QMAKE_LIBS_QT_ENTRY");
-		project->variables()["QMAKE_LIBS_QT_ENTRY"] = "-lqaxserver";
-		if ( project->isActiveConfig( "dll" ) ) {
-		   project->variables()["QMAKE_LIBS"]  += project->variables()["QMAKE_LIBS_QT_ENTRY"];
 		}
 	    }
@@ -618,10 +592,4 @@
 	    project->variables()["TARGET_EXT"].append(".exe");
 	} else {
-//@@TODO (dmik): old, guess to remove
-//	    project->variables()["TARGET_EXT"].append(".a");
-//	    project->variables()["QMAKE_LFLAGS"].append("-static");
-//	    if(project->variables()["TARGET"].first().left(3) != "lib")
-//		project->variables()["TARGET"].first().prepend("lib");
-//	}
 	    project->variables()["TARGET_EXT"].append(".lib");
 	}
@@ -676,6 +644,6 @@
 
     project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
-	"HEADERS SOURCES DEF_FILE DEF_FILE_TEMPLATE DEF_FILE_MAP RC_FILE TARGET "
-        "QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
+	"HEADERS SOURCES DEF_FILE DEF_FILE_TEMPLATE DEF_FILE_MAP RC_FILE "
+        "RES_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
     QStringList &l = project->variables()["QMAKE_FILETAGS"];
     QStringList::Iterator it;
@@ -686,31 +654,21 @@
     }
 
-//@@TODO (dmik): old, remove    
-//    if ( project->isActiveConfig("dll") ) {
-//		QString destDir = "";
-//		if (!project->first("DESTDIR").isEmpty())
-//			destDir = project->first("DESTDIR") + "\\";
-//		project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") +
-//					  destDir + "lib" + project->first("TARGET") + ".a");
-//    }
-    
-//    if(!project->isActiveConfig("incremental"))
-//	project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no"));
-
     if ( !project->variables()["RC_FILE"].isEmpty()) {
 	if ( !project->variables()["RES_FILE"].isEmpty()) {
 	    fprintf( stderr, "Both RC_FILE and RES_FILE are specified.\n" );
-	    fprintf( stderr, "Please specify one of them, not both." );
+	    fprintf( stderr, "Please specify one of them, not both.\n" );
 	    exit( 666 );
 	}
-	project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
-	project->variables()["RES_FILE"].first().replace(".rc",Option::obj_ext);
-	project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
-	project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"];
-    }
-    
+	project->variables()["RES_FILE"] =
+            Option::fixPathToLocalOS( var( "OBJECTS_DIR" ) + "/"
+                                      + QFileInfo( var( "RC_FILE" ) ).baseName( TRUE )
+                                      + ".res",
+                                      FALSE ); 
+	project->variables()["CLEAN_FILES"] += "$(RES_FILE)";
+    }
+
     if ( !project->variables()["RES_FILE"].isEmpty())
-	project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"];
-
+	project->variables()["POST_TARGETDEPS"] += "$(RES_FILE)";
+    
     MakefileGenerator::init();
     
@@ -721,9 +679,4 @@
     }
 
-//@@TODO (dmik): old, remove    
-//    if(project->isActiveConfig("dll")) {
-//	project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a");
-//    }
-    
     QStringList &quc = project->variables()["QMAKE_EXTRA_COMPILERS"];
     for(it = quc.begin(); it != quc.end(); ++it) {
