summaryrefslogtreecommitdiff
path: root/qmake/generators/win32/msvc_nmake.cpp
Unidiff
Diffstat (limited to 'qmake/generators/win32/msvc_nmake.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp98
1 files changed, 86 insertions, 12 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 9cc9a69..ecef34d 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
@@ -40,2 +40,3 @@
40#include <qregexp.h> 40#include <qregexp.h>
41#include <qdict.h>
41#include <qdir.h> 42#include <qdir.h>
@@ -137,2 +138,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
137 t << "MOVE = " << var("QMAKE_MOVE") << endl; 138 t << "MOVE = " << var("QMAKE_MOVE") << endl;
139 t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl;
140 t << "MKDIR =" << var("QMAKE_MKDIR") << endl;
138 t << endl; 141 t << endl;
@@ -158,7 +161,47 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
158 t << "####### Implicit rules" << endl << endl; 161 t << "####### Implicit rules" << endl << endl;
159 t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl; 162 t << ".SUFFIXES: .c";
160 t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 163 QStringList::Iterator cppit;
161 t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 164 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
162 t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 165 t << " " << (*cppit);
163 t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; 166 t << endl << endl;
167 if(!project->isActiveConfig("no_batch")) {
168 // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC
169 project->variables().remove("QMAKE_RUN_CXX");
170 project->variables().remove("QMAKE_RUN_CC");
171
172 QDict<void> source_directories;
173 source_directories.insert(".", (void*)1);
174 if(!project->isEmpty("MOC_DIR"))
175 source_directories.insert(project->first("MOC_DIR"), (void*)1);
176 if(!project->isEmpty("UI_SOURCES_DIR"))
177 source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1);
178 else if(!project->isEmpty("UI_DIR"))
179 source_directories.insert(project->first("UI_DIR"), (void*)1);
180 QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null };
181 for(int x = 0; !srcs[x].isNull(); x++) {
182 QStringList &l = project->variables()[srcs[x]];
183 for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) {
184 QString sep = "\\";
185 if((*sit).find(sep) == -1)
186 sep = "/";
187 QString dir = (*sit).section(sep, 0, -2);
188 if(!dir.isEmpty() && !source_directories[dir])
189 source_directories.insert(dir, (void*)1);
190 }
191 }
192
193 for(QDictIterator<void> it(source_directories); it.current(); ++it) {
194 if(it.currentKey().isEmpty())
195 continue;
196 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
197 t << "{" << it.currentKey() << "}" << (*cppit) << "{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t"
198 << var("QMAKE_RUN_CXX_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl;
199 t << "{" << it.currentKey() << "}" << ".c{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t"
200 << var("QMAKE_RUN_CC_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl;
201 }
202 } else {
203 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
204 t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
205 t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
206 }
164 207
@@ -166,3 +209,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
166 t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; 209 t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl;
167 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS"); 210 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
211 << var("POST_TARGETDEPS");
168 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { 212 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
@@ -175,2 +219,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
175 t << endl << "<<" << endl; 219 t << endl << "<<" << endl;
220 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
221 t << "\t" << var( "QMAKE_POST_LINK" ) << endl;
176 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { 222 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
@@ -222,2 +268,3 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
222 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); 268 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
269
223 if ( project->isActiveConfig("activeqt")) { 270 if ( project->isActiveConfig("activeqt")) {
@@ -248,2 +295,6 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
248 t << endl << endl; 295 t << endl << endl;
296
297 t << "distclean: clean"
298 << "\n\t-del $(TARGET)"
299 << endl << endl;
249} 300}
@@ -433,2 +484,24 @@ NmakeMakefileGenerator::init()
433 } 484 }
485 if ( project->isActiveConfig("stl") ) {
486 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
487 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
488 } else {
489 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
490 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
491 }
492 if ( project->isActiveConfig("exceptions") ) {
493 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
494 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
495 } else {
496 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
497 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
498 }
499 if ( project->isActiveConfig("rtti") ) {
500 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
501 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
502 } else {
503 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
504 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
505 }
506
434 507
@@ -467,3 +540,3 @@ NmakeMakefileGenerator::init()
467 project->variables()["RES_FILE"].first().replace(".rc",".res"); 540 project->variables()["RES_FILE"].first().replace(".rc",".res");
468 project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"]; 541 project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
469 } 542 }
@@ -478,9 +551,10 @@ NmakeMakefileGenerator::init()
478 } 551 }
552
553 QString version = QStringList::split('.', project->first("VERSION")).join("");
479 if(project->isActiveConfig("dll")) { 554 if(project->isActiveConfig("dll")) {
480 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".lib"); 555 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp");
481 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".exp");
482 } 556 }
483 if(project->isActiveConfig("debug")) { 557 if(project->isActiveConfig("debug")) {
484 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".pdb"); 558 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb");
485 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".ilk"); 559 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
486 project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); 560 project->variables()["QMAKE_CLEAN"].append("vc*.pdb");