summaryrefslogtreecommitdiff
path: root/qmake/generators/win32/winmakefile.cpp
Unidiff
Diffstat (limited to 'qmake/generators/win32/winmakefile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/win32/winmakefile.cpp161
1 files changed, 118 insertions, 43 deletions
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index bc3fed9..cd733c6 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -1,11 +1,9 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2**
3** 3**
4** Definition of ________ class. 4** Implementation of Win32MakefileGenerator class.
5** 5**
6** Created : 970521 6** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
7** 7**
8** Copyright (C) 1992-2000 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**
@@ -40,2 +38,3 @@
40#include "project.h" 38#include "project.h"
39#include "meta.h"
41#include <qtextstream.h> 40#include <qtextstream.h>
@@ -99,4 +98,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
99 98
100 if(!project->isEmpty("MAKEFILE")) 99 t << "MAKEFILE = " << (project->isEmpty("MAKEFILE") ? QString("Makefile") : var("MAKEFILE")) << endl;
101 t << "MAKEFILE=" << var("MAKEFILE") << endl;
102 t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; 100 t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
@@ -106,3 +104,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
106 t << endl << endl; 104 t << endl << endl;
107 t << "all: qmake_all $(SUBTARGETS)" << endl << endl; 105 t << "all: $(MAKEFILE) $(SUBTARGETS)" << endl << endl;
108 106
@@ -116,4 +114,2 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
116 t << mkfile << ":"; 114 t << mkfile << ":";
117 if(project->variables()["QMAKE_NOFORCE"].isEmpty())
118 t << " FORCE";
119 if(have_dir) 115 if(have_dir)
@@ -147,2 +143,12 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
147 143
144 if (project->isActiveConfig("ordered")) { // generate dependencies
145 for( it.toFirst(); it.current(); ) {
146 QString tar = it.current()->target;
147 ++it;
148 if (it.current())
149 t << it.current()->target << ": " << tar << endl;
150 }
151 t << endl;
152 }
153
148 if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) 154 if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1)
@@ -177,7 +183,14 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
177 183
178 QString targs[] = { QString("clean"), QString("install"), QString("mocclean"), QString::null }; 184 QStringList targs;
179 for(int x = 0; targs[x] != QString::null; x++) { 185 targs << "clean" << "install_subdirs" << "mocables" << "uicables" << "uiclean" << "mocclean";
180 t << targs[x] << ": qmake_all"; 186 targs += project->values("SUBDIR_TARGETS");
181 if(targs[x] == "clean") 187 for(QStringList::Iterator targ_it = targs.begin(); targ_it != targs.end(); ++targ_it) {
182 t << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ", ""); 188 t << (*targ_it) << ": qmake_all";
189 QString targ = (*targ_it);
190 if(targ == "install_subdirs")
191 targ = "install";
192 else if(targ == "uninstall_subdirs")
193 targ = "uninstall";
194 if(targ == "clean")
195 t << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ", "");
183 if (!subdirs.isEmpty()) { 196 if (!subdirs.isEmpty()) {
@@ -189,3 +202,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
189 QString in_file = " -f " + (*it)->makefile; 202 QString in_file = " -f " + (*it)->makefile;
190 t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x]; 203 t << "\n\t" << "$(MAKE) " << in_file << " " << targ;
191 if(have_dir) { 204 if(have_dir) {
@@ -204,2 +217,28 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
204 217
218 //installations
219 project->variables()["INSTALLDEPS"] += "install_subdirs";
220 project->variables()["UNINSTALLDEPS"] += "uninstall_subdirs";
221 writeInstalls(t, "INSTALLS");
222
223 // user defined targets
224 QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
225 for(QStringList::Iterator sit = qut.begin(); sit != qut.end(); ++sit) {
226 QString targ = var((*sit) + ".target"),
227 cmd = var((*sit) + ".commands"), deps;
228 if(targ.isEmpty())
229 targ = (*sit);
230 QStringList &deplist = project->variables()[(*sit) + ".depends"];
231 for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
232 QString dep = var((*dep_it) + ".target");
233 if(dep.isEmpty())
234 dep = (*dep_it);
235 deps += " " + dep;
236 }
237 if(!project->variables()["QMAKE_NOFORCE"].isEmpty() &&
238 project->variables()[(*sit) + ".CONFIG"].findIndex("phony") != -1)
239 deps += QString(" ") + "FORCE";
240 t << "\n\n" << targ << ":" << deps << "\n\t"
241 << cmd;
242 }
243
205 if(project->variables()["QMAKE_NOFORCE"].isEmpty()) 244 if(project->variables()["QMAKE_NOFORCE"].isEmpty())
@@ -228,8 +267,6 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem
228 } 267 }
229 if(dir.exists(dllStem + Option::prl_ext)) { 268 QMakeMetaInfo libinfo;
230 QMakeProject proj; 269 if(libinfo.readLib(bd + dllStem)) {
231 if(proj.read(bd + dllStem + Option::prl_ext, QDir::currentDirPath(), TRUE)) { 270 if(!libinfo.isEmpty("QMAKE_PRL_VERSION"))
232 if(!proj.isEmpty("QMAKE_PRL_VERSION")) 271 biggest = QMAX(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt());
233 biggest = QMAX(biggest, proj.first("QMAKE_PRL_VERSION").replace(".", "").toInt());
234 }
235 } 272 }
@@ -238,2 +275,38 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem
238 275
276QString
277Win32MakefileGenerator::findDependency(const QString &dep)
278{
279 {
280 QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
281 for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) {
282 QString targ = var((*it) + ".target");
283 if(targ.isEmpty())
284 targ = (*it);
285 if(targ.endsWith(dep))
286 return targ;
287 }
288 }
289 {
290 QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"];
291 for(QStringList::Iterator it = quc.begin(); it != quc.end(); ++it) {
292 QString tmp_out = project->variables()[(*it) + ".output"].first();
293 QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" ");
294 if(tmp_out.isEmpty() || tmp_cmd.isEmpty())
295 continue;
296 QStringList &tmp = project->variables()[(*it) + ".input"];
297 for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
298 QStringList &inputs = project->variables()[(*it2)];
299 for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
300 QString out = tmp_out;
301 QFileInfo fi(Option::fixPathToLocalOS((*input)));
302 out.replace("${QMAKE_FILE_BASE}", fi.baseName());
303 out.replace("${QMAKE_FILE_NAME}", fi.fileName());
304 if(out.endsWith(dep))
305 return out;
306 }
307 }
308 }
309 }
310 return MakefileGenerator::findDependency(dep);
311}
239 312
@@ -280,3 +353,3 @@ Win32MakefileGenerator::findLibraries(const QString &where)
280 extension += ".lib"; 353 extension += ".lib";
281 if(QFile::exists(mdd->local_dir + Option::dir_sep + lib + Option::prl_ext) || 354 if(QMakeMetaInfo::libExists(mdd->local_dir + Option::dir_sep + lib) ||
282 QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) { 355 QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) {
@@ -305,22 +378,24 @@ Win32MakefileGenerator::findLibraries(const QString &where)
305 } 378 }
306 if(file.endsWith(".lib")) { 379 if (!project->variables()["QMAKE_QT_DLL"].isEmpty()) {
307 file = file.left(file.length() - 4); 380 if(file.endsWith(".lib")) {
308 if(!file.at(file.length()-1).isNumber()) { 381 file = file.left(file.length() - 4);
309 for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) { 382 if(!file.at(file.length()-1).isNumber()) {
310 QString lib_tmpl(file + "%1" + ".lib"); 383 for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) {
311 int ver = findHighestVersion(mdd->local_dir, file); 384 QString lib_tmpl(file + "%1" + ".lib");
312 if(ver != -1) { 385 int ver = findHighestVersion(mdd->local_dir, file);
313 if(ver) 386 if(ver != -1) {
314 lib_tmpl = lib_tmpl.arg(ver); 387 if(ver)
315 else 388 lib_tmpl = lib_tmpl.arg(ver);
316 lib_tmpl = lib_tmpl.arg(""); 389 else
317 if(slsh != -1) { 390 lib_tmpl = lib_tmpl.arg("");
318 QString dir = mdd->real_dir; 391 if(slsh != -1) {
319 if(!dir.endsWith(Option::dir_sep)) 392 QString dir = mdd->real_dir;
320 dir += Option::dir_sep; 393 if(!dir.endsWith(Option::dir_sep))
321 lib_tmpl.prepend(dir); 394 dir += Option::dir_sep;
395 lib_tmpl.prepend(dir);
396 }
397 modified_opt = TRUE;
398 (*it) = lib_tmpl;
399 break;
322 } 400 }
323 modified_opt = TRUE;
324 (*it) = lib_tmpl;
325 break;
326 } 401 }