author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff) | |
tree | e6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/generators/win32/winmakefile.cpp | |
parent | 86703e8a5527ef114facd02c005b6b3a7e62e263 (diff) | |
download | opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2 |
update qmake to 1.05a
Diffstat (limited to 'qmake/generators/win32/winmakefile.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 126 |
1 files changed, 83 insertions, 43 deletions
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index a07c921..bc3fed9 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp | |||
@@ -119,7 +119,6 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
119 | if(have_dir) | 119 | if(have_dir) |
120 | t << "\n\t" << "cd " << (*it)->directory; | 120 | t << "\n\t" << "cd " << (*it)->directory; |
121 | t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); | 121 | t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); |
122 | if((*it)->makefile != "$(MAKEFILE)") | ||
123 | t << " -o " << (*it)->makefile; | 122 | t << " -o " << (*it)->makefile; |
124 | if(have_dir) { | 123 | if(have_dir) { |
125 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; | 124 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; |
@@ -136,7 +135,6 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
136 | if(have_dir) | 135 | if(have_dir) |
137 | t << "\n\t" << "cd " << (*it)->directory; | 136 | t << "\n\t" << "cd " << (*it)->directory; |
138 | t << "\n\t" << "$(MAKE)"; | 137 | t << "\n\t" << "$(MAKE)"; |
139 | if((*it)->makefile != "$(MAKEFILE)") | ||
140 | t << " -f " << (*it)->makefile; | 138 | t << " -f " << (*it)->makefile; |
141 | if(have_dir) { | 139 | if(have_dir) { |
142 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; | 140 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; |
@@ -155,14 +153,16 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
155 | if ( !subdirs.isEmpty() ) { | 153 | if ( !subdirs.isEmpty() ) { |
156 | for( it.toFirst(); it.current(); ++it) { | 154 | for( it.toFirst(); it.current(); ++it) { |
157 | QString subdir = (*it)->directory; | 155 | QString subdir = (*it)->directory; |
156 | QString profile = (*it)->profile; | ||
158 | int subLevels = subdir.contains(Option::dir_sep) + 1; | 157 | int subLevels = subdir.contains(Option::dir_sep) + 1; |
159 | t << "\n\t" | 158 | t << "\n\t" |
160 | << "cd " << subdir << "\n\t"; | 159 | << "cd " << subdir << "\n\t"; |
161 | int lastSlash = subdir.findRev(Option::dir_sep); | 160 | int lastSlash = subdir.findRev(Option::dir_sep); |
162 | if(lastSlash != -1) | 161 | if(lastSlash != -1) |
163 | subdir = subdir.mid( lastSlash + 1 ); | 162 | subdir = subdir.mid( lastSlash + 1 ); |
164 | t << "$(QMAKE) " << subdir << ".pro" | 163 | t << "$(QMAKE) " |
165 | << (!project->isEmpty("MAKEFILE") ? QString(" -o ") + var("MAKEFILE") : QString("")) | 164 | << ( !profile.isEmpty() ? profile : subdir + ".pro" ) |
165 | << " -o " << (*it)->makefile | ||
166 | << " " << buildArgs() << "\n\t" | 166 | << " " << buildArgs() << "\n\t" |
167 | << "@cd .."; | 167 | << "@cd .."; |
168 | for(int i = 1; i < subLevels; i++ ) | 168 | for(int i = 1; i < subLevels; i++ ) |
@@ -186,9 +186,7 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
186 | bool have_dir = !(*it)->directory.isEmpty(); | 186 | bool have_dir = !(*it)->directory.isEmpty(); |
187 | if(have_dir) | 187 | if(have_dir) |
188 | t << "\n\t" << "cd " << (*it)->directory; | 188 | t << "\n\t" << "cd " << (*it)->directory; |
189 | QString in_file; | 189 | QString in_file = " -f " + (*it)->makefile; |
190 | if((*it)->makefile != "$(MAKEFILE)") | ||
191 | in_file = " -f " + (*it)->makefile; | ||
192 | t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x]; | 190 | t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x]; |
193 | if(have_dir) { | 191 | if(have_dir) { |
194 | t << "\n\t" << "@cd .."; | 192 | t << "\n\t" << "@cd .."; |
@@ -210,27 +208,31 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t) | |||
210 | 208 | ||
211 | 209 | ||
212 | int | 210 | int |
213 | Win32MakefileGenerator::findHighestVersion(const QString &d, const | 211 | Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem) |
214 | QString &stem) | ||
215 | { | 212 | { |
216 | if(!QFile::exists(Option::fixPathToLocalOS(d))) | 213 | QString bd = Option::fixPathToLocalOS(d, TRUE); |
214 | if(!QFile::exists(bd)) | ||
217 | return -1; | 215 | return -1; |
218 | if(!project->variables()["QMAKE_" + stem.upper() + | 216 | if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty()) |
219 | "_VERSION_OVERRIDE"].isEmpty()) | 217 | return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt(); |
220 | return project->variables()["QMAKE_" + stem.upper() + | 218 | |
221 | "_VERSION_OVERRIDE"].first().toInt(); | ||
222 | QString bd = d; | ||
223 | fixEnvVariables(bd); | ||
224 | QDir dir(bd); | 219 | QDir dir(bd); |
225 | int biggest=-1; | 220 | int biggest=-1; |
226 | QStringList entries = dir.entryList(); | 221 | QStringList entries = dir.entryList(); |
227 | QRegExp regx( "(" + stem + "([0-9]*)).lib", FALSE ); | 222 | QString dllStem = stem + QTDLL_POSTFIX; |
228 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); | 223 | QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE ); |
229 | ++it) { | 224 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { |
230 | if(regx.exactMatch((*it))) | 225 | if(regx.exactMatch((*it))) |
231 | biggest = QMAX(biggest, (regx.cap(1) == stem || | 226 | biggest = QMAX(biggest, (regx.cap(1) == dllStem || |
232 | regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); | 227 | regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); |
233 | } | 228 | } |
229 | if(dir.exists(dllStem + Option::prl_ext)) { | ||
230 | QMakeProject proj; | ||
231 | if(proj.read(bd + dllStem + Option::prl_ext, QDir::currentDirPath(), TRUE)) { | ||
232 | if(!proj.isEmpty("QMAKE_PRL_VERSION")) | ||
233 | biggest = QMAX(biggest, proj.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); | ||
234 | } | ||
235 | } | ||
234 | return biggest; | 236 | return biggest; |
235 | } | 237 | } |
236 | 238 | ||
@@ -241,61 +243,99 @@ Win32MakefileGenerator::findLibraries(const QString &where) | |||
241 | 243 | ||
242 | QStringList &l = project->variables()[where]; | 244 | QStringList &l = project->variables()[where]; |
243 | QPtrList<MakefileDependDir> dirs; | 245 | QPtrList<MakefileDependDir> dirs; |
246 | { | ||
247 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; | ||
248 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { | ||
249 | QString r = (*libpathit), l = r; | ||
250 | fixEnvVariables(l); | ||
251 | dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); | ||
252 | } | ||
253 | } | ||
244 | dirs.setAutoDelete(TRUE); | 254 | dirs.setAutoDelete(TRUE); |
245 | for(QStringList::Iterator it = l.begin(); it != l.end(); ) { | 255 | for(QStringList::Iterator it = l.begin(); it != l.end(); ) { |
246 | QString opt = (*it); | 256 | QChar quote; |
247 | bool remove = FALSE; | 257 | bool modified_opt = FALSE, remove = FALSE; |
248 | if(opt.startsWith("-L") || opt.startsWith("/L")) { | 258 | QString opt = (*it).stripWhiteSpace(); |
249 | QString r = opt.right(opt.length() - 2), l = Option::fixPathToLocalOS(r); | 259 | if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) { |
260 | quote = opt[0]; | ||
261 | opt = opt.mid(1, opt.length()-2); | ||
262 | } | ||
263 | if(opt.startsWith("/LIBPATH:")) { | ||
264 | QString r = opt.mid(9), l = Option::fixPathToLocalOS(r); | ||
265 | dirs.append(new MakefileDependDir(r.replace("\"",""), | ||
266 | l.replace("\"",""))); | ||
267 | } else if(opt.startsWith("-L") || opt.startsWith("/L")) { | ||
268 | QString r = opt.mid(2), l = Option::fixPathToLocalOS(r); | ||
250 | dirs.append(new MakefileDependDir(r.replace("\"",""), | 269 | dirs.append(new MakefileDependDir(r.replace("\"",""), |
251 | l.replace("\"",""))); | 270 | l.replace("\"",""))); |
252 | remove = TRUE; | 271 | remove = TRUE; //we eat this switch |
253 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) { | 272 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) { |
254 | QString lib = opt.right(opt.length() - 2), out; | 273 | QString lib = opt.right(opt.length() - 2), out; |
255 | if(!lib.isEmpty()) { | 274 | if(!lib.isEmpty()) { |
256 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { | 275 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { |
276 | QString extension; | ||
257 | int ver = findHighestVersion(mdd->local_dir, lib); | 277 | int ver = findHighestVersion(mdd->local_dir, lib); |
258 | if(ver > 0) | 278 | if(ver > 0) |
259 | lib += QString::number(ver); | 279 | extension += QString::number(ver); |
260 | lib += ".lib"; | 280 | extension += ".lib"; |
261 | if(QFile::exists(mdd->local_dir + Option::dir_sep + lib)) { | 281 | if(QFile::exists(mdd->local_dir + Option::dir_sep + lib + Option::prl_ext) || |
262 | out = mdd->real_dir + Option::dir_sep + lib; | 282 | QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) { |
283 | out = mdd->real_dir + Option::dir_sep + lib + extension; | ||
263 | break; | 284 | break; |
264 | } | 285 | } |
265 | } | 286 | } |
266 | } | 287 | } |
267 | if(out.isEmpty()) | 288 | if(out.isEmpty()) { |
268 | remove = TRUE; | 289 | remove = TRUE; //just eat it since we cannot find one.. |
269 | else | 290 | } else { |
291 | modified_opt = TRUE; | ||
270 | (*it) = out; | 292 | (*it) = out; |
293 | } | ||
271 | } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { | 294 | } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { |
272 | QString dir, file = opt; | 295 | QPtrList<MakefileDependDir> lib_dirs; |
296 | QString file = opt; | ||
273 | int slsh = file.findRev(Option::dir_sep); | 297 | int slsh = file.findRev(Option::dir_sep); |
274 | if(slsh != -1) { | 298 | if(slsh != -1) { |
275 | dir = file.left(slsh+1); | 299 | QString r = file.left(slsh+1), l = r; |
300 | fixEnvVariables(l); | ||
301 | lib_dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); | ||
276 | file = file.right(file.length() - slsh - 1); | 302 | file = file.right(file.length() - slsh - 1); |
303 | } else { | ||
304 | lib_dirs = dirs; | ||
277 | } | 305 | } |
278 | if ( !(project->variables()["QMAKE_QT_DLL"].isEmpty() && (file == "qt.lib" || file == "qt-mt.lib")) ) { | ||
279 | if(file.endsWith(".lib")) { | 306 | if(file.endsWith(".lib")) { |
280 | file = file.left(file.length() - 4); | 307 | file = file.left(file.length() - 4); |
281 | if(!file.at(file.length()-1).isNumber()) { | 308 | if(!file.at(file.length()-1).isNumber()) { |
282 | int ver = findHighestVersion(dir, file); | 309 | for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) { |
310 | QString lib_tmpl(file + "%1" + ".lib"); | ||
311 | int ver = findHighestVersion(mdd->local_dir, file); | ||
283 | if(ver != -1) { | 312 | if(ver != -1) { |
284 | file = QString(dir + file + "%1" + ".lib"); | ||
285 | if(ver) | 313 | if(ver) |
286 | (*it) = file.arg(ver); | 314 | lib_tmpl = lib_tmpl.arg(ver); |
287 | else | 315 | else |
288 | (*it) = file.arg(""); | 316 | lib_tmpl = lib_tmpl.arg(""); |
317 | if(slsh != -1) { | ||
318 | QString dir = mdd->real_dir; | ||
319 | if(!dir.endsWith(Option::dir_sep)) | ||
320 | dir += Option::dir_sep; | ||
321 | lib_tmpl.prepend(dir); | ||
322 | } | ||
323 | modified_opt = TRUE; | ||
324 | (*it) = lib_tmpl; | ||
325 | break; | ||
289 | } | 326 | } |
290 | } | 327 | } |
291 | } | 328 | } |
292 | } | 329 | } |
293 | } | 330 | } |
294 | if(remove) | 331 | if(remove) { |
295 | it = l.remove(it); | 332 | it = l.remove(it); |
296 | else | 333 | } else { |
334 | if(!quote.isNull() && modified_opt) | ||
335 | (*it) = quote + (*it) + quote; | ||
297 | ++it; | 336 | ++it; |
298 | } | 337 | } |
338 | } | ||
299 | return TRUE; | 339 | return TRUE; |
300 | } | 340 | } |
301 | 341 | ||
@@ -323,8 +363,8 @@ Win32MakefileGenerator::processPrlFiles() | |||
323 | QStringList &l = project->variables()[where]; | 363 | QStringList &l = project->variables()[where]; |
324 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 364 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
325 | QString opt = (*it); | 365 | QString opt = (*it); |
326 | if(opt.left(1) == "/") { | 366 | if(opt.startsWith("/")) { |
327 | if(opt.left(9) == "/LIBPATH:") { | 367 | if(opt.startsWith("/LIBPATH:")) { |
328 | QString r = opt.mid(9), l = r; | 368 | QString r = opt.mid(9), l = r; |
329 | fixEnvVariables(l); | 369 | fixEnvVariables(l); |
330 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 370 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |