author | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
commit | 323e9a7472a110b4befba7320540263147505bae (patch) (unidiff) | |
tree | 14c810bdb9c0603a30356b17b4bdf9ccb72741c6 /qmake/generators/win32/msvc_nmake.cpp | |
parent | aa292b322f1ecb43dd8f4e3cd295855730dd9f59 (diff) | |
download | opie-323e9a7472a110b4befba7320540263147505bae.zip opie-323e9a7472a110b4befba7320540263147505bae.tar.gz opie-323e9a7472a110b4befba7320540263147505bae.tar.bz2 |
Manually updatet to qmake1.06a which includes support for precompiled
headers.
Opies 'PRO' keyword was already reintroduced
Diffstat (limited to 'qmake/generators/win32/msvc_nmake.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 321 |
1 files changed, 273 insertions, 48 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index ecef34d..528cb19 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp | |||
@@ -1,12 +1,10 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of NmakeMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
@@ -44,5 +42,4 @@ | |||
44 | #include <time.h> | 42 | #include <time.h> |
45 | 43 | ||
46 | |||
47 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 44 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
48 | { | 45 | { |
@@ -55,4 +52,9 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) | |||
55 | writeHeader(t); | 52 | writeHeader(t); |
56 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
54 | { //write the extra unix targets.. | ||
55 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
56 | for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) | ||
57 | t << *it << " "; | ||
58 | } | ||
57 | t << "all clean:" << "\n\t" | 59 | t << "all clean:" << "\n\t" |
58 | << "@echo \"Some of the required modules (" | 60 | << "@echo \"Some of the required modules (" |
@@ -75,4 +77,22 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) | |||
75 | } | 77 | } |
76 | 78 | ||
79 | QStringList | ||
80 | &NmakeMakefileGenerator::findDependencies(const QString &file) | ||
81 | { | ||
82 | QStringList &aList = MakefileGenerator::findDependencies(file); | ||
83 | // Note: The QMAKE_IMAGE_COLLECTION file have all images | ||
84 | // as dependency, so don't add precompiled header then | ||
85 | if (file == project->first("QMAKE_IMAGE_COLLECTION")) | ||
86 | return aList; | ||
87 | for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) { | ||
88 | if(file.endsWith(*it)) { | ||
89 | if(!aList.contains(precompH)) | ||
90 | aList += precompH; | ||
91 | break; | ||
92 | } | ||
93 | } | ||
94 | return aList; | ||
95 | } | ||
96 | |||
77 | void | 97 | void |
78 | NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | 98 | NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) |
@@ -96,6 +116,6 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
96 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 116 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
97 | QString inc = (*incit); | 117 | QString inc = (*incit); |
98 | inc.replace(QRegExp("\\\\$"), "\\\\"); | 118 | if (inc.endsWith("\\")) |
99 | inc.replace("\"", ""); | 119 | inc.truncate(inc.length()-1); |
100 | t << " -I\"" << inc << "\""; | 120 | t << " -I\"" << inc << "\""; |
101 | } | 121 | } |
@@ -112,6 +132,6 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
112 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { | 132 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { |
113 | QString lib = (*libit); | 133 | QString lib = (*libit); |
114 | lib.replace(QRegExp("\\\\$"), "\\\\"); | 134 | if (lib.endsWith("\\")) |
115 | lib.replace(QRegExp("\""), ""); | 135 | lib.truncate(lib.length()-1); |
116 | t << " \"" << lib << "\""; | 136 | t << " \"" << lib << "\""; |
117 | } | 137 | } |
@@ -139,4 +159,6 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
139 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; | 159 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; |
140 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | 160 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; |
161 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
162 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
141 | t << endl; | 163 | t << endl; |
142 | 164 | ||
@@ -150,4 +172,21 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
150 | t << "SRCMOC =" << varList("SRCMOC") << endl; | 172 | t << "SRCMOC =" << varList("SRCMOC") << endl; |
151 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 173 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
174 | |||
175 | QString extraCompilerDeps; | ||
176 | if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) { | ||
177 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | ||
178 | extraCompilerDeps += " $(OBJCOMP) "; | ||
179 | |||
180 | QStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
181 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { | ||
182 | QStringList &vars = project->variables()[(*compit) + ".variables"]; | ||
183 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { | ||
184 | QStringList vals = project->variables()[(*varit)]; | ||
185 | if(!vals.isEmpty()) | ||
186 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
152 | t << "DIST =" << varList("DISTFILES") << endl; | 191 | t << "DIST =" << varList("DISTFILES") << endl; |
153 | t << "TARGET ="; | 192 | t << "TARGET ="; |
@@ -165,4 +204,5 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
165 | t << " " << (*cppit); | 204 | t << " " << (*cppit); |
166 | t << endl << endl; | 205 | t << endl << endl; |
206 | |||
167 | if(!project->isActiveConfig("no_batch")) { | 207 | if(!project->isActiveConfig("no_batch")) { |
168 | // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC | 208 | // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC |
@@ -172,10 +212,12 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
172 | QDict<void> source_directories; | 212 | QDict<void> source_directories; |
173 | source_directories.insert(".", (void*)1); | 213 | source_directories.insert(".", (void*)1); |
174 | if(!project->isEmpty("MOC_DIR")) | 214 | QString directories[] = { QString("MOC_DIR"), QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString::null }; |
175 | source_directories.insert(project->first("MOC_DIR"), (void*)1); | 215 | for(int y = 0; !directories[y].isNull(); y++) { |
176 | if(!project->isEmpty("UI_SOURCES_DIR")) | 216 | QString dirTemp = project->first(directories[y]); |
177 | source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1); | 217 | if (dirTemp.endsWith("\\")) |
178 | else if(!project->isEmpty("UI_DIR")) | 218 | dirTemp.truncate(dirTemp.length()-1); |
179 | source_directories.insert(project->first("UI_DIR"), (void*)1); | 219 | if(!dirTemp.isEmpty()) |
220 | source_directories.insert(dirTemp, (void*)1); | ||
221 | } | ||
180 | QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null }; | 222 | QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null }; |
181 | for(int x = 0; !srcs[x].isNull(); x++) { | 223 | for(int x = 0; !srcs[x].isNull(); x++) { |
@@ -207,7 +249,7 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
207 | 249 | ||
208 | t << "####### Build rules" << endl << endl; | 250 | t << "####### Build rules" << endl << endl; |
209 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; | 251 | t << "all: " << fileFixify(Option::output.name()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(TARGET)" << endl << endl; |
210 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 252 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
211 | << var("POST_TARGETDEPS"); | 253 | << extraCompilerDeps << var("POST_TARGETDEPS"); |
212 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 254 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
213 | t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t " | 255 | t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t " |
@@ -217,4 +259,5 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
217 | << "$(OBJECTS) $(OBJMOC)"; | 259 | << "$(OBJECTS) $(OBJMOC)"; |
218 | } | 260 | } |
261 | t << extraCompilerDeps; | ||
219 | t << endl << "<<" << endl; | 262 | t << endl << "<<" << endl; |
220 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) | 263 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) |
@@ -223,5 +266,5 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
223 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 266 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
224 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 267 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
225 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; | 268 | t << "\n\t" << "-$(COPY_FILE) \"$(TARGET)\" " << *dlldir; |
226 | } | 269 | } |
227 | } | 270 | } |
@@ -233,12 +276,12 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
233 | 276 | ||
234 | if ( project->isActiveConfig("dll")) { | 277 | if ( project->isActiveConfig("dll")) { |
235 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 278 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
236 | t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"); | 279 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
237 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 280 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
238 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | 281 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); |
239 | } else { | 282 | } else { |
240 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | 283 | t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
241 | t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"); | 284 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
242 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 285 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
243 | t << "\n\t" << "-$(TARGET) -regserver"; | 286 | t << "\n\t" << "-$(TARGET) -regserver"; |
244 | } | 287 | } |
@@ -251,31 +294,51 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
251 | } | 294 | } |
252 | 295 | ||
253 | t << "mocables: $(SRCMOC)" << endl << endl; | 296 | t << "mocables: $(SRCMOC)" << endl |
297 | << "uicables: $(UICIMPLS) $(UICDECLS)" << endl << endl; | ||
254 | 298 | ||
255 | writeMakeQmake(t); | 299 | writeMakeQmake(t); |
256 | 300 | ||
301 | QStringList dist_files = Option::mkfile::project_files; | ||
302 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) | ||
303 | dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; | ||
304 | if(!project->isEmpty("TRANSLATIONS")) | ||
305 | dist_files << var("TRANSLATIONS"); | ||
306 | if(!project->isEmpty("FORMS")) { | ||
307 | QStringList &forms = project->variables()["FORMS"]; | ||
308 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | ||
309 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | ||
310 | if(QFile::exists(ui_h) ) | ||
311 | dist_files << ui_h; | ||
312 | } | ||
313 | } | ||
257 | t << "dist:" << "\n\t" | 314 | t << "dist:" << "\n\t" |
258 | << "$(ZIP) " << var("PROJECT") << ".zip " | 315 | << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(HEADERS) $(DIST) $(FORMS) " |
259 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; | 316 | << dist_files.join(" ") << " " << var("TRANSLATIONS") << " " << var("IMAGES") << endl << endl; |
260 | 317 | ||
261 | t << "clean:" | 318 | t << "uiclean:" |
262 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","") | 319 | << varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
263 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 320 | << varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") << endl; |
264 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") | 321 | |
265 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | 322 | t << "mocclean:" |
266 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | 323 | << varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
267 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | 324 | << varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") << endl; |
268 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | 325 | |
269 | 326 | t << "clean: uiclean mocclean" | |
327 | << varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") | ||
328 | << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","\n") | ||
329 | << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","\n"); | ||
270 | if ( project->isActiveConfig("activeqt")) { | 330 | if ( project->isActiveConfig("activeqt")) { |
271 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 331 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl"); |
272 | t << "\n\t-del tmp\\dump.*"; | 332 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
273 | } | 333 | } |
274 | if(!project->isEmpty("IMAGES")) | 334 | if(!project->isEmpty("IMAGES")) |
275 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 335 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", ""); |
336 | t << endl; | ||
337 | |||
338 | // user defined targets | ||
276 | 339 | ||
277 | // blasted user defined targets | 340 | QStringList::Iterator it; |
278 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 341 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
279 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 342 | for(it = qut.begin(); it != qut.end(); ++it) { |
280 | QString targ = var((*it) + ".target"), | 343 | QString targ = var((*it) + ".target"), |
281 | cmd = var((*it) + ".commands"), deps; | 344 | cmd = var((*it) + ".commands"), deps; |
@@ -289,15 +352,103 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | |||
289 | deps += " " + dep; | 352 | deps += " " + dep; |
290 | } | 353 | } |
354 | if(!project->variables()["QMAKE_NOFORCE"].isEmpty() && | ||
355 | project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1) | ||
356 | deps += QString(" ") + "FORCE"; | ||
291 | t << "\n\n" << targ << ":" << deps << "\n\t" | 357 | t << "\n\n" << targ << ":" << deps << "\n\t" |
292 | << cmd; | 358 | << cmd; |
293 | } | 359 | } |
294 | |||
295 | t << endl << endl; | 360 | t << endl << endl; |
296 | 361 | ||
362 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
363 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
364 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
365 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
366 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); | ||
367 | QStringList &vars = project->variables()[(*it) + ".variables"]; | ||
368 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
369 | continue; | ||
370 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
371 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
372 | QStringList &inputs = project->variables()[(*it2)]; | ||
373 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
374 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
375 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
376 | out = tmp_out, cmd = tmp_cmd, deps; | ||
377 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
378 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
379 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
380 | cmd.replace("${QMAKE_FILE_OUT}", out); | ||
381 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
382 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) | ||
383 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); | ||
384 | if(!tmp_dep.isEmpty()) { | ||
385 | char buff[256]; | ||
386 | QString dep_cmd = tmp_dep; | ||
387 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
388 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { | ||
389 | while(!feof(proc)) { | ||
390 | int read_in = int(fread(buff, 1, 255, proc)); | ||
391 | if(!read_in) | ||
392 | break; | ||
393 | int l = 0; | ||
394 | for(int i = 0; i < read_in; i++) { | ||
395 | if(buff[i] == '\n' || buff[i] == ' ') { | ||
396 | deps += " " + QCString(buff+l, (i - l) + 1); | ||
397 | l = i; | ||
398 | } | ||
399 | } | ||
400 | } | ||
401 | fclose(proc); | ||
402 | } | ||
403 | } | ||
404 | t << out << ": " << in << deps << "\n\t" | ||
405 | << cmd << endl << endl; | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | t << endl; | ||
410 | |||
411 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | ||
412 | t << "FORCE:" << endl << endl; | ||
413 | |||
297 | t << "distclean: clean" | 414 | t << "distclean: clean" |
298 | << "\n\t-del $(TARGET)" | 415 | << "\n\t-$(DEL_FILE) $(TARGET)" |
299 | << endl << endl; | 416 | << endl << endl; |
417 | |||
418 | // precompiled header | ||
419 | if(usePCH) { | ||
420 | QString precompRule = QString("-c -Yc -Fp%1 -Fo%2").arg(precompPch).arg(precompObj); | ||
421 | t << precompObj << ": " << precompH << " " << findDependencies(precompH).join(" \\\n\t\t") | ||
422 | << "\n\t" << "$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " << precompH << endl << endl; | ||
423 | } | ||
300 | } | 424 | } |
301 | 425 | ||
426 | QString | ||
427 | NmakeMakefileGenerator::var(const QString &value) | ||
428 | { | ||
429 | if (usePCH) { | ||
430 | if ((value == "QMAKE_RUN_CXX_IMP_BATCH" | ||
431 | || value == "QMAKE_RUN_CXX_IMP" | ||
432 | || value == "QMAKE_RUN_CXX")) { | ||
433 | QFileInfo precompHInfo(precompH); | ||
434 | QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3") | ||
435 | .arg(precompHInfo.fileName()) | ||
436 | .arg(precompHInfo.fileName()) | ||
437 | .arg(precompPch); | ||
438 | QString p = MakefileGenerator::var(value); | ||
439 | p.replace("-c", precompRule); | ||
440 | // Cannot use -Gm with -FI & -Yu, as this gives an | ||
441 | // internal compiler error, on the newer compilers | ||
442 | p.remove("-Gm"); | ||
443 | return p; | ||
444 | } else if (value == "QMAKE_CXXFLAGS") { | ||
445 | // Remove internal compiler error option | ||
446 | return MakefileGenerator::var(value).remove("-Gm"); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | // Normal val | ||
451 | return MakefileGenerator::var(value); | ||
452 | } | ||
302 | 453 | ||
303 | void | 454 | void |
@@ -322,4 +473,9 @@ NmakeMakefileGenerator::init() | |||
322 | } | 473 | } |
323 | 474 | ||
475 | if(project->isEmpty("QMAKE_INSTALL_FILE")) | ||
476 | project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)"); | ||
477 | if(project->isEmpty("QMAKE_INSTALL_DIR")) | ||
478 | project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)"); | ||
479 | |||
324 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 480 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
325 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 481 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
@@ -331,4 +487,10 @@ NmakeMakefileGenerator::init() | |||
331 | if (project->isActiveConfig("qt_dll")) | 487 | if (project->isActiveConfig("qt_dll")) |
332 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 488 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
489 | if ( project->isActiveConfig("qtopia") ) { | ||
490 | if(configs.findIndex("qtopialib") == -1) | ||
491 | configs.append("qtopialib"); | ||
492 | if(configs.findIndex("qtopiainc") == -1) | ||
493 | configs.append("qtopiainc"); | ||
494 | } | ||
333 | if ( project->isActiveConfig("qt") ) { | 495 | if ( project->isActiveConfig("qt") ) { |
334 | if ( project->isActiveConfig( "plugin" ) ) { | 496 | if ( project->isActiveConfig( "plugin" ) ) { |
@@ -402,4 +564,11 @@ NmakeMakefileGenerator::init() | |||
402 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) | 564 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) |
403 | project->variables()["CONFIG"].append("windows"); | 565 | project->variables()["CONFIG"].append("windows"); |
566 | if ( project->isActiveConfig("qtopiainc") ) | ||
567 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
568 | if ( project->isActiveConfig("qtopialib") ) { | ||
569 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
570 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
571 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
572 | } | ||
404 | if ( project->isActiveConfig("qt") ) { | 573 | if ( project->isActiveConfig("qt") ) { |
405 | project->variables()["CONFIG"].append("moc"); | 574 | project->variables()["CONFIG"].append("moc"); |
@@ -509,8 +678,24 @@ NmakeMakefileGenerator::init() | |||
509 | setMocAware(TRUE); | 678 | setMocAware(TRUE); |
510 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 679 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
680 | |||
681 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | ||
682 | for( QStringList::Iterator stIt = libList.begin(); stIt != libList.end(); ) { | ||
683 | QString s = *stIt; | ||
684 | if( s.startsWith( "-l" ) ) { | ||
685 | stIt = libList.remove( stIt ); | ||
686 | stIt = libList.insert( stIt, s.mid( 2 ) + ".lib" ); | ||
687 | } else if( s.startsWith( "-L" ) ) { | ||
688 | stIt = libList.remove( stIt ); | ||
689 | project->variables()["QMAKE_LIBDIR"].append(QDir::convertSeparators(s.mid( 2 ))); | ||
690 | } else { | ||
691 | stIt++; | ||
692 | } | ||
693 | } | ||
694 | |||
511 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 695 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
512 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 696 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
513 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 697 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
514 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 698 | QStringList::Iterator it; |
699 | for(it = l.begin(); it != l.end(); ++it) { | ||
515 | QStringList &gdmf = project->variables()[(*it)]; | 700 | QStringList &gdmf = project->variables()[(*it)]; |
516 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 701 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
@@ -540,9 +725,28 @@ NmakeMakefileGenerator::init() | |||
540 | project->variables()["RES_FILE"].first().replace(".rc",".res"); | 725 | project->variables()["RES_FILE"].first().replace(".rc",".res"); |
541 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | 726 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; |
727 | project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"]; | ||
542 | } | 728 | } |
543 | if ( !project->variables()["RES_FILE"].isEmpty()) | 729 | if ( !project->variables()["RES_FILE"].isEmpty()) |
544 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | 730 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; |
545 | 731 | ||
732 | // Base class init! | ||
546 | MakefileGenerator::init(); | 733 | MakefileGenerator::init(); |
734 | |||
735 | // Setup PCH variables | ||
736 | precompH = project->first("PRECOMPILED_HEADER"); | ||
737 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
738 | if (usePCH) { | ||
739 | // Created files | ||
740 | precompObj = var("OBJECTS_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext; | ||
741 | precompPch = var("OBJECTS_DIR") + project->first("TARGET") + "_pch.pch"; | ||
742 | // Add linking of precompObj (required for whole precompiled classes) | ||
743 | project->variables()["OBJECTS"] += precompObj; | ||
744 | // Add pch file to cleanup | ||
745 | project->variables()["QMAKE_CLEAN"] += precompPch; | ||
746 | // Return to variable pool | ||
747 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
748 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
749 | } | ||
750 | |||
547 | if ( !project->variables()["VERSION"].isEmpty()) { | 751 | if ( !project->variables()["VERSION"].isEmpty()) { |
548 | QStringList l = QStringList::split('.', project->first("VERSION")); | 752 | QStringList l = QStringList::split('.', project->first("VERSION")); |
@@ -559,4 +763,25 @@ NmakeMakefileGenerator::init() | |||
559 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk"); | 763 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk"); |
560 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); | 764 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); |
765 | project->variables()["QMAKE_CLEAN"].append("vc*.idb"); | ||
766 | } | ||
767 | |||
768 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
769 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
770 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
771 | if(tmp_out.isEmpty()) | ||
772 | continue; | ||
773 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
774 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
775 | QStringList &inputs = project->variables()[(*it2)]; | ||
776 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
777 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
778 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
779 | out = tmp_out; | ||
780 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
781 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
782 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
783 | project->variables()["OBJCOMP"] += out; | ||
784 | } | ||
785 | } | ||
561 | } | 786 | } |
562 | } | 787 | } |