summaryrefslogtreecommitdiff
path: root/qmake/generators
authorllornkcor <llornkcor>2003-07-10 02:40:10 (UTC)
committer llornkcor <llornkcor>2003-07-10 02:40:10 (UTC)
commit155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff)
treee6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/generators
parent86703e8a5527ef114facd02c005b6b3a7e62e263 (diff)
downloadopie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip
opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz
opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2
update qmake to 1.05a
Diffstat (limited to 'qmake/generators') (more/less context) (show whitespace changes)
-rw-r--r--qmake/generators/makefile.cpp384
-rw-r--r--qmake/generators/makefile.h10
-rw-r--r--qmake/generators/projectgenerator.cpp64
-rw-r--r--qmake/generators/unix/unixmake.cpp154
-rw-r--r--qmake/generators/unix/unixmake.h1
-rw-r--r--qmake/generators/unix/unixmake2.cpp149
-rw-r--r--qmake/generators/win32/borland_bmake.cpp56
-rw-r--r--qmake/generators/win32/borland_bmake.h9
-rw-r--r--qmake/generators/win32/mingw_make.cpp524
-rw-r--r--qmake/generators/win32/mingw_make.h58
-rw-r--r--qmake/generators/win32/msvc_dsp.cpp163
-rw-r--r--qmake/generators/win32/msvc_dsp.h14
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp98
-rw-r--r--qmake/generators/win32/msvc_nmake.h8
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp155
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h50
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp316
-rw-r--r--qmake/generators/win32/msvc_vcproj.h30
-rw-r--r--qmake/generators/win32/winmakefile.cpp126
19 files changed, 1833 insertions, 536 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
62static 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
62static bool createDir(const QString& fullPath) 73static bool createDir(const QString& fullPath)
63{ 74{
75 if(QFile::exists(fullPath))
76 return FALSE;
77
64 QDir dirTmp; 78 QDir dirTmp;
@@ -95,3 +109,3 @@ static char *gimme_buffer(off_t s)
95bool 109bool
96MakefileGenerator::generateMocList(QString fn_target) 110MakefileGenerator::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)
227bool 243bool
228MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, QString fn, bool recurse) 244MakefileGenerator::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');
@@ -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)) {
@@ -784,6 +860,11 @@ 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++) {
863 file_list.append(dir + d[i]);
864 if(i == (int)d.count() - 1)
865 (*val_it) = dir + d[i];
866 else
787 l.insert(val_it, dir + d[i]); 867 l.insert(val_it, dir + d[i]);
788 } 868 }
869 }
789 } else { 870 } else {
@@ -797,4 +878,5 @@ 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) {
881 QString file_list_file = fileFixify((*file_it));
800 bool found_cache_moc = FALSE, found_cache_dep = FALSE; 882 bool found_cache_moc = FALSE, found_cache_dep = FALSE;
@@ -802,5 +884,5 @@ MakefileGenerator::init()
802 project->isActiveConfig("qmake_cache")) { 884 project->isActiveConfig("qmake_cache")) {
803 if(!findDependencies(val_file).isEmpty()) 885 if(!findDependencies(file_list_file).isEmpty())
804 found_cache_dep = TRUE; 886 found_cache_dep = TRUE;
805 if(cache_found_files[(*val_it)] == (void *)2) 887 if(cache_found_files[(*file_it)] == (void *)2)
806 found_cache_moc = TRUE; 888 found_cache_moc = TRUE;
@@ -809,8 +891,6 @@ MakefileGenerator::init()
809 } 891 }
810 if(!found_cache_dep && sources[x] != "OBJECTS") { 892 /* Do moc before dependency checking since some includes can come from
811 debug_msg(5, "Looking for dependancies for %s", (*val_it).latin1()); 893 moc_*.cpp files */
812 generateDependencies(deplist, (*val_it), doDepends());
813 }
814 if(found_cache_moc) { 894 if(found_cache_moc) {
815 QString moc = findMocDestination(val_file); 895 QString moc = findMocDestination(file_list_file);
816 if(!moc.isEmpty()) { 896 if(!moc.isEmpty()) {
@@ -818,4 +898,4 @@ MakefileGenerator::init()
818 cppit != Option::cpp_ext.end(); ++cppit) { 898 cppit != Option::cpp_ext.end(); ++cppit) {
819 if(val_file.endsWith((*cppit))) { 899 if(file_list_file.endsWith((*cppit))) {
820 QStringList &deps = findDependencies(val_file); 900 QStringList &deps = findDependencies(file_list_file);
821 if(!deps.contains(moc)) 901 if(!deps.contains(moc))
@@ -829,3 +909,8 @@ MakefileGenerator::init()
829 Option::mkfile::do_mocs)) { 909 Option::mkfile::do_mocs)) {
830 generateMocList((*val_it)); 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());
915 }
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
@@ -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"))
1335 impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - dlen);
1336 } 1442 }
1443 if(!project->isEmpty("UI_SOURCES_DIR")) {
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();
@@ -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)
@@ -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,5 +1669,8 @@ 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;
1675#endif
1547 QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"]; 1676 QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"];
@@ -1563,17 +1692,7 @@ 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);
1564 if(QFile::exists(wild)) { //real file 1693 QString dirstr = QDir::currentDirPath(), filestr = wild;
1565 QFileInfo fi(wild); 1694 int slsh = filestr.findRev(Option::dir_sep);
1566 target += QString("\t-") + (fi.isDir() ? "$(COPY_DIR)" : "$(COPY_FILE)") +
1567 " \"" + Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + fileFixify(dst) + "\"\n";
1568 if(!project->isActiveConfig("debug") &&
1569 !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP"))
1570 target += QString("\t") + var("QMAKE_STRIP") + " \"" + fileFixify(dst + wild) + "\"\n";
1571 uninst.append(QString("-$(DEL_FILE) -r") + " \"" + fileFixify(dst + wild) + "\"");
1572 continue;
1573 }
1574 QString dirstr = QDir::currentDirPath(), f = wild; //wild
1575 int slsh = f.findRev(Option::dir_sep);
1576 if(slsh != -1) { 1695 if(slsh != -1) {
1577 dirstr = f.left(slsh+1); 1696 dirstr = filestr.left(slsh+1);
1578 f = f.right(f.length() - slsh - 1); 1697 filestr = filestr.right(filestr.length() - slsh - 1);
1579 } 1698 }
@@ -1581,7 +1700,24 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs)
1581 dirstr += Option::dir_sep; 1700 dirstr += Option::dir_sep;
1701 if(QFile::exists(wild)) { //real file
1702 QString file = wild;
1703 QFileInfo fi(wild);
1704 if(!target.isEmpty())
1705 target += "\t";
1706 target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" +
1707 Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + root + dst + "\"\n";
1708 if(!project->isActiveConfig("debug") &&
1709 !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP"))
1710 target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + filestr) + "\"\n";
1582 if(!uninst.isEmpty()) 1711 if(!uninst.isEmpty())
1583 uninst.append("\n\t"); 1712 uninst.append("\n\t");
1584 uninst.append(QString("-$(DEL_FILE) -r") + " " + fileFixify(dst + f) + ""); 1713 uninst.append(
1585 1714#ifdef Q_WS_WIN
1586 QDir dir(dirstr, f); 1715 QString("-$(DEL_FILE)")
1716#else
1717 QString("-$(DEL_FILE) -r")
1718#endif
1719 + " \"" + root + fileFixify(dst + filestr) + "\"");
1720 continue;
1721 }
1722 QDir dir(dirstr, filestr); //wild
1587 for(uint x = 0; x < dir.count(); x++) { 1723 for(uint x = 0; x < dir.count(); x++) {
@@ -1590,9 +1726,20 @@ 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 }
@@ -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) + " ";
@@ -1612,3 +1767,3 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs)
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"
@@ -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") {
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index 1d19d98..4fdabe8 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -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**
@@ -49,3 +49,3 @@ class MakefileGenerator
49 QString build_args(); 49 QString build_args();
50 QMap<QString, QString> depHeuristics, depKeyMap; 50 QMap<QString, QString> depHeuristics, depKeyMap, fileFixed;
51 QMap<QString, QString> mocablesToMOC, mocablesFromMOC; 51 QMap<QString, QString> mocablesToMOC, mocablesFromMOC;
@@ -70,6 +70,6 @@ protected:
70 public: 70 public:
71 MakefileDependDir(QString r, QString l) : real_dir(r), local_dir(l) { } 71 MakefileDependDir(const QString &r, const QString &l) : real_dir(r), local_dir(l) { }
72 QString real_dir, local_dir; 72 QString real_dir, local_dir;
73 }; 73 };
74 bool generateDependencies(QPtrList<MakefileDependDir> &dirs, QString x, bool recurse); 74 bool generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &x, bool recurse);
75 75
@@ -79,3 +79,3 @@ protected:
79 QString cleanFilePath(const QString &file) const; 79 QString cleanFilePath(const QString &file) const;
80 bool generateMocList(QString fn); 80 bool generateMocList(const QString &fn);
81 81
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index 5ff6250..1515216 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -44,2 +44,18 @@
44 44
45QString project_builtin_regx() //calculate the builtin regular expression..
46{
47 QString ret;
48 QStringList builtin_exts(".c");
49 builtin_exts << Option::ui_ext << Option::yacc_ext << Option::lex_ext << ".ts";
50 builtin_exts += Option::h_ext + Option::cpp_ext;
51 for(QStringList::Iterator ext_it = builtin_exts.begin();
52 ext_it != builtin_exts.end(); ++ext_it) {
53 if(!ret.isEmpty())
54 ret += "; ";
55 ret += QString("*") + (*ext_it);
56 }
57 return ret;
58}
59
60
45 61
@@ -69,17 +85,9 @@ ProjectGenerator::init()
69 if(project->first("TEMPLATE_ASSIGN") != "subdirs") { 85 if(project->first("TEMPLATE_ASSIGN") != "subdirs") {
70 QString builtin_regex; 86 QString builtin_regex = project_builtin_regx();
71 { //calculate the builtin regular expression..
72 QStringList builtin_exts(".c");
73 builtin_exts << Option::ui_ext << Option::yacc_ext << Option::lex_ext;
74 builtin_exts += Option::h_ext + Option::cpp_ext;
75 for(QStringList::Iterator ext_it = builtin_exts.begin();
76 ext_it != builtin_exts.end(); ++ext_it) {
77 if(!builtin_regex.isEmpty())
78 builtin_regex += "; ";
79 builtin_regex += QString("*") + (*ext_it);
80 }
81 }
82 QStringList dirs = Option::projfile::project_dirs; 87 QStringList dirs = Option::projfile::project_dirs;
83 if(Option::projfile::do_pwd) 88 if(Option::projfile::do_pwd) {
89 if(!v["INCLUDEPATH"].contains("."))
90 v["INCLUDEPATH"] += ".";
84 dirs.prepend(QDir::currentDirPath()); 91 dirs.prepend(QDir::currentDirPath());
92 }
85 93
@@ -142,3 +150,3 @@ ProjectGenerator::init()
142 QFileInfo fi(dir); 150 QFileInfo fi(dir);
143 if(fi.absFilePath() != QDir::currentDirPath()) { 151 if(fi.absFilePath() != QDir::currentDirPath())
144 v["DEPENDPATH"] += fileFixify(dir); 152 v["DEPENDPATH"] += fileFixify(dir);
@@ -147,3 +155,2 @@ ProjectGenerator::init()
147 } 155 }
148 }
149 if(!file_count) { //shall we try a subdir? 156 if(!file_count) { //shall we try a subdir?
@@ -243,4 +250,10 @@ ProjectGenerator::init()
243 for(QStringList::Iterator dep_it = tmp.begin(); dep_it != tmp.end(); ++dep_it) { 250 for(QStringList::Iterator dep_it = tmp.begin(); dep_it != tmp.end(); ++dep_it) {
244 QString file_no_path = (*dep_it).right( 251 QString file_dir = (*dep_it).section(Option::dir_sep, 0, -2),
245 (*dep_it).length() - ((*dep_it).findRev(Option::dir_sep)+1)); 252 file_no_path = (*dep_it).section(Option::dir_sep, -1);
253 if(!file_dir.isEmpty()) {
254 for(MakefileDependDir *mdd = deplist.first(); mdd; mdd = deplist.next()) {
255 if(mdd->local_dir == file_dir && !v["INCLUDEPATH"].contains(mdd->real_dir))
256 v["INCLUDEPATH"] += mdd->real_dir;
257 }
258 }
246 if(no_qt_files && file_no_path.find(QRegExp("^q[a-z_0-9].h$")) != -1) 259 if(no_qt_files && file_no_path.find(QRegExp("^q[a-z_0-9].h$")) != -1)
@@ -248,3 +261,4 @@ ProjectGenerator::init()
248 QString h_ext; 261 QString h_ext;
249 for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { 262 for(QStringList::Iterator hit = Option::h_ext.begin();
263 hit != Option::h_ext.end(); ++hit) {
250 if((*dep_it).endsWith((*hit))) { 264 if((*dep_it).endsWith((*hit))) {
@@ -262,3 +276,4 @@ ProjectGenerator::init()
262 cppit != Option::cpp_ext.end(); ++cppit) { 276 cppit != Option::cpp_ext.end(); ++cppit) {
263 QString src((*dep_it).left((*dep_it).length() - h_ext.length()) + (*cppit)); 277 QString src((*dep_it).left((*dep_it).length() - h_ext.length()) +
278 (*cppit));
264 if(QFile::exists(src)) { 279 if(QFile::exists(src)) {
@@ -266,3 +281,4 @@ ProjectGenerator::init()
266 QStringList &srcl = v["SOURCES"]; 281 QStringList &srcl = v["SOURCES"];
267 for(QStringList::Iterator src_it = srcl.begin(); src_it != srcl.end(); ++src_it) { 282 for(QStringList::Iterator src_it = srcl.begin();
283 src_it != srcl.end(); ++src_it) {
268 if((*src_it).lower() == src.lower()) { 284 if((*src_it).lower() == src.lower()) {
@@ -339,3 +355,4 @@ ProjectGenerator::writeMakefile(QTextStream &t)
339 << getWritableVar("CONFIG_REMOVE", FALSE) 355 << getWritableVar("CONFIG_REMOVE", FALSE)
340 << getWritableVar("DEPENDPATH") << endl; 356 << getWritableVar("DEPENDPATH")
357 << getWritableVar("INCLUDEPATH") << endl;
341 358
@@ -346,3 +363,4 @@ ProjectGenerator::writeMakefile(QTextStream &t)
346 << getWritableVar("YACCSOURCES") 363 << getWritableVar("YACCSOURCES")
347 << getWritableVar("SOURCES"); 364 << getWritableVar("SOURCES")
365 << getWritableVar("TRANSLATIONS");
348 } 366 }
@@ -405,2 +423,4 @@ ProjectGenerator::addFile(QString file)
405 where = "YACCSOURCES"; 423 where = "YACCSOURCES";
424 else if(file.endsWith(".ts"))
425 where = "TRANSLATIONS";
406 } 426 }
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 7df95b2..e274481 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -7,3 +7,3 @@
7** 7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 9**
@@ -74,7 +74,6 @@ UnixMakefileGenerator::init()
74 if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { 74 if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) {
75 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); 75 if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) {
76 if ( os == "cygwin" ) {
77 project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" );
78 } else {
79 project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); 76 project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" );
77 } else {
78 project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" );
80 } 79 }
@@ -178,14 +177,2 @@ UnixMakefileGenerator::init()
178 } 177 }
179 if ( project->isActiveConfig("thread") ) {
180 if(project->isActiveConfig("qt"))
181 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT");
182 if ( !project->isEmpty("QMAKE_CFLAGS_THREAD"))
183 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"];
184 if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD"))
185 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"];
186 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"];
187 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"];
188 if(!project->isEmpty("QMAKE_LFLAGS_THREAD"))
189 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"];
190 }
191 if ( project->isActiveConfig("opengl") ) { 178 if ( project->isActiveConfig("opengl") ) {
@@ -201,6 +188,2 @@ UnixMakefileGenerator::init()
201 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; 188 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
202 if ( project->isActiveConfig("x11sm") )
203 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"];
204 if ( project->isActiveConfig("dylib") )
205 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"];
206 if ( project->isActiveConfig("x11inc") ) 189 if ( project->isActiveConfig("x11inc") )
@@ -212,2 +195,18 @@ UnixMakefileGenerator::init()
212 } 195 }
196 if ( project->isActiveConfig("x11sm") )
197 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"];
198 if ( project->isActiveConfig("dylib") )
199 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"];
200 if ( project->isActiveConfig("thread") ) {
201 if(project->isActiveConfig("qt"))
202 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT");
203 if ( !project->isEmpty("QMAKE_CFLAGS_THREAD"))
204 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"];
205 if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD"))
206 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"];
207 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"];
208 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"];
209 if(!project->isEmpty("QMAKE_LFLAGS_THREAD"))
210 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"];
211 }
213 if ( project->isActiveConfig("moc") ) 212 if ( project->isActiveConfig("moc") )
@@ -359,2 +358,86 @@ UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList
359 358
359bool
360UnixMakefileGenerator::findLibraries()
361{
362 QPtrList<MakefileDependDir> libdirs;
363 libdirs.setAutoDelete(TRUE);
364 const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
365 for(int i = 0; !lflags[i].isNull(); i++) {
366 QStringList &l = project->variables()[lflags[i]];
367 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
368 QString stub, dir, extn, opt = (*it).stripWhiteSpace();
369 if(opt.startsWith("-")) {
370 if(opt.startsWith("-L")) {
371 QString r = opt.right(opt.length() - 2), l = r;
372 fixEnvVariables(l);
373 libdirs.append(new MakefileDependDir(r.replace("\"",""),
374 l.replace("\"","")));
375 } else if(opt.startsWith("-l")) {
376 stub = opt.mid(2);
377 } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) {
378 if(opt.length() > 11) {
379 opt = opt.mid(11);
380 } else {
381 ++it;
382 opt = (*it);
383 }
384 extn = "";
385 dir = "/System/Library/Frameworks/" + opt + ".framework/";
386 stub = opt;
387 }
388 } else {
389 extn = dir = "";
390 stub = opt;
391 int slsh = opt.findRev(Option::dir_sep);
392 if(slsh != -1) {
393 dir = opt.left(slsh);
394 stub = opt.mid(slsh+1);
395 }
396 QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$");
397 if(stub_reg.exactMatch(stub)) {
398 stub = stub_reg.cap(1);
399 extn = stub_reg.cap(2);
400 }
401 }
402 if(!stub.isEmpty()) {
403 const QString modifs[] = { "-mt", QString::null };
404 for(int modif = 0; !modifs[modif].isNull(); modif++) {
405 bool found = FALSE;
406 QStringList extens;
407 if(!extn.isNull())
408 extens << extn;
409 else
410 extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a";
411 for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
412 if(dir.isNull()) {
413 QString lib_stub;
414 for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
415 if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub +
416 modifs[modif] + "." + (*extit))) {
417 lib_stub = stub + modifs[modif];
418 break;
419 }
420 }
421 if(!lib_stub.isNull()) {
422 (*it) = "-l" + lib_stub;
423 found = TRUE;
424 break;
425 }
426 } else {
427 if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) {
428 (*it) = "lib" + stub + modifs[modif] + "." + (*extit);
429 found = TRUE;
430 break;
431 }
432 }
433 }
434 if(found)
435 break;
436 }
437 }
438 }
439 }
440 return FALSE;
441}
442
360void 443void
@@ -436,4 +519,5 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
436 bool resource = FALSE; 519 bool resource = FALSE;
520 const QString root = "$(INSTALL_ROOT)";
437 QStringList &uninst = project->variables()[t + ".uninstall"]; 521 QStringList &uninst = project->variables()[t + ".uninstall"];
438 QString ret, destdir=fileFixify(project->first("DESTDIR")); 522 QString ret, destdir=project->first("DESTDIR");
439 QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); 523 QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE);
@@ -441,3 +525,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
441 destdir += Option::dir_sep; 525 destdir += Option::dir_sep;
442 targetdir = "$(INSTALL_ROOT)" + Option::fixPathToTargetOS(targetdir, FALSE); 526 targetdir = fileFixify(targetdir);
443 if(targetdir.right(1) != Option::dir_sep) 527 if(targetdir.right(1) != Option::dir_sep)
@@ -460,4 +544,4 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
460 dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); 544 dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
461 dst_prl = targetdir + dst_prl; 545 dst_prl = root + targetdir + dst_prl;
462 ret += "-$(COPY) " + project->first("QMAKE_INTERNAL_PRL_FILE") + " " + dst_prl; 546 ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\"";
463 if(!uninst.isEmpty()) 547 if(!uninst.isEmpty())
@@ -466,9 +550,8 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
466 } 550 }
467 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); 551 if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) {
468 if ( os != "cygwin" ) {
469 if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { 552 if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) {
470 if ( os == "hpux" ) { 553 if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) {
471 links << "$(TARGET0)";
472 } else {
473 links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; 554 links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)";
555 } else {
556 links << "$(TARGET0)";
474 } 557 }
@@ -480,3 +563,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
480 src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); 563 src_targ = Option::fixPathToTargetOS(destdir + target, FALSE);
481 QString dst_targ = fileFixify(targetdir + target); 564 QString dst_targ = root + fileFixify(targetdir + target);
482 if(!ret.isEmpty()) 565 if(!ret.isEmpty())
@@ -485,6 +568,8 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
485 src_targ + "\" \"" + dst_targ + "\""; 568 src_targ + "\" \"" + dst_targ + "\"";
486 if(!project->isEmpty("QMAKE_STRIP")) { 569 if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) {
487 ret += "\n\t-" + var("QMAKE_STRIP"); 570 ret += "\n\t-" + var("QMAKE_STRIP");
571 if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib")
572 ret += " " + var("QMAKE_STRIPFLAGS_LIB");
488 if(resource) 573 if(resource)
489 ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)"; 574 ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\"";
490 else 575 else
@@ -508,3 +593,3 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
508 link = link.right(link.length() - (lslash + 1)); 593 link = link.right(link.length() - (lslash + 1));
509 QString dst_link = fileFixify(targetdir + link); 594 QString dst_link = root + fileFixify(targetdir + link);
510 ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; 595 ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\"";
@@ -519,2 +604 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
519
520
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index e889dcc..3d00214 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -57,2 +57,3 @@ protected:
57 57
58 virtual bool findLibraries();
58 virtual void init(); 59 virtual void init();
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 9bb6f6b..7fbb9f4 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -83,3 +83,2 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
83 src_incremental=FALSE, moc_incremental=FALSE; 83 src_incremental=FALSE, moc_incremental=FALSE;
84 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 );
85 84
@@ -110,3 +109,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
110 t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; 109 t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl;
111 t << "INCPATH = " << varGlue("INCLUDEPATH","-I", " -I", "") << " -I" << specdir() << endl; 110 t << "INCPATH = " << "-I" << specdir();
111 if(!project->isActiveConfig("no_include_pwd")) {
112 QString pwd = fileFixify(QDir::currentDirPath());
113 if(pwd.isEmpty())
114 pwd = ".";
115 t << " -I" << pwd;
116 }
117 t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl;
112 118
@@ -138,3 +144,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
138 t << "MOVE = " << var("QMAKE_MOVE") << endl; 144 t << "MOVE = " << var("QMAKE_MOVE") << endl;
139 t << "PRO = " << fileFixify(project->projectFile() )<< endl; 145 t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
146 t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
140 t << endl; 147 t << endl;
@@ -214,4 +221,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
214 do_incremental = FALSE; 221 do_incremental = FALSE;
215 t << "DIST = " << varList("DISTFILES") << endl; 222 t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl;
216 t << "PRO = " << fileFixify(project->projectFile()) << endl;
217 t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; 223 t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
@@ -223,7 +229,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
223 t << "TARGETA= " << var("TARGETA") << endl; 229 t << "TARGETA= " << var("TARGETA") << endl;
224 if (os == "hpux") { 230 if (project->isEmpty("QMAKE_HPUX_SHLIB")) {
225 t << "TARGETD= " << var("TARGET_x") << endl;
226 t << "TARGET0= " << var("TARGET_") << endl;
227 }
228 else {
229 t << "TARGETD= " << var("TARGET_x.y.z") << endl; 231 t << "TARGETD= " << var("TARGET_x.y.z") << endl;
@@ -232,2 +234,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
232 t << "TARGET2= " << var("TARGET_x.y") << endl; 234 t << "TARGET2= " << var("TARGET_x.y") << endl;
235 } else {
236 t << "TARGETD= " << var("TARGET_x") << endl;
237 t << "TARGET0= " << var("TARGET_") << endl;
233 } 238 }
@@ -263,3 +268,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
263 odir = project->first("OBJECTS_DIR"); 268 odir = project->first("OBJECTS_DIR");
264 t << "###### Dependancies" << endl << endl; 269 t << "###### Dependencies" << endl << endl;
265 t << odir << ".deps/%.d: %.cpp\n\t" 270 t << odir << ".deps/%.d: %.cpp\n\t"
@@ -388,3 +393,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
388 //real target 393 //real target
389 t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t"; 394 t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps
395 << " " << var("POST_TARGETDEPS") << "\n\t";
390 if(!destdir.isEmpty()) 396 if(!destdir.isEmpty())
@@ -401,3 +407,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
401 407
402 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t"; 408 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
409 << var("POST_TARGETDEPS") << "\n\t";
403 if(!destdir.isEmpty()) 410 if(!destdir.isEmpty())
@@ -462,4 +469,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
462 //real target 469 //real target
463 t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " << 470 t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " "
464 var("TARGETDEPS"); 471 << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS");
465 } else { 472 } else {
@@ -467,4 +474,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
467 var("DESTDIR_TARGET") << endl << endl; 474 var("DESTDIR_TARGET") << endl << endl;
468 t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << 475 t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS")
469 var("TARGETDEPS"); 476 << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS");
470 } 477 }
@@ -485,7 +492,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
485 t << endl << endl; 492 t << endl << endl;
486 } else if ( os == "hpux" ) { 493 } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) {
487 t << "\n\t" 494 t << "\n\t"
488 << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" 495 << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t"
489 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; 496 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
490 t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); 497 t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t"
498 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
499 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
491 if(!destdir.isEmpty()) 500 if(!destdir.isEmpty())
@@ -494,3 +503,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
494 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" 503 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
495 << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); 504 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t"
505 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t"
506 << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR");
496 if(!project->isEmpty("QMAKE_POST_LINK")) 507 if(!project->isEmpty("QMAKE_POST_LINK"))
@@ -500,7 +511,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
500 t << "\n\t" 511 t << "\n\t"
501 << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" 512 << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t"
502 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; 513 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
503 t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" 514 t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
504 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
505 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
506 if(!destdir.isEmpty()) 515 if(!destdir.isEmpty())
@@ -509,5 +518,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
509 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" 518 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
510 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" 519 << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
511 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t"
512 << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR");
513 if(!project->isEmpty("QMAKE_POST_LINK")) 520 if(!project->isEmpty("QMAKE_POST_LINK"))
@@ -520,6 +527,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
520 t << "staticlib: $(TARGETA)" << endl << endl; 527 t << "staticlib: $(TARGETA)" << endl << endl;
521 t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)"; 528 t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)";
522 if(do_incremental) 529 if(do_incremental)
523 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 530 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
524 t << var("TARGETDEPS") << "\n\t" 531 t << var("POST_TARGETDEPS") << "\n\t"
525 << "-$(DEL_FILE) $(TARGETA) " << "\n\t" 532 << "-$(DEL_FILE) $(TARGETA) " << "\n\t"
@@ -537,3 +544,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
537 if(project->isEmpty("QMAKE_AR_SUBLIBS")) { 544 if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
538 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t"; 545 t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
546 << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t";
539 if(!project->isEmpty("DESTDIR")) { 547 if(!project->isEmpty("DESTDIR")) {
@@ -552,3 +560,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
552 } else { 560 } else {
553 int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); 561 int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
554 QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], 562 QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"],
@@ -559,3 +567,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
559 QStringList build; 567 QStringList build;
560 for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) 568 for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
561 build << (*objit); 569 build << (*objit);
@@ -563,4 +571,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
563 if((*libit) == "$(TARGET)") { 571 if((*libit) == "$(TARGET)") {
564 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " 572 t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
565 << valList(build) << "\n\t"; 573 << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t";
566 ar = project->variables()["QMAKE_AR_CMD"].first(); 574 ar = project->variables()["QMAKE_AR_CMD"].first();
@@ -594,3 +602,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
594 //this is an implicity depend on moc, so it will be built if necesary, however 602 //this is an implicity depend on moc, so it will be built if necesary, however
595 //moc itself shouldn't have this dependancy - this is a little kludgy but it is 603 //moc itself shouldn't have this dependency - this is a little kludgy but it is
596 //better than the alternative for now. 604 //better than the alternative for now.
@@ -655,3 +663,3 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
655 << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " 663 << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && "
656 << "$(DEL_DIR) " << ddir_c 664 << "$(DEL_FILE) -r " << ddir_c
657 << endl << endl; 665 << endl << endl;
@@ -679,2 +687,41 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
679 687
688 t << "yaccclean:" << "\n";
689 if(!var("YACCSOURCES").isEmpty()) {
690 QStringList clean, &l = project->variables()["YACCSOURCES"];
691 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
692 QFileInfo fi((*it));
693 QString dir;
694 if(fi.dirPath() != ".")
695 dir = fi.dirPath() + Option::dir_sep;
696 dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir);
697 if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)
698 dir += Option::dir_sep;
699 clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first();
700 clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first();
701 }
702 if(!clean.isEmpty()) {
703 t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n";
704 clean_targets += " yaccclean";
705 }
706 }
707
708 t << "lexclean:" << "\n";
709 if(!var("LEXSOURCES").isEmpty()) {
710 QStringList clean, &l = project->variables()["LEXSOURCES"];
711 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
712 QFileInfo fi((*it));
713 QString dir;
714 if(fi.dirPath() != ".")
715 dir = fi.dirPath() + Option::dir_sep;
716 dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir);
717 if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)
718 dir += Option::dir_sep;
719 clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first();
720 }
721 if(!clean.isEmpty()) {
722 t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n";
723 clean_targets += " lexclean";
724 }
725 }
726
680 if(do_incremental) { 727 if(do_incremental) {
@@ -712,4 +759,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
712 destdir += Option::dir_sep; 759 destdir += Option::dir_sep;
713 t << "distclean: " << "clean\n\t" 760 t << "distclean: " << "clean\n";
714 << "-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; 761 if(project->first("TEMPLATE") == "app" &&
762 project->isActiveConfig("resource_fork") && !project->isActiveConfig("console"))
763 t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n";
764 else
765 t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n";
715 if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && 766 if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() &&
@@ -846,3 +897,3 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
846 if(project->isEmpty("SUBDIRS")) { 897 if(project->isEmpty("SUBDIRS")) {
847 t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl; 898 t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl;
848 } else { 899 } else {
@@ -864,3 +915,3 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
864 t << endl; 915 t << endl;
865 t << "clean uninstall install uiclean mocclean: qmake_all FORCE"; 916 t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE";
866 for( it.toFirst(); it.current(); ++it) { 917 for( it.toFirst(); it.current(); ++it) {
@@ -908,2 +959,4 @@ void UnixMakefileGenerator::init2()
908 project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); 959 project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
960 if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() )
961 project->variables()["TARGET_EXT"].append(".exe");
909 } else if ( project->isActiveConfig("staticlib") ) { 962 } else if ( project->isActiveConfig("staticlib") ) {
@@ -919,3 +972,2 @@ void UnixMakefileGenerator::init2()
919 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); 972 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)");
920 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 );
921 if( project->isActiveConfig("plugin") ) { 973 if( project->isActiveConfig("plugin") ) {
@@ -935,3 +987,3 @@ void UnixMakefileGenerator::init2()
935 project->variables()["DEFINES"].append("QT_PLUGIN"); 987 project->variables()["DEFINES"].append("QT_PLUGIN");
936 } else if ( os == "hpux" ) { 988 } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) {
937 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); 989 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl");
@@ -944,3 +996,3 @@ void UnixMakefileGenerator::init2()
944 project->variables()["TARGET"] = project->variables()["TARGET_x"]; 996 project->variables()["TARGET"] = project->variables()["TARGET_x"];
945 } else if ( os == "aix" ) { 997 } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) {
946 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); 998 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a");
@@ -1013,4 +1065,11 @@ void UnixMakefileGenerator::init2()
1013 project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); 1065 project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR"));
1014 if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty() && !project->variables()["TARGET_x"].isEmpty() ) 1066 if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) {
1067 if(project->isActiveConfig("plugin")) {
1068 if(!project->variables()["TARGET"].isEmpty() )
1069 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET");
1070 } else {
1071 if(!project->variables()["TARGET_x"].isEmpty() )
1015 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); 1072 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x");
1073 }
1074 }
1016 if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) 1075 if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() )
diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp
index ae7b47b..26eea88 100644
--- a/qmake/generators/win32/borland_bmake.cpp
+++ b/qmake/generators/win32/borland_bmake.cpp
@@ -134,2 +134,4 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
134 t << "MOVE = " << var("QMAKE_MOVE") << endl; 134 t << "MOVE = " << var("QMAKE_MOVE") << endl;
135 t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl;
136 t << "MKDIR =" << var("QMAKE_MKDIR") << endl;
135 t << endl; 137 t << endl;
@@ -152,7 +154,10 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
152 t << "####### Implicit rules" << endl << endl; 154 t << "####### Implicit rules" << endl << endl;
153 t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl; 155 t << ".SUFFIXES: .c";
154 t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 156 QStringList::Iterator cppit;
155 t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 157 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
156 t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 158 t << " " << (*cppit);
157 t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; 159 t << endl << endl;
160 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
161 t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
162 t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
158 163
@@ -160,3 +165,4 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
160 t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl; 165 t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl;
161 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS"); 166 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
167 << var("POST_TARGETDEPS");
162 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { 168 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
@@ -171,2 +177,6 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
171 t << endl << "|" << endl; 177 t << endl << "|" << endl;
178
179 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
180 t << "\t" <<var("QMAKE_POST_LINK") << endl;
181
172 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { 182 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
@@ -215,3 +225,2 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
215 << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") 225 << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
216 << "\n\t-del $(TARGET)"
217 << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") 226 << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
@@ -222,4 +231,2 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
222 } 231 }
223 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty())
224 t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
225 if(!project->isEmpty("IMAGES")) 232 if(!project->isEmpty("IMAGES"))
@@ -246,2 +253,6 @@ BorlandMakefileGenerator::writeBorlandParts(QTextStream &t)
246 t << endl << endl; 253 t << endl << endl;
254
255 t << "distclean: clean"
256 << "\n\t-del $(TARGET)"
257 << endl << endl;
247} 258}
@@ -366,3 +377,3 @@ BorlandMakefileGenerator::init()
366 if ( hver == -1 ) 377 if ( hver == -1 )
367 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); 378 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qtmt");
368 if(hver != -1) { 379 if(hver != -1) {
@@ -428,2 +439,24 @@ BorlandMakefileGenerator::init()
428 } 439 }
440 if ( project->isActiveConfig("stl") ) {
441 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
442 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
443 } else {
444 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
445 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
446 }
447 if ( project->isActiveConfig("exceptions") ) {
448 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
449 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
450 } else {
451 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
452 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
453 }
454 if ( project->isActiveConfig("rtti") ) {
455 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
456 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
457 } else {
458 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
459 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
460 }
461
429 if ( project->isActiveConfig("thread") ) { 462 if ( project->isActiveConfig("thread") ) {
@@ -454,3 +487,3 @@ BorlandMakefileGenerator::init()
454 project->variables()["RES_FILE"].first().replace(".rc",".res"); 487 project->variables()["RES_FILE"].first().replace(".rc",".res");
455 project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"]; 488 project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
456 } 489 }
@@ -476,2 +509 @@ BorlandMakefileGenerator::init()
476} }
477
diff --git a/qmake/generators/win32/borland_bmake.h b/qmake/generators/win32/borland_bmake.h
index 90f8229..5ffed58 100644
--- a/qmake/generators/win32/borland_bmake.h
+++ b/qmake/generators/win32/borland_bmake.h
@@ -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**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __BORLANDMAKE_H__ 37#ifndef __BORLAND_BMAKE_H__
38#define __BORLANDMAKE_H__ 38#define __BORLAND_BMAKE_H__
39 39
@@ -57,3 +57,2 @@ inline BorlandMakefileGenerator::~BorlandMakefileGenerator()
57 57
58 58#endif /* __BORLAND_BMAKE_H__ */
59#endif /* __BORLANDMAKE_H__ */
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
new file mode 100644
index 0000000..7f58a55
--- a/dev/null
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -0,0 +1,524 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of ________ class.
5**
6** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
7**
8** This file is part of the network module of the Qt GUI Toolkit.
9**
10** This file may be distributed under the terms of the Q Public License
11** as defined by Trolltech AS of Norway and appearing in the file
12** LICENSE.QPL included in the packaging of this file.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** Licensees holding valid Qt Enterprise Edition licenses may use this
20** file in accordance with the Qt Commercial License Agreement provided
21** with the Software.
22**
23** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25**
26** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27** information about Qt Commercial License Agreements.
28** See http://www.trolltech.com/qpl/ for QPL licensing information.
29** See http://www.trolltech.com/gpl/ for GPL licensing information.
30**
31** Contact info@trolltech.com if any conditions of this licensing are
32** not clear to you.
33**
34**********************************************************************/
35
36#include "mingw_make.h"
37#include "option.h"
38#include <qregexp.h>
39#include <qdir.h>
40#include <stdlib.h>
41#include <time.h>
42
43
44MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
45{
46 Option::obj_ext = ".o";
47}
48
49bool
50MingwMakefileGenerator::writeMakefile(QTextStream &t)
51{
52 writeHeader(t);
53 if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
54 t << "all clean:" << "\n\t"
55 << "@echo \"Some of the required modules ("
56 << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
57 << "@echo \"Skipped.\"" << endl << endl;
58 writeMakeQmake(t);
59 return TRUE;
60 }
61
62 if(project->first("TEMPLATE") == "app" ||
63 project->first("TEMPLATE") == "lib") {
64 writeMingwParts(t);
65 return MakefileGenerator::writeMakefile(t);
66 }
67 else if(project->first("TEMPLATE") == "subdirs") {
68 writeSubDirs(t);
69 return TRUE;
70 }
71 return FALSE;
72}
73
74void
75MingwMakefileGenerator::writeMingwParts(QTextStream &t)
76{
77 t << "####### Compiler, tools and options" << endl << endl;
78 t << "CC =" << var("QMAKE_CC") << endl;
79 t << "CXX =" << var("QMAKE_CXX") << endl;
80 t << "LEX = " << var("QMAKE_LEX") << endl;
81 t << "YACC = " << var("QMAKE_YACC") << endl;
82 t << "CFLAGS =" << var("QMAKE_CFLAGS") << " "
83 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
84 << varGlue("DEFINES","-D"," -D","") << endl;
85 t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " "
86 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
87 << varGlue("DEFINES","-D"," -D","") << endl;
88 t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl;
89 t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl;
90
91 t << "INCPATH =";
92 QStringList &incs = project->variables()["INCLUDEPATH"];
93 for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
94 QString inc = (*incit);
95 inc.replace(QRegExp("\\\\$"), "\\\\");
96 inc.replace(QRegExp("\""), "");
97 t << " -I" << inc ;
98 }
99 t << " -I" << specdir()
100 << endl;
101 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
102 t << "LINK =" << var("QMAKE_LINK") << endl;
103 t << "LFLAGS =";
104 if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
105 t << varGlue("QMAKE_LIBDIR","-L",";","") << " ";
106 t << var("QMAKE_LFLAGS") << endl;
107 t << "LIBS =" << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl;
108 }
109 else {
110 t << "LIB =" << var("QMAKE_LIB") << endl;
111 }
112 t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") :
113 Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl;
114 t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") :
115 Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl;
116 t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") :
117 Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl;
118 t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
119 Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl;
120 t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
121 Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl;
122 t << "ZIP =" << var("QMAKE_ZIP") << endl;
123 t << "DEF_FILE =" << varList("DEF_FILE") << endl;
124 t << "COPY_FILE= " << var("QMAKE_COPY") << endl;
125 t << "COPY_DIR= " << var("QMAKE_COPY") << endl;
126 t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl;
127 t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl;
128 t << "MOVE = " << var("QMAKE_MOVE") << endl;
129 t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl;
130 t << "MKDIR =" << var("QMAKE_MKDIR") << endl;
131 t << endl;
132
133 t << "####### Output directory" << endl << endl;
134 if (! project->variables()["OBJECTS_DIR"].isEmpty())
135 t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl;
136 else
137 t << "OBJECTS_DIR = . " << endl;
138 if (! project->variables()["MOC_DIR"].isEmpty())
139 t << "MOC_DIR = " << var("MOC_DIR").replace(QRegExp("\\\\$"),"") << endl;
140 else
141 t << "MOC_DIR = . " << endl;
142 t << endl;
143
144 t << "####### Files" << endl << endl;
145 t << "HEADERS =" << varList("HEADERS") << endl;
146 t << "SOURCES =" << varList("SOURCES") << endl;
147 // t << "OBJECTS =" << varList("OBJECTS").replace(QRegExp("\\.obj"),".o") << endl;
148 t << "OBJECTS =" << varList("OBJECTS") << endl;
149 t << "FORMS =" << varList("FORMS") << endl;
150 t << "UICDECLS =" << varList("UICDECLS") << endl;
151 t << "UICIMPLS =" << varList("UICIMPLS") << endl;
152 t << "SRCMOC =" << varList("SRCMOC") << endl;
153 t << "OBJMOC =" << varList("OBJMOC") << endl;
154 // t << "OBJMOC =" << varList("OBJMOC").replace(QRegExp("\\.obj"),".o") << endl;
155 t << "DIST =" << varList("DISTFILES") << endl;
156 t << "TARGET =";
157 if( !project->variables()[ "DESTDIR" ].isEmpty() )
158 t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT"));
159 else
160 t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
161 t << endl;
162 t << endl;
163
164 t << "####### Implicit rules" << endl << endl;
165 t << ".SUFFIXES: .cpp .cxx .cc .C .c" << endl << endl;
166 t << ".cpp.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
167 t << ".cxx.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
168 t << ".cc.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
169 t << ".C.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
170 t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
171
172 t << "####### Build rules" << endl << endl;
173 t << "all: " << "$(OBJECTS_DIR) " << "$(MOC_DIR) " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl;
174 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
175 << var("POST_TARGETDEPS");
176 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
177 t << "\n\t" << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)";
178 } else {
179 t << "\n\t" << "$(LIB) $(TARGET) $(OBJECTS) $(OBJMOC)";
180 }
181
182 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
183 QStringList dlldirs = project->variables()["DLLDESTDIR"];
184 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
185 t << "\n\t" << "copy $(TARGET) " << *dlldir;
186 }
187 }
188 QString targetfilename = project->variables()["TARGET"].first();
189 if(project->isActiveConfig("activeqt")) {
190 QString version = project->variables()["VERSION"].first();
191 if ( version.isEmpty() )
192 version = "1.0";
193
194 if ( project->isActiveConfig("dll")) {
195 t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version);
196 t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
197 t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
198 t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
199 } else {
200 t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version);
201 t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
202 t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
203 t << "\n\t" << "-$(TARGET) -regserver";
204 }
205 }
206 t << endl << endl;
207
208 if(!project->variables()["RC_FILE"].isEmpty()) {
209 t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
210 << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),".o") << endl << endl;
211 }
212 project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),".o");
213
214 t << "mocables: $(SRCMOC)" << endl << endl;
215
216 t << "$(OBJECTS_DIR):" << "\n\t"
217 << "@if not exist $(OBJECTS_DIR) mkdir $(OBJECTS_DIR)" << endl << endl;
218
219 t << "$(MOC_DIR):" << "\n\t"
220 << "@if not exist $(MOC_DIR) mkdir $(MOC_DIR)" << endl << endl;
221
222 writeMakeQmake(t);
223
224 t << "dist:" << "\n\t"
225 << "$(ZIP) " << var("PROJECT") << ".zip "
226 << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl;
227
228 t << "clean:"
229 << varGlue("OBJECTS","\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o")
230 << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","")
231 << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o")
232 << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","")
233 << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
234 << "\n\t-del $(TARGET)"
235 << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
236 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
237 if ( project->isActiveConfig("activeqt")) {
238 t << ("\n\t-del tmp\\" + targetfilename + ".*");
239 t << "\n\t-del tmp\\dump.*";
240 }
241 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty())
242 t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first();
243 if(!project->isEmpty("IMAGES"))
244 t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", "");
245
246 // blasted user defined targets
247 QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
248 for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) {
249 QString targ = var((*it) + ".target"),
250 cmd = var((*it) + ".commands"), deps;
251 if(targ.isEmpty())
252 targ = (*it);
253 QStringList &deplist = project->variables()[(*it) + ".depends"];
254 for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
255 QString dep = var((*dep_it) + ".target");
256 if(dep.isEmpty())
257 dep = (*dep_it);
258 deps += " " + dep;
259 }
260 t << "\n\n" << targ << ":" << deps << "\n\t"
261 << cmd;
262 }
263
264 t << endl << endl;
265}
266
267
268void
269MingwMakefileGenerator::init()
270{
271 if(init_flag)
272 return;
273 init_flag = TRUE;
274
275 /* this should probably not be here, but I'm using it to wrap the .t files */
276 if(project->first("TEMPLATE") == "app")
277 project->variables()["QMAKE_APP_FLAG"].append("1");
278 else if(project->first("TEMPLATE") == "lib")
279 project->variables()["QMAKE_LIB_FLAG"].append("1");
280 else if(project->first("TEMPLATE") == "subdirs") {
281 MakefileGenerator::init();
282 if(project->variables()["MAKEFILE"].isEmpty())
283 project->variables()["MAKEFILE"].append("Makefile");
284 if(project->variables()["QMAKE"].isEmpty())
285 project->variables()["QMAKE"].append("qmake");
286 return;
287 }
288
289 bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX);
290 project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
291
292 // LIBS defined in Profile comes first for gcc
293 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
294
295 QString targetfilename = project->variables()["TARGET"].first();
296 QStringList &configs = project->variables()["CONFIG"];
297 if (project->isActiveConfig("qt") && project->isActiveConfig("shared"))
298 project->variables()["DEFINES"].append("QT_DLL");
299 if (project->isActiveConfig("qt_dll"))
300 if(configs.findIndex("qt") == -1) configs.append("qt");
301 if ( project->isActiveConfig("qt") ) {
302 if ( project->isActiveConfig( "plugin" ) ) {
303 project->variables()["CONFIG"].append("dll");
304 if(project->isActiveConfig("qt"))
305 project->variables()["DEFINES"].append("QT_PLUGIN");
306 }
307 if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) &&
308 ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 ||
309 project->variables()["DEFINES"].findIndex("QT_DLL") != -1) ||
310 (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) {
311 project->variables()["QMAKE_QT_DLL"].append("1");
312 if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() )
313 project->variables()["CONFIG"].append("dll");
314 }
315 if ( project->isActiveConfig("thread") )
316 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT");
317 if ( project->isActiveConfig("accessibility" ) )
318 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT");
319 if ( project->isActiveConfig("tablet") )
320 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT");
321 }
322 if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
323 project->variables()["CONFIG"].remove("staticlib");
324 project->variables()["QMAKE_APP_OR_DLL"].append("1");
325 } else {
326 project->variables()["CONFIG"].append("staticlib");
327 }
328 if ( project->isActiveConfig("warn_off") ) {
329 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"];
330 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"];
331 } else if ( project->isActiveConfig("warn_on") ) {
332 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"];
333 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"];
334 }
335 if ( project->isActiveConfig("debug") ) {
336 if ( project->isActiveConfig("thread") ) {
337 // use the DLL RT even here
338 if ( project->variables()["DEFINES"].contains("QT_DLL") ) {
339 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"];
340 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"];
341 } else {
342 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"];
343 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"];
344 }
345 }
346 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"];
347 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"];
348 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"];
349 } else {
350 if ( project->isActiveConfig("thread") ) {
351 if ( project->variables()["DEFINES"].contains("QT_DLL") ) {
352 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"];
353 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"];
354 } else {
355 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"];
356 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"];
357 }
358 }
359 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"];
360 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"];
361 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"];
362 }
363
364 if ( !project->variables()["QMAKE_INCDIR"].isEmpty())
365 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
366 if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") )
367 project->variables()["CONFIG"].append("windows");
368 if ( project->isActiveConfig("qt") ) {
369 project->variables()["CONFIG"].append("moc");
370 project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"];
371 project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"];
372 if ( !project->isActiveConfig("debug") )
373 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG");
374 if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
375 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) {
376 project->variables()["DEFINES"].append("QT_MAKEDLL");
377 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"];
378 }
379 } else {
380 if(project->isActiveConfig("thread"))
381 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
382 else
383 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
384 if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
385 int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt");
386 if ( hver == -1 )
387 hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt");
388 if(hver != -1) {
389 QString ver;
390 ver.sprintf("libqt-%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver);
391 QStringList &libs = project->variables()["QMAKE_LIBS"];
392// @@@HGTODO maybe we must change the replace regexp if we understand what's going on
393 for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
394 (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver);
395 }
396 }
397 if ( project->isActiveConfig( "activeqt" ) ) {
398 project->variables().remove("QMAKE_LIBS_QT_ENTRY");
399 project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib";
400 if ( project->isActiveConfig( "dll" ) )
401 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"];
402 }
403 if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) {
404 project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"];
405 }
406 }
407 }
408 if ( project->isActiveConfig("opengl") ) {
409 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
410 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"];
411 }
412 if ( project->isActiveConfig("dll") ) {
413 project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"];
414 project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"];
415 project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"];
416 project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"];
417 if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) {
418 project->variables()["TARGET_EXT"].append(
419 QStringList::split('.',project->first("VERSION")).join("") + ".dll");
420 } else {
421 project->variables()["TARGET_EXT"].append(".dll");
422 }
423 } else {
424 project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"];
425 project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"];
426 project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"];
427 project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"];
428 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
429 project->variables()["TARGET_EXT"].append(".exe");
430 } else {
431 project->variables()["TARGET_EXT"].append(".a");
432 project->variables()["QMAKE_LFLAGS"].append("-static");
433 if(project->variables()["TARGET"].first().left(3) != "lib")
434 project->variables()["TARGET"].first().prepend("lib");
435 }
436 }
437 if ( project->isActiveConfig("windows") ) {
438 if ( project->isActiveConfig("console") ) {
439 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
440 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
441 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
442 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
443 } else {
444 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"];
445 }
446 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
447 } else {
448 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
449 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
450 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
451 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
452 }
453
454 if ( project->isActiveConfig("moc") )
455 setMocAware(TRUE);
456 project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
457 "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
458 QStringList &l = project->variables()["QMAKE_FILETAGS"];
459 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
460 QStringList &gdmf = project->variables()[(*it)];
461 for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
462 (*inner) = Option::fixPathToTargetOS((*inner), FALSE);
463 }
464
465 if ( project->isActiveConfig("dll") )
466 project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") + project->first("DESTDIR") + "\\lib"+ project->first("TARGET") + ".a");
467
468 if ( !project->variables()["DEF_FILE"].isEmpty() )
469 project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--output-def,") + project->first("DEF_FILE"));
470// if(!project->isActiveConfig("incremental"))
471 //project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no"));
472
473#if 0
474 if ( !project->variables()["VERSION"].isEmpty() ) {
475 QString version = project->variables()["VERSION"][0];
476 int firstDot = version.find( "." );
477 QString major = version.left( firstDot );
478 QString minor = version.right( version.length() - firstDot - 1 );
479 minor.replace( ".", "" );
480 project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor );
481 }
482#endif
483 if ( !project->variables()["RC_FILE"].isEmpty()) {
484 if ( !project->variables()["RES_FILE"].isEmpty()) {
485 fprintf(stderr, "Both .rc and .res file specified.\n");
486 fprintf(stderr, "Please specify one of them, not both.");
487 exit(666);
488 }
489 project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
490 project->variables()["RES_FILE"].first().replace(".rc",".o");
491 project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
492 }
493 if ( !project->variables()["RES_FILE"].isEmpty())
494 project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"];
495
496 MakefileGenerator::init();
497 if ( !project->variables()["VERSION"].isEmpty()) {
498 QStringList l = QStringList::split('.', project->first("VERSION"));
499 project->variables()["VER_MAJ"].append(l[0]);
500 project->variables()["VER_MIN"].append(l[1]);
501 }
502 if(project->isActiveConfig("dll")) {
503 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a");
504 }
505}
506
507void
508MingwMakefileGenerator::writeSubDirs(QTextStream &t)
509{
510 QString qs ;
511 QTextStream ts (&qs, IO_WriteOnly) ;
512 Win32MakefileGenerator::writeSubDirs( ts ) ;
513 QRegExp rx("(\\n\\tcd [^\\n\\t]+)(\\n\\t.+)\\n\\t@cd ..") ;
514 rx.setMinimal(true);
515 int pos = 0 ;
516 while ( -1 != (pos = rx.search( qs, pos)))
517 {
518 QString qsMatch = rx.cap(2);
519 qsMatch.replace("\n\t"," && \\\n\t");
520 qs.replace(pos+rx.cap(1).length(), rx.cap(2).length(), qsMatch );
521 pos += (rx.cap(1).length()+qsMatch.length());
522 }
523 t << qs ;
524}
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h
new file mode 100644
index 0000000..c00bf1b
--- a/dev/null
+++ b/qmake/generators/win32/mingw_make.h
@@ -0,0 +1,58 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of ________ class.
5**
6** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
7**
8** This file is part of the network module of the Qt GUI Toolkit.
9**
10** This file may be distributed under the terms of the Q Public License
11** as defined by Trolltech AS of Norway and appearing in the file
12** LICENSE.QPL included in the packaging of this file.
13**
14** This file may be distributed and/or modified under the terms of the
15** GNU General Public License version 2 as published by the Free Software
16** Foundation and appearing in the file LICENSE.GPL included in the
17** packaging of this file.
18**
19** Licensees holding valid Qt Enterprise Edition licenses may use this
20** file in accordance with the Qt Commercial License Agreement provided
21** with the Software.
22**
23** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
24** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
25**
26** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
27** information about Qt Commercial License Agreements.
28** See http://www.trolltech.com/qpl/ for QPL licensing information.
29** See http://www.trolltech.com/gpl/ for GPL licensing information.
30**
31** Contact info@trolltech.com if any conditions of this licensing are
32** not clear to you.
33**
34**********************************************************************/
35#ifndef __MINGW_MAKE_H__
36#define __MINGW_MAKE_H__
37
38#include "winmakefile.h"
39
40class MingwMakefileGenerator : public Win32MakefileGenerator
41{
42 bool init_flag;
43 void writeMingwParts(QTextStream &);
44 void writeSubDirs(QTextStream &t) ;
45
46 bool writeMakefile(QTextStream &);
47 void init();
48
49public:
50 MingwMakefileGenerator(QMakeProject *p);
51 ~MingwMakefileGenerator();
52
53};
54
55inline MingwMakefileGenerator::~MingwMakefileGenerator()
56{ }
57
58#endif /* __MINGW_MAKE_H__ */
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp
index 8b08c78..3fa0496 100644
--- a/qmake/generators/win32/msvc_dsp.cpp
+++ b/qmake/generators/win32/msvc_dsp.cpp
@@ -510,2 +510,26 @@ DspMakefileGenerator::init()
510 510
511 const bool thread = project->isActiveConfig("thread");
512
513 if ( project->isActiveConfig("stl") ) {
514 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
515 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
516 } else {
517 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
518 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
519 }
520 if ( project->isActiveConfig("exceptions") ) {
521 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
522 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
523 } else {
524 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
525 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
526 }
527 if ( project->isActiveConfig("rtti") ) {
528 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
529 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
530 } else {
531 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
532 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
533 }
534
511 /* this should probably not be here, but I'm using it to wrap the .t files */ 535 /* this should probably not be here, but I'm using it to wrap the .t files */
@@ -570,3 +594,3 @@ DspMakefileGenerator::init()
570 } else { 594 } else {
571 if(project->isActiveConfig("thread")) 595 if( thread )
572 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; 596 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
@@ -580,3 +604,3 @@ DspMakefileGenerator::init()
580 QString ver; 604 QString ver;
581 ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); 605 ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver);
582 QStringList &libs = project->variables()["QMAKE_LIBS"]; 606 QStringList &libs = project->variables()["QMAKE_LIBS"];
@@ -624,3 +648,3 @@ DspMakefileGenerator::init()
624 } 648 }
625 if ( project->isActiveConfig("thread") ) { 649 if ( thread ) {
626 if(project->isActiveConfig("qt")) 650 if(project->isActiveConfig("qt"))
@@ -734,2 +758,3 @@ DspMakefileGenerator::init()
734 758
759 processPrlFiles();
735 QStringList &libs = project->variables()["QMAKE_LIBS"]; 760 QStringList &libs = project->variables()["QMAKE_LIBS"];
@@ -756,2 +781,14 @@ DspMakefileGenerator::init()
756 QString dest; 781 QString dest;
782 QString postLinkStep;
783 QString copyDllStep;
784 QString activeQtStepPreCopyDll;
785 QString activeQtStepPostCopyDll;
786 QString activeQtStepPreCopyDllDebug;
787 QString activeQtStepPostCopyDllDebug;
788 QString activeQtStepPreCopyDllRelease;
789 QString activeQtStepPostCopyDllRelease;
790
791 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
792 postLinkStep += var("QMAKE_POST_LINK");
793
757 if ( !project->variables()["DESTDIR"].isEmpty() ) { 794 if ( !project->variables()["DESTDIR"].isEmpty() ) {
@@ -772,16 +809,9 @@ DspMakefileGenerator::init()
772 QStringList dlldirs = project->variables()["DLLDESTDIR"]; 809 QStringList dlldirs = project->variables()["DLLDESTDIR"];
773 QString copydll = "# Begin Special Build Tool\n" 810 if ( dlldirs.count() )
774 "TargetPath=" + dest + "\n" 811 copyDllStep += "\t";
775 "SOURCE=$(InputPath)\n"
776 "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n"
777 "PostBuild_Cmds=";
778
779 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { 812 for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
780 copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; 813 copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t";
781 } 814 }
782
783 copydll += "\n# End Special Build Tool";
784 project->variables()["MSVCDSP_COPY_DLL_REL"].append( copydll );
785 project->variables()["MSVCDSP_COPY_DLL_DBG"].append( copydll );
786 } 815 }
816
787 if ( project->isActiveConfig("activeqt") ) { 817 if ( project->isActiveConfig("activeqt") ) {
@@ -797,38 +827,50 @@ DspMakefileGenerator::init()
797 if ( project->isActiveConfig( "dll" ) ) { 827 if ( project->isActiveConfig( "dll" ) ) {
798 QString regcmd = "# Begin Special Build Tool\n" 828 activeQtStepPreCopyDll +=
799 "TargetPath=" + targetfilename + "\n" 829 "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version +
800 "SOURCE=$(InputPath)\n"
801 "PostBuild_Desc=Finalizing ActiveQt server...\n"
802 "PostBuild_Cmds=" +
803 idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version +
804 "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" 830 "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"
805 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" 831 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb";
806 "\t" + idc + " %1 /regserver\n" 832 activeQtStepPostCopyDll +=
807 "# End Special Build Tool"; 833 "\t" + idc + " %1 /regserver\n";
808 834
809 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); 835 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll";
810 project->variables()["MSVCDSP_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 836 activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
837 activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
811 838
812 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); 839 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll";
813 project->variables()["MSVCDSP_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 840 activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
841 activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
814 } else { 842 } else {
815 QString regcmd = "# Begin Special Build Tool\n" 843 activeQtStepPreCopyDll +=
816 "TargetPath=" + targetfilename + "\n" 844 "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version +
817 "SOURCE=$(InputPath)\n"
818 "PostBuild_Desc=Finalizing ActiveQt server...\n"
819 "PostBuild_Cmds="
820 "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version +
821 "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" 845 "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl"
822 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" 846 "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb";
823 "\t%1 -regserver\n" 847 activeQtStepPostCopyDll +=
824 "# End Special Build Tool"; 848 "\t%1 -regserver\n";
849 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe";
850 activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable);
851 activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable);
825 852
826 QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); 853 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe";
827 project->variables()["MSVCDSP_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); 854 activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable);
855 activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable);
856 }
828 857
829 executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first();
830 project->variables()["MSVCDSP_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) );
831 } 858 }
832 859
860
861 if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) {
862 project->variables()["MSVCDSP_POST_LINK_DBG"].append(
863 "# Begin Special Build Tool\n"
864 "SOURCE=$(InputPath)\n"
865 "PostBuild_Desc=Post Build Step\n"
866 "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n"
867 "# End Special Build Tool\n" );
868 project->variables()["MSVCDSP_POST_LINK_REL"].append(
869 "# Begin Special Build Tool\n"
870 "SOURCE=$(InputPath)\n"
871 "PostBuild_Desc=Post Build Step\n"
872 "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n"
873 "# End Special Build Tool\n" );
833 } 874 }
875
834 if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { 876 if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) {
@@ -846,3 +888,3 @@ DspMakefileGenerator::init()
846QString 888QString
847DspMakefileGenerator::findTemplate(QString file) 889DspMakefileGenerator::findTemplate(const QString &file)
848{ 890{
@@ -873,8 +915,8 @@ DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &
873 915
874int 916void
875DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, 917DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
876 QString filter) 918 const QString& filter)
877{ 919{
878 if(project->isActiveConfig("flat")) 920 if(project->isActiveConfig("flat"))
879 return 0; 921 return;
880 922
@@ -885,3 +927,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
885 if(file == currentGroup) 927 if(file == currentGroup)
886 return 0; 928 return;
887 929
@@ -889,3 +931,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
889 endGroups(t); 931 endGroups(t);
890 return 0; 932 return;
891 } 933 }
@@ -893,7 +935,14 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
893 file = file.mid(currentGroup.length()); 935 file = file.mid(currentGroup.length());
894 else 936 int dirSep = currentGroup.findRev( Option::dir_sep );
895 endGroups(t); 937 while( !file.startsWith( currentGroup ) && dirSep != -1 ) {
896 int lvl = file.contains(Option::dir_sep), old_lvl = currentGroup.contains(Option::dir_sep); 938 currentGroup.truncate( dirSep );
897 if(lvl > old_lvl) { 939 dirSep = currentGroup.findRev( Option::dir_sep );
898 QStringList dirs = QStringList::split(Option::dir_sep, file); 940 if ( !file.startsWith( currentGroup ) && dirSep != -1 )
941 t << "\n# End Group\n";
942 }
943 if ( !file.startsWith( currentGroup ) ) {
944 t << "\n# End Group\n";
945 currentGroup = "";
946 }
947 QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) );
899 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { 948 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
@@ -902,8 +951,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
902 } 951 }
903 } else {
904 for(int x = old_lvl - lvl; x; x--)
905 t << "\n# End Group\n";
906 }
907 currentGroup = file; 952 currentGroup = file;
908 return lvl - old_lvl;
909} 953}
@@ -911,3 +955,3 @@ DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t,
911 955
912int 956void
913DspMakefileGenerator::endGroups(QTextStream &t) 957DspMakefileGenerator::endGroups(QTextStream &t)
@@ -915,5 +959,5 @@ DspMakefileGenerator::endGroups(QTextStream &t)
915 if(project->isActiveConfig("flat")) 959 if(project->isActiveConfig("flat"))
916 return 0; 960 return;
917 else if(currentGroup.isEmpty()) 961 else if(currentGroup.isEmpty())
918 return 0; 962 return;
919 963
@@ -924,3 +968,2 @@ DspMakefileGenerator::endGroups(QTextStream &t)
924 currentGroup = ""; 968 currentGroup = "";
925 return dirs.count();
926} 969}
diff --git a/qmake/generators/win32/msvc_dsp.h b/qmake/generators/win32/msvc_dsp.h
index a7fc3e7..3a7d18e 100644
--- a/qmake/generators/win32/msvc_dsp.h
+++ b/qmake/generators/win32/msvc_dsp.h
@@ -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**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __DSPMAKE_H__ 37#ifndef __MSVC_DSP_H__
38#define __DSPMAKE_H__ 38#define __MSVC_DSP_H__
39 39
@@ -45,4 +45,4 @@ class DspMakefileGenerator : public Win32MakefileGenerator
45 QString currentGroup; 45 QString currentGroup;
46 int beginGroupForFile(QString file, QTextStream &, const QString filter=""); 46 void beginGroupForFile(QString file, QTextStream &, const QString& filter="");
47 int endGroups(QTextStream &); 47 void endGroups(QTextStream &);
48 48
@@ -52,3 +52,3 @@ class DspMakefileGenerator : public Win32MakefileGenerator
52 bool writeMakefile(QTextStream &); 52 bool writeMakefile(QTextStream &);
53 QString findTemplate(QString file); 53 QString findTemplate(const QString &file);
54 void init(); 54 void init();
@@ -72,2 +72,2 @@ inline bool DspMakefileGenerator::findLibraries()
72 72
73#endif /* __DSPMAKE_H__ */ 73#endif /* __MSVC_DSP_H__ */
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 9cc9a69..ecef34d 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.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**
@@ -40,2 +40,3 @@
40#include <qregexp.h> 40#include <qregexp.h>
41#include <qdict.h>
41#include <qdir.h> 42#include <qdir.h>
@@ -137,2 +138,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
137 t << "MOVE = " << var("QMAKE_MOVE") << endl; 138 t << "MOVE = " << var("QMAKE_MOVE") << endl;
139 t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl;
140 t << "MKDIR =" << var("QMAKE_MKDIR") << endl;
138 t << endl; 141 t << endl;
@@ -158,7 +161,47 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
158 t << "####### Implicit rules" << endl << endl; 161 t << "####### Implicit rules" << endl << endl;
159 t << ".SUFFIXES: .cpp .cxx .cc .c" << endl << endl; 162 t << ".SUFFIXES: .c";
160 t << ".cpp.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 163 QStringList::Iterator cppit;
161 t << ".cxx.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 164 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
162 t << ".cc.obj:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 165 t << " " << (*cppit);
163 t << ".c.obj:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; 166 t << endl << endl;
167 if(!project->isActiveConfig("no_batch")) {
168 // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC
169 project->variables().remove("QMAKE_RUN_CXX");
170 project->variables().remove("QMAKE_RUN_CC");
171
172 QDict<void> source_directories;
173 source_directories.insert(".", (void*)1);
174 if(!project->isEmpty("MOC_DIR"))
175 source_directories.insert(project->first("MOC_DIR"), (void*)1);
176 if(!project->isEmpty("UI_SOURCES_DIR"))
177 source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1);
178 else if(!project->isEmpty("UI_DIR"))
179 source_directories.insert(project->first("UI_DIR"), (void*)1);
180 QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null };
181 for(int x = 0; !srcs[x].isNull(); x++) {
182 QStringList &l = project->variables()[srcs[x]];
183 for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) {
184 QString sep = "\\";
185 if((*sit).find(sep) == -1)
186 sep = "/";
187 QString dir = (*sit).section(sep, 0, -2);
188 if(!dir.isEmpty() && !source_directories[dir])
189 source_directories.insert(dir, (void*)1);
190 }
191 }
192
193 for(QDictIterator<void> it(source_directories); it.current(); ++it) {
194 if(it.currentKey().isEmpty())
195 continue;
196 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
197 t << "{" << it.currentKey() << "}" << (*cppit) << "{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t"
198 << var("QMAKE_RUN_CXX_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl;
199 t << "{" << it.currentKey() << "}" << ".c{" << var("OBJECTS_DIR") << "}" << Option::obj_ext << "::\n\t"
200 << var("QMAKE_RUN_CC_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl;
201 }
202 } else {
203 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
204 t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
205 t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
206 }
164 207
@@ -166,3 +209,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
166 t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; 209 t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl;
167 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS"); 210 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
211 << var("POST_TARGETDEPS");
168 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { 212 if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
@@ -175,2 +219,4 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
175 t << endl << "<<" << endl; 219 t << endl << "<<" << endl;
220 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
221 t << "\t" << var( "QMAKE_POST_LINK" ) << endl;
176 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { 222 if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
@@ -222,2 +268,3 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
222 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); 268 << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
269
223 if ( project->isActiveConfig("activeqt")) { 270 if ( project->isActiveConfig("activeqt")) {
@@ -248,2 +295,6 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
248 t << endl << endl; 295 t << endl << endl;
296
297 t << "distclean: clean"
298 << "\n\t-del $(TARGET)"
299 << endl << endl;
249} 300}
@@ -433,2 +484,24 @@ NmakeMakefileGenerator::init()
433 } 484 }
485 if ( project->isActiveConfig("stl") ) {
486 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
487 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
488 } else {
489 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
490 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
491 }
492 if ( project->isActiveConfig("exceptions") ) {
493 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
494 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
495 } else {
496 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
497 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
498 }
499 if ( project->isActiveConfig("rtti") ) {
500 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
501 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
502 } else {
503 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
504 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
505 }
506
434 507
@@ -467,3 +540,3 @@ NmakeMakefileGenerator::init()
467 project->variables()["RES_FILE"].first().replace(".rc",".res"); 540 project->variables()["RES_FILE"].first().replace(".rc",".res");
468 project->variables()["TARGETDEPS"] += project->variables()["RES_FILE"]; 541 project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
469 } 542 }
@@ -478,9 +551,10 @@ NmakeMakefileGenerator::init()
478 } 551 }
552
553 QString version = QStringList::split('.', project->first("VERSION")).join("");
479 if(project->isActiveConfig("dll")) { 554 if(project->isActiveConfig("dll")) {
480 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".lib"); 555 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp");
481 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".exp");
482 } 556 }
483 if(project->isActiveConfig("debug")) { 557 if(project->isActiveConfig("debug")) {
484 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".pdb"); 558 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb");
485 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + ".ilk"); 559 project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
486 project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); 560 project->variables()["QMAKE_CLEAN"].append("vc*.pdb");
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h
index d3e170f..579fc35 100644
--- a/qmake/generators/win32/msvc_nmake.h
+++ b/qmake/generators/win32/msvc_nmake.h
@@ -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**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __NMAKEMAKE_H__ 37#ifndef __MSVC_NMAKE_H__
38#define __NMAKEMAKE_H__ 38#define __MSVC_NMAKE_H__
39 39
@@ -58,2 +58,2 @@ inline NmakeMakefileGenerator::~NmakeMakefileGenerator()
58 58
59#endif /* __NMAKEMAKE_H__ */ 59#endif /* __MSVC_NMAKE_H__ */
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index c2b9e30..7ffe4f7 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -385,3 +385,3 @@ QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool )
385 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); 385 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
386 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 386 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
387 strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); 387 strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories );
@@ -456,2 +456,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
456 char fourth = option[4]; 456 char fourth = option[4];
457 bool found = TRUE;
457 458
@@ -461,13 +462,16 @@ bool VCCLCompilerTool::parseOption( const char* option )
461 qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" ); 462 qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" );
462 return FALSE; 463 found = FALSE;
464 break;
463 case '@': 465 case '@':
464 qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); 466 qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" );
465 return FALSE; 467 found = FALSE;
468 break;
466 case 'l': 469 case 'l':
467 qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); 470 qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" );
468 return FALSE; 471 found = FALSE;
469 472 break;
470 case 'A': 473 case 'A':
471 if ( second != 'I' ) 474 if ( second != 'I' ) {
472 return FALSE; 475 found = FALSE; break;
476 }
473 AdditionalUsingDirectories += option+2; 477 AdditionalUsingDirectories += option+2;
@@ -489,3 +493,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
489 } 493 }
490 return FALSE; 494 found = FALSE; break;
491 } 495 }
@@ -546,3 +550,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
546 default: 550 default:
547 return FALSE; 551 found = FALSE; break;
548 } 552 }
@@ -555,3 +559,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
555 qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" ); 559 qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" );
556 return FALSE; 560 found = FALSE; break;
557 case '5': 561 case '5':
@@ -621,3 +625,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
621 default: 625 default:
622 return FALSE; 626 found = FALSE; break;
623 } 627 }
@@ -635,3 +639,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
635 } 639 }
636 return FALSE; 640 found = FALSE; break;
637 case 'M': 641 case 'M':
@@ -653,3 +657,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
653 } 657 }
654 return FALSE; 658 found = FALSE; break;
655 case 'O': 659 case 'O':
@@ -673,3 +677,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
673 else 677 else
674 return FALSE; 678 found = FALSE;
675 break; 679 break;
@@ -707,3 +711,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
707 default: 711 default:
708 return FALSE; 712 found = FALSE; break;
709 } 713 }
@@ -718,3 +722,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
718 } 722 }
719 return FALSE; 723 found = FALSE; break;
720 case 'R': 724 case 'R':
@@ -730,3 +734,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
730 else 734 else
731 return FALSE; 735 found = FALSE; break;
732 } 736 }
@@ -740,3 +744,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
740 qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" ); 744 qWarning( "Generator: Options '/Tp<filename>' and '/Tc<filename>' are not supported by qmake" );
741 return FALSE; 745 found = FALSE; break;
742 } 746 }
@@ -780,3 +784,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
780 default: 784 default:
781 return FALSE; 785 found = FALSE; break;
782 } 786 }
@@ -809,3 +813,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
809 default: 813 default:
810 return FALSE; 814 found = FALSE; break;
811 } 815 }
@@ -842,5 +846,5 @@ bool VCCLCompilerTool::parseOption( const char* option )
842 else 846 else
843 return FALSE; 847 found = FALSE;
844 } else { 848 } else {
845 return FALSE; 849 found = FALSE; break;
846 } 850 }
@@ -871,3 +875,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
871 default: 875 default:
872 return FALSE; 876 found = FALSE; break;
873 } 877 }
@@ -875,3 +879,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
875 default: 879 default:
876 return FALSE; 880 found = FALSE; break;
877 } 881 }
@@ -889,3 +893,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
889 } else { 893 } else {
890 return FALSE; 894 found = FALSE; break;
891 } 895 }
@@ -893,4 +897,5 @@ bool VCCLCompilerTool::parseOption( const char* option )
893 case 'd': 897 case 'd':
894 if ( second != 'r' ) 898 if ( second != 'r' ) {
895 return FALSE; 899 found = FALSE; break;
900 }
896 CompileAsManaged = managedAssembly; 901 CompileAsManaged = managedAssembly;
@@ -906,3 +911,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
906 } 911 }
907 return FALSE; 912 found = FALSE; break;
908 case 's': 913 case 's':
@@ -912,3 +917,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
912 } 917 }
913 return FALSE; 918 found = FALSE; break;
914 case 'u': 919 case 'u':
@@ -921,3 +926,3 @@ bool VCCLCompilerTool::parseOption( const char* option )
921 } 926 }
922 return FALSE; 927 found = FALSE; break;
923 case 'w': 928 case 'w':
@@ -935,4 +940,6 @@ bool VCCLCompilerTool::parseOption( const char* option )
935 default: 940 default:
936 return FALSE; 941 found = FALSE; break;
937 } 942 }
943 if( !found )
944 warn_msg( WarnLogic, "Could not parse Compiler option: %s", option );
938 return TRUE; 945 return TRUE;
@@ -982,3 +989,3 @@ QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool )
982 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); 989 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
983 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 990 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
984 strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly ); 991 strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly );
@@ -1062,2 +1069,5 @@ static uint elfHash( const char* name )
1062} 1069}
1070
1071//#define USE_DISPLAY_HASH
1072#ifdef USE_DISPLAY_HASH
1063static void displayHash( const char* str ) 1073static void displayHash( const char* str )
@@ -1066,2 +1076,3 @@ static void displayHash( const char* str )
1066} 1076}
1077#endif
1067 1078
@@ -1069,3 +1080,3 @@ bool VCLinkerTool::parseOption( const char* option )
1069{ 1080{
1070#if 0 1081#ifdef USE_DISPLAY_HASH
1071 // Main options 1082 // Main options
@@ -1090,3 +1101,3 @@ bool VCLinkerTool::parseOption( const char* option )
1090#endif 1101#endif
1091#if 0 1102#ifdef USE_DISPLAY_HASH
1092 // Sub options 1103 // Sub options
@@ -1100,3 +1111,3 @@ bool VCLinkerTool::parseOption( const char* option )
1100#endif 1111#endif
1101 1112 bool found = TRUE;
1102 switch ( elfHash(option) ) { 1113 switch ( elfHash(option) ) {
@@ -1218,3 +1229,3 @@ bool VCLinkerTool::parseOption( const char* option )
1218 default: 1229 default:
1219 return FALSE; 1230 found = FALSE;
1220 } 1231 }
@@ -1277,3 +1288,3 @@ bool VCLinkerTool::parseOption( const char* option )
1277 default: 1288 default:
1278 return FALSE; 1289 found = FALSE;
1279 } 1290 }
@@ -1326,3 +1337,3 @@ bool VCLinkerTool::parseOption( const char* option )
1326 default: 1337 default:
1327 return FALSE; 1338 found = FALSE;
1328 } 1339 }
@@ -1336,3 +1347,3 @@ bool VCLinkerTool::parseOption( const char* option )
1336 else 1347 else
1337 return FALSE; 1348 found = FALSE;
1338 break; 1349 break;
@@ -1362,5 +1373,7 @@ bool VCLinkerTool::parseOption( const char* option )
1362 default: 1373 default:
1363 return FALSE; 1374 found = FALSE;
1364 } 1375 }
1365 return TRUE; 1376 if( !found )
1377 warn_msg( WarnLogic, "Could not parse Linker options: %s", option );
1378 return found;
1366} 1379}
@@ -1394,3 +1407,3 @@ QTextStream &operator<<( QTextStream &strm, const VCMIDLTool &tool )
1394 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); 1407 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
1395 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 1408 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1396 strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions ); 1409 strm << XPair( _CPreprocessOptions, tool.CPreprocessOptions );
@@ -1429,3 +1442,3 @@ bool VCMIDLTool::parseOption( const char* option )
1429{ 1442{
1430#if 0 1443#ifdef USE_DISPLAY_HASH
1431 displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" ); 1444 displayHash( "/D name[=def]" ); displayHash( "/I directory-list" ); displayHash( "/Oi" );
@@ -1457,2 +1470,3 @@ bool VCMIDLTool::parseOption( const char* option )
1457#endif 1470#endif
1471 bool found = TRUE;
1458 int offset = 0; 1472 int offset = 0;
@@ -1492,3 +1506,3 @@ bool VCMIDLTool::parseOption( const char* option )
1492 default: 1506 default:
1493 return FALSE; 1507 found = FALSE;
1494 } 1508 }
@@ -1507,3 +1521,3 @@ bool VCMIDLTool::parseOption( const char* option )
1507 default: 1521 default:
1508 return FALSE; 1522 found = FALSE;
1509 } 1523 }
@@ -1538,9 +1552,9 @@ bool VCMIDLTool::parseOption( const char* option )
1538 case 'r': 1552 case 'r':
1539 break;
1540 ErrorCheckRefPointers = _True; 1553 ErrorCheckRefPointers = _True;
1541 case 's':
1542 break; 1554 break;
1555 case 's':
1543 ErrorCheckStubData = _True; 1556 ErrorCheckStubData = _True;
1557 break;
1544 default: 1558 default:
1545 return FALSE; 1559 found = FALSE;
1546 } 1560 }
@@ -1649,3 +1663,3 @@ bool VCMIDLTool::parseOption( const char* option )
1649 default: 1663 default:
1650 return FALSE; 1664 found = FALSE;
1651 } 1665 }
@@ -1654,2 +1668,4 @@ bool VCMIDLTool::parseOption( const char* option )
1654 } 1668 }
1669 if( !found )
1670 warn_msg( WarnLogic, "Could not parse MIDL option: %s", option );
1655 return TRUE; 1671 return TRUE;
@@ -1670,3 +1686,3 @@ QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool )
1670 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); 1686 strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories );
1671 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 1687 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1672 strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions ); 1688 strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions );
@@ -1716,3 +1732,3 @@ QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool )
1716 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); 1732 strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories );
1717 strm << XPair( _AdditionalOptions, tool.AdditionalOptions ); 1733 strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " );
1718 if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture ); 1734 if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture );
@@ -1853,8 +1869,29 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
1853 QString mocDir = Project->var( "MOC_DIR" ); 1869 QString mocDir = Project->var( "MOC_DIR" );
1854 int dot = fname.findRev( '.' ); 1870 QString uiDir = Project->var( "UI_DIR" );
1855 if( dot != -1 ) 1871 QString uiHeaders;
1856 fname.truncate( dot ); 1872 QString uiSources;
1857 1873
1874 // Determining the paths for the output files.
1858 int slash = str.findRev( '\\' ); 1875 int slash = str.findRev( '\\' );
1859 QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString(".\\"); 1876 QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString(".\\");
1877 if( !uiDir.isEmpty() ) {
1878 uiHeaders = uiDir;
1879 uiSources = uiDir;
1880 } else {
1881 uiHeaders = Project->var( "UI_HEADERS_DIR" );
1882 uiSources = Project->var( "UI_SOURCES_DIR" );
1883 if( uiHeaders.isEmpty() )
1884 uiHeaders = pname;
1885 if( uiSources.isEmpty() )
1886 uiSources = pname;
1887 }
1888 if( !uiHeaders.endsWith( "\\" ) )
1889 uiHeaders += "\\";
1890 if( !uiSources.endsWith( "\\" ) )
1891 uiSources += "\\";
1892
1893 // Determine the file name.
1894 int dot = fname.findRev( '.' );
1895 if( dot != -1 )
1896 fname.truncate( dot );
1860 1897
@@ -1869,5 +1906,5 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
1869 strm << _CommandLine6; 1906 strm << _CommandLine6;
1870 strm << uicApp << " " << str << " -o " << pname << fname << ".h &amp;&amp; "; // Create .h from .ui file 1907 strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h &amp;&amp; "; // Create .h from .ui file
1871 strm << uicApp << " " << str << " -i " << fname << ".h -o " << pname << fname << ".cpp &amp;&amp; ";// Create .cpp from .ui file 1908 strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp &amp;&amp; ";// Create .cpp from .ui file
1872 strm << mocApp << " " << pname << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; 1909 strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\"";
1873 strm << _AdditionalDependencies6; 1910 strm << _AdditionalDependencies6;
@@ -1875,3 +1912,3 @@ void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const
1875 strm << _Outputs6; 1912 strm << _Outputs6;
1876 strm << pname << fname << ".h;" << pname << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; 1913 strm << uiHeaders << fname << ".h;" << uiSources << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\"";
1877 strm << "/>"; 1914 strm << "/>";
@@ -1908,5 +1945,5 @@ VCProject::VCProject()
1908{ 1945{
1909 QUuid uniqueId;
1910#if defined(Q_WS_WIN32) 1946#if defined(Q_WS_WIN32)
1911 GUID guid; 1947 GUID guid;
1948 QUuid uniqueId;
1912 HRESULT h = CoCreateGuid( &guid ); 1949 HRESULT h = CoCreateGuid( &guid );
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index 2d09280..1dca68d 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -392,10 +392,8 @@ protected:
392 VCToolBase(){}; 392 VCToolBase(){};
393 ~VCToolBase(){}; 393 virtual ~VCToolBase(){}
394 virtual bool parseOption( const char* option ) = 0; 394 virtual bool parseOption( const char* option ) = 0;
395public: 395public:
396 bool parseOptions( QStringList& options ) { 396 void parseOptions( QStringList& options ) {
397 bool result = TRUE; 397 for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++ )
398 for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()) && result; it++ ) 398 parseOption( (*it).latin1() );
399 result = parseOption( (*it).latin1() );
400 return result;
401 } 399 }
@@ -411,4 +409,4 @@ public:
411 VCCLCompilerTool(); 409 VCCLCompilerTool();
412 ~VCCLCompilerTool(){}; 410 virtual ~VCCLCompilerTool(){}
413 virtual bool parseOption( const char* option ); 411 bool parseOption( const char* option );
414 412
@@ -482,4 +480,4 @@ public:
482 VCLinkerTool(); 480 VCLinkerTool();
483 ~VCLinkerTool(){}; 481 virtual ~VCLinkerTool(){}
484 virtual bool parseOption( const char* option ); 482 bool parseOption( const char* option );
485 483
@@ -547,4 +545,4 @@ public:
547 VCMIDLTool(); 545 VCMIDLTool();
548 ~VCMIDLTool(){}; 546 virtual ~VCMIDLTool(){}
549 virtual bool parseOption( const char* option ); 547 bool parseOption( const char* option );
550 548
@@ -589,4 +587,4 @@ public:
589 VCLibrarianTool(); 587 VCLibrarianTool();
590 ~VCLibrarianTool(){}; 588 virtual ~VCLibrarianTool(){}
591 virtual bool parseOption( const char* option ){ return FALSE; }; 589 bool parseOption( const char* ){ return FALSE; };
592 590
@@ -610,4 +608,4 @@ public:
610 VCCustomBuildTool(); 608 VCCustomBuildTool();
611 ~VCCustomBuildTool(){}; 609 virtual ~VCCustomBuildTool(){}
612 virtual bool parseOption( const char* option ){ return FALSE; }; 610 bool parseOption( const char* ){ return FALSE; };
613 611
@@ -627,4 +625,4 @@ public:
627 VCResourceCompilerTool(); 625 VCResourceCompilerTool();
628 ~VCResourceCompilerTool(){}; 626 virtual ~VCResourceCompilerTool(){}
629 virtual bool parseOption( const char* option ){ return FALSE; }; 627 bool parseOption( const char* ){ return FALSE; };
630 628
@@ -647,4 +645,4 @@ protected:
647 VCEventTool() : ExcludedFromBuild( unset ){}; 645 VCEventTool() : ExcludedFromBuild( unset ){};
648 ~VCEventTool(){}; 646 virtual ~VCEventTool(){}
649 virtual bool parseOption( const char* option ){ return FALSE; }; 647 bool parseOption( const char* ){ return FALSE; };
650 648
@@ -663,3 +661,3 @@ public:
663 VCPostBuildEventTool(); 661 VCPostBuildEventTool();
664 ~VCPostBuildEventTool(){}; 662 ~VCPostBuildEventTool(){}
665}; 663};
@@ -670,3 +668,3 @@ public:
670 VCPreBuildEventTool(); 668 VCPreBuildEventTool();
671 ~VCPreBuildEventTool(){}; 669 ~VCPreBuildEventTool(){}
672}; 670};
@@ -677,3 +675,3 @@ public:
677 VCPreLinkEventTool(); 675 VCPreLinkEventTool();
678 ~VCPreLinkEventTool(){}; 676 ~VCPreLinkEventTool(){}
679}; 677};
@@ -685,3 +683,3 @@ public:
685 VCConfiguration(); 683 VCConfiguration();
686 ~VCConfiguration(){}; 684 ~VCConfiguration(){}
687 685
@@ -722,3 +720,3 @@ public:
722 VCFilter(); 720 VCFilter();
723 ~VCFilter(){}; 721 ~VCFilter(){}
724 void generateMOC( QTextStream &strm, QString str ) const; 722 void generateMOC( QTextStream &strm, QString str ) const;
@@ -741,3 +739,3 @@ public:
741 VCProject(); 739 VCProject();
742 ~VCProject(){}; 740 ~VCProject(){}
743 741
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index a2bb6e9..d2cbc31 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.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**
@@ -40,4 +40,6 @@
40#include <qdir.h> 40#include <qdir.h>
41#include <stdlib.h>
42#include <qregexp.h> 41#include <qregexp.h>
42#include <qdict.h>
43#include <quuid.h>
44#include <stdlib.h>
43 45
@@ -45,4 +47,44 @@
45#include <objbase.h> 47#include <objbase.h>
48#ifndef GUID_DEFINED
49#define GUID_DEFINED
50typedef struct _GUID
51{
52 ulong Data1;
53 ushort Data2;
54 ushort Data3;
55 uchar Data4[8];
56} GUID;
57#endif
46#endif 58#endif
47 59
60// Flatfile Tags ----------------------------------------------------
61 const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version 7.00";
62 // The following UUID _may_ change for later servicepacks...
63 // If so we need to search through the registry at
64 // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects
65 // to find the subkey that contains a "PossibleProjectExtension"
66 // containing "vcproj"...
67 // Use the hardcoded value for now so projects generated on other
68 // platforms are actually usable.
69const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
70 const char* _snlProjectBeg= "\nProject(\"";
71 const char* _snlProjectMid= "\") = ";
72 const char* _snlProjectEnd= "\nEndProject";
73 const char* _snlGlobalBeg= "\nGlobal";
74 const char* _snlGlobalEnd= "\nEndGlobal";
75 const char* _snlSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution"
76 "\n\t\tConfigName.0 = Release"
77 "\n\tEndGlobalSection";
78 const char* _snlProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution";
79 const char* _snlProjDepEnd= "\n\tEndGlobalSection";
80 const char* _snlProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution";
81 const char* _snlProjConfTag1= ".Release.ActiveCfg = Release|Win32";
82 const char* _snlProjConfTag2= ".Release.Build.0 = Release|Win32";
83 const char* _snlProjConfEnd= "\n\tEndGlobalSection";
84 const char* _snlExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution"
85 "\n\tEndGlobalSection"
86 "\n\tGlobalSection(ExtensibilityAddIns) = postSolution"
87 "\n\tEndGlobalSection";
88// ------------------------------------------------------------------
89
48VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) 90VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
@@ -54,4 +96,3 @@ VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), i
54 Options are either a Visual Studio projectfiles, or 96 Options are either a Visual Studio projectfiles, or
55 recursive projectfiles.. Maybe we can make .sln files 97 solutionfiles by parsing recursive projectdirectories.
56 someday?
57*/ 98*/
@@ -66,3 +107,3 @@ bool VcprojGenerator::writeMakefile(QTextStream &t)
66 107
67 // Generate full project file 108 // Generate project file
68 if(project->first("TEMPLATE") == "vcapp" || 109 if(project->first("TEMPLATE") == "vcapp" ||
@@ -72,3 +113,5 @@ bool VcprojGenerator::writeMakefile(QTextStream &t)
72 return TRUE; 113 return TRUE;
73 } else if(project->first("TEMPLATE") == "vcsubdirs") { // Generate recursive project 114 }
115 // Generate solution file
116 else if(project->first("TEMPLATE") == "vcsubdirs") {
74 debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); 117 debug_msg(1, "Generator: MSVC.NET: Writing solution file" );
@@ -82,3 +125,5 @@ bool VcprojGenerator::writeMakefile(QTextStream &t)
82struct VcsolutionDepend { 125struct VcsolutionDepend {
126 QString uuid;
83 QString vcprojFile, orig_target, target; 127 QString vcprojFile, orig_target, target;
128 ::target targetType;
84 QStringList dependencies; 129 QStringList dependencies;
@@ -86,2 +131,28 @@ struct VcsolutionDepend {
86 131
132QUuid VcprojGenerator::increaseUUID( const QUuid &id )
133{
134 QUuid result( id );
135 Q_LONG dataFirst = (result.data4[0] << 24) +
136 (result.data4[1] << 16) +
137 (result.data4[2] << 8) +
138 result.data4[3];
139 Q_LONG dataLast = (result.data4[4] << 24) +
140 (result.data4[5] << 16) +
141 (result.data4[6] << 8) +
142 result.data4[7];
143
144 if ( !(dataLast++) )
145 dataFirst++;
146
147 result.data4[0] = uchar((dataFirst >> 24) & 0xff);
148 result.data4[1] = uchar((dataFirst >> 16) & 0xff);
149 result.data4[2] = uchar((dataFirst >> 8) & 0xff);
150 result.data4[3] = uchar( dataFirst & 0xff);
151 result.data4[4] = uchar((dataLast >> 24) & 0xff);
152 result.data4[5] = uchar((dataLast >> 16) & 0xff);
153 result.data4[6] = uchar((dataLast >> 8) & 0xff);
154 result.data4[7] = uchar( dataLast & 0xff);
155 return result;
156}
157
87void VcprojGenerator::writeSubDirs(QTextStream &t) 158void VcprojGenerator::writeSubDirs(QTextStream &t)
@@ -94,4 +165,18 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
94 165
95 QPtrList<VcsolutionDepend> solution_depends; 166 t << _snlHeader;
96 solution_depends.setAutoDelete(TRUE); 167 QUuid solutionGUID;
168#if defined(Q_WS_WIN32)
169 GUID guid;
170 HRESULT h = CoCreateGuid( &guid );
171 if ( h == S_OK )
172 solutionGUID = QUuid( guid );
173#else
174 // Qt doesn't support GUID on other platforms yet,
175 // so we use the all-zero uuid, and increase that.
176#endif
177
178
179 QDict<VcsolutionDepend> solution_depends;
180 QPtrList<VcsolutionDepend> solution_cleanup;
181 solution_cleanup.setAutoDelete(TRUE);
97 QStringList subdirs = project->variables()["SUBDIRS"]; 182 QStringList subdirs = project->variables()["SUBDIRS"];
@@ -118,9 +203,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
118 subdirs += tmp_subdirs; 203 subdirs += tmp_subdirs;
119 } else if(tmp_proj.first("TEMPLATE") == "vcapp" || 204 } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") {
120 tmp_proj.first("TEMPLATE") == "vclib") { 205 // Initialize a 'fake' project to get the correct variables
121 QString vcproj = fi.baseName() + project->first("VCPROJ_EXTENSION"); 206 // and to be able to extract all the dependencies
122 if(QFile::exists(vcproj) || 1) { 207 VcprojGenerator tmp_vcproj(&tmp_proj);
123 VcprojGenerator tmp_dsp(&tmp_proj); 208 tmp_vcproj.setNoIO(TRUE);
124 tmp_dsp.setNoIO(TRUE); 209 tmp_vcproj.init();
125 tmp_dsp.init();
126 if(Option::debug_level) { 210 if(Option::debug_level) {
@@ -134,2 +218,13 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
134 } 218 }
219
220 // We assume project filename is [QMAKE_ORIG_TARGET].vcproj
221 QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION");
222
223 // If file doesn't exsist, then maybe the users configuration
224 // doesn't allow it to be created. Skip to next...
225 if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) {
226 qDebug( "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() );
227 goto nextfile; // # Dirty!
228 }
229
135 VcsolutionDepend *newDep = new VcsolutionDepend; 230 VcsolutionDepend *newDep = new VcsolutionDepend;
@@ -138,2 +233,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
138 newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); 233 newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1);
234 newDep->targetType = tmp_vcproj.projectTarget;
235 {
236 static QUuid uuid = solutionGUID;
237 uuid = increaseUUID( uuid );
238 newDep->uuid = uuid.toString().upper();
239 }
139 if(newDep->target.endsWith(".dll")) 240 if(newDep->target.endsWith(".dll"))
@@ -156,6 +257,17 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
156 } 257 }
157 solution_depends.append(newDep); 258 solution_cleanup.append(newDep);
259 solution_depends.insert(newDep->target, newDep);
260 {
261 QRegExp libVersion("[0-9]{3,3}\\.lib$");
262 if(libVersion.search(newDep->target) != -1)
263 solution_depends.insert(newDep->target.left(newDep->target.length() -
264 libVersion.matchedLength()) + ".lib", newDep);
158 } 265 }
266 t << _snlProjectBeg << _snlMSVCvcprojGUID << _snlProjectMid
267 << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile
268 << "\", \"" << newDep->uuid << "\"";
269 t << _snlProjectEnd;
159 } 270 }
160 } 271 }
272nextfile:
161 QDir::setCurrent(oldpwd); 273 QDir::setCurrent(oldpwd);
@@ -164,22 +276,26 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
164 } 276 }
165 277 t << _snlGlobalBeg;
278 t << _snlSolutionConf;
279 t << _snlProjDepBeg;
280 for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) {
281 int cnt = 0;
282 for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin();
283 dit != solution_cleanup.current()->dependencies.end();
284 ++dit) {
166 VcsolutionDepend *vc; 285 VcsolutionDepend *vc;
167 QMap<QString, int> uuids; 286 if((vc=solution_depends[*dit])) {
168 QRegExp libVersion("[0-9]{3,3}\\.lib$"); 287 if(solution_cleanup.current()->targetType != StaticLib || vc->targetType == Application)
169 for(vc = solution_depends.first(); vc; vc = solution_depends.next()) { 288 t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid;
170 static int uuid = 666;
171 uuids.insert(vc->target, uuid);
172 if(libVersion.match(vc->target) != -1)
173 uuids.insert(vc->target.left(vc->target.length() - libVersion.matchedLength()) + ".lib",
174 uuid);
175 t << "\"" << vc->orig_target << "\" \"" << vc->vcprojFile << "\" { " << uuid << " }" << endl;
176 uuid++;
177 } 289 }
178 for(vc = solution_depends.first(); vc; vc = solution_depends.next()) {
179 int uuid = uuids[vc->target], cnt = 0;
180 for(QStringList::iterator dit = vc->dependencies.begin(); dit != vc->dependencies.end(); ++dit) {
181 if(uuids.contains((*dit)))
182 t << uuid << "." << cnt++ << " = " << uuids[(*dit)] << endl;
183 } 290 }
184 } 291 }
292 t << _snlProjDepEnd;
293 t << _snlProjConfBeg;
294 for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) {
295 t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag1;
296 t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag2;
297 }
298 t << _snlProjConfEnd;
299 t << _snlExtSections;
300 t << _snlGlobalEnd;
185} 301}
@@ -308,8 +424,8 @@ void VcprojGenerator::initConfiguration()
308 } 424 }
309 vcProject.Configuration.Name = ( project->isActiveConfig( "release" ) ? "Release|" : "Debug|" ); 425 vcProject.Configuration.Name = ( project->isActiveConfig( "debug" ) ? "Debug|" : "Release|" );
310 vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); 426 vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" );
311 vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); 427 vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True );
312 vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? unset : temp.toShort() ); 428 vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() );
313 temp = project->first("CharacterSet"); 429 temp = project->first("CharacterSet");
314 vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? charSetNotSet : temp.toShort() ); 430 vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() );
315 vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); 431 vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean");
@@ -340,3 +456,3 @@ void VcprojGenerator::initCompilerTool()
340 if ( placement.isEmpty() ) 456 if ( placement.isEmpty() )
341 placement = project->isActiveConfig( "release" )? ".\\Release\\":".\\Debug\\"; 457 placement = ".\\";
342 458
@@ -364,2 +480,3 @@ void VcprojGenerator::initCompilerTool()
364 vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; 480 vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG";
481 vcProject.Configuration.compiler.PreprocessorDefinitions += "NDEBUG";
365 if ( project->isActiveConfig("thread") ) { 482 if ( project->isActiveConfig("thread") ) {
@@ -377,3 +494,3 @@ void VcprojGenerator::initCompilerTool()
377 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); 494 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] );
378 else 495 else if ( project->isActiveConfig("warn_on") )
379 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); 496 vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] );
@@ -417,2 +534,4 @@ void VcprojGenerator::initLinkerTool()
417 break; 534 break;
535 case StaticLib: //unhandled - added to remove warnings..
536 break;
418 } 537 }
@@ -461,3 +580,13 @@ void VcprojGenerator::initPreBuildEventTools()
461 //vcProject.Configuration.preBuild.AdditionalDependencies += list; 580 //vcProject.Configuration.preBuild.AdditionalDependencies += list;
462 vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " " + list.join(" ") + " -o " + collectionName; 581
582 QFile imgs( ".imgcol" );
583 imgs.open( IO_WriteOnly );
584 QTextStream s( &imgs );
585 QStringList::ConstIterator it = list.begin();
586 while( it!=list.end() ) {
587 s << *it << " ";
588 it++;
589 }
590
591 vcProject.Configuration.preBuild.CommandLine = project->first("QMAKE_UIC") + " -embed " + project->first("QMAKE_ORIG_TARGET") + " -f .imgcol -o " + collectionName;
463 //vcProject.Configuration.preBuild.Outputs = collectionName; 592 //vcProject.Configuration.preBuild.Outputs = collectionName;
@@ -469,2 +598,6 @@ void VcprojGenerator::initPostBuildEventTools()
469{ 598{
599 if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) {
600 vcProject.Configuration.postBuild.Description = var("QMAKE_POST_LINK");
601 vcProject.Configuration.postBuild.CommandLine = var("QMAKE_POST_LINK");
602 }
470 if( project->isActiveConfig( "activeqt" ) ) { 603 if( project->isActiveConfig( "activeqt" ) ) {
@@ -476,5 +609,7 @@ void VcprojGenerator::initPostBuildEventTools()
476 vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; 609 vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server...";
610 if ( !vcProject.Configuration.postBuild.CommandLine.isEmpty() )
611 vcProject.Configuration.postBuild.CommandLine += " &amp;&amp; ";
477 612
478 if( project->isActiveConfig( "dll" ) ) { // In process 613 if( project->isActiveConfig( "dll" ) ) { // In process
479 vcProject.Configuration.postBuild.CommandLine = 614 vcProject.Configuration.postBuild.CommandLine +=
480 // call idc to generate .idl file from .dll 615 // call idc to generate .idl file from .dll
@@ -604,17 +739,2 @@ void VcprojGenerator::initResourceFiles()
604 739
605/*
606// $$MSVCPROJ_IDLSOURCES ---------------------------------------------
607void VcprojGenerator::writeIDLs( QTextStream &t )
608{
609 QStringList &l = project->variables()["MSVCPROJ_IDLSOURCES"];
610 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
611 t << "# Begin Source File" << endl << endl;
612 t << "SOURCE=" << (*it) << endl;
613 t << "# PROP Exclude_From_Build 1" << endl;
614 t << "# End Source File" << endl << endl;
615 }
616 debug_msg(3, "Generator: MSVC.NET: Added IDLs" );
617}
618*/
619
620/* \internal 740/* \internal
@@ -631,2 +751,24 @@ void VcprojGenerator::initOld()
631 751
752 if ( project->isActiveConfig("stl") ) {
753 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
754 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
755 } else {
756 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
757 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
758 }
759 if ( project->isActiveConfig("exceptions") ) {
760 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
761 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
762 } else {
763 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
764 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
765 }
766 if ( project->isActiveConfig("rtti") ) {
767 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
768 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
769 } else {
770 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
771 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
772 }
773
632 // this should probably not be here, but I'm using it to wrap the .t files 774 // this should probably not be here, but I'm using it to wrap the .t files
@@ -790,3 +932,3 @@ void VcprojGenerator::initOld()
790 if(!project->isActiveConfig("incremental")) { 932 if(!project->isActiveConfig("incremental")) {
791 project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); 933 project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no"));
792 if ( is_qt ) 934 if ( is_qt )
@@ -801,2 +943,15 @@ void VcprojGenerator::initOld()
801 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; 943 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
944 // Update -lname to name.lib, and -Ldir to
945 QStringList &libList = project->variables()["QMAKE_LIBS"];
946 for( it = libList.begin(); it != libList.end(); ) {
947 QString s = *it;
948 if( s.startsWith( "-l" ) ) {
949 it = libList.remove( it );
950 it = libList.insert( it, s.mid( 2 ) + ".lib" );
951 } else if( s.startsWith( "-L" ) ) {
952 it = libList.remove( it );
953 } else {
954 it++;
955 }
956 }
802 957
@@ -823,4 +978,4 @@ void VcprojGenerator::initOld()
823 978
824 // TARGET (add extention to $$TARGET) ---------------------------- 979 // TARGET (add extention to $$TARGET)
825 project->variables()["TARGET"].first() += project->first("TARGET_EXT"); 980 //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT");
826 981
@@ -869,4 +1024,11 @@ void VcprojGenerator::initOld()
869 project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; 1024 project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"];
870 if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) 1025 if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) {
871 project->variables()["MSVCPROJ_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:"," /LIBPATH:","")); 1026 QStringList strl = project->variables()["QMAKE_LIBDIR"];
1027 QStringList::iterator stri;
1028 for ( stri = strl.begin(); stri != strl.end(); ++stri ) {
1029 if ( !(*stri).startsWith("/LIBPATH:") )
1030 (*stri).prepend( "/LIBPATH:" );
1031 }
1032 project->variables()["MSVCPROJ_LFLAGS"] += strl;
1033 }
872 project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; 1034 project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"];
@@ -885,15 +1047,14 @@ void VcprojGenerator::initOld()
885 project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); 1047 project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET");
886 if ( !project->variables()["DESTDIR"].isEmpty() ) {
887 project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
888 Option::fixPathToTargetOS(project->first("TARGET")); 1048 Option::fixPathToTargetOS(project->first("TARGET"));
889 dest = project->first("TARGET"); 1049 dest = project->first("TARGET") + project->first( "TARGET_EXT" );
890 if ( project->first("TARGET").startsWith("$(QTDIR)") ) 1050 if ( project->first("TARGET").startsWith("$(QTDIR)") )
891 dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); 1051 dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") );
892 project->variables()["MSVCPROJ_TARGET"].append( 1052 project->variables()["MSVCPROJ_TARGET"] = dest;
893 QString("/OUT:") + dest );
894 if ( project->isActiveConfig("dll") ) { 1053 if ( project->isActiveConfig("dll") ) {
895 QString imp = dest; 1054 QString imp = project->first( "DESTDIR" );
1055 if( !imp.isNull() && !imp.endsWith( "\\" ) )
1056 imp += "\\";
1057 imp += dest;
896 imp.replace(QRegExp("\\.dll"), ".lib"); 1058 imp.replace(QRegExp("\\.dll"), ".lib");
897 project->variables()["MSVCPROJ_LIBOPTIONS"] += (QString("/IMPLIB:") + imp ); 1059 project->variables()["MSVCPROJ_LIBOPTIONS"] += QString("/IMPLIB:") + imp;
898 }
899 } 1060 }
@@ -998,7 +1159,12 @@ bool VcprojGenerator::openOutput(QFile &file) const
998 if(QDir::isRelativePath(file.name())) { 1159 if(QDir::isRelativePath(file.name())) {
999 QString ofile; 1160 file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) );
1000 ofile = file.name(); 1161 }
1162 return Win32MakefileGenerator::openOutput(file);
1163}
1164
1165QString VcprojGenerator::fixFilename(QString ofile) const
1166{
1001 int slashfind = ofile.findRev('\\'); 1167 int slashfind = ofile.findRev('\\');
1002 if (slashfind == -1) { 1168 if (slashfind == -1) {
1003 ofile = ofile.replace("-", "_"); 1169 ofile = ofile.replace('-', '_');
1004 } else { 1170 } else {
@@ -1006,3 +1172,3 @@ bool VcprojGenerator::openOutput(QFile &file) const
1006 while (hypenfind != -1 && slashfind < hypenfind) { 1172 while (hypenfind != -1 && slashfind < hypenfind) {
1007 ofile = ofile.replace(hypenfind, 1, "_"); 1173 ofile = ofile.replace(hypenfind, 1, '_');
1008 hypenfind = ofile.find('-', hypenfind + 1); 1174 hypenfind = ofile.find('-', hypenfind + 1);
@@ -1010,5 +1176,3 @@ bool VcprojGenerator::openOutput(QFile &file) const
1010 } 1176 }
1011 file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile)); 1177 return ofile;
1012 }
1013 return Win32MakefileGenerator::openOutput(file);
1014} 1178}
@@ -1044,5 +1208,5 @@ void VcprojGenerator::outputVariables()
1044#if 0 1208#if 0
1045 debug_msg(3, "Generator: MSVC.NET: List of current variables:" ); 1209 qDebug( "Generator: MSVC.NET: List of current variables:" );
1046 for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) { 1210 for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) {
1047 debug_msg(3, "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() ); 1211 qDebug( "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() );
1048 } 1212 }
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 583b164..69e0c02 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -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**
@@ -36,4 +36,4 @@
36**********************************************************************/ 36**********************************************************************/
37#ifndef __VCPROJMAKE_H__ 37#ifndef __MSVC_VCPROJ_H__
38#define __VCPROJMAKE_H__ 38#define __MSVC_VCPROJ_H__
39 39
@@ -48,2 +48,3 @@ enum target {
48 48
49struct QUuid;
49class VcprojGenerator : public Win32MakefileGenerator 50class VcprojGenerator : public Win32MakefileGenerator
@@ -70,2 +71,3 @@ protected:
70 virtual void outputVariables(); 71 virtual void outputVariables();
72 QString fixFilename(QString ofile) const;
71 73
@@ -91,20 +93,2 @@ protected:
91 93
92 /*
93 void writeGuid( QTextStream &t );
94 void writeAdditionalOptions( QTextStream &t );
95 void writeHeaders( QTextStream &t );
96 void writeSources( QTextStream &t );
97 void writeMocs( QTextStream &t );
98 void writeLexs( QTextStream &t );
99 void writeYaccs( QTextStream &t );
100 void writePictures( QTextStream &t );
101 void writeImages( QTextStream &t );
102 void writeIDLs( QTextStream &t );
103
104 void writeForms( QTextStream &t );
105 void writeFormsSourceHeaders( QString &variable, QTextStream &t );
106 void writeTranslations( QTextStream &t );
107 void writeStrippedTranslations( QTextStream &t );
108 */
109
110 VCProject vcProject; 94 VCProject vcProject;
@@ -112,2 +96,4 @@ protected:
112 96
97private:
98 QUuid increaseUUID(const QUuid &id);
113 friend class VCFilter; 99 friend class VCFilter;
@@ -128,2 +114,2 @@ inline bool VcprojGenerator::findLibraries()
128 114
129#endif /* __VCPROJMAKE_H__ */ 115#endif /* __MSVC_VCPROJ_H__ */
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
@@ -121,3 +121,2 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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;
@@ -138,3 +137,2 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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;
@@ -157,2 +155,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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;
@@ -163,4 +162,5 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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"
@@ -188,5 +188,3 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
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];
@@ -212,13 +210,10 @@ Win32MakefileGenerator::writeSubDirs(QTextStream &t)
212int 210int
213Win32MakefileGenerator::findHighestVersion(const QString &d, const 211Win32MakefileGenerator::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);
@@ -226,9 +221,16 @@ Win32MakefileGenerator::findHighestVersion(const QString &d, const
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;
@@ -243,11 +245,28 @@ Win32MakefileGenerator::findLibraries(const QString &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")) {
@@ -256,8 +275,10 @@ Win32MakefileGenerator::findLibraries(const QString &where)
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;
@@ -266,14 +287,20 @@ Win32MakefileGenerator::findLibraries(const QString &where)
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")) {
@@ -281,9 +308,19 @@ Win32MakefileGenerator::findLibraries(const QString &where)
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 }
@@ -293,7 +330,10 @@ Win32MakefileGenerator::findLibraries(const QString &where)
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;
@@ -325,4 +365,4 @@ Win32MakefileGenerator::processPrlFiles()
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;