author | kergoth <kergoth> | 2002-11-01 00:10:42 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-11-01 00:10:42 (UTC) |
commit | 5042e3cf0d3514552769e441f5aad590c8eaf967 (patch) (unidiff) | |
tree | 4a5ea45f3519d981a172ab5275bf38c6fa778dec /qmake/generators/win32/msvc_nmake.cpp | |
parent | 108c1c753e74e989cc13923086996791428c9af4 (diff) | |
download | opie-5042e3cf0d3514552769e441f5aad590c8eaf967.zip opie-5042e3cf0d3514552769e441f5aad590c8eaf967.tar.gz opie-5042e3cf0d3514552769e441f5aad590c8eaf967.tar.bz2 |
Adding qmake in preperation for new build system
Diffstat (limited to 'qmake/generators/win32/msvc_nmake.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 488 |
1 files changed, 488 insertions, 0 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp new file mode 100644 index 0000000..9cc9a69 --- a/dev/null +++ b/qmake/generators/win32/msvc_nmake.cpp | |||
@@ -0,0 +1,488 @@ | |||
1 | /**************************************************************************** | ||
2 | ** $Id$ | ||
3 | ** | ||
4 | ** Definition of ________ class. | ||
5 | ** | ||
6 | ** Created : 970521 | ||
7 | ** | ||
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | ||
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | ||
12 | ** This file may be distributed under the terms of the Q Public License | ||
13 | ** as defined by Trolltech AS of Norway and appearing in the file | ||
14 | ** LICENSE.QPL included in the packaging of this file. | ||
15 | ** | ||
16 | ** This file may be distributed and/or modified under the terms of the | ||
17 | ** GNU General Public License version 2 as published by the Free Software | ||
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
19 | ** packaging of this file. | ||
20 | ** | ||
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | ||
22 | ** file in accordance with the Qt Commercial License Agreement provided | ||
23 | ** with the Software. | ||
24 | ** | ||
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
27 | ** | ||
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
29 | ** information about Qt Commercial License Agreements. | ||
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | ||
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
32 | ** | ||
33 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
34 | ** not clear to you. | ||
35 | ** | ||
36 | **********************************************************************/ | ||
37 | |||
38 | #include "msvc_nmake.h" | ||
39 | #include "option.h" | ||
40 | #include <qregexp.h> | ||
41 | #include <qdir.h> | ||
42 | #include <stdlib.h> | ||
43 | #include <time.h> | ||
44 | |||
45 | |||
46 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | ||
47 | { | ||
48 | |||
49 | } | ||
50 | |||
51 | bool | ||
52 | NmakeMakefileGenerator::writeMakefile(QTextStream &t) | ||
53 | { | ||
54 | writeHeader(t); | ||
55 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | ||
56 | t << "all clean:" << "\n\t" | ||
57 | << "@echo \"Some of the required modules (" | ||
58 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | ||
59 | << "@echo \"Skipped.\"" << endl << endl; | ||
60 | writeMakeQmake(t); | ||
61 | return TRUE; | ||
62 | } | ||
63 | |||
64 | if(project->first("TEMPLATE") == "app" || | ||
65 | project->first("TEMPLATE") == "lib") { | ||
66 | writeNmakeParts(t); | ||
67 | return MakefileGenerator::writeMakefile(t); | ||
68 | } | ||
69 | else if(project->first("TEMPLATE") == "subdirs") { | ||
70 | writeSubDirs(t); | ||
71 | return TRUE; | ||
72 | } | ||
73 | return FALSE; | ||
74 | } | ||
75 | |||
76 | void | ||
77 | NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | ||
78 | { | ||
79 | t << "####### Compiler, tools and options" << endl << endl; | ||
80 | t << "CC =" << var("QMAKE_CC") << endl; | ||
81 | t << "CXX =" << var("QMAKE_CXX") << endl; | ||
82 | t << "LEX = " << var("QMAKE_LEX") << endl; | ||
83 | t << "YACC = " << var("QMAKE_YACC") << endl; | ||
84 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " | ||
85 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | ||
86 | << varGlue("DEFINES","-D"," -D","") << endl; | ||
87 | t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " " | ||
88 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | ||
89 | << varGlue("DEFINES","-D"," -D","") << endl; | ||
90 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; | ||
91 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; | ||
92 | |||
93 | t << "INCPATH ="; | ||
94 | QStringList &incs = project->variables()["INCLUDEPATH"]; | ||
95 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | ||
96 | QString inc = (*incit); | ||
97 | inc.replace(QRegExp("\\\\$"), "\\\\"); | ||
98 | inc.replace("\"", ""); | ||
99 | t << " -I\"" << inc << "\""; | ||
100 | } | ||
101 | t << " -I\"" << specdir() << "\"" | ||
102 | << endl; | ||
103 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | ||
104 | t << "LINK =" << var("QMAKE_LINK") << endl; | ||
105 | t << "LFLAGS =" << var("QMAKE_LFLAGS"); | ||
106 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | ||
107 | t << " " << varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\""); | ||
108 | t << endl; | ||
109 | t << "LIBS ="; | ||
110 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | ||
111 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { | ||
112 | QString lib = (*libit); | ||
113 | lib.replace(QRegExp("\\\\$"), "\\\\"); | ||
114 | lib.replace(QRegExp("\""), ""); | ||
115 | t << " \"" << lib << "\""; | ||
116 | } | ||
117 | t << endl; | ||
118 | } | ||
119 | else { | ||
120 | t << "LIB =" << var("QMAKE_LIB") << endl; | ||
121 | } | ||
122 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | ||
123 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; | ||
124 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | ||
125 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | ||
126 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | ||
127 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | ||
128 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : | ||
129 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; | ||
130 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : | ||
131 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; | ||
132 | t << "ZIP =" << var("QMAKE_ZIP") << endl; | ||
133 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; | ||
134 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; | ||
135 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; | ||
136 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; | ||
137 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | ||
138 | t << endl; | ||
139 | |||
140 | t << "####### Files" << endl << endl; | ||
141 | t << "HEADERS =" << varList("HEADERS") << endl; | ||
142 | t << "SOURCES =" << varList("SOURCES") << endl; | ||
143 | t << "OBJECTS =" << varList("OBJECTS") << endl; | ||
144 | t << "FORMS =" << varList("FORMS") << endl; | ||
145 | t << "UICDECLS =" << varList("UICDECLS") << endl; | ||
146 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; | ||
147 | t << "SRCMOC =" << varList("SRCMOC") << endl; | ||
148 | t << "OBJMOC =" << varList("OBJMOC") << endl; | ||
149 | t << "DIST =" << varList("DISTFILES") << endl; | ||
150 | t << "TARGET ="; | ||
151 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) | ||
152 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); | ||
153 | else | ||
154 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | ||
155 | t << endl; | ||
156 | t << endl; | ||
157 | |||
158 | t << "####### Implicit rules" << endl << endl; | ||
159 | t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl; | ||
160 | t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
161 | t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
162 | t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | ||
163 | t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | ||
164 | |||
165 | t << "####### Build rules" << endl << endl; | ||
166 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; | ||
167 | t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS"); | ||
168 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | ||
169 | t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t " | ||
170 | << "$(OBJECTS) $(OBJMOC) $(LIBS)"; | ||
171 | } else { | ||
172 | t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t " | ||
173 | << "$(OBJECTS) $(OBJMOC)"; | ||
174 | } | ||
175 | t << endl << "<<" << endl; | ||
176 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { | ||
177 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | ||
178 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | ||
179 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; | ||
180 | } | ||
181 | } | ||
182 | QString targetfilename = project->variables()["TARGET"].first(); | ||
183 | if(project->isActiveConfig("activeqt")) { | ||
184 | QString version = project->variables()["VERSION"].first(); | ||
185 | if ( version.isEmpty() ) | ||
186 | version = "1.0"; | ||
187 | |||
188 | if ( project->isActiveConfig("dll")) { | ||
189 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | ||
190 | 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"); | ||
191 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | ||
192 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | ||
193 | } else { | ||
194 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | ||
195 | 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"); | ||
196 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | ||
197 | t << "\n\t" << "-$(TARGET) -regserver"; | ||
198 | } | ||
199 | } | ||
200 | t << endl << endl; | ||
201 | |||
202 | if(!project->variables()["RC_FILE"].isEmpty()) { | ||
203 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" | ||
204 | << var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl; | ||
205 | } | ||
206 | |||
207 | t << "mocables: $(SRCMOC)" << endl << endl; | ||
208 | |||
209 | writeMakeQmake(t); | ||
210 | |||
211 | t << "dist:" << "\n\t" | ||
212 | << "$(ZIP) " << var("PROJECT") << ".zip " | ||
213 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; | ||
214 | |||
215 | t << "clean:" | ||
216 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","") | ||
217 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | ||
218 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") | ||
219 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | ||
220 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | ||
221 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | ||
222 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | ||
223 | if ( project->isActiveConfig("activeqt")) { | ||
224 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | ||
225 | t << "\n\t-del tmp\\dump.*"; | ||
226 | } | ||
227 | if(!project->isEmpty("IMAGES")) | ||
228 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | ||
229 | |||
230 | // blasted user defined targets | ||
231 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
232 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | ||
233 | QString targ = var((*it) + ".target"), | ||
234 | cmd = var((*it) + ".commands"), deps; | ||
235 | if(targ.isEmpty()) | ||
236 | targ = (*it); | ||
237 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | ||
238 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | ||
239 | QString dep = var((*dep_it) + ".target"); | ||
240 | if(dep.isEmpty()) | ||
241 | dep = (*dep_it); | ||
242 | deps += " " + dep; | ||
243 | } | ||
244 | t << "\n\n" << targ << ":" << deps << "\n\t" | ||
245 | << cmd; | ||
246 | } | ||
247 | |||
248 | t << endl << endl; | ||
249 | } | ||
250 | |||
251 | |||
252 | void | ||
253 | NmakeMakefileGenerator::init() | ||
254 | { | ||
255 | if(init_flag) | ||
256 | return; | ||
257 | init_flag = TRUE; | ||
258 | |||
259 | /* this should probably not be here, but I'm using it to wrap the .t files */ | ||
260 | if(project->first("TEMPLATE") == "app") | ||
261 | project->variables()["QMAKE_APP_FLAG"].append("1"); | ||
262 | else if(project->first("TEMPLATE") == "lib") | ||
263 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | ||
264 | else if(project->first("TEMPLATE") == "subdirs") { | ||
265 | MakefileGenerator::init(); | ||
266 | if(project->variables()["MAKEFILE"].isEmpty()) | ||
267 | project->variables()["MAKEFILE"].append("Makefile"); | ||
268 | if(project->variables()["QMAKE"].isEmpty()) | ||
269 | project->variables()["QMAKE"].append("qmake"); | ||
270 | return; | ||
271 | } | ||
272 | |||
273 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | ||
274 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | ||
275 | |||
276 | QString targetfilename = project->variables()["TARGET"].first(); | ||
277 | QStringList &configs = project->variables()["CONFIG"]; | ||
278 | if (project->isActiveConfig("qt") && project->isActiveConfig("shared")) | ||
279 | project->variables()["DEFINES"].append("QT_DLL"); | ||
280 | if (project->isActiveConfig("qt_dll")) | ||
281 | if(configs.findIndex("qt") == -1) configs.append("qt"); | ||
282 | if ( project->isActiveConfig("qt") ) { | ||
283 | if ( project->isActiveConfig( "plugin" ) ) { | ||
284 | project->variables()["CONFIG"].append("dll"); | ||
285 | if(project->isActiveConfig("qt")) | ||
286 | project->variables()["DEFINES"].append("QT_PLUGIN"); | ||
287 | } | ||
288 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && | ||
289 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || | ||
290 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || | ||
291 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { | ||
292 | project->variables()["QMAKE_QT_DLL"].append("1"); | ||
293 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | ||
294 | project->variables()["CONFIG"].append("dll"); | ||
295 | } | ||
296 | if ( project->isActiveConfig("thread") ) | ||
297 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | ||
298 | if ( project->isActiveConfig("accessibility" ) ) | ||
299 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | ||
300 | if ( project->isActiveConfig("tablet") ) | ||
301 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | ||
302 | } | ||
303 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | ||
304 | project->variables()["CONFIG"].remove("staticlib"); | ||
305 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); | ||
306 | } else { | ||
307 | project->variables()["CONFIG"].append("staticlib"); | ||
308 | } | ||
309 | if ( project->isActiveConfig("warn_off") ) { | ||
310 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | ||
311 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | ||
312 | } else if ( project->isActiveConfig("warn_on") ) { | ||
313 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | ||
314 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | ||
315 | } | ||
316 | if ( project->isActiveConfig("debug") ) { | ||
317 | if ( project->isActiveConfig("thread") ) { | ||
318 | // use the DLL RT even here | ||
319 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | ||
320 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; | ||
321 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | ||
322 | } else { | ||
323 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; | ||
324 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | ||
325 | } | ||
326 | } | ||
327 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | ||
328 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | ||
329 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | ||
330 | } else { | ||
331 | if ( project->isActiveConfig("thread") ) { | ||
332 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | ||
333 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; | ||
334 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | ||
335 | } else { | ||
336 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; | ||
337 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | ||
338 | } | ||
339 | } | ||
340 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | ||
341 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | ||
342 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | ||
343 | } | ||
344 | if ( project->isActiveConfig("thread") && !project->variables()["DEFINES"].contains("QT_DLL") | ||
345 | && !is_qt && project->first("TARGET") != "qtmain") { | ||
346 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); | ||
347 | } | ||
348 | |||
349 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) | ||
350 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | ||
351 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) | ||
352 | project->variables()["CONFIG"].append("windows"); | ||
353 | if ( project->isActiveConfig("qt") ) { | ||
354 | project->variables()["CONFIG"].append("moc"); | ||
355 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | ||
356 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | ||
357 | if ( !project->isActiveConfig("debug") ) | ||
358 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | ||
359 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | ||
360 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { | ||
361 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | ||
362 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; | ||
363 | } | ||
364 | } else { | ||
365 | if(project->isActiveConfig("thread")) | ||
366 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | ||
367 | else | ||
368 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | ||
369 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | ||
370 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | ||
371 | if ( hver == -1 ) | ||
372 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | ||
373 | if(hver != -1) { | ||
374 | QString ver; | ||
375 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | ||
376 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | ||
377 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | ||
378 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | ||
379 | } | ||
380 | } | ||
381 | if ( project->isActiveConfig( "activeqt" ) ) { | ||
382 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | ||
383 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | ||
384 | if ( project->isActiveConfig( "dll" ) ) | ||
385 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | ||
386 | } | ||
387 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | ||
388 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | ||
389 | } | ||
390 | } | ||
391 | } | ||
392 | if ( project->isActiveConfig("opengl") ) { | ||
393 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | ||
394 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | ||
395 | } | ||
396 | if ( project->isActiveConfig("dll") ) { | ||
397 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | ||
398 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | ||
399 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | ||
400 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | ||
401 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { | ||
402 | project->variables()["TARGET_EXT"].append( | ||
403 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); | ||
404 | } else { | ||
405 | project->variables()["TARGET_EXT"].append(".dll"); | ||
406 | } | ||
407 | } else { | ||
408 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | ||
409 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | ||
410 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | ||
411 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | ||
412 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | ||
413 | project->variables()["TARGET_EXT"].append(".exe"); | ||
414 | } else { | ||
415 | project->variables()["TARGET_EXT"].append(".lib"); | ||
416 | } | ||
417 | } | ||
418 | if ( project->isActiveConfig("windows") ) { | ||
419 | if ( project->isActiveConfig("console") ) { | ||
420 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
421 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
422 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
423 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
424 | } else { | ||
425 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | ||
426 | } | ||
427 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | ||
428 | } else { | ||
429 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
430 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
431 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
432 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
433 | } | ||
434 | |||
435 | if ( project->isActiveConfig("moc") ) | ||
436 | setMocAware(TRUE); | ||
437 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | ||
438 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | ||
439 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | ||
440 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | ||
441 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
442 | QStringList &gdmf = project->variables()[(*it)]; | ||
443 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | ||
444 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | ||
445 | } | ||
446 | |||
447 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | ||
448 | project->variables()["QMAKE_LFLAGS"].append(QString("/DEF:") + project->first("DEF_FILE")); | ||
449 | if(!project->isActiveConfig("incremental")) | ||
450 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | ||
451 | |||
452 | if ( !project->variables()["VERSION"].isEmpty() ) { | ||
453 | QString version = project->variables()["VERSION"][0]; | ||
454 | int firstDot = version.find( "." ); | ||
455 | QString major = version.left( firstDot ); | ||
456 | QString minor = version.right( version.length() - firstDot - 1 ); | ||
457 | minor.replace( ".", "" ); | ||
458 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | ||
459 | } | ||
460 | if ( !project->variables()["RC_FILE"].isEmpty()) { | ||
461 | if ( !project->variables()["RES_FILE"].isEmpty()) { | ||
462 | fprintf(stderr, "Both .rc and .res file specified.\n"); | ||
463 | fprintf(stderr, "Please specify one of them, not both."); | ||
464 | exit(666); | ||
465 | } | ||
466 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | ||
467 | project->variables()["RES_FILE"].first().replace(".rc",".res"); | ||
468 | project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"]; | ||
469 | } | ||
470 | if ( !project->variables()["RES_FILE"].isEmpty()) | ||
471 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | ||
472 | |||
473 | MakefileGenerator::init(); | ||
474 | if ( !project->variables()["VERSION"].isEmpty()) { | ||
475 | QStringList l = QStringList::split('.', project->first("VERSION")); | ||
476 | project->variables()["VER_MAJ"].append(l[0]); | ||
477 | project->variables()["VER_MIN"].append(l[1]); | ||
478 | } | ||
479 | if(project->isActiveConfig("dll")) { | ||
480 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".lib"); | ||
481 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".exp"); | ||
482 | } | ||
483 | if(project->isActiveConfig("debug")) { | ||
484 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".pdb"); | ||
485 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".ilk"); | ||
486 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); | ||
487 | } | ||
488 | } | ||