-rw-r--r-- | qmake/project.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp index 96cdad8..44eb503 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp | |||
@@ -259,385 +259,385 @@ QMakeProject::parse(QString t, QMap<QString, QStringList> &place) | |||
259 | op.replace(QRegExp("\\s"), ""); | 259 | op.replace(QRegExp("\\s"), ""); |
260 | 260 | ||
261 | SKIP_WS(d); | 261 | SKIP_WS(d); |
262 | QString vals(d); /* vals now contains the space separated list of values */ | 262 | QString vals(d); /* vals now contains the space separated list of values */ |
263 | int rbraces = vals.contains('}'), lbraces = vals.contains('{'); | 263 | int rbraces = vals.contains('}'), lbraces = vals.contains('{'); |
264 | if(scope_block && rbraces - lbraces == 1) { | 264 | if(scope_block && rbraces - lbraces == 1) { |
265 | debug_msg(1, "Project Parser: %s:%d : Leaving block %d", parser.file.latin1(), | 265 | debug_msg(1, "Project Parser: %s:%d : Leaving block %d", parser.file.latin1(), |
266 | parser.line_no, scope_block); | 266 | parser.line_no, scope_block); |
267 | test_status = ((scope_flag & (0x01 << scope_block)) ? TestFound : TestSeek); | 267 | test_status = ((scope_flag & (0x01 << scope_block)) ? TestFound : TestSeek); |
268 | scope_block--; | 268 | scope_block--; |
269 | vals.truncate(vals.length()-1); | 269 | vals.truncate(vals.length()-1); |
270 | } else if(rbraces != lbraces) { | 270 | } else if(rbraces != lbraces) { |
271 | warn_msg(WarnParser, "Possible braces mismatch {%s} %s:%d", | 271 | warn_msg(WarnParser, "Possible braces mismatch {%s} %s:%d", |
272 | vals.latin1(), parser.file.latin1(), parser.line_no); | 272 | vals.latin1(), parser.file.latin1(), parser.line_no); |
273 | } | 273 | } |
274 | doVariableReplace(vals, place); | 274 | doVariableReplace(vals, place); |
275 | 275 | ||
276 | var = var.stripWhiteSpace(); | 276 | var = var.stripWhiteSpace(); |
277 | #undef SKIP_WS | 277 | #undef SKIP_WS |
278 | 278 | ||
279 | if(!var.isEmpty() && Option::mkfile::do_preprocess) { | 279 | if(!var.isEmpty() && Option::mkfile::do_preprocess) { |
280 | static QString last_file("*none*"); | 280 | static QString last_file("*none*"); |
281 | if(parser.file != last_file) { | 281 | if(parser.file != last_file) { |
282 | fprintf(stderr, "#file %s:%d\n", parser.file.latin1(), parser.line_no); | 282 | fprintf(stderr, "#file %s:%d\n", parser.file.latin1(), parser.line_no); |
283 | last_file = parser.file; | 283 | last_file = parser.file; |
284 | } | 284 | } |
285 | fprintf(stderr, "%s %s %s\n", var.latin1(), op.latin1(), vals.latin1()); | 285 | fprintf(stderr, "%s %s %s\n", var.latin1(), op.latin1(), vals.latin1()); |
286 | } | 286 | } |
287 | var = varMap(var); //backwards compatability | 287 | var = varMap(var); //backwards compatability |
288 | 288 | ||
289 | /* vallist is the broken up list of values */ | 289 | /* vallist is the broken up list of values */ |
290 | QStringList vallist = split_value_list(vals, (var == "DEPENDPATH" || var == "INCLUDEPATH")); | 290 | QStringList vallist = split_value_list(vals, (var == "DEPENDPATH" || var == "INCLUDEPATH")); |
291 | if(!vallist.grep("=").isEmpty()) | 291 | if(!vallist.grep("=").isEmpty()) |
292 | warn_msg(WarnParser, "Detected possible line continuation: {%s} %s:%d", | 292 | warn_msg(WarnParser, "Detected possible line continuation: {%s} %s:%d", |
293 | var.latin1(), parser.file.latin1(), parser.line_no); | 293 | var.latin1(), parser.file.latin1(), parser.line_no); |
294 | 294 | ||
295 | QStringList &varlist = place[var]; /* varlist is the list in the symbol table */ | 295 | QStringList &varlist = place[var]; /* varlist is the list in the symbol table */ |
296 | debug_msg(1, "Project Parser: %s:%d :%s: :%s: (%s)", parser.file.latin1(), parser.line_no, | 296 | debug_msg(1, "Project Parser: %s:%d :%s: :%s: (%s)", parser.file.latin1(), parser.line_no, |
297 | var.latin1(), op.latin1(), vallist.join(" :: ").latin1()); | 297 | var.latin1(), op.latin1(), vallist.join(" :: ").latin1()); |
298 | 298 | ||
299 | /* now do the operation */ | 299 | /* now do the operation */ |
300 | if(op == "~=") { | 300 | if(op == "~=") { |
301 | if(vallist.count() != 1) { | 301 | if(vallist.count() != 1) { |
302 | qmake_error_msg("~= operator only accepts one right hand paramater ('" + | 302 | qmake_error_msg("~= operator only accepts one right hand paramater ('" + |
303 | s + "')"); | 303 | s + "')"); |
304 | return FALSE; | 304 | return FALSE; |
305 | } | 305 | } |
306 | QString val(vallist.first()); | 306 | QString val(vallist.first()); |
307 | if(val.length() < 4 || val.at(0) != 's') { | 307 | if(val.length() < 4 || val.at(0) != 's') { |
308 | qmake_error_msg("~= operator only can handle s/// function ('" + | 308 | qmake_error_msg("~= operator only can handle s/// function ('" + |
309 | s + "')"); | 309 | s + "')"); |
310 | return FALSE; | 310 | return FALSE; |
311 | } | 311 | } |
312 | QChar sep = val.at(1); | 312 | QChar sep = val.at(1); |
313 | QStringList func = QStringList::split(sep, val, TRUE); | 313 | QStringList func = QStringList::split(sep, val, TRUE); |
314 | if(func.count() < 3 || func.count() > 4) { | 314 | if(func.count() < 3 || func.count() > 4) { |
315 | qmake_error_msg("~= operator only can handle s/// function ('" + | 315 | qmake_error_msg("~= operator only can handle s/// function ('" + |
316 | s + "')"); | 316 | s + "')"); |
317 | return FALSE; | 317 | return FALSE; |
318 | } | 318 | } |
319 | bool global = FALSE, case_sense = TRUE; | 319 | bool global = FALSE, case_sense = TRUE; |
320 | if(func.count() == 4) { | 320 | if(func.count() == 4) { |
321 | global = func[3].find('g') != -1; | 321 | global = func[3].find('g') != -1; |
322 | case_sense = func[3].find('i') == -1; | 322 | case_sense = func[3].find('i') == -1; |
323 | } | 323 | } |
324 | QRegExp regexp(func[1], case_sense); | 324 | QRegExp regexp(func[1], case_sense); |
325 | for(QStringList::Iterator varit = varlist.begin(); | 325 | for(QStringList::Iterator varit = varlist.begin(); |
326 | varit != varlist.end(); ++varit) { | 326 | varit != varlist.end(); ++varit) { |
327 | if((*varit).contains(regexp)) { | 327 | if((*varit).contains(regexp)) { |
328 | (*varit) = (*varit).replace(regexp, func[2]); | 328 | (*varit) = (*varit).replace(regexp, func[2]); |
329 | if(!global) | 329 | if(!global) |
330 | break; | 330 | break; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | } else { | 333 | } else { |
334 | if(op == "=") { | 334 | if(op == "=") { |
335 | if(!varlist.isEmpty()) | 335 | if(!varlist.isEmpty()) |
336 | warn_msg(WarnParser, "Operator=(%s) clears variables previously set: %s:%d", | 336 | warn_msg(WarnParser, "Operator=(%s) clears variables previously set: %s:%d", |
337 | var.latin1(), parser.file.latin1(), parser.line_no); | 337 | var.latin1(), parser.file.latin1(), parser.line_no); |
338 | varlist.clear(); | 338 | varlist.clear(); |
339 | } | 339 | } |
340 | for(QStringList::Iterator valit = vallist.begin(); | 340 | for(QStringList::Iterator valit = vallist.begin(); |
341 | valit != vallist.end(); ++valit) { | 341 | valit != vallist.end(); ++valit) { |
342 | if((*valit).isEmpty()) | 342 | if((*valit).isEmpty()) |
343 | continue; | 343 | continue; |
344 | if((op == "*=" && !(*varlist.find((*valit)))) || | 344 | if((op == "*=" && !(*varlist.find((*valit)))) || |
345 | op == "=" || op == "+=") | 345 | op == "=" || op == "+=") |
346 | varlist.append((*valit)); | 346 | varlist.append((*valit)); |
347 | else if(op == "-=") | 347 | else if(op == "-=") |
348 | varlist.remove((*valit)); | 348 | varlist.remove((*valit)); |
349 | } | 349 | } |
350 | } | 350 | } |
351 | if(var == "REQUIRES") /* special case to get communicated to backends! */ | 351 | if(var == "REQUIRES") /* special case to get communicated to backends! */ |
352 | doProjectCheckReqs(vallist, place); | 352 | doProjectCheckReqs(vallist, place); |
353 | 353 | ||
354 | return TRUE; | 354 | return TRUE; |
355 | } | 355 | } |
356 | 356 | ||
357 | bool | 357 | bool |
358 | QMakeProject::read(QString file, QMap<QString, QStringList> &place) | 358 | QMakeProject::read(QString file, QMap<QString, QStringList> &place) |
359 | { | 359 | { |
360 | parser_info pi = parser; | 360 | parser_info pi = parser; |
361 | /* scope blocks start at true */ | 361 | /* scope blocks start at true */ |
362 | test_status = TestNone; | 362 | test_status = TestNone; |
363 | scope_flag = 0x01; | 363 | scope_flag = 0x01; |
364 | scope_block = 0; | 364 | scope_block = 0; |
365 | 365 | ||
366 | file = Option::fixPathToLocalOS(file); | 366 | file = Option::fixPathToLocalOS(file); |
367 | doVariableReplace(file, place); | 367 | doVariableReplace(file, place); |
368 | bool ret = FALSE, using_stdin = FALSE; | 368 | bool ret = FALSE, using_stdin = FALSE; |
369 | QFile qfile; | 369 | QFile qfile; |
370 | if(!strcmp(file, "-")) { | 370 | if(!strcmp(file, "-")) { |
371 | qfile.setName(""); | 371 | qfile.setName(""); |
372 | ret = qfile.open(IO_ReadOnly, stdin); | 372 | ret = qfile.open(IO_ReadOnly, stdin); |
373 | using_stdin = TRUE; | 373 | using_stdin = TRUE; |
374 | } else { | 374 | } else { |
375 | qfile.setName(file); | 375 | qfile.setName(file); |
376 | ret = qfile.open(IO_ReadOnly); | 376 | ret = qfile.open(IO_ReadOnly); |
377 | } | 377 | } |
378 | if ( ret ) { | 378 | if ( ret ) { |
379 | QTextStream t( &qfile ); | 379 | QTextStream t( &qfile ); |
380 | QString s, line; | 380 | QString s, line; |
381 | parser.file = file; | 381 | parser.file = file; |
382 | parser.line_no = 0; | 382 | parser.line_no = 0; |
383 | while ( !t.eof() ) { | 383 | while ( !t.eof() ) { |
384 | parser.line_no++; | 384 | parser.line_no++; |
385 | line = t.readLine().stripWhiteSpace(); | 385 | line = t.readLine().stripWhiteSpace(); |
386 | int prelen = line.length(); | 386 | int prelen = line.length(); |
387 | line.replace(QRegExp("#.*$"), ""); // bye comments | 387 | line.replace(QRegExp("#.*$"), ""); // bye comments |
388 | if(!line.isEmpty() && line.right(1) == "\\") { | 388 | if(!line.isEmpty() && line.right(1) == "\\") { |
389 | line.truncate(line.length() - 1); | 389 | line.truncate(line.length() - 1); |
390 | s += line + " "; | 390 | s += line + " "; |
391 | } else if(!line.isEmpty() || (line.isEmpty() && !prelen)) { | 391 | } else if(!line.isEmpty() || (line.isEmpty() && !prelen)) { |
392 | if(s.isEmpty() && line.isEmpty()) | 392 | if(s.isEmpty() && line.isEmpty()) |
393 | continue; | 393 | continue; |
394 | if(!line.isEmpty()) | 394 | if(!line.isEmpty()) |
395 | s += line; | 395 | s += line; |
396 | if(!s.isEmpty()) { | 396 | if(!s.isEmpty()) { |
397 | if(!(ret = parse(s, place))) | 397 | if(!(ret = parse(s, place))) |
398 | break; | 398 | break; |
399 | s = ""; | 399 | s = ""; |
400 | } | 400 | } |
401 | } | 401 | } |
402 | } | 402 | } |
403 | if(!using_stdin) | 403 | if(!using_stdin) |
404 | qfile.close(); | 404 | qfile.close(); |
405 | } | 405 | } |
406 | parser = pi; | 406 | parser = pi; |
407 | return ret; | 407 | return ret; |
408 | } | 408 | } |
409 | 409 | ||
410 | bool | 410 | bool |
411 | QMakeProject::read(QString project, QString) | 411 | QMakeProject::read(QString project, QString) |
412 | { | 412 | { |
413 | if(cfile.isEmpty()) { | 413 | if(cfile.isEmpty()) { |
414 | // hack to get the Option stuff in there | 414 | // hack to get the Option stuff in there |
415 | base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext; | 415 | base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext; |
416 | base_vars["QMAKE_EXT_H"] = Option::h_ext; | 416 | base_vars["QMAKE_EXT_H"] = Option::h_ext; |
417 | 417 | ||
418 | /* parse the cache */ | 418 | /* parse the cache */ |
419 | if(Option::mkfile::do_cache) { | 419 | if(Option::mkfile::do_cache) { |
420 | if(Option::mkfile::cachefile.isEmpty()) { //find it as it has not been specified | 420 | if(Option::mkfile::cachefile.isEmpty()) { //find it as it has not been specified |
421 | QString dir = QDir::convertSeparators(Option::output_dir); | 421 | QString dir = QDir::convertSeparators(Option::output_dir); |
422 | while(!QFile::exists((Option::mkfile::cachefile = dir + | 422 | while(!QFile::exists((Option::mkfile::cachefile = dir + |
423 | QDir::separator() + ".qmake.cache"))) { | 423 | QDir::separator() + ".qmake.cache"))) { |
424 | dir = dir.left(dir.findRev(QDir::separator())); | 424 | dir = dir.left(dir.findRev(QDir::separator())); |
425 | if(dir.isEmpty() || dir.find(QDir::separator()) == -1) { | 425 | if(dir.isEmpty() || dir.find(QDir::separator()) == -1) { |
426 | Option::mkfile::cachefile = ""; | 426 | Option::mkfile::cachefile = ""; |
427 | break; | 427 | break; |
428 | } | 428 | } |
429 | if(Option::mkfile::cachefile_depth == -1) | 429 | if(Option::mkfile::cachefile_depth == -1) |
430 | Option::mkfile::cachefile_depth = 1; | 430 | Option::mkfile::cachefile_depth = 1; |
431 | else | 431 | else |
432 | Option::mkfile::cachefile_depth++; | 432 | Option::mkfile::cachefile_depth++; |
433 | } | 433 | } |
434 | } | 434 | } |
435 | if(!Option::mkfile::cachefile.isEmpty()) { | 435 | if(!Option::mkfile::cachefile.isEmpty()) { |
436 | read(Option::mkfile::cachefile, cache); | 436 | read(Option::mkfile::cachefile, cache); |
437 | if(Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty()) | 437 | if(Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty()) |
438 | Option::mkfile::qmakespec = cache["QMAKESPEC"].first(); | 438 | Option::mkfile::qmakespec = cache["QMAKESPEC"].first(); |
439 | } | 439 | } |
440 | } | 440 | } |
441 | /* parse mkspec */ | 441 | /* parse mkspec */ |
442 | QStringList mkspec_roots; | 442 | QStringList mkspec_roots; |
443 | /* prefer $QTDIR if it is set */ | 443 | /* prefer $QTDIR if it is set */ |
444 | /* prefer QMAKESPECSDIR -cl */ | 444 | /* prefer QMAKESPECSDIR -cl */ |
445 | 445 | ||
446 | if (getenv("QTDIR")) { | 446 | if (getenv("QTDIR")) { |
447 | mkspec_roots << getenv("QTDIR"); | 447 | mkspec_roots << getenv("QTDIR"); |
448 | } | 448 | } |
449 | mkspec_roots << qInstallPathData(); | 449 | mkspec_roots << qInstallPathData(); |
450 | 450 | ||
451 | if (getenv("QMAKESPECSDIR")){ | 451 | if (Option::mkfile::qmakespec.isEmpty() && getenv("QMAKESPECSDIR")){ |
452 | QString mkspec = QString(getenv("QMAKESPECSDIR")) + QDir::separator() + | 452 | QString mkspec = QString(getenv("QMAKESPECSDIR")) + QDir::separator() + |
453 | QDir::separator() + "default"; | 453 | QDir::separator() + "default"; |
454 | if(QFile::exists(mkspec)) | 454 | if(QFile::exists(mkspec)) |
455 | Option::mkfile::qmakespec = mkspec; | 455 | Option::mkfile::qmakespec = mkspec; |
456 | } | 456 | } |
457 | 457 | ||
458 | if(Option::mkfile::qmakespec.isEmpty()) { | 458 | if(Option::mkfile::qmakespec.isEmpty()) { |
459 | for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { | 459 | for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { |
460 | QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + | 460 | QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + |
461 | QDir::separator() + "default"; | 461 | QDir::separator() + "default"; |
462 | if(QFile::exists(mkspec)) { | 462 | if(QFile::exists(mkspec)) { |
463 | Option::mkfile::qmakespec = mkspec; | 463 | Option::mkfile::qmakespec = mkspec; |
464 | break; | 464 | break; |
465 | } | 465 | } |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | if(Option::mkfile::qmakespec.isEmpty()) { | 469 | if(Option::mkfile::qmakespec.isEmpty()) { |
470 | fprintf(stderr, "QMAKESPEC has not been set, so configuration cannot be deduced.\n"); | 470 | fprintf(stderr, "QMAKESPEC has not been set, so configuration cannot be deduced.\n"); |
471 | return FALSE; | 471 | return FALSE; |
472 | } | 472 | } |
473 | 473 | ||
474 | if(QDir::isRelativePath(Option::mkfile::qmakespec)) { | 474 | if(QDir::isRelativePath(Option::mkfile::qmakespec)) { |
475 | bool found_mkspec = FALSE; | 475 | bool found_mkspec = FALSE; |
476 | for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { | 476 | for(QStringList::Iterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) { |
477 | QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + | 477 | QString mkspec = (*it) + QDir::separator() + QString("mkspecs") + |
478 | QDir::separator() + Option::mkfile::qmakespec; | 478 | QDir::separator() + Option::mkfile::qmakespec; |
479 | if(QFile::exists(mkspec)) { | 479 | if(QFile::exists(mkspec)) { |
480 | found_mkspec = TRUE; | 480 | found_mkspec = TRUE; |
481 | Option::mkfile::qmakespec = mkspec; | 481 | Option::mkfile::qmakespec = mkspec; |
482 | break; | 482 | break; |
483 | } | 483 | } |
484 | } | 484 | } |
485 | if(!found_mkspec) { | 485 | if(!found_mkspec) { |
486 | fprintf(stderr, "Could not find mkspecs for your QMAKESPEC after trying:\n\t%s\n", | 486 | fprintf(stderr, "Could not find mkspecs for your QMAKESPEC after trying:\n\t%s\n", |
487 | mkspec_roots.join("\n\t").latin1()); | 487 | mkspec_roots.join("\n\t").latin1()); |
488 | return FALSE; | 488 | return FALSE; |
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
492 | /* parse qmake configuration */ | 492 | /* parse qmake configuration */ |
493 | QString spec = Option::mkfile::qmakespec + QDir::separator() + "qmake.conf"; | 493 | QString spec = Option::mkfile::qmakespec + QDir::separator() + "qmake.conf"; |
494 | debug_msg(1, "QMAKESPEC conf: reading %s", spec.latin1()); | 494 | debug_msg(1, "QMAKESPEC conf: reading %s", spec.latin1()); |
495 | if(!read(spec, base_vars)) { | 495 | if(!read(spec, base_vars)) { |
496 | fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.latin1()); | 496 | fprintf(stderr, "Failure to read QMAKESPEC conf file %s.\n", spec.latin1()); |
497 | return FALSE; | 497 | return FALSE; |
498 | } | 498 | } |
499 | if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty()) { | 499 | if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty()) { |
500 | debug_msg(1, "QMAKECACHE file: reading %s", Option::mkfile::cachefile.latin1()); | 500 | debug_msg(1, "QMAKECACHE file: reading %s", Option::mkfile::cachefile.latin1()); |
501 | read(Option::mkfile::cachefile, base_vars); | 501 | read(Option::mkfile::cachefile, base_vars); |
502 | } | 502 | } |
503 | 503 | ||
504 | /* commandline */ | 504 | /* commandline */ |
505 | cfile = project; | 505 | cfile = project; |
506 | parser.line_no = 1; //really arg count now.. duh | 506 | parser.line_no = 1; //really arg count now.. duh |
507 | parser.file = "(internal)"; | 507 | parser.file = "(internal)"; |
508 | for(QStringList::Iterator it = Option::before_user_vars.begin(); | 508 | for(QStringList::Iterator it = Option::before_user_vars.begin(); |
509 | it != Option::before_user_vars.end(); ++it) { | 509 | it != Option::before_user_vars.end(); ++it) { |
510 | if(!parse((*it), base_vars)) { | 510 | if(!parse((*it), base_vars)) { |
511 | fprintf(stderr, "Argument failed to parse: %s\n", (*it).latin1()); | 511 | fprintf(stderr, "Argument failed to parse: %s\n", (*it).latin1()); |
512 | return FALSE; | 512 | return FALSE; |
513 | } | 513 | } |
514 | parser.line_no++; | 514 | parser.line_no++; |
515 | } | 515 | } |
516 | } | 516 | } |
517 | 517 | ||
518 | /* parse project file */ | 518 | /* parse project file */ |
519 | debug_msg(1, "Project file: reading %s", project.latin1()); | 519 | debug_msg(1, "Project file: reading %s", project.latin1()); |
520 | vars = base_vars; /* start with the base */ | 520 | vars = base_vars; /* start with the base */ |
521 | 521 | ||
522 | pfile = project; | 522 | pfile = project; |
523 | if(pfile != "-" && !QFile::exists(pfile) && pfile.right(4) != ".pro") | 523 | if(pfile != "-" && !QFile::exists(pfile) && pfile.right(4) != ".pro") |
524 | pfile += ".pro"; | 524 | pfile += ".pro"; |
525 | 525 | ||
526 | if(!read(pfile, vars)) | 526 | if(!read(pfile, vars)) |
527 | return FALSE; | 527 | return FALSE; |
528 | 528 | ||
529 | parser.line_no = 1; //really arg count now.. duh | 529 | parser.line_no = 1; //really arg count now.. duh |
530 | parser.file = "(internal)"; | 530 | parser.file = "(internal)"; |
531 | for(QStringList::Iterator it = Option::after_user_vars.begin(); | 531 | for(QStringList::Iterator it = Option::after_user_vars.begin(); |
532 | it != Option::after_user_vars.end(); ++it) { | 532 | it != Option::after_user_vars.end(); ++it) { |
533 | if(!parse((*it), vars)) { | 533 | if(!parse((*it), vars)) { |
534 | fprintf(stderr, "Argument failed to parse: %s\n", (*it).latin1()); | 534 | fprintf(stderr, "Argument failed to parse: %s\n", (*it).latin1()); |
535 | return FALSE; | 535 | return FALSE; |
536 | } | 536 | } |
537 | parser.line_no++; | 537 | parser.line_no++; |
538 | } | 538 | } |
539 | 539 | ||
540 | /* now let the user override the template from an option.. */ | 540 | /* now let the user override the template from an option.. */ |
541 | if(!Option::user_template.isEmpty()) { | 541 | if(!Option::user_template.isEmpty()) { |
542 | debug_msg(1, "Overriding TEMPLATE (%s) with: %s", vars["TEMPLATE"].first().latin1(), Option::user_template.latin1()); | 542 | debug_msg(1, "Overriding TEMPLATE (%s) with: %s", vars["TEMPLATE"].first().latin1(), Option::user_template.latin1()); |
543 | vars["TEMPLATE"].clear(); | 543 | vars["TEMPLATE"].clear(); |
544 | vars["TEMPLATE"].append(Option::user_template); | 544 | vars["TEMPLATE"].append(Option::user_template); |
545 | } | 545 | } |
546 | 546 | ||
547 | if(vars["TEMPLATE"].isEmpty()) | 547 | if(vars["TEMPLATE"].isEmpty()) |
548 | vars["TEMPLATE"].append(QString("app")); | 548 | vars["TEMPLATE"].append(QString("app")); |
549 | else | 549 | else |
550 | vars["TEMPLATE"].first().replace(QRegExp("\\.t$"), ""); | 550 | vars["TEMPLATE"].first().replace(QRegExp("\\.t$"), ""); |
551 | if(!Option::user_template_prefix.isEmpty()) | 551 | if(!Option::user_template_prefix.isEmpty()) |
552 | vars["TEMPLATE"].first().prepend(Option::user_template_prefix); | 552 | vars["TEMPLATE"].first().prepend(Option::user_template_prefix); |
553 | 553 | ||
554 | if(vars["TARGET"].isEmpty()) { | 554 | if(vars["TARGET"].isEmpty()) { |
555 | // ### why not simply use: | 555 | // ### why not simply use: |
556 | // QFileInfo fi(pfile); | 556 | // QFileInfo fi(pfile); |
557 | // fi.baseName(); | 557 | // fi.baseName(); |
558 | QString tmp = pfile; | 558 | QString tmp = pfile; |
559 | if(tmp.findRev('/') != -1) | 559 | if(tmp.findRev('/') != -1) |
560 | tmp = tmp.right( tmp.length() - tmp.findRev('/') - 1 ); | 560 | tmp = tmp.right( tmp.length() - tmp.findRev('/') - 1 ); |
561 | if(tmp.findRev('.') != -1) | 561 | if(tmp.findRev('.') != -1) |
562 | tmp = tmp.left(tmp.findRev('.')); | 562 | tmp = tmp.left(tmp.findRev('.')); |
563 | vars["TARGET"].append(tmp); | 563 | vars["TARGET"].append(tmp); |
564 | } | 564 | } |
565 | 565 | ||
566 | QString test_version = getenv("QTESTVERSION"); | 566 | QString test_version = getenv("QTESTVERSION"); |
567 | if (!test_version.isEmpty()) { | 567 | if (!test_version.isEmpty()) { |
568 | QString s = vars["TARGET"].first(); | 568 | QString s = vars["TARGET"].first(); |
569 | if (s == "qt" || s == "qt-mt" || s == "qte" || s == "qte-mt") { | 569 | if (s == "qt" || s == "qt-mt" || s == "qte" || s == "qte-mt") { |
570 | QString &ver = vars["VERSION"].first(); | 570 | QString &ver = vars["VERSION"].first(); |
571 | // fprintf(stderr,"Current QT version number: " + ver + "\n"); | 571 | // fprintf(stderr,"Current QT version number: " + ver + "\n"); |
572 | if (ver != "" && ver != test_version) { | 572 | if (ver != "" && ver != test_version) { |
573 | ver = test_version; | 573 | ver = test_version; |
574 | fprintf(stderr,"Changed QT version number to " + test_version + "!\n"); | 574 | fprintf(stderr,"Changed QT version number to " + test_version + "!\n"); |
575 | } | 575 | } |
576 | } | 576 | } |
577 | } | 577 | } |
578 | return TRUE; | 578 | return TRUE; |
579 | } | 579 | } |
580 | 580 | ||
581 | bool | 581 | bool |
582 | QMakeProject::isActiveConfig(const QString &x) | 582 | QMakeProject::isActiveConfig(const QString &x) |
583 | { | 583 | { |
584 | if(x.isEmpty()) | 584 | if(x.isEmpty()) |
585 | return TRUE; | 585 | return TRUE; |
586 | 586 | ||
587 | QRegExp re(x, FALSE, TRUE); | 587 | QRegExp re(x, FALSE, TRUE); |
588 | if((Option::target_mode == Option::TARG_MACX_MODE || Option::target_mode == Option::TARG_QNX6_MODE || Option::target_mode == Option::TARG_UNIX_MODE) && | 588 | if((Option::target_mode == Option::TARG_MACX_MODE || Option::target_mode == Option::TARG_QNX6_MODE || Option::target_mode == Option::TARG_UNIX_MODE) && |
589 | x == "unix") | 589 | x == "unix") |
590 | return TRUE; | 590 | return TRUE; |
591 | else if(Option::target_mode == Option::TARG_MACX_MODE && x == "macx") | 591 | else if(Option::target_mode == Option::TARG_MACX_MODE && x == "macx") |
592 | return TRUE; | 592 | return TRUE; |
593 | else if(Option::target_mode == Option::TARG_QNX6_MODE && x == "qnx6") | 593 | else if(Option::target_mode == Option::TARG_QNX6_MODE && x == "qnx6") |
594 | return TRUE; | 594 | return TRUE; |
595 | else if(Option::target_mode == Option::TARG_MAC9_MODE && x == "mac9") | 595 | else if(Option::target_mode == Option::TARG_MAC9_MODE && x == "mac9") |
596 | return TRUE; | 596 | return TRUE; |
597 | else if((Option::target_mode == Option::TARG_MAC9_MODE || Option::target_mode == Option::TARG_MACX_MODE) && | 597 | else if((Option::target_mode == Option::TARG_MAC9_MODE || Option::target_mode == Option::TARG_MACX_MODE) && |
598 | x == "mac") | 598 | x == "mac") |
599 | return TRUE; | 599 | return TRUE; |
600 | else if(Option::target_mode == Option::TARG_WIN_MODE && x == "win32") | 600 | else if(Option::target_mode == Option::TARG_WIN_MODE && x == "win32") |
601 | return TRUE; | 601 | return TRUE; |
602 | 602 | ||
603 | 603 | ||
604 | QString spec = Option::mkfile::qmakespec.right(Option::mkfile::qmakespec.length() - | 604 | QString spec = Option::mkfile::qmakespec.right(Option::mkfile::qmakespec.length() - |
605 | (Option::mkfile::qmakespec.findRev(QDir::separator())+1)); | 605 | (Option::mkfile::qmakespec.findRev(QDir::separator())+1)); |
606 | if(re.exactMatch(spec)) | 606 | if(re.exactMatch(spec)) |
607 | return TRUE; | 607 | return TRUE; |
608 | #ifdef Q_OS_UNIX | 608 | #ifdef Q_OS_UNIX |
609 | else if(spec == "default") { | 609 | else if(spec == "default") { |
610 | static char *buffer = NULL; | 610 | static char *buffer = NULL; |
611 | if(!buffer) | 611 | if(!buffer) |
612 | buffer = (char *)malloc(1024); | 612 | buffer = (char *)malloc(1024); |
613 | int l = readlink(Option::mkfile::qmakespec, buffer, 1024); | 613 | int l = readlink(Option::mkfile::qmakespec, buffer, 1024); |
614 | if(l != -1) { | 614 | if(l != -1) { |
615 | buffer[l] = '\0'; | 615 | buffer[l] = '\0'; |
616 | QString r = buffer; | 616 | QString r = buffer; |
617 | if(r.findRev('/') != -1) | 617 | if(r.findRev('/') != -1) |
618 | r = r.mid(r.findRev('/') + 1); | 618 | r = r.mid(r.findRev('/') + 1); |
619 | if(re.exactMatch(r)) | 619 | if(re.exactMatch(r)) |
620 | return TRUE; | 620 | return TRUE; |
621 | } | 621 | } |
622 | } | 622 | } |
623 | #endif | 623 | #endif |
624 | 624 | ||
625 | 625 | ||
626 | QStringList &configs = vars["CONFIG"]; | 626 | QStringList &configs = vars["CONFIG"]; |
627 | for(QStringList::Iterator it = configs.begin(); it != configs.end(); ++it) { | 627 | for(QStringList::Iterator it = configs.begin(); it != configs.end(); ++it) { |
628 | if(re.exactMatch((*it))) | 628 | if(re.exactMatch((*it))) |
629 | return TRUE; | 629 | return TRUE; |
630 | } | 630 | } |
631 | return FALSE; | 631 | return FALSE; |
632 | } | 632 | } |
633 | 633 | ||
634 | bool | 634 | bool |
635 | QMakeProject::doProjectTest(QString func, const QString ¶ms, QMap<QString, QStringList> &place) | 635 | QMakeProject::doProjectTest(QString func, const QString ¶ms, QMap<QString, QStringList> &place) |
636 | { | 636 | { |
637 | QStringList args = split_arg_list(params); | 637 | QStringList args = split_arg_list(params); |
638 | for(QStringList::Iterator arit = args.begin(); arit != args.end(); ++arit) { | 638 | for(QStringList::Iterator arit = args.begin(); arit != args.end(); ++arit) { |
639 | QString tmp = (*arit).stripWhiteSpace(); | 639 | QString tmp = (*arit).stripWhiteSpace(); |
640 | if((tmp[0] == '\'' || tmp[0] == '"') && tmp.right(1) == tmp.left(1)) | 640 | if((tmp[0] == '\'' || tmp[0] == '"') && tmp.right(1) == tmp.left(1)) |
641 | tmp = tmp.mid(1, tmp.length() - 2); | 641 | tmp = tmp.mid(1, tmp.length() - 2); |
642 | } | 642 | } |
643 | return doProjectTest(func.stripWhiteSpace(), args, place); | 643 | return doProjectTest(func.stripWhiteSpace(), args, place); |