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/winmakefile.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/winmakefile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 161 |
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,56 +1,55 @@ | |||
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 | ** |
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 |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** 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 | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** 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. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "winmakefile.h" | 36 | #include "winmakefile.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include "project.h" | 38 | #include "project.h" |
39 | #include "meta.h" | ||
41 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
42 | #include <qstring.h> | 41 | #include <qstring.h> |
43 | #include <qdict.h> | 42 | #include <qdict.h> |
44 | #include <qregexp.h> | 43 | #include <qregexp.h> |
45 | #include <qstringlist.h> | 44 | #include <qstringlist.h> |
46 | #include <qdir.h> | 45 | #include <qdir.h> |
47 | 46 | ||
48 | 47 | ||
49 | Win32MakefileGenerator::Win32MakefileGenerator(QMakeProject *p) : MakefileGenerator(p) | 48 | Win32MakefileGenerator::Win32MakefileGenerator(QMakeProject *p) : MakefileGenerator(p) |
50 | { | 49 | { |
51 | 50 | ||
52 | } | 51 | } |
53 | 52 | ||
54 | 53 | ||
55 | struct SubDir | 54 | struct SubDir |
56 | { | 55 | { |
@@ -84,171 +83,245 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
84 | sd->directory = sd->directory.left(sd->directory.length() - 1); | 83 | sd->directory = sd->directory.left(sd->directory.length() - 1); |
85 | if(!sd->profile.isEmpty()) { | 84 | if(!sd->profile.isEmpty()) { |
86 | QString basename = sd->directory; | 85 | QString basename = sd->directory; |
87 | int new_slsh = basename.findRev(Option::dir_sep); | 86 | int new_slsh = basename.findRev(Option::dir_sep); |
88 | if(new_slsh != -1) | 87 | if(new_slsh != -1) |
89 | basename = basename.mid(new_slsh+1); | 88 | basename = basename.mid(new_slsh+1); |
90 | if(sd->profile != basename + ".pro") | 89 | if(sd->profile != basename + ".pro") |
91 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro | 90 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro |
92 | } | 91 | } |
93 | sd->target = "sub-" + (*it); | 92 | sd->target = "sub-" + (*it); |
94 | sd->target.replace('/', '-'); | 93 | sd->target.replace('/', '-'); |
95 | sd->target.replace('.', '_'); | 94 | sd->target.replace('.', '_'); |
96 | } | 95 | } |
97 | } | 96 | } |
98 | QPtrListIterator<SubDir> it(subdirs); | 97 | QPtrListIterator<SubDir> it(subdirs); |
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; |
103 | t << "SUBTARGETS= "; | 101 | t << "SUBTARGETS= "; |
104 | for( it.toFirst(); it.current(); ++it) | 102 | for( it.toFirst(); it.current(); ++it) |
105 | t << " \\\n\t\t" << it.current()->target; | 103 | t << " \\\n\t\t" << it.current()->target; |
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 | ||
109 | for( it.toFirst(); it.current(); ++it) { | 107 | for( it.toFirst(); it.current(); ++it) { |
110 | bool have_dir = !(*it)->directory.isEmpty(); | 108 | bool have_dir = !(*it)->directory.isEmpty(); |
111 | 109 | ||
112 | //make the makefile | 110 | //make the makefile |
113 | QString mkfile = (*it)->makefile; | 111 | QString mkfile = (*it)->makefile; |
114 | if(have_dir) | 112 | if(have_dir) |
115 | mkfile.prepend((*it)->directory + Option::dir_sep); | 113 | mkfile.prepend((*it)->directory + Option::dir_sep); |
116 | t << mkfile << ":"; | 114 | t << mkfile << ":"; |
117 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | ||
118 | t << " FORCE"; | ||
119 | if(have_dir) | 115 | if(have_dir) |
120 | t << "\n\t" << "cd " << (*it)->directory; | 116 | t << "\n\t" << "cd " << (*it)->directory; |
121 | t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); | 117 | t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); |
122 | t << " -o " << (*it)->makefile; | 118 | t << " -o " << (*it)->makefile; |
123 | if(have_dir) { | 119 | if(have_dir) { |
124 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; | 120 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; |
125 | t << "\n\t" << "@cd .."; | 121 | t << "\n\t" << "@cd .."; |
126 | for(int i = 1; i < subLevels; i++ ) | 122 | for(int i = 1; i < subLevels; i++ ) |
127 | t << Option::dir_sep << ".."; | 123 | t << Option::dir_sep << ".."; |
128 | } | 124 | } |
129 | t << endl; | 125 | t << endl; |
130 | 126 | ||
131 | //now actually build | 127 | //now actually build |
132 | t << (*it)->target << ": " << mkfile; | 128 | t << (*it)->target << ": " << mkfile; |
133 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | 129 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) |
134 | t << " FORCE"; | 130 | t << " FORCE"; |
135 | if(have_dir) | 131 | if(have_dir) |
136 | t << "\n\t" << "cd " << (*it)->directory; | 132 | t << "\n\t" << "cd " << (*it)->directory; |
137 | t << "\n\t" << "$(MAKE)"; | 133 | t << "\n\t" << "$(MAKE)"; |
138 | t << " -f " << (*it)->makefile; | 134 | t << " -f " << (*it)->makefile; |
139 | if(have_dir) { | 135 | if(have_dir) { |
140 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; | 136 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; |
141 | t << "\n\t" << "@cd .."; | 137 | t << "\n\t" << "@cd .."; |
142 | for(int i = 1; i < subLevels; i++ ) | 138 | for(int i = 1; i < subLevels; i++ ) |
143 | t << Option::dir_sep << ".."; | 139 | t << Option::dir_sep << ".."; |
144 | } | 140 | } |
145 | t << endl << endl; | 141 | t << endl << endl; |
146 | } | 142 | } |
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) |
149 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); | 155 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); |
150 | writeMakeQmake(t); | 156 | writeMakeQmake(t); |
151 | 157 | ||
152 | t << "qmake_all:"; | 158 | t << "qmake_all:"; |
153 | if ( !subdirs.isEmpty() ) { | 159 | if ( !subdirs.isEmpty() ) { |
154 | for( it.toFirst(); it.current(); ++it) { | 160 | for( it.toFirst(); it.current(); ++it) { |
155 | QString subdir = (*it)->directory; | 161 | QString subdir = (*it)->directory; |
156 | QString profile = (*it)->profile; | 162 | QString profile = (*it)->profile; |
157 | int subLevels = subdir.contains(Option::dir_sep) + 1; | 163 | int subLevels = subdir.contains(Option::dir_sep) + 1; |
158 | t << "\n\t" | 164 | t << "\n\t" |
159 | << "cd " << subdir << "\n\t"; | 165 | << "cd " << subdir << "\n\t"; |
160 | int lastSlash = subdir.findRev(Option::dir_sep); | 166 | int lastSlash = subdir.findRev(Option::dir_sep); |
161 | if(lastSlash != -1) | 167 | if(lastSlash != -1) |
162 | subdir = subdir.mid( lastSlash + 1 ); | 168 | subdir = subdir.mid( lastSlash + 1 ); |
163 | t << "$(QMAKE) " | 169 | t << "$(QMAKE) " |
164 | << ( !profile.isEmpty() ? profile : subdir + ".pro" ) | 170 | << ( !profile.isEmpty() ? profile : subdir + ".pro" ) |
165 | << " -o " << (*it)->makefile | 171 | << " -o " << (*it)->makefile |
166 | << " " << buildArgs() << "\n\t" | 172 | << " " << buildArgs() << "\n\t" |
167 | << "@cd .."; | 173 | << "@cd .."; |
168 | for(int i = 1; i < subLevels; i++ ) | 174 | for(int i = 1; i < subLevels; i++ ) |
169 | t << Option::dir_sep << ".."; | 175 | t << Option::dir_sep << ".."; |
170 | } | 176 | } |
171 | } else { | 177 | } else { |
172 | // Borland make does not like empty an empty command section, so insert | 178 | // Borland make does not like empty an empty command section, so insert |
173 | // a dummy command. | 179 | // a dummy command. |
174 | t << "\n\t" << "@cd ."; | 180 | t << "\n\t" << "@cd ."; |
175 | } | 181 | } |
176 | t << endl << endl; | 182 | t << endl << endl; |
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()) { |
184 | for( it.toFirst(); it.current(); ++it) { | 197 | for( it.toFirst(); it.current(); ++it) { |
185 | int subLevels = (*it)->directory.contains(Option::dir_sep) + 1; | 198 | int subLevels = (*it)->directory.contains(Option::dir_sep) + 1; |
186 | bool have_dir = !(*it)->directory.isEmpty(); | 199 | bool have_dir = !(*it)->directory.isEmpty(); |
187 | if(have_dir) | 200 | if(have_dir) |
188 | t << "\n\t" << "cd " << (*it)->directory; | 201 | t << "\n\t" << "cd " << (*it)->directory; |
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) { |
192 | t << "\n\t" << "@cd .."; | 205 | t << "\n\t" << "@cd .."; |
193 | for(int i = 1; i < subLevels; i++ ) | 206 | for(int i = 1; i < subLevels; i++ ) |
194 | t << Option::dir_sep << ".."; | 207 | t << Option::dir_sep << ".."; |
195 | } | 208 | } |
196 | } | 209 | } |
197 | } else { | 210 | } else { |
198 | // Borland make does not like empty an empty command section, so | 211 | // Borland make does not like empty an empty command section, so |
199 | // insert a dummy command. | 212 | // insert a dummy command. |
200 | t << "\n\t" << "@cd ."; | 213 | t << "\n\t" << "@cd ."; |
201 | } | 214 | } |
202 | t << endl << endl; | 215 | t << endl << endl; |
203 | } | 216 | } |
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()) |
206 | t << "FORCE:" << endl << endl; | 245 | t << "FORCE:" << endl << endl; |
207 | } | 246 | } |
208 | 247 | ||
209 | 248 | ||
210 | int | 249 | int |
211 | Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem) | 250 | Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem) |
212 | { | 251 | { |
213 | QString bd = Option::fixPathToLocalOS(d, TRUE); | 252 | QString bd = Option::fixPathToLocalOS(d, TRUE); |
214 | if(!QFile::exists(bd)) | 253 | if(!QFile::exists(bd)) |
215 | return -1; | 254 | return -1; |
216 | if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty()) | 255 | if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty()) |
217 | return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt(); | 256 | return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt(); |
218 | 257 | ||
219 | QDir dir(bd); | 258 | QDir dir(bd); |
220 | int biggest=-1; | 259 | int biggest=-1; |
221 | QStringList entries = dir.entryList(); | 260 | QStringList entries = dir.entryList(); |
222 | QString dllStem = stem + QTDLL_POSTFIX; | 261 | QString dllStem = stem + QTDLL_POSTFIX; |
223 | QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE ); | 262 | QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE ); |
224 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { | 263 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { |
225 | if(regx.exactMatch((*it))) | 264 | if(regx.exactMatch((*it))) |
226 | biggest = QMAX(biggest, (regx.cap(1) == dllStem || | 265 | biggest = QMAX(biggest, (regx.cap(1) == dllStem || |
227 | regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); | 266 | regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); |
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 | } |
236 | return biggest; | 273 | return biggest; |
237 | } | 274 | } |
238 | 275 | ||
276 | QString | ||
277 | Win32MakefileGenerator::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 | ||
240 | bool | 313 | bool |
241 | Win32MakefileGenerator::findLibraries(const QString &where) | 314 | Win32MakefileGenerator::findLibraries(const QString &where) |
242 | { | 315 | { |
243 | 316 | ||
244 | QStringList &l = project->variables()[where]; | 317 | QStringList &l = project->variables()[where]; |
245 | QPtrList<MakefileDependDir> dirs; | 318 | QPtrList<MakefileDependDir> dirs; |
246 | { | 319 | { |
247 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; | 320 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; |
248 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { | 321 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { |
249 | QString r = (*libpathit), l = r; | 322 | QString r = (*libpathit), l = r; |
250 | fixEnvVariables(l); | 323 | fixEnvVariables(l); |
251 | dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); | 324 | dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); |
252 | } | 325 | } |
253 | } | 326 | } |
254 | dirs.setAutoDelete(TRUE); | 327 | dirs.setAutoDelete(TRUE); |
@@ -265,77 +338,79 @@ Win32MakefileGenerator::findLibraries(const QString &where) | |||
265 | dirs.append(new MakefileDependDir(r.replace("\"",""), | 338 | dirs.append(new MakefileDependDir(r.replace("\"",""), |
266 | l.replace("\"",""))); | 339 | l.replace("\"",""))); |
267 | } else if(opt.startsWith("-L") || opt.startsWith("/L")) { | 340 | } else if(opt.startsWith("-L") || opt.startsWith("/L")) { |
268 | QString r = opt.mid(2), l = Option::fixPathToLocalOS(r); | 341 | QString r = opt.mid(2), l = Option::fixPathToLocalOS(r); |
269 | dirs.append(new MakefileDependDir(r.replace("\"",""), | 342 | dirs.append(new MakefileDependDir(r.replace("\"",""), |
270 | l.replace("\"",""))); | 343 | l.replace("\"",""))); |
271 | remove = TRUE; //we eat this switch | 344 | remove = TRUE; //we eat this switch |
272 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) { | 345 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) { |
273 | QString lib = opt.right(opt.length() - 2), out; | 346 | QString lib = opt.right(opt.length() - 2), out; |
274 | if(!lib.isEmpty()) { | 347 | if(!lib.isEmpty()) { |
275 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { | 348 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { |
276 | QString extension; | 349 | QString extension; |
277 | int ver = findHighestVersion(mdd->local_dir, lib); | 350 | int ver = findHighestVersion(mdd->local_dir, lib); |
278 | if(ver > 0) | 351 | if(ver > 0) |
279 | extension += QString::number(ver); | 352 | extension += QString::number(ver); |
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)) { |
283 | out = mdd->real_dir + Option::dir_sep + lib + extension; | 356 | out = mdd->real_dir + Option::dir_sep + lib + extension; |
284 | break; | 357 | break; |
285 | } | 358 | } |
286 | } | 359 | } |
287 | } | 360 | } |
288 | if(out.isEmpty()) { | 361 | if(out.isEmpty()) { |
289 | remove = TRUE; //just eat it since we cannot find one.. | 362 | remove = TRUE; //just eat it since we cannot find one.. |
290 | } else { | 363 | } else { |
291 | modified_opt = TRUE; | 364 | modified_opt = TRUE; |
292 | (*it) = out; | 365 | (*it) = out; |
293 | } | 366 | } |
294 | } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { | 367 | } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { |
295 | QPtrList<MakefileDependDir> lib_dirs; | 368 | QPtrList<MakefileDependDir> lib_dirs; |
296 | QString file = opt; | 369 | QString file = opt; |
297 | int slsh = file.findRev(Option::dir_sep); | 370 | int slsh = file.findRev(Option::dir_sep); |
298 | if(slsh != -1) { | 371 | if(slsh != -1) { |
299 | QString r = file.left(slsh+1), l = r; | 372 | QString r = file.left(slsh+1), l = r; |
300 | fixEnvVariables(l); | 373 | fixEnvVariables(l); |
301 | lib_dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); | 374 | lib_dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); |
302 | file = file.right(file.length() - slsh - 1); | 375 | file = file.right(file.length() - slsh - 1); |
303 | } else { | 376 | } else { |
304 | lib_dirs = dirs; | 377 | lib_dirs = dirs; |
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 | } |
327 | } | 402 | } |
328 | } | 403 | } |
329 | } | 404 | } |
330 | } | 405 | } |
331 | if(remove) { | 406 | if(remove) { |
332 | it = l.remove(it); | 407 | it = l.remove(it); |
333 | } else { | 408 | } else { |
334 | if(!quote.isNull() && modified_opt) | 409 | if(!quote.isNull() && modified_opt) |
335 | (*it) = quote + (*it) + quote; | 410 | (*it) = quote + (*it) + quote; |
336 | ++it; | 411 | ++it; |
337 | } | 412 | } |
338 | } | 413 | } |
339 | return TRUE; | 414 | return TRUE; |
340 | } | 415 | } |
341 | 416 | ||