Diffstat (limited to 'qmake/generators/makefile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/makefile.cpp | 476 |
1 files changed, 327 insertions, 149 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f490313..c12375d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp | |||
@@ -7,3 +7,3 @@ | |||
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
@@ -61,4 +61,18 @@ | |||
61 | 61 | ||
62 | static QString mkdir_p_asstring(const QString &dir) | ||
63 | { | ||
64 | QString ret = "@$(CHK_DIR_EXISTS) \"" + dir + "\" "; | ||
65 | if(Option::target_mode == Option::TARG_WIN_MODE) | ||
66 | ret += "$(MKDIR)"; | ||
67 | else | ||
68 | ret += "|| $(MKDIR)"; | ||
69 | ret += " \"" + dir + "\""; | ||
70 | return ret; | ||
71 | } | ||
72 | |||
62 | static bool createDir(const QString& fullPath) | 73 | static bool createDir(const QString& fullPath) |
63 | { | 74 | { |
75 | if(QFile::exists(fullPath)) | ||
76 | return FALSE; | ||
77 | |||
64 | QDir dirTmp; | 78 | QDir dirTmp; |
@@ -79,4 +93,4 @@ static bool createDir(const QString& fullPath) | |||
79 | 93 | ||
80 | MakefileGenerator::MakefileGenerator(QMakeProject *p) : init_opath_already(FALSE), | 94 | MakefileGenerator::MakefileGenerator(QMakeProject *p) : init_opath_already(FALSE), |
81 | init_already(FALSE), moc_aware(FALSE), | 95 | init_already(FALSE), moc_aware(FALSE), |
82 | no_io(FALSE), project(p) | 96 | no_io(FALSE), project(p) |
@@ -90,3 +104,3 @@ static char *gimme_buffer(off_t s) | |||
90 | if(!big_buffer || big_buffer_size < s) | 104 | if(!big_buffer || big_buffer_size < s) |
91 | big_buffer = (char *)realloc(big_buffer, s); | 105 | big_buffer = (char *)realloc(big_buffer, s); |
92 | return big_buffer; | 106 | return big_buffer; |
@@ -95,3 +109,3 @@ static char *gimme_buffer(off_t s) | |||
95 | bool | 109 | bool |
96 | MakefileGenerator::generateMocList(QString fn_target) | 110 | MakefileGenerator::generateMocList(const QString &fn_target) |
97 | { | 111 | { |
@@ -175,3 +189,4 @@ MakefileGenerator::generateMocList(QString fn_target) | |||
175 | *(big_buffer+x+len) = '\0'; | 189 | *(big_buffer+x+len) = '\0'; |
176 | debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), line_count, big_buffer+x); | 190 | debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), |
191 | line_count, big_buffer+x); | ||
177 | 192 | ||
@@ -187,3 +202,4 @@ MakefileGenerator::generateMocList(QString fn_target) | |||
187 | bool cpp_ext = FALSE; | 202 | bool cpp_ext = FALSE; |
188 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { | 203 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
204 | cppit != Option::cpp_ext.end(); ++cppit) { | ||
189 | if((cpp_ext = (fn_target.right(ext_len) == (*cppit)))) | 205 | if((cpp_ext = (fn_target.right(ext_len) == (*cppit)))) |
@@ -193,6 +209,6 @@ MakefileGenerator::generateMocList(QString fn_target) | |||
193 | mocFile += fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::moc_ext; | 209 | mocFile += fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::moc_ext; |
194 | findDependencies(fn_target).append(mocFile); | ||
195 | project->variables()["_SRCMOC"].append(mocFile); | 210 | project->variables()["_SRCMOC"].append(mocFile); |
196 | } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { | 211 | } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { |
197 | for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { | 212 | for(QStringList::Iterator hit = Option::h_ext.begin(); |
213 | hit != Option::h_ext.end(); ++hit) { | ||
198 | if((fn_target.right(ext_len) == (*hit))) { | 214 | if((fn_target.right(ext_len) == (*hit))) { |
@@ -227,9 +243,8 @@ MakefileGenerator::generateMocList(QString fn_target) | |||
227 | bool | 243 | bool |
228 | MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QString fn, bool recurse) | 244 | MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &f, bool recurse) |
229 | { | 245 | { |
230 | fn = fileFixify(fn); | 246 | QStringList &fndeps = findDependencies(f); |
231 | QStringList &fndeps = findDependencies(fn); | ||
232 | if(!fndeps.isEmpty()) | 247 | if(!fndeps.isEmpty()) |
233 | return TRUE; | 248 | return TRUE; |
234 | 249 | QString fn = fileFixify(f, QDir::currentDirPath(), Option::output_dir); | |
235 | fn = Option::fixPathToLocalOS(fn, FALSE); | 250 | fn = Option::fixPathToLocalOS(fn, FALSE); |
@@ -290,4 +305,6 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
290 | x++; | 305 | x++; |
291 | if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include ", 8)) { | 306 | if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && |
292 | for(x+=8; //skip spaces after keyword | 307 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '\t' || |
308 | *(big_buffer + x + 7) == '<' || *(big_buffer + x + 7) == '"')) { | ||
309 | for(x+=7; //skip spaces after keyword | ||
293 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); | 310 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); |
@@ -330,3 +347,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
330 | while(x < total_size_read && | 347 | while(x < total_size_read && |
331 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | 348 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) |
332 | x++; | 349 | x++; |
@@ -344,3 +361,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
344 | for(x += 8; *(big_buffer + x) != '>'; x++) { | 361 | for(x += 8; *(big_buffer + x) != '>'; x++) { |
345 | if(total_size_read >= x + 9 && *(big_buffer + x) == 'i' && | 362 | if(total_size_read >= x + 9 && *(big_buffer + x) == 'i' && |
346 | !strncmp(big_buffer + x, "impldecl", 8)) { | 363 | !strncmp(big_buffer + x, "impldecl", 8)) { |
@@ -371,3 +388,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
371 | QString cpp = fn.left(fn.length() - Option::ui_ext.length()) + | 388 | QString cpp = fn.left(fn.length() - Option::ui_ext.length()) + |
372 | Option::cpp_ext.first(); | 389 | Option::cpp_ext.first(); |
373 | outdeps = &findDependencies(cpp); | 390 | outdeps = &findDependencies(cpp); |
@@ -385,2 +402,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
385 | if(!inc.isEmpty()) { | 402 | if(!inc.isEmpty()) { |
403 | bool from_source_dir = TRUE; | ||
386 | debug_msg(5, "%s:%d Found dependency to %s", fix_env_fn.latin1(), | 404 | debug_msg(5, "%s:%d Found dependency to %s", fix_env_fn.latin1(), |
@@ -406,2 +424,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
406 | fqn = fndir + inc; | 424 | fqn = fndir + inc; |
425 | goto handle_fqn; | ||
407 | } else { | 426 | } else { |
@@ -417,3 +436,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
417 | fqn = mdd->real_dir + QDir::separator() + inc; | 436 | fqn = mdd->real_dir + QDir::separator() + inc; |
418 | break; | 437 | goto handle_fqn; |
419 | } | 438 | } |
@@ -422,3 +441,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
422 | } | 441 | } |
423 | if(fqn.isEmpty()) { | 442 | if(fqn.isEmpty() && Option::mkfile::do_dep_heuristics) { |
424 | //these are some hacky heuristics it will try to do on an include | 443 | //these are some hacky heuristics it will try to do on an include |
@@ -427,3 +446,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
427 | //and see if they go away.. | 446 | //and see if they go away.. |
428 | if(Option::mkfile::do_dep_heuristics && depHeuristics.contains(inc)) { | 447 | if(depHeuristics.contains(inc)) { |
429 | fqn = depHeuristics[inc]; | 448 | fqn = depHeuristics[inc]; |
@@ -449,3 +468,26 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
449 | fqn += inc_file; | 468 | fqn += inc_file; |
450 | break; | 469 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) |
470 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); | ||
471 | goto handle_fqn; | ||
472 | } | ||
473 | } | ||
474 | } | ||
475 | if(project->isActiveConfig("lex_included")) { //is this the lex file? | ||
476 | QString rhs = Option::lex_mod + Option::cpp_ext.first(); | ||
477 | if(inc.endsWith(rhs)) { | ||
478 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::lex_ext; | ||
479 | QStringList ll = project->variables()["LEXSOURCES"]; | ||
480 | for(QStringList::Iterator it = ll.begin(); it != ll.end(); ++it) { | ||
481 | QString s = (*it), d; | ||
482 | int slsh = s.findRev(Option::dir_sep); | ||
483 | if(slsh != -1) { | ||
484 | d = s.left(slsh + 1); | ||
485 | s = s.right(s.length() - slsh - 1); | ||
486 | } | ||
487 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | ||
488 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); | ||
489 | if(s == lhs) { | ||
490 | fqn = d + inc; | ||
491 | goto handle_fqn; | ||
492 | } | ||
451 | } | 493 | } |
@@ -453,3 +495,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
453 | } | 495 | } |
454 | if(fqn.isEmpty()) { //is it from a .y? | 496 | { //is it from a .y? |
455 | QString rhs = Option::yacc_mod + Option::h_ext.first(); | 497 | QString rhs = Option::yacc_mod + Option::h_ext.first(); |
@@ -469,3 +511,30 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
469 | fqn = d + inc; | 511 | fqn = d + inc; |
470 | break; | 512 | goto handle_fqn; |
513 | } | ||
514 | } | ||
515 | } | ||
516 | } | ||
517 | if(mocAware() && //is it a moc file? | ||
518 | (inc.endsWith(Option::cpp_ext.first()) || inc.endsWith(Option::moc_ext))) { | ||
519 | QString mocs[] = { QString("_HDRMOC"), QString("_SRCMOC"), QString::null }; | ||
520 | for(int moc = 0; !mocs[moc].isNull(); moc++) { | ||
521 | QStringList &l = project->variables()[mocs[moc]]; | ||
522 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
523 | QString file = Option::fixPathToTargetOS((*it)); | ||
524 | if(file.section(Option::dir_sep, -(inc.contains('/')+1)) == inc) { | ||
525 | fqn = (*it); | ||
526 | if(mocs[moc] == "_HDRMOC") { | ||
527 | //Since it is include, no need to link it in as well | ||
528 | project->variables()["_SRCMOC"].append((*it)); | ||
529 | l.remove(it); | ||
530 | } else if(!findMocSource(fqn).endsWith(fn)) { | ||
531 | /* Not really a very good test, but this will at least avoid | ||
532 | confusion if it really does happen (since tmake/qmake | ||
533 | previously didn't even allow this the test is mostly accurate) */ | ||
534 | warn_msg(WarnLogic, | ||
535 | "Found potential multiple MOC include %s (%s) in '%s'", | ||
536 | inc.latin1(), fqn.latin1(), fix_env_fn.latin1()); | ||
537 | } | ||
538 | from_source_dir = FALSE; //mocs go in the output_dir (so don't fix them) | ||
539 | goto handle_fqn; | ||
471 | } | 540 | } |
@@ -476,8 +545,10 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
476 | } | 545 | } |
477 | if(!Option::mkfile::do_dep_heuristics || fqn.isEmpty()) //I give up | ||
478 | continue; | ||
479 | } | 546 | } |
480 | 547 | handle_fqn: | |
481 | fqn = fileFixify(Option::fixPathToTargetOS(fqn, FALSE)); | 548 | if(fqn.isEmpty()) //I give up |
482 | debug_msg(4, "Resolved dependancy of %s to %s", inc.latin1(), fqn.latin1()); | 549 | continue; |
550 | fqn = Option::fixPathToTargetOS(fqn, FALSE); | ||
551 | if(from_source_dir) | ||
552 | fqn = fileFixify(fqn); | ||
553 | debug_msg(4, "Resolved dependency of %s to %s", inc.latin1(), fqn.latin1()); | ||
483 | if(outdeps && outdeps->findIndex(fqn) == -1) | 554 | if(outdeps && outdeps->findIndex(fqn) == -1) |
@@ -499,3 +570,3 @@ MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QStri | |||
499 | } | 570 | } |
500 | debug_msg(2, "Dependancies: %s -> %s", fn.latin1(), fndeps.join(" :: ").latin1()); | 571 | debug_msg(2, "Dependencies: %s -> %s", fn.latin1(), fndeps.join(" :: ").latin1()); |
501 | return TRUE; | 572 | return TRUE; |
@@ -615,3 +686,7 @@ MakefileGenerator::init() | |||
615 | QDict<void> cache_found_files; | 686 | QDict<void> cache_found_files; |
616 | QString cache_file(Option::output_dir + QDir::separator() + ".qmake.internal.cache"); | 687 | QString cache_file(".qmake.internal.cache"); |
688 | if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) | ||
689 | cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE")); | ||
690 | if(cache_file.find(QDir::separator()) == -1) //guess they know what they are doing.. | ||
691 | cache_file.prepend(Option::output_dir + QDir::separator()); | ||
617 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | 692 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || |
@@ -630,3 +705,3 @@ MakefileGenerator::init() | |||
630 | } | 705 | } |
631 | debug_msg(1, "Dependancy Directories: %s", incDirs.join(" :: ").latin1()); | 706 | debug_msg(1, "Dependency Directories: %s", incDirs.join(" :: ").latin1()); |
632 | if(Option::output.name() != "-" && project->isActiveConfig("qmake_cache")) { | 707 | if(Option::output.name() != "-" && project->isActiveConfig("qmake_cache")) { |
@@ -685,3 +760,3 @@ MakefileGenerator::init() | |||
685 | if(found) { | 760 | if(found) { |
686 | debug_msg(2, "Dependancies (cached): %s -> %s", file.latin1(), | 761 | debug_msg(2, "Dependencies (cached): %s -> %s", file.latin1(), |
687 | files.join(" :: ").latin1()); | 762 | files.join(" :: ").latin1()); |
@@ -745,2 +820,3 @@ MakefileGenerator::init() | |||
745 | QString file = Option::fixPathToLocalOS((*val_it)); | 820 | QString file = Option::fixPathToLocalOS((*val_it)); |
821 | QStringList file_list(file); | ||
746 | if(!QFile::exists(file)) { | 822 | if(!QFile::exists(file)) { |
@@ -771,3 +847,3 @@ MakefileGenerator::init() | |||
771 | dir = regex.left(regex.findRev(Option::dir_sep) + 1); | 847 | dir = regex.left(regex.findRev(Option::dir_sep) + 1); |
772 | real_dir = fileFixify(Option::fixPathToLocalOS(dir), | 848 | real_dir = fileFixify(Option::fixPathToLocalOS(dir), |
773 | QDir::currentDirPath(), Option::output_dir); | 849 | QDir::currentDirPath(), Option::output_dir); |
@@ -784,5 +860,10 @@ MakefileGenerator::init() | |||
784 | } else { | 860 | } else { |
785 | (*val_it) = dir + d[0]; | 861 | file_list.clear(); |
786 | for(int i = 1; i < (int)d.count(); i++) | 862 | for(int i = 0; i < (int)d.count(); i++) { |
787 | l.insert(val_it, dir + d[i]); | 863 | file_list.append(dir + d[i]); |
864 | if(i == (int)d.count() - 1) | ||
865 | (*val_it) = dir + d[i]; | ||
866 | else | ||
867 | l.insert(val_it, dir + d[i]); | ||
868 | } | ||
788 | } | 869 | } |
@@ -797,35 +878,39 @@ MakefileGenerator::init() | |||
797 | } | 878 | } |
798 | 879 | for(QStringList::Iterator file_it = file_list.begin(); | |
799 | QString val_file = fileFixify((*val_it)); | 880 | file_it != file_list.end(); ++file_it) { |
800 | bool found_cache_moc = FALSE, found_cache_dep = FALSE; | 881 | QString file_list_file = fileFixify((*file_it)); |
801 | if(read_cache && Option::output.name() != "-" && | 882 | bool found_cache_moc = FALSE, found_cache_dep = FALSE; |
802 | project->isActiveConfig("qmake_cache")) { | 883 | if(read_cache && Option::output.name() != "-" && |
803 | if(!findDependencies(val_file).isEmpty()) | 884 | project->isActiveConfig("qmake_cache")) { |
804 | found_cache_dep = TRUE; | 885 | if(!findDependencies(file_list_file).isEmpty()) |
805 | if(cache_found_files[(*val_it)] == (void *)2) | 886 | found_cache_dep = TRUE; |
806 | found_cache_moc = TRUE; | 887 | if(cache_found_files[(*file_it)] == (void *)2) |
807 | if(!found_cache_moc || !found_cache_dep) | 888 | found_cache_moc = TRUE; |
808 | write_cache = TRUE; | 889 | if(!found_cache_moc || !found_cache_dep) |
809 | } | 890 | write_cache = TRUE; |
810 | if(!found_cache_dep && sources[x] != "OBJECTS") { | 891 | } |
811 | debug_msg(5, "Looking for dependancies for %s", (*val_it).latin1()); | 892 | /* Do moc before dependency checking since some includes can come from |
812 | generateDependencies(deplist, (*val_it), doDepends()); | 893 | moc_*.cpp files */ |
813 | } | 894 | if(found_cache_moc) { |
814 | if(found_cache_moc) { | 895 | QString moc = findMocDestination(file_list_file); |
815 | QString moc = findMocDestination(val_file); | 896 | if(!moc.isEmpty()) { |
816 | if(!moc.isEmpty()) { | 897 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
817 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 898 | cppit != Option::cpp_ext.end(); ++cppit) { |
818 | cppit != Option::cpp_ext.end(); ++cppit) { | 899 | if(file_list_file.endsWith((*cppit))) { |
819 | if(val_file.endsWith((*cppit))) { | 900 | QStringList &deps = findDependencies(file_list_file); |
820 | QStringList &deps = findDependencies(val_file); | 901 | if(!deps.contains(moc)) |
821 | if(!deps.contains(moc)) | 902 | deps.append(moc); |
822 | deps.append(moc); | 903 | break; |
823 | break; | 904 | } |
824 | } | 905 | } |
825 | } | 906 | } |
907 | } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && | ||
908 | (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | ||
909 | Option::mkfile::do_mocs)) { | ||
910 | generateMocList((*file_it)); | ||
911 | } | ||
912 | if(!found_cache_dep && sources[x] != "OBJECTS") { | ||
913 | debug_msg(5, "Looking for dependencies for %s", (*file_it).latin1()); | ||
914 | generateDependencies(deplist, (*file_it), doDepends()); | ||
826 | } | 915 | } |
827 | } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && | ||
828 | (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | ||
829 | Option::mkfile::do_mocs)) { | ||
830 | generateMocList((*val_it)); | ||
831 | } | 916 | } |
@@ -855,7 +940,8 @@ MakefileGenerator::init() | |||
855 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 940 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
856 | if(!(*val_it).isEmpty()) { | 941 | QString f = fileFixify((*val_it)); |
857 | mc = mocablesToMOC[(*val_it)]; | 942 | if(!f.isEmpty()) { |
943 | mc = mocablesToMOC[f]; | ||
858 | if(mc.isEmpty()) | 944 | if(mc.isEmpty()) |
859 | mc = "*qmake_ignore*"; | 945 | mc = "*qmake_ignore*"; |
860 | cachet << (*val_it) << " = " << mc << endl; | 946 | cachet << f << " = " << mc << endl; |
861 | } | 947 | } |
@@ -948,6 +1034,7 @@ MakefileGenerator::init() | |||
948 | { | 1034 | { |
1035 | QStringList &includepath = project->variables()["INCLUDEPATH"]; | ||
949 | if(!project->isEmpty("UI_DIR")) | 1036 | if(!project->isEmpty("UI_DIR")) |
950 | project->variables()["INCLUDEPATH"].append(project->first("UI_DIR")); | 1037 | includepath.append(project->first("UI_DIR")); |
951 | else if(!project->isEmpty("UI_HEADERS_DIR")) | 1038 | else if(!project->isEmpty("UI_HEADERS_DIR")) |
952 | project->variables()["INCLUDEPATH"].append(project->first("UI_HEADERS_DIR")); | 1039 | includepath.append(project->first("UI_HEADERS_DIR")); |
953 | QStringList &decls = v["UICDECLS"], &impls = v["UICIMPLS"]; | 1040 | QStringList &decls = v["UICDECLS"], &impls = v["UICIMPLS"]; |
@@ -962,5 +1049,5 @@ MakefileGenerator::init() | |||
962 | d = QDir::currentDirPath(); | 1049 | d = QDir::currentDirPath(); |
963 | d = fileFixify(d); | 1050 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); |
964 | if( !project->variables()["INCLUDEPATH"].contains(d)) | 1051 | if(!includepath.contains(d)) |
965 | project->variables()["INCLUDEPATH"].append(d); | 1052 | includepath.append(d); |
966 | } else { | 1053 | } else { |
@@ -968,3 +1055,4 @@ MakefileGenerator::init() | |||
968 | decl = project->first("UI_HEADERS_DIR"); | 1055 | decl = project->first("UI_HEADERS_DIR"); |
969 | if ( !decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && !project->isEmpty("UI_SOURCES_DIR")) ) { | 1056 | if(!decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && |
1057 | !project->isEmpty("UI_SOURCES_DIR")) ) { | ||
970 | QString d = fi.dirPath(); | 1058 | QString d = fi.dirPath(); |
@@ -972,5 +1060,5 @@ MakefileGenerator::init() | |||
972 | d = QDir::currentDirPath(); | 1060 | d = QDir::currentDirPath(); |
973 | d = fileFixify(d); | 1061 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); |
974 | if( !project->variables()["INCLUDEPATH"].contains(d)) | 1062 | if(includepath.contains(d)) |
975 | project->variables()["INCLUDEPATH"].append(d); | 1063 | includepath.append(d); |
976 | } | 1064 | } |
@@ -985,3 +1073,17 @@ MakefileGenerator::init() | |||
985 | } | 1073 | } |
986 | impl += fi.baseName(TRUE) + Option::cpp_ext.first(), | 1074 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); |
1075 | if(!impl.isEmpty()) | ||
1076 | impl += Option::dir_sep; | ||
1077 | impl += fi.baseName(TRUE) + Option::cpp_ext.first(); | ||
1078 | if(Option::output_dir != QDir::currentDirPath() && | ||
1079 | project->isEmpty("UI_DIR") && project->isEmpty("UI_HEADERS_DIR")) { | ||
1080 | QString decl_fixed = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | ||
1081 | if(!includepath.contains(decl_fixed)) | ||
1082 | includepath.append(decl_fixed); | ||
1083 | if(!includepath.contains(decl)) | ||
1084 | project->variables()["INCLUDEPATH"].append(decl); | ||
1085 | } | ||
1086 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | ||
1087 | if(!decl.isEmpty()) | ||
1088 | decl += Option::dir_sep; | ||
987 | decl += fi.baseName(TRUE) + Option::h_ext.first(); | 1089 | decl += fi.baseName(TRUE) + Option::h_ext.first(); |
@@ -1032,5 +1134,5 @@ MakefileGenerator::init() | |||
1032 | } | 1134 | } |
1033 | 1135 | if(Option::output_dir != QDir::currentDirPath()) | |
1034 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 1136 | project->variables()["INCLUDEPATH"].append(fileFixify(Option::output_dir, Option::output_dir, |
1035 | project->variables()["INCLUDEPATH"].append(Option::output_dir); | 1137 | Option::output_dir)); |
1036 | 1138 | ||
@@ -1068,3 +1170,3 @@ MakefileGenerator::processPrlFile(QString &file) | |||
1068 | prl_file = fileFixify(prl_file); | 1170 | prl_file = fileFixify(prl_file); |
1069 | if(!QFile::exists(fileFixify(prl_file, QDir::currentDirPath(), Option::output_dir)) && | 1171 | if(!QFile::exists(fileFixify(prl_file, QDir::currentDirPath(), Option::output_dir)) && |
1070 | project->isActiveConfig("qt")) { | 1172 | project->isActiveConfig("qt")) { |
@@ -1106,3 +1208,3 @@ MakefileGenerator::processPrlFile(QString &file) | |||
1106 | if(!proj.read(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir), | 1208 | if(!proj.read(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir), |
1107 | QDir::currentDirPath())) { | 1209 | QDir::currentDirPath(), TRUE)) { |
1108 | fprintf(stderr, "Error processing prl file: %s\n", real_prl_file.latin1()); | 1210 | fprintf(stderr, "Error processing prl file: %s\n", real_prl_file.latin1()); |
@@ -1198,2 +1300,4 @@ MakefileGenerator::writePrlFile(QTextStream &t) | |||
1198 | t << "QMAKE_PRL_CONFIG = " << project->variables()["CONFIG"].join(" ") << endl; | 1300 | t << "QMAKE_PRL_CONFIG = " << project->variables()["CONFIG"].join(" ") << endl; |
1301 | if(!project->isEmpty("VERSION")) | ||
1302 | t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl; | ||
1199 | if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { | 1303 | if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { |
@@ -1230,4 +1334,3 @@ MakefileGenerator::write() | |||
1230 | prl.prepend(var("DESTDIR")); | 1334 | prl.prepend(var("DESTDIR")); |
1231 | QString local_prl = fileFixify(prl, QDir::currentDirPath(), Option::output_dir); | 1335 | QString local_prl = Option::fixPathToLocalOS(fileFixify(prl, QDir::currentDirPath(), Option::output_dir)); |
1232 | fixEnvVariables(local_prl); | ||
1233 | QFile ft(local_prl); | 1336 | QFile ft(local_prl); |
@@ -1242,3 +1345,3 @@ MakefileGenerator::write() | |||
1242 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && | 1345 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && |
1243 | project->isActiveConfig("link_prl")) //load up prl's | 1346 | project->isActiveConfig("link_prl")) //load up prl's' |
1244 | processPrlFiles(); | 1347 | processPrlFiles(); |
@@ -1304,3 +1407,3 @@ MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &s | |||
1304 | } | 1407 | } |
1305 | if (!use_implicit_rule) { | 1408 | if (!use_implicit_rule && !project->isEmpty(comp)) { |
1306 | QString p = var(comp); | 1409 | QString p = var(comp); |
@@ -1322,16 +1425,32 @@ MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) | |||
1322 | { | 1425 | { |
1323 | QString tmp = (*it); | 1426 | QString tmp = (*it), impl_dir, decl_dir; |
1324 | decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); | 1427 | decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); |
1428 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | ||
1429 | int dlen = decl.findRev(Option::dir_sep) + 1; | ||
1325 | tmp = (*it); | 1430 | tmp = (*it); |
1326 | impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); | 1431 | impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); |
1327 | int dlen = (*it).findRev(Option::dir_sep) + 1; | 1432 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); |
1433 | int ilen = decl.findRev(Option::dir_sep) + 1; | ||
1328 | if(!project->isEmpty("UI_DIR")) { | 1434 | if(!project->isEmpty("UI_DIR")) { |
1435 | impl_dir = project->first("UI_DIR"); | ||
1329 | decl = project->first("UI_DIR") + decl.right(decl.length() - dlen); | 1436 | decl = project->first("UI_DIR") + decl.right(decl.length() - dlen); |
1330 | impl = project->first("UI_DIR") + impl.right(impl.length() - dlen); | 1437 | impl = project->first("UI_DIR") + impl.right(impl.length() - ilen); |
1331 | } else { | 1438 | } else { |
1332 | if(!project->isEmpty("UI_HEADERS_DIR")) | 1439 | if(!project->isEmpty("UI_HEADERS_DIR")) { |
1440 | decl_dir = project->first("UI_HEADERS_DIR"); | ||
1333 | decl = project->first("UI_HEADERS_DIR") + decl.right(decl.length() - dlen); | 1441 | decl = project->first("UI_HEADERS_DIR") + decl.right(decl.length() - dlen); |
1334 | if(!project->isEmpty("UI_SOURCES_DIR")) | 1442 | } |
1335 | impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - dlen); | 1443 | if(!project->isEmpty("UI_SOURCES_DIR")) { |
1336 | } | 1444 | impl_dir = project->first("UI_SOURCES_DIR"); |
1445 | impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - ilen); | ||
1446 | } | ||
1447 | } | ||
1448 | if(decl_dir.isEmpty()) | ||
1449 | decl_dir = decl.left(dlen); | ||
1450 | if(impl_dir.isEmpty()) | ||
1451 | impl_dir = impl.left(ilen); | ||
1452 | if(!impl_dir.isEmpty()) | ||
1453 | createDir(Option::output_dir + Option::dir_sep + impl_dir); | ||
1454 | if(!decl_dir.isEmpty() && decl_dir != impl_dir) | ||
1455 | createDir(Option::output_dir + Option::dir_sep + decl_dir); | ||
1337 | } | 1456 | } |
@@ -1372,3 +1491,3 @@ MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString | |||
1372 | } | 1491 | } |
1373 | if (!use_implicit_rule) { | 1492 | if (!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { |
1374 | QString p = var("QMAKE_RUN_CXX"); | 1493 | QString p = var("QMAKE_RUN_CXX"); |
@@ -1415,5 +1534,9 @@ MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) | |||
1415 | QFileInfo fi((*it)); | 1534 | QFileInfo fi((*it)); |
1416 | QString dir = fileFixify(Option::output_dir); | 1535 | QString dir; |
1536 | if(fi.dirPath() != ".") | ||
1537 | dir = fi.dirPath() + Option::dir_sep; | ||
1538 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | ||
1417 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1539 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
1418 | dir += Option::dir_sep; | 1540 | dir += Option::dir_sep; |
1541 | |||
1419 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | 1542 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); |
@@ -1425,3 +1548,3 @@ MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) | |||
1425 | yaccflags += " -p " + mangle; | 1548 | yaccflags += " -p " + mangle; |
1426 | } | 1549 | } |
1427 | QString out_h = default_out_h, out_c = default_out_c; | 1550 | QString out_h = default_out_h, out_c = default_out_c; |
@@ -1454,3 +1577,6 @@ MakefileGenerator::writeLexSrc(QTextStream &t, const QString &src) | |||
1454 | QFileInfo fi((*it)); | 1577 | QFileInfo fi((*it)); |
1455 | QString dir = fileFixify(Option::output_dir); | 1578 | QString dir; |
1579 | if(fi.dirPath() != ".") | ||
1580 | dir = fi.dirPath() + Option::dir_sep; | ||
1581 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | ||
1456 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1582 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
@@ -1465,3 +1591,3 @@ MakefileGenerator::writeLexSrc(QTextStream &t, const QString &src) | |||
1465 | QString out_c = default_out_c; | 1591 | QString out_c = default_out_c; |
1466 | if(!stub.isEmpty()) | 1592 | if(!stub.isEmpty()) |
1467 | out_c.replace(stringBase, stub); | 1593 | out_c.replace(stringBase, stub); |
@@ -1496,3 +1622,3 @@ MakefileGenerator::writeImageObj(QTextStream &t, const QString &obj) | |||
1496 | } | 1622 | } |
1497 | if(!use_implicit_rule) { | 1623 | if(!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { |
1498 | QString p = var("QMAKE_RUN_CXX"); | 1624 | QString p = var("QMAKE_RUN_CXX"); |
@@ -1543,19 +1669,22 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | |||
1543 | bool do_default = TRUE; | 1669 | bool do_default = TRUE; |
1544 | QString target, dst="$(INSTALL_ROOT)" + Option::fixPathToTargetOS(project->variables()[pvar].first(), FALSE); | 1670 | const QString root = "$(INSTALL_ROOT)"; |
1671 | QString target, dst= fileFixify(project->variables()[pvar].first()); | ||
1672 | #ifndef Q_WS_WIN | ||
1545 | if(dst.right(1) != Option::dir_sep) | 1673 | if(dst.right(1) != Option::dir_sep) |
1546 | dst += Option::dir_sep; | 1674 | dst += Option::dir_sep; |
1547 | QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"]; | 1675 | #endif |
1548 | //other | 1676 | QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"]; |
1549 | tmp = project->variables()[(*it) + ".extra"]; | 1677 | //other |
1550 | if(!tmp.isEmpty()) { | 1678 | tmp = project->variables()[(*it) + ".extra"]; |
1679 | if(!tmp.isEmpty()) { | ||
1551 | do_default = FALSE; | 1680 | do_default = FALSE; |
1552 | if(!target.isEmpty()) | 1681 | if(!target.isEmpty()) |
1553 | target += "\n\t"; | 1682 | target += "\n\t"; |
1554 | target += tmp.join(" "); | 1683 | target += tmp.join(" "); |
1555 | } | 1684 | } |
1556 | //masks | 1685 | //masks |
1557 | tmp = project->variables()[(*it) + ".files"]; | 1686 | tmp = project->variables()[(*it) + ".files"]; |
1558 | if(!tmp.isEmpty()) { | 1687 | if(!tmp.isEmpty()) { |
1559 | if(!target.isEmpty()) | 1688 | if(!target.isEmpty()) |
1560 | target += "\n"; | 1689 | target += "\n"; |
1561 | do_default = FALSE; | 1690 | do_default = FALSE; |
@@ -1563,25 +1692,32 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | |||
1563 | QString wild = Option::fixPathToLocalOS((*wild_it), FALSE), wild_var = fileFixify(wild); | 1692 | QString wild = Option::fixPathToLocalOS((*wild_it), FALSE), wild_var = fileFixify(wild); |
1693 | QString dirstr = QDir::currentDirPath(), filestr = wild; | ||
1694 | int slsh = filestr.findRev(Option::dir_sep); | ||
1695 | if(slsh != -1) { | ||
1696 | dirstr = filestr.left(slsh+1); | ||
1697 | filestr = filestr.right(filestr.length() - slsh - 1); | ||
1698 | } | ||
1699 | if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) | ||
1700 | dirstr += Option::dir_sep; | ||
1564 | if(QFile::exists(wild)) { //real file | 1701 | if(QFile::exists(wild)) { //real file |
1702 | QString file = wild; | ||
1565 | QFileInfo fi(wild); | 1703 | QFileInfo fi(wild); |
1566 | target += QString("\t-") + (fi.isDir() ? "$(COPY_DIR)" : "$(COPY_FILE)") + | 1704 | if(!target.isEmpty()) |
1567 | " \"" + Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + fileFixify(dst) + "\"\n"; | 1705 | target += "\t"; |
1706 | target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + | ||
1707 | Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + root + dst + "\"\n"; | ||
1568 | if(!project->isActiveConfig("debug") && | 1708 | if(!project->isActiveConfig("debug") && |
1569 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) | 1709 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) |
1570 | target += QString("\t") + var("QMAKE_STRIP") + " \"" + fileFixify(dst + wild) + "\"\n"; | 1710 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + filestr) + "\"\n"; |
1571 | uninst.append(QString("-$(DEL_FILE) -r") + " \"" + fileFixify(dst + wild) + "\""); | 1711 | if(!uninst.isEmpty()) |
1712 | uninst.append("\n\t"); | ||
1713 | uninst.append( | ||
1714 | #ifdef Q_WS_WIN | ||
1715 | QString("-$(DEL_FILE)") | ||
1716 | #else | ||
1717 | QString("-$(DEL_FILE) -r") | ||
1718 | #endif | ||
1719 | + " \"" + root + fileFixify(dst + filestr) + "\""); | ||
1572 | continue; | 1720 | continue; |
1573 | } | 1721 | } |
1574 | QString dirstr = QDir::currentDirPath(), f = wild; //wild | 1722 | QDir dir(dirstr, filestr); //wild |
1575 | int slsh = f.findRev(Option::dir_sep); | ||
1576 | if(slsh != -1) { | ||
1577 | dirstr = f.left(slsh+1); | ||
1578 | f = f.right(f.length() - slsh - 1); | ||
1579 | } | ||
1580 | if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) | ||
1581 | dirstr += Option::dir_sep; | ||
1582 | if(!uninst.isEmpty()) | ||
1583 | uninst.append("\n\t"); | ||
1584 | uninst.append(QString("-$(DEL_FILE) -r") + " " + fileFixify(dst + f) + ""); | ||
1585 | |||
1586 | QDir dir(dirstr, f); | ||
1587 | for(uint x = 0; x < dir.count(); x++) { | 1723 | for(uint x = 0; x < dir.count(); x++) { |
@@ -1590,13 +1726,24 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | |||
1590 | continue; | 1726 | continue; |
1727 | if(!uninst.isEmpty()) | ||
1728 | uninst.append("\n\t"); | ||
1729 | uninst.append( | ||
1730 | #ifdef Q_WS_WIN | ||
1731 | QString("-$(DEL_FILE)") | ||
1732 | #else | ||
1733 | QString("-$(DEL_FILE) -r") | ||
1734 | #endif | ||
1735 | + " \"" + root + fileFixify(dst + file) + "\""); | ||
1591 | QFileInfo fi(file); | 1736 | QFileInfo fi(file); |
1592 | target += QString("\t-") + (fi.isDir() ? "$(COPY_DIR)" : "$(COPY_FILE)") + | 1737 | if(!target.isEmpty()) |
1593 | " \"" + Option::fixPathToTargetOS(fileFixify(dirstr + file), FALSE) + | 1738 | target += "\t"; |
1594 | "\" \"" + fileFixify(dst) + "\"\n"; | 1739 | target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + |
1740 | Option::fixPathToTargetOS(fileFixify(dirstr + file), FALSE) + | ||
1741 | "\" \"" + root + fileFixify(dst) + "\"\n"; | ||
1595 | if(!project->isActiveConfig("debug") && | 1742 | if(!project->isActiveConfig("debug") && |
1596 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) | 1743 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) |
1597 | target += QString("\t") + var("QMAKE_STRIP") + " \"" + fileFixify(dst + file) + "\"\n"; | 1744 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + file) + "\"\n"; |
1598 | } | 1745 | } |
1599 | } | 1746 | } |
1600 | } | 1747 | } |
1601 | //default? | 1748 | //default? |
1602 | if(do_default) | 1749 | if(do_default) |
@@ -1605,5 +1752,13 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | |||
1605 | if(!target.isEmpty()) { | 1752 | if(!target.isEmpty()) { |
1606 | t << "install_" << (*it) << ": " << "\n\t" | 1753 | t << "install_" << (*it) << ": " << "\n\t"; |
1607 | << "@test -d " << dst << " || mkdir -p " << dst << "\n\t" | 1754 | const QStringList &dirs = project->variables()[pvar]; |
1608 | << target << endl << endl; | 1755 | for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { |
1756 | QString tmp_dst = fileFixify((*pit)); | ||
1757 | #ifndef Q_WS_WIN | ||
1758 | if(tmp_dst.right(1) != Option::dir_sep) | ||
1759 | tmp_dst += Option::dir_sep; | ||
1760 | #endif | ||
1761 | t << mkdir_p_asstring(root+tmp_dst) << "\n\t"; | ||
1762 | } | ||
1763 | t << target << endl << endl; | ||
1609 | all_installs += QString("install_") + (*it) + " "; | 1764 | all_installs += QString("install_") + (*it) + " "; |
@@ -1611,4 +1766,4 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | |||
1611 | t << "uninstall_" << (*it) << ": " << "\n\t" | 1766 | t << "uninstall_" << (*it) << ": " << "\n\t" |
1612 | << uninst.join(" ") << "\n\t" | 1767 | << uninst.join("") << "\n\t" |
1613 | << "-$(DEL_DIR) \"" << dst << "\"" << endl << endl; | 1768 | << "-$(DEL_DIR) \"" << ( root + dst ) << "\"" << endl << endl; |
1614 | all_uninstalls += "uninstall_" + (*it) + " "; | 1769 | all_uninstalls += "uninstall_" + (*it) + " "; |
@@ -1789,3 +1944,3 @@ MakefileGenerator::writeHeader(QTextStream &t) | |||
1789 | t << "# Makefile for building: " << var("TARGET") << endl; | 1944 | t << "# Makefile for building: " << var("TARGET") << endl; |
1790 | t << "# Generated by qmake (" << qmake_version() << ") on: " << ctime(&foo); | 1945 | t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: " << ctime(&foo); |
1791 | t << "# Project: " << fileFixify(project->projectFile()) << endl; | 1946 | t << "# Project: " << fileFixify(project->projectFile()) << endl; |
@@ -1804,3 +1959,3 @@ MakefileGenerator::writeMakeQmake(QTextStream &t) | |||
1804 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.name())); | 1959 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.name())); |
1805 | if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && | 1960 | if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake") && |
1806 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | 1961 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { |
@@ -1848,5 +2003,11 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const | |||
1848 | { | 2003 | { |
2004 | if(file0.isEmpty()) | ||
2005 | return file0; | ||
2006 | QString key = file0; | ||
2007 | if(!in_d.isEmpty() || !out_d.isEmpty() || force_fix) | ||
2008 | key.prepend(in_d + "--" + out_d + "--" + QString::number((int)force_fix) + "-"); | ||
2009 | if(fileFixed.contains(key)) | ||
2010 | return fileFixed[key]; | ||
2011 | |||
1849 | QString file = file0; | 2012 | QString file = file0; |
1850 | if(file.isEmpty()) | ||
1851 | return file; | ||
1852 | int depth = 4; | 2013 | int depth = 4; |
@@ -1892,2 +2053,8 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const | |||
1892 | } | 2053 | } |
2054 | QString in_canonical_dir = QDir(in_dir).canonicalPath(), | ||
2055 | out_canonical_dir = QDir(out_dir).canonicalPath(); | ||
2056 | if(!in_canonical_dir.isEmpty()) | ||
2057 | in_dir = in_canonical_dir; | ||
2058 | if(!out_canonical_dir.isEmpty()) | ||
2059 | out_dir = out_canonical_dir; | ||
1893 | } | 2060 | } |
@@ -1901,2 +2068,7 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const | |||
1901 | file = Option::fixPathToTargetOS(file, FALSE); | 2068 | file = Option::fixPathToTargetOS(file, FALSE); |
2069 | if(QFile::exists(file) && file == Option::fixPathToTargetOS(file, TRUE)) { | ||
2070 | QString real_file = QDir(file).canonicalPath(); | ||
2071 | if(!real_file.isEmpty()) | ||
2072 | file = real_file; | ||
2073 | } | ||
1902 | QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE); | 2074 | QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE); |
@@ -1931,2 +2103,4 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const | |||
1931 | file = Option::fixPathToTargetOS(file, FALSE); | 2103 | file = Option::fixPathToTargetOS(file, FALSE); |
2104 | if(file.isEmpty()) | ||
2105 | file = "."; | ||
1932 | if(!quote.isNull()) | 2106 | if(!quote.isNull()) |
@@ -1934,2 +2108,3 @@ MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const | |||
1934 | debug_msg(3, "Fixed %s :: to :: %s (%d)", orig_file.latin1(), file.latin1(), depth); | 2108 | debug_msg(3, "Fixed %s :: to :: %s (%d)", orig_file.latin1(), file.latin1(), depth); |
2109 | ((MakefileGenerator*)this)->fileFixed.insert(key, file); | ||
1935 | return file; | 2110 | return file; |
@@ -2041,4 +2216,5 @@ MakefileGenerator::openOutput(QFile &file) const | |||
2041 | #include "unixmake.h" | 2216 | #include "unixmake.h" |
2042 | #include "borland_bmake.h" | ||
2043 | #include "msvc_nmake.h" | 2217 | #include "msvc_nmake.h" |
2218 | #include "borland_bmake.h" | ||
2219 | #include "mingw_make.h" | ||
2044 | #include "msvc_dsp.h" | 2220 | #include "msvc_dsp.h" |
@@ -2063,3 +2239,3 @@ MakefileGenerator::create(QMakeProject *proj) | |||
2063 | } else if(gen == "MSVC") { | 2239 | } else if(gen == "MSVC") { |
2064 | // Visual Studio =< v6.0 | 2240 | // Visual Studio =< v6.0 |
2065 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) | 2241 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) |
@@ -2069,3 +2245,3 @@ MakefileGenerator::create(QMakeProject *proj) | |||
2069 | } else if(gen == "MSVC.NET") { | 2245 | } else if(gen == "MSVC.NET") { |
2070 | // Visual Studio >= v7.0 | 2246 | // Visual Studio >= v7.0 |
2071 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) | 2247 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) |
@@ -2076,2 +2252,4 @@ MakefileGenerator::create(QMakeProject *proj) | |||
2076 | mkfile = new BorlandMakefileGenerator(proj); | 2252 | mkfile = new BorlandMakefileGenerator(proj); |
2253 | } else if(gen == "MINGW") { | ||
2254 | mkfile = new MingwMakefileGenerator(proj); | ||
2077 | } else if(gen == "METROWERKS") { | 2255 | } else if(gen == "METROWERKS") { |