25 files changed, 4562 insertions, 1958 deletions
diff --git a/qmake/generators/mac/metrowerks_xml.cpp b/qmake/generators/mac/metrowerks_xml.cpp index 125749d..baaeeec 100644 --- a/qmake/generators/mac/metrowerks_xml.cpp +++ b/qmake/generators/mac/metrowerks_xml.cpp | |||
@@ -1,147 +1,144 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of MetrowerksMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "metrowerks_xml.h" | 36 | #include "metrowerks_xml.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qdir.h> | 38 | #include <qdir.h> |
41 | #include <qdict.h> | 39 | #include <qdict.h> |
42 | #include <qregexp.h> | 40 | #include <qregexp.h> |
43 | #include <stdlib.h> | 41 | #include <stdlib.h> |
44 | #include <time.h> | 42 | #include <time.h> |
45 | #ifdef Q_OS_MAC | 43 | #if !defined(QWS) && defined(Q_OS_MAC) |
46 | #include <Carbon/Carbon.h> | 44 | #include <Carbon/Carbon.h> |
47 | #include <sys/types.h> | 45 | #include <sys/types.h> |
48 | #include <sys/stat.h> | 46 | #include <sys/stat.h> |
49 | #endif | 47 | #endif |
50 | 48 | ||
51 | |||
52 | MetrowerksMakefileGenerator::MetrowerksMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) | 49 | MetrowerksMakefileGenerator::MetrowerksMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) |
53 | { | 50 | { |
54 | 51 | ||
55 | } | 52 | } |
56 | 53 | ||
57 | bool | 54 | bool |
58 | MetrowerksMakefileGenerator::writeMakefile(QTextStream &t) | 55 | MetrowerksMakefileGenerator::writeMakefile(QTextStream &t) |
59 | { | 56 | { |
60 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 57 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
61 | /* for now just dump, I need to generated an empty xml or something.. */ | 58 | /* for now just dump, I need to generated an empty xml or something.. */ |
62 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 59 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
63 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 60 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
64 | return TRUE; | 61 | return TRUE; |
65 | } | 62 | } |
66 | 63 | ||
67 | if(project->first("TEMPLATE") == "app" || | 64 | if(project->first("TEMPLATE") == "app" || |
68 | project->first("TEMPLATE") == "lib") { | 65 | project->first("TEMPLATE") == "lib") { |
69 | return writeMakeParts(t); | 66 | return writeMakeParts(t); |
70 | } | 67 | } |
71 | else if(project->first("TEMPLATE") == "subdirs") { | 68 | else if(project->first("TEMPLATE") == "subdirs") { |
72 | writeHeader(t); | 69 | writeHeader(t); |
73 | qDebug("Not supported!"); | 70 | qDebug("Not supported!"); |
74 | return TRUE; | 71 | return TRUE; |
75 | } | 72 | } |
76 | return FALSE; | 73 | return FALSE; |
77 | } | 74 | } |
78 | 75 | ||
79 | bool | 76 | bool |
80 | MetrowerksMakefileGenerator::writeMakeParts(QTextStream &t) | 77 | MetrowerksMakefileGenerator::writeMakeParts(QTextStream &t) |
81 | { | 78 | { |
82 | //..grrr.. libs! | 79 | //..grrr.. libs! |
83 | QStringList extra_objs; | 80 | QStringList extra_objs; |
84 | bool do_libs = TRUE; | 81 | bool do_libs = TRUE; |
85 | if(project->first("TEMPLATE") == "app") | 82 | if(project->first("TEMPLATE") == "app") |
86 | extra_objs += project->variables()["QMAKE_CRT_OBJECTS"]; | 83 | extra_objs += project->variables()["QMAKE_CRT_OBJECTS"]; |
87 | else if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) | 84 | else if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) |
88 | do_libs = FALSE; | 85 | do_libs = FALSE; |
89 | if(do_libs) | 86 | if(do_libs) |
90 | extra_objs += project->variables()["QMAKE_LIBS"]; | 87 | extra_objs += project->variables()["QMAKE_LIBS"]; |
91 | for(QStringList::Iterator val_it = extra_objs.begin(); | 88 | for(QStringList::Iterator val_it = extra_objs.begin(); |
92 | val_it != extra_objs.end(); ++val_it) { | 89 | val_it != extra_objs.end(); ++val_it) { |
93 | if((*val_it).startsWith("-L")) { | 90 | if((*val_it).startsWith("-L")) { |
94 | QString dir((*val_it).right((*val_it).length() - 2)); | 91 | QString dir((*val_it).right((*val_it).length() - 2)); |
95 | fixEnvVariables(dir); | 92 | fixEnvVariables(dir); |
96 | if(project->variables()["DEPENDPATH"].findIndex(dir) == -1 && | 93 | if(project->variables()["DEPENDPATH"].findIndex(dir) == -1 && |
97 | project->variables()["INCLUDEPATH"].findIndex(dir) == -1) | 94 | project->variables()["INCLUDEPATH"].findIndex(dir) == -1) |
98 | project->variables()["INCLUDEPATH"].append(dir); | 95 | project->variables()["INCLUDEPATH"].append(dir); |
99 | } else if((*val_it).startsWith("-l")) { | 96 | } else if((*val_it).startsWith("-l")) { |
100 | QString lib("lib" + (*val_it).right((*val_it).length() - 2) + "." + | 97 | QString lib("lib" + (*val_it).right((*val_it).length() - 2) + "." + |
101 | project->first("QMAKE_EXTENSION_SHLIB")); | 98 | project->first("QMAKE_EXTENSION_SHLIB")); |
102 | if(project->variables()["LIBRARIES"].findIndex(lib) == -1) | 99 | if(project->variables()["LIBRARIES"].findIndex(lib) == -1) |
103 | project->variables()["LIBRARIES"].append(lib); | 100 | project->variables()["LIBRARIES"].append(lib); |
104 | } else | 101 | } else |
105 | if((*val_it) == "-framework") { | 102 | if((*val_it) == "-framework") { |
106 | ++val_it; | 103 | ++val_it; |
107 | if(val_it == extra_objs.end()) | 104 | if(val_it == extra_objs.end()) |
108 | break; | 105 | break; |
109 | QString frmwrk = (*val_it) + ".framework"; | 106 | QString frmwrk = (*val_it) + ".framework"; |
110 | if(project->variables()["FRAMEWORKS"].findIndex(frmwrk) == -1) | 107 | if(project->variables()["FRAMEWORKS"].findIndex(frmwrk) == -1) |
111 | project->variables()["FRAMEWORKS"].append(frmwrk); | 108 | project->variables()["FRAMEWORKS"].append(frmwrk); |
112 | } else if((*val_it).left(1) != "-") { | 109 | } else if((*val_it).left(1) != "-") { |
113 | QString lib=(*val_it); | 110 | QString lib=(*val_it); |
114 | int s = lib.findRev('/'); | 111 | int s = lib.findRev('/'); |
115 | if(s != -1) { | 112 | if(s != -1) { |
116 | QString dir = lib.left(s); | 113 | QString dir = lib.left(s); |
117 | lib = lib.right(lib.length() - s - 1); | 114 | lib = lib.right(lib.length() - s - 1); |
118 | fixEnvVariables(dir); | 115 | fixEnvVariables(dir); |
119 | if(project->variables()["DEPENDPATH"].findIndex(dir) == -1 && | 116 | if(project->variables()["DEPENDPATH"].findIndex(dir) == -1 && |
120 | project->variables()["INCLUDEPATH"].findIndex(dir) == -1) | 117 | project->variables()["INCLUDEPATH"].findIndex(dir) == -1) |
121 | project->variables()["INCLUDEPATH"].append(dir); | 118 | project->variables()["INCLUDEPATH"].append(dir); |
122 | } | 119 | } |
123 | project->variables()["LIBRARIES"].append(lib); | 120 | project->variables()["LIBRARIES"].append(lib); |
124 | } | 121 | } |
125 | } | 122 | } |
126 | //let metrowerks find the files & set the files to the type I expect | 123 | //let metrowerks find the files & set the files to the type I expect |
127 | QDict<void> seen(293); | 124 | QDict<void> seen(293); |
128 | QString paths[] = { QString("SRCMOC"), QString("FORMS"), QString("UICDECLS"), | 125 | QString paths[] = { QString("SRCMOC"), QString("FORMS"), QString("UICDECLS"), |
129 | QString("UICIMPLS"), QString("SOURCES"),QString("HEADERS"), | 126 | QString("UICIMPLS"), QString("SOURCES"),QString("HEADERS"), |
130 | QString::null }; | 127 | QString::null }; |
131 | for(int y = 0; paths[y] != QString::null; y++) { | 128 | for(int y = 0; paths[y] != QString::null; y++) { |
132 | QStringList &l = project->variables()[paths[y]]; | 129 | QStringList &l = project->variables()[paths[y]]; |
133 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 130 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
134 | //establish file types | 131 | //establish file types |
135 | seen.insert((*val_it), (void *)1); | 132 | seen.insert((*val_it), (void *)1); |
136 | createFork((*val_it)); //the file itself | 133 | createFork((*val_it)); //the file itself |
137 | QStringList &d = findDependencies((*val_it)); //depends | 134 | QStringList &d = findDependencies((*val_it)); //depends |
138 | for(QStringList::Iterator dep_it = d.begin(); dep_it != d.end(); ++dep_it) { | 135 | for(QStringList::Iterator dep_it = d.begin(); dep_it != d.end(); ++dep_it) { |
139 | if(!seen.find((*dep_it))) { | 136 | if(!seen.find((*dep_it))) { |
140 | seen.insert((*dep_it), (void *)1); | 137 | seen.insert((*dep_it), (void *)1); |
141 | createFork((*dep_it)); | 138 | createFork((*dep_it)); |
142 | } | 139 | } |
143 | } | 140 | } |
144 | //now chop it | 141 | //now chop it |
145 | int s = (*val_it).findRev('/'); | 142 | int s = (*val_it).findRev('/'); |
146 | if(s != -1) { | 143 | if(s != -1) { |
147 | QString dir = (*val_it).left(s); | 144 | QString dir = (*val_it).left(s); |
@@ -514,309 +511,309 @@ MetrowerksMakefileGenerator::writeMakeParts(QTextStream &t) | |||
514 | } | 511 | } |
515 | 512 | ||
516 | 513 | ||
517 | 514 | ||
518 | void | 515 | void |
519 | MetrowerksMakefileGenerator::init() | 516 | MetrowerksMakefileGenerator::init() |
520 | { | 517 | { |
521 | if(init_flag) | 518 | if(init_flag) |
522 | return; | 519 | return; |
523 | init_flag = TRUE; | 520 | init_flag = TRUE; |
524 | 521 | ||
525 | if ( project->isEmpty("QMAKE_XML_TEMPLATE") ) | 522 | if ( project->isEmpty("QMAKE_XML_TEMPLATE") ) |
526 | project->variables()["QMAKE_XML_TEMPLATE"].append("mwerkstmpl.xml"); | 523 | project->variables()["QMAKE_XML_TEMPLATE"].append("mwerkstmpl.xml"); |
527 | 524 | ||
528 | QStringList &configs = project->variables()["CONFIG"]; | 525 | QStringList &configs = project->variables()["CONFIG"]; |
529 | if(project->isActiveConfig("qt")) { | 526 | if(project->isActiveConfig("qt")) { |
530 | if(configs.findIndex("moc")) configs.append("moc"); | 527 | if(configs.findIndex("moc")) configs.append("moc"); |
531 | if ( !( (project->first("TARGET") == "qt") || (project->first("TARGET") == "qte") || | 528 | if ( !( (project->first("TARGET") == "qt") || (project->first("TARGET") == "qte") || |
532 | (project->first("TARGET") == "qt-mt") ) ) | 529 | (project->first("TARGET") == "qt-mt") ) ) |
533 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 530 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
534 | if(configs.findIndex("moc")) | 531 | if(configs.findIndex("moc")) |
535 | configs.append("moc"); | 532 | configs.append("moc"); |
536 | if ( !project->isActiveConfig("debug") ) | 533 | if ( !project->isActiveConfig("debug") ) |
537 | project->variables()["DEFINES"].append("QT_NO_DEBUG"); | 534 | project->variables()["DEFINES"].append("QT_NO_DEBUG"); |
538 | } | 535 | } |
539 | 536 | ||
540 | //version handling | 537 | //version handling |
541 | if(project->variables()["VERSION"].isEmpty()) | 538 | if(project->variables()["VERSION"].isEmpty()) |
542 | project->variables()["VERSION"].append("1.0." + | 539 | project->variables()["VERSION"].append("1.0." + |
543 | (project->isEmpty("VER_PAT") ? QString("0") : | 540 | (project->isEmpty("VER_PAT") ? QString("0") : |
544 | project->first("VER_PAT")) ); | 541 | project->first("VER_PAT")) ); |
545 | QStringList ver = QStringList::split('.', project->first("VERSION")); | 542 | QStringList ver = QStringList::split('.', project->first("VERSION")); |
546 | ver << "0" << "0"; //make sure there are three | 543 | ver << "0" << "0"; //make sure there are three |
547 | project->variables()["VER_MAJ"].append(ver[0]); | 544 | project->variables()["VER_MAJ"].append(ver[0]); |
548 | project->variables()["VER_MIN"].append(ver[1]); | 545 | project->variables()["VER_MIN"].append(ver[1]); |
549 | project->variables()["VER_PAT"].append(ver[2]); | 546 | project->variables()["VER_PAT"].append(ver[2]); |
550 | 547 | ||
551 | if( !project->isEmpty("LIBS") ) | 548 | if( !project->isEmpty("LIBS") ) |
552 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 549 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
553 | if( project->variables()["QMAKE_EXTENSION_SHLIB"].isEmpty() ) | 550 | if( project->variables()["QMAKE_EXTENSION_SHLIB"].isEmpty() ) |
554 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dylib" ); | 551 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dylib" ); |
555 | 552 | ||
556 | if ( project->isActiveConfig("moc") ) { | 553 | if ( project->isActiveConfig("moc") ) { |
557 | QString mocfile = project->first("TARGET"); | 554 | QString mocfile = project->first("TARGET"); |
558 | if(project->first("TEMPLATE") == "lib") | 555 | if(project->first("TEMPLATE") == "lib") |
559 | mocfile += project->isActiveConfig("staticlib") ? "_static" : "_shared"; | 556 | mocfile += project->isActiveConfig("staticlib") ? "_static" : "_shared"; |
560 | project->variables()["MOCS"].append(mocfile + ".mocs"); | 557 | project->variables()["MOCS"].append(mocfile + ".mocs"); |
561 | setMocAware(TRUE); | 558 | setMocAware(TRUE); |
562 | } | 559 | } |
563 | if(!project->isEmpty("FORMS")) { | 560 | if(!project->isEmpty("FORMS")) { |
564 | QString uicfile = project->first("TARGET"); | 561 | QString uicfile = project->first("TARGET"); |
565 | if(project->first("TEMPLATE") == "lib") | 562 | if(project->first("TEMPLATE") == "lib") |
566 | uicfile += project->isActiveConfig("staticlib") ? "_static" : "_shared"; | 563 | uicfile += project->isActiveConfig("staticlib") ? "_static" : "_shared"; |
567 | project->variables()["UICS"].append(uicfile + ".uics"); | 564 | project->variables()["UICS"].append(uicfile + ".uics"); |
568 | } | 565 | } |
569 | if(project->isEmpty("DESTDIR")) | 566 | if(project->isEmpty("DESTDIR")) |
570 | project->variables()["DESTDIR"].append(QDir::currentDirPath()); | 567 | project->variables()["DESTDIR"].append(QDir::currentDirPath()); |
571 | MakefileGenerator::init(); | 568 | MakefileGenerator::init(); |
572 | 569 | ||
573 | if ( project->isActiveConfig("opengl") ) { | 570 | if ( project->isActiveConfig("opengl") ) { |
574 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; | 571 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; |
575 | if ( (project->first("TARGET") == "qt") || (project->first("TARGET") == "qte") || | 572 | if ( (project->first("TARGET") == "qt") || (project->first("TARGET") == "qte") || |
576 | (project->first("TARGET") == "qt-mt") ) | 573 | (project->first("TARGET") == "qt-mt") ) |
577 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; | 574 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; |
578 | else | 575 | else |
579 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 576 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
580 | } | 577 | } |
581 | 578 | ||
582 | if(project->isActiveConfig("qt")) | 579 | if(project->isActiveConfig("qt")) |
583 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; | 580 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; |
584 | if(project->isEmpty("FRAMEWORKPATH")) | 581 | if(project->isEmpty("FRAMEWORKPATH")) |
585 | project->variables()["FRAMEWORKPATH"].append("/System/Library/Frameworks/"); | 582 | project->variables()["FRAMEWORKPATH"].append("/System/Library/Frameworks/"); |
586 | 583 | ||
587 | //set the target up | 584 | //set the target up |
588 | project->variables()["TARGET_STEM"] = project->variables()["TARGET"]; | 585 | project->variables()["TARGET_STEM"] = project->variables()["TARGET"]; |
589 | if(project->first("TEMPLATE") == "lib") { | 586 | if(project->first("TEMPLATE") == "lib") { |
590 | if(project->isActiveConfig("staticlib")) | 587 | if(project->isActiveConfig("staticlib")) |
591 | project->variables()["TARGET"].first() = "lib" + project->first("TARGET") + ".lib"; | 588 | project->variables()["TARGET"].first() = "lib" + project->first("TARGET") + ".lib"; |
592 | else | 589 | else |
593 | project->variables()["TARGET"].first() = "lib" + project->first("TARGET") + "." + | 590 | project->variables()["TARGET"].first() = "lib" + project->first("TARGET") + "." + |
594 | project->first("QMAKE_EXTENSION_SHLIB"); | 591 | project->first("QMAKE_EXTENSION_SHLIB"); |
595 | 592 | ||
596 | project->variables()["CODEWARRIOR_VERSION"].append(project->first("VER_MAJ") + | 593 | project->variables()["CODEWARRIOR_VERSION"].append(project->first("VER_MAJ") + |
597 | project->first("VER_MIN") + | 594 | project->first("VER_MIN") + |
598 | project->first("VER_PAT")); | 595 | project->first("VER_PAT")); |
599 | } else { | 596 | } else { |
600 | project->variables()["CODEWARRIOR_VERSION"].append("0"); | 597 | project->variables()["CODEWARRIOR_VERSION"].append("0"); |
601 | if(project->isEmpty("QMAKE_ENTRYPOINT")) | 598 | if(project->isEmpty("QMAKE_ENTRYPOINT")) |
602 | project->variables()["QMAKE_ENTRYPOINT"].append("start"); | 599 | project->variables()["QMAKE_ENTRYPOINT"].append("start"); |
603 | project->variables()["CODEWARRIOR_ENTRYPOINT"].append( | 600 | project->variables()["CODEWARRIOR_ENTRYPOINT"].append( |
604 | project->first("QMAKE_ENTRYPOINT")); | 601 | project->first("QMAKE_ENTRYPOINT")); |
605 | } | 602 | } |
606 | } | 603 | } |
607 | 604 | ||
608 | 605 | ||
609 | QString | 606 | QString |
610 | MetrowerksMakefileGenerator::findTemplate(QString file) | 607 | MetrowerksMakefileGenerator::findTemplate(const QString &file) |
611 | { | 608 | { |
612 | QString ret; | 609 | QString ret; |
613 | if(!QFile::exists(ret = file) && | 610 | if(!QFile::exists(ret = file) && |
614 | !QFile::exists((ret = Option::mkfile::qmakespec + QDir::separator() + file)) && | 611 | !QFile::exists((ret = Option::mkfile::qmakespec + QDir::separator() + file)) && |
615 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/mac-mwerks/" + file)) && | 612 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/mac-mwerks/" + file)) && |
616 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 613 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
617 | return ""; | 614 | return ""; |
618 | return ret; | 615 | return ret; |
619 | } | 616 | } |
620 | 617 | ||
621 | bool | 618 | bool |
622 | MetrowerksMakefileGenerator::createFork(const QString &f) | 619 | MetrowerksMakefileGenerator::createFork(const QString &f) |
623 | { | 620 | { |
624 | #if defined(Q_OS_MACX) | 621 | #if !defined(QWS) && defined(Q_OS_MACX) |
625 | FSRef fref; | 622 | FSRef fref; |
626 | FSSpec fileSpec; | 623 | FSSpec fileSpec; |
627 | if(QFile::exists(f)) { | 624 | if(QFile::exists(f)) { |
628 | mode_t perms = 0; | 625 | mode_t perms = 0; |
629 | { | 626 | { |
630 | struct stat s; | 627 | struct stat s; |
631 | stat(f.latin1(), &s); | 628 | stat(f.latin1(), &s); |
632 | if(!(s.st_mode & S_IWUSR)) { | 629 | if(!(s.st_mode & S_IWUSR)) { |
633 | perms = s.st_mode; | 630 | perms = s.st_mode; |
634 | chmod(f.latin1(), perms | S_IWUSR); | 631 | chmod(f.latin1(), perms | S_IWUSR); |
635 | } | 632 | } |
636 | } | 633 | } |
637 | FILE *o = fopen(f.latin1(), "a"); | 634 | FILE *o = fopen(f.latin1(), "a"); |
638 | if(!o) | 635 | if(!o) |
639 | return FALSE; | 636 | return FALSE; |
640 | if(FSPathMakeRef((const UInt8 *)f.latin1(), &fref, NULL) == noErr) { | 637 | if(FSPathMakeRef((const UInt8 *)f.latin1(), &fref, NULL) == noErr) { |
641 | if(FSGetCatalogInfo(&fref, kFSCatInfoNone, NULL, NULL, &fileSpec, NULL) == noErr) | 638 | if(FSGetCatalogInfo(&fref, kFSCatInfoNone, NULL, NULL, &fileSpec, NULL) == noErr) |
642 | FSpCreateResFile(&fileSpec, 'CUTE', 'TEXT', smSystemScript); | 639 | FSpCreateResFile(&fileSpec, 'CUTE', 'TEXT', smSystemScript); |
643 | else | 640 | else |
644 | qDebug("bogus %d", __LINE__); | 641 | qDebug("bogus %d", __LINE__); |
645 | } else | 642 | } else |
646 | qDebug("bogus %d", __LINE__); | 643 | qDebug("bogus %d", __LINE__); |
647 | fclose(o); | 644 | fclose(o); |
648 | if(perms) | 645 | if(perms) |
649 | chmod(f.latin1(), perms); | 646 | chmod(f.latin1(), perms); |
650 | } | 647 | } |
651 | #else | 648 | #else |
652 | Q_UNUSED(f) | 649 | Q_UNUSED(f) |
653 | #endif | 650 | #endif |
654 | return TRUE; | 651 | return TRUE; |
655 | } | 652 | } |
656 | 653 | ||
657 | bool | 654 | bool |
658 | MetrowerksMakefileGenerator::fixifyToMacPath(QString &p, QString &v, bool ) | 655 | MetrowerksMakefileGenerator::fixifyToMacPath(QString &p, QString &v, bool ) |
659 | { | 656 | { |
660 | v = "Absolute"; | 657 | v = "Absolute"; |
661 | if(p.find(':') != -1) //guess its macish already | 658 | if(p.find(':') != -1) //guess its macish already |
662 | return TRUE; | 659 | return TRUE; |
663 | 660 | ||
664 | static QString st_volume; | 661 | static QString st_volume; |
665 | if(st_volume.isEmpty()) { | 662 | if(st_volume.isEmpty()) { |
666 | st_volume = var("QMAKE_VOLUMENAME"); | 663 | st_volume = var("QMAKE_VOLUMENAME"); |
667 | #ifdef Q_OS_MAC | 664 | #if !defined(QWS) && defined(Q_OS_MACX) |
668 | if(st_volume.isEmpty()) { | 665 | if(st_volume.isEmpty()) { |
669 | uchar foo[512]; | 666 | uchar foo[512]; |
670 | HVolumeParam pb; | 667 | HVolumeParam pb; |
671 | memset(&pb, '\0', sizeof(pb)); | 668 | memset(&pb, '\0', sizeof(pb)); |
672 | pb.ioVRefNum = 0; | 669 | pb.ioVRefNum = 0; |
673 | pb.ioNamePtr = foo; | 670 | pb.ioNamePtr = foo; |
674 | if(PBHGetVInfoSync((HParmBlkPtr)&pb) == noErr) { | 671 | if(PBHGetVInfoSync((HParmBlkPtr)&pb) == noErr) { |
675 | int len = foo[0]; | 672 | int len = foo[0]; |
676 | memcpy(foo,foo+1, len); | 673 | memcpy(foo,foo+1, len); |
677 | foo[len] = '\0'; | 674 | foo[len] = '\0'; |
678 | st_volume = (char *)foo; | 675 | st_volume = (char *)foo; |
679 | } | 676 | } |
680 | } | 677 | } |
681 | #endif | 678 | #endif |
682 | } | 679 | } |
683 | QString volume = st_volume; | 680 | QString volume = st_volume; |
684 | 681 | ||
685 | fixEnvVariables(p); | 682 | fixEnvVariables(p); |
686 | if(p.startsWith("\"") && p.endsWith("\"")) | 683 | if(p.startsWith("\"") && p.endsWith("\"")) |
687 | p = p.mid(1, p.length() - 2); | 684 | p = p.mid(1, p.length() - 2); |
688 | if(p.isEmpty()) | 685 | if(p.isEmpty()) |
689 | return FALSE; | 686 | return FALSE; |
690 | if(!p.endsWith("/")) | 687 | if(!p.endsWith("/")) |
691 | p += "/"; | 688 | p += "/"; |
692 | if(QDir::isRelativePath(p)) { | 689 | if(QDir::isRelativePath(p)) { |
693 | if(p.startsWith("{")) { | 690 | if(p.startsWith("{")) { |
694 | int eoc = p.find('}'); | 691 | int eoc = p.find('}'); |
695 | if(eoc == -1) | 692 | if(eoc == -1) |
696 | return FALSE; | 693 | return FALSE; |
697 | volume = p.mid(1, eoc - 1); | 694 | volume = p.mid(1, eoc - 1); |
698 | p = p.right(p.length() - eoc - 1); | 695 | p = p.right(p.length() - eoc - 1); |
699 | } else { | 696 | } else { |
700 | QFileInfo fi(p); | 697 | QFileInfo fi(p); |
701 | if(fi.convertToAbs()) //strange | 698 | if(fi.convertToAbs()) //strange |
702 | return FALSE; | 699 | return FALSE; |
703 | p = fi.filePath(); | 700 | p = fi.filePath(); |
704 | } | 701 | } |
705 | } | 702 | } |
706 | p = QDir::cleanDirPath(p); | 703 | p = QDir::cleanDirPath(p); |
707 | if(!volume.isEmpty()) | 704 | if(!volume.isEmpty()) |
708 | v = volume; | 705 | v = volume; |
709 | p.replace("/", ":"); | 706 | p.replace("/", ":"); |
710 | if(p.right(1) != ":") | 707 | if(p.right(1) != ":") |
711 | p += ':'; | 708 | p += ':'; |
712 | return TRUE; | 709 | return TRUE; |
713 | } | 710 | } |
714 | 711 | ||
715 | void | 712 | void |
716 | MetrowerksMakefileGenerator::processPrlFiles() | 713 | MetrowerksMakefileGenerator::processPrlFiles() |
717 | { | 714 | { |
718 | QPtrList<MakefileDependDir> libdirs; | 715 | QPtrList<MakefileDependDir> libdirs; |
719 | libdirs.setAutoDelete(TRUE); | 716 | libdirs.setAutoDelete(TRUE); |
720 | const QString lflags[] = { "QMAKE_LIBS", QString::null }; | 717 | const QString lflags[] = { "QMAKE_LIBS", QString::null }; |
721 | for(int i = 0; !lflags[i].isNull(); i++) { | 718 | for(int i = 0; !lflags[i].isNull(); i++) { |
722 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 719 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
723 | QStringList l_out; | 720 | QStringList l_out; |
724 | QStringList &l = project->variables()[lflags[i]]; | 721 | QStringList &l = project->variables()[lflags[i]]; |
725 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 722 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
726 | QString opt = (*it); | 723 | QString opt = (*it); |
727 | if(opt.startsWith("-")) { | 724 | if(opt.startsWith("-")) { |
728 | if(opt.startsWith("-L")) { | 725 | if(opt.startsWith("-L")) { |
729 | QString r = opt.right(opt.length() - 2), l = r; | 726 | QString r = opt.right(opt.length() - 2), l = r; |
730 | fixEnvVariables(l); | 727 | fixEnvVariables(l); |
731 | libdirs.append(new MakefileDependDir(r.replace( "\"", ""), | 728 | libdirs.append(new MakefileDependDir(r.replace( "\"", ""), |
732 | l.replace( "\"", ""))); | 729 | l.replace( "\"", ""))); |
733 | } else if(opt.left(2) == "-l") { | 730 | } else if(opt.left(2) == "-l") { |
734 | QString lib = opt.right(opt.length() - 2), prl; | 731 | QString lib = opt.right(opt.length() - 2), prl; |
735 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 732 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
736 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext; | 733 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib; |
737 | if(processPrlFile(prl)) { | 734 | if(processPrlFile(prl)) { |
738 | if(prl.startsWith(mdd->local_dir)) | 735 | if(prl.startsWith(mdd->local_dir)) |
739 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); | 736 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); |
740 | QRegExp reg("^.*lib(" + lib + "[^.]*)\\." + | 737 | QRegExp reg("^.*lib(" + lib + "[^.]*)\\." + |
741 | project->first("QMAKE_EXTENSION_SHLIB") + "$"); | 738 | project->first("QMAKE_EXTENSION_SHLIB") + "$"); |
742 | if(reg.exactMatch(prl)) | 739 | if(reg.exactMatch(prl)) |
743 | prl = "-l" + reg.cap(1); | 740 | prl = "-l" + reg.cap(1); |
744 | opt = prl; | 741 | opt = prl; |
745 | ret = TRUE; | 742 | ret = TRUE; |
746 | break; | 743 | break; |
747 | } | 744 | } |
748 | } | 745 | } |
749 | } else if(opt == "-framework") { | 746 | } else if(opt == "-framework") { |
750 | l_out.append(opt); | 747 | l_out.append(opt); |
751 | ++it; | 748 | ++it; |
752 | opt = (*it); | 749 | opt = (*it); |
753 | QString prl = "/System/Library/Frameworks/" + opt + | 750 | QString prl = "/System/Library/Frameworks/" + opt + |
754 | ".framework/" + opt + Option::prl_ext; | 751 | ".framework/" + opt; |
755 | if(processPrlFile(prl)) | 752 | if(processPrlFile(prl)) |
756 | ret = TRUE; | 753 | ret = TRUE; |
757 | } | 754 | } |
758 | if(!opt.isEmpty()) | 755 | if(!opt.isEmpty()) |
759 | l_out.append(opt); | 756 | l_out.append(opt); |
760 | } else { | 757 | } else { |
761 | if(processPrlFile(opt)) | 758 | if(processPrlFile(opt)) |
762 | ret = TRUE; | 759 | ret = TRUE; |
763 | if(!opt.isEmpty()) | 760 | if(!opt.isEmpty()) |
764 | l_out.append(opt); | 761 | l_out.append(opt); |
765 | } | 762 | } |
766 | } | 763 | } |
767 | if(ret) | 764 | if(ret) |
768 | l = l_out; | 765 | l = l_out; |
769 | else | 766 | else |
770 | break; | 767 | break; |
771 | } | 768 | } |
772 | } | 769 | } |
773 | } | 770 | } |
774 | 771 | ||
775 | void | 772 | void |
776 | MetrowerksMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 773 | MetrowerksMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
777 | { | 774 | { |
778 | if(var == "QMAKE_PRL_LIBS") { | 775 | if(var == "QMAKE_PRL_LIBS") { |
779 | QStringList &out = project->variables()["QMAKE_LIBS"]; | 776 | QStringList &out = project->variables()["QMAKE_LIBS"]; |
780 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 777 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
781 | bool append = TRUE; | 778 | bool append = TRUE; |
782 | if((*it).startsWith("-")) { | 779 | if((*it).startsWith("-")) { |
783 | if((*it).startsWith("-l") || (*it).startsWith("-L")) { | 780 | if((*it).startsWith("-l") || (*it).startsWith("-L")) { |
784 | append = out.findIndex((*it)) == -1; | 781 | append = out.findIndex((*it)) == -1; |
785 | } else if((*it).startsWith("-framework")) { | 782 | } else if((*it).startsWith("-framework")) { |
786 | ++it; | 783 | ++it; |
787 | for(QStringList::ConstIterator outit = out.begin(); | 784 | for(QStringList::ConstIterator outit = out.begin(); |
788 | outit != out.end(); ++it) { | 785 | outit != out.end(); ++it) { |
789 | if((*outit) == "-framework") { | 786 | if((*outit) == "-framework") { |
790 | ++outit; | 787 | ++outit; |
791 | if((*outit) == (*it)) { | 788 | if((*outit) == (*it)) { |
792 | append = FALSE; | 789 | append = FALSE; |
793 | break; | 790 | break; |
794 | } | 791 | } |
795 | } | 792 | } |
796 | } | 793 | } |
797 | } | 794 | } |
798 | } else if(QFile::exists((*it))) { | 795 | } else if(QFile::exists((*it))) { |
799 | append = out.findIndex((*it)); | 796 | append = out.findIndex((*it)); |
800 | } | 797 | } |
801 | if(append) | 798 | if(append) |
802 | out.append((*it)); | 799 | out.append((*it)); |
803 | } | 800 | } |
804 | } else { | 801 | } else { |
805 | MakefileGenerator::processPrlVariable(var, l); | 802 | MakefileGenerator::processPrlVariable(var, l); |
806 | } | 803 | } |
807 | } | 804 | } |
808 | 805 | ||
809 | 806 | ||
810 | bool | 807 | bool |
811 | MetrowerksMakefileGenerator::openOutput(QFile &file) const | 808 | MetrowerksMakefileGenerator::openOutput(QFile &file) const |
812 | { | 809 | { |
813 | QString outdir; | 810 | QString outdir; |
814 | if(!file.name().isEmpty()) { | 811 | if(!file.name().isEmpty()) { |
815 | QFileInfo fi(file); | 812 | QFileInfo fi(file); |
816 | if(fi.isDir()) | 813 | if(fi.isDir()) |
817 | outdir = file.name() + QDir::separator(); | 814 | outdir = file.name() + QDir::separator(); |
818 | } | 815 | } |
819 | if(!outdir.isEmpty() || file.name().isEmpty()) | 816 | if(!outdir.isEmpty() || file.name().isEmpty()) |
820 | file.setName(outdir + project->first("TARGET") + ".xml"); | 817 | file.setName(outdir + project->first("TARGET") + ".xml"); |
821 | return MakefileGenerator::openOutput(file); | 818 | return MakefileGenerator::openOutput(file); |
822 | } | 819 | } |
diff --git a/qmake/generators/mac/metrowerks_xml.h b/qmake/generators/mac/metrowerks_xml.h index ae3cfae..0aa3615 100644 --- a/qmake/generators/mac/metrowerks_xml.h +++ b/qmake/generators/mac/metrowerks_xml.h | |||
@@ -1,69 +1,68 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of MetrowerksMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | #ifndef __METROWERKSMAKE_H__ | 35 | |
38 | #define __METROWERKSMAKE_H__ | 36 | #ifndef __METROWERKS_XML_H__ |
37 | #define __METROWERKS_XML_H__ | ||
39 | 38 | ||
40 | #include "makefile.h" | 39 | #include "makefile.h" |
41 | 40 | ||
42 | class MetrowerksMakefileGenerator : public MakefileGenerator | 41 | class MetrowerksMakefileGenerator : public MakefileGenerator |
43 | { | 42 | { |
44 | bool createFork(const QString &f); | 43 | bool createFork(const QString &f); |
45 | bool fixifyToMacPath(QString &c, QString &v, bool exists=TRUE); | 44 | bool fixifyToMacPath(QString &c, QString &v, bool exists=TRUE); |
46 | 45 | ||
47 | bool init_flag; | 46 | bool init_flag; |
48 | 47 | ||
49 | bool writeMakeParts(QTextStream &); | 48 | bool writeMakeParts(QTextStream &); |
50 | bool writeSubDirs(QTextStream &); | 49 | bool writeSubDirs(QTextStream &); |
51 | 50 | ||
52 | bool writeMakefile(QTextStream &); | 51 | bool writeMakefile(QTextStream &); |
53 | QString findTemplate(QString file); | 52 | QString findTemplate(const QString &file); |
54 | void init(); | 53 | void init(); |
55 | public: | 54 | public: |
56 | MetrowerksMakefileGenerator(QMakeProject *p); | 55 | MetrowerksMakefileGenerator(QMakeProject *p); |
57 | ~MetrowerksMakefileGenerator(); | 56 | ~MetrowerksMakefileGenerator(); |
58 | 57 | ||
59 | bool openOutput(QFile &file) const; | 58 | bool openOutput(QFile &file) const; |
60 | protected: | 59 | protected: |
61 | virtual void processPrlFiles(); | 60 | virtual void processPrlFiles(); |
62 | virtual void processPrlVariable(const QString &var, const QStringList &l); | 61 | virtual void processPrlVariable(const QString &var, const QStringList &l); |
63 | virtual bool doDepends() const { return FALSE; } //never necesary | 62 | virtual bool doDepends() const { return FALSE; } //never necesary |
64 | }; | 63 | }; |
65 | 64 | ||
66 | inline MetrowerksMakefileGenerator::~MetrowerksMakefileGenerator() | 65 | inline MetrowerksMakefileGenerator::~MetrowerksMakefileGenerator() |
67 | { } | 66 | { } |
68 | 67 | ||
69 | #endif /* __METROWERKSMAKE_H__ */ | 68 | #endif /* __METROWERKS_XML_H__ */ |
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index b46005b..9d1286e 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp | |||
@@ -1,983 +1,1396 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of ProjectBuilderMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "pbuilder_pbx.h" | 36 | #include "pbuilder_pbx.h" |
39 | #include "option.h" | 37 | #include "option.h" |
38 | #include "meta.h" | ||
40 | #include <qdir.h> | 39 | #include <qdir.h> |
41 | #include <qdict.h> | 40 | #include <qdict.h> |
42 | #include <qregexp.h> | 41 | #include <qregexp.h> |
43 | #include <stdlib.h> | 42 | #include <stdlib.h> |
44 | #include <time.h> | 43 | #include <time.h> |
44 | #include "qtmd5.h" | ||
45 | #ifdef Q_OS_UNIX | 45 | #ifdef Q_OS_UNIX |
46 | # include <sys/types.h> | 46 | # include <sys/types.h> |
47 | # include <sys/stat.h> | 47 | # include <sys/stat.h> |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | // Note: this is fairly hacky, but it does the job... | 50 | // Note: this is fairly hacky, but it does the job... |
51 | 51 | ||
52 | |||
53 | ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator(QMakeProject *p) : UnixMakefileGenerator(p) | 52 | ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator(QMakeProject *p) : UnixMakefileGenerator(p) |
54 | { | 53 | { |
55 | 54 | ||
56 | } | 55 | } |
57 | 56 | ||
58 | bool | 57 | bool |
59 | ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t) | 58 | ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t) |
60 | { | 59 | { |
61 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 60 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
62 | /* for now just dump, I need to generated an empty xml or something.. */ | 61 | /* for now just dump, I need to generated an empty xml or something.. */ |
63 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 62 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
64 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 63 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
65 | return TRUE; | 64 | return TRUE; |
66 | } | 65 | } |
67 | 66 | ||
68 | project->variables()["MAKEFILE"].clear(); | 67 | project->variables()["MAKEFILE"].clear(); |
69 | project->variables()["MAKEFILE"].append("Makefile"); | 68 | project->variables()["MAKEFILE"].append("Makefile"); |
70 | if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib") { | 69 | if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib") |
71 | return writeMakeParts(t); | 70 | return writeMakeParts(t); |
72 | } else if(project->first("TEMPLATE") == "subdirs") { | 71 | else if(project->first("TEMPLATE") == "subdirs") |
73 | writeSubdirs(t, FALSE); | 72 | return writeSubdirs(t, FALSE); |
74 | return TRUE; | ||
75 | } | ||
76 | return FALSE; | 73 | return FALSE; |
77 | } | 74 | } |
78 | 75 | ||
79 | bool | 76 | bool |
77 | ProjectBuilderMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | ||
78 | { | ||
79 | QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), | ||
80 | QDir::currentDirPath()); | ||
81 | QFile mkwrapf(mkwrap); | ||
82 | if(mkwrapf.open(IO_WriteOnly | IO_Translate)) { | ||
83 | debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1()); | ||
84 | QTextStream mkwrapt(&mkwrapf); | ||
85 | UnixMakefileGenerator::writeSubdirs(mkwrapt, direct); | ||
86 | } | ||
87 | |||
88 | //HEADER | ||
89 | t << "// !$*UTF8*$!" << "\n" | ||
90 | << "{" << "\n" | ||
91 | << "\t" << "archiveVersion = 1;" << "\n" | ||
92 | << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n" | ||
93 | << "\t" << "objectVersion = " << pbuilderVersion() << ";" << "\n" | ||
94 | << "\t" << "objects = {" << endl; | ||
95 | |||
96 | //SUBDIRS | ||
97 | QStringList subdirs = project->variables()["SUBDIRS"]; | ||
98 | QString oldpwd = QDir::currentDirPath(); | ||
99 | QMap<QString, QStringList> groups; | ||
100 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { | ||
101 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); | ||
102 | if(fi.exists()) { | ||
103 | if(fi.isDir()) { | ||
104 | QString profile = (*it); | ||
105 | if(!profile.endsWith(Option::dir_sep)) | ||
106 | profile += Option::dir_sep; | ||
107 | profile += fi.baseName() + ".pro"; | ||
108 | subdirs.append(profile); | ||
109 | } else { | ||
110 | QMakeProject tmp_proj; | ||
111 | QString dir = fi.dirPath(), fn = fi.fileName(); | ||
112 | if(!dir.isEmpty()) { | ||
113 | if(!QDir::setCurrent(dir)) | ||
114 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); | ||
115 | } | ||
116 | if(tmp_proj.read(fn, oldpwd)) { | ||
117 | if(Option::debug_level) { | ||
118 | QMap<QString, QStringList> &vars = tmp_proj.variables(); | ||
119 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); | ||
120 | it != vars.end(); ++it) { | ||
121 | if(it.key().left(1) != "." && !it.data().isEmpty()) | ||
122 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), | ||
123 | it.data().join(" :: ").latin1()); | ||
124 | } | ||
125 | } | ||
126 | if(tmp_proj.first("TEMPLATE") == "subdirs") { | ||
127 | subdirs += fileFixify(tmp_proj.variables()["SUBDIRS"]); | ||
128 | } else if(tmp_proj.first("TEMPLATE") == "app" || tmp_proj.first("TEMPLATE") == "lib") { | ||
129 | QString pbxproj = QDir::currentDirPath() + Option::dir_sep + tmp_proj.first("TARGET") + projectSuffix(); | ||
130 | if(!QFile::exists(pbxproj)) { | ||
131 | warn_msg(WarnLogic, "Ignored (not found) '%s'", pbxproj.latin1()); | ||
132 | goto nextfile; // # Dirty! | ||
133 | } | ||
134 | project->variables()["QMAKE_PBX_SUBDIRS"] += pbxproj; | ||
135 | //PROJECTREF | ||
136 | { | ||
137 | bool in_root = TRUE; | ||
138 | QString name = QDir::currentDirPath(); | ||
139 | QString project_key = keyFor(pbxproj + "_PROJECTREF"); | ||
140 | if(project->isActiveConfig("flat")) { | ||
141 | QString flat_file = fileFixify(name, oldpwd, Option::output_dir, TRUE); | ||
142 | if(flat_file.find(Option::dir_sep) != -1) { | ||
143 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | ||
144 | name = dirs.back(); | ||
145 | } | ||
146 | } else { | ||
147 | QString flat_file = fileFixify(name, oldpwd, Option::output_dir, TRUE); | ||
148 | if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) { | ||
149 | QString last_grp("QMAKE_PBX_HEIR_GROUP"); | ||
150 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | ||
151 | name = dirs.back(); | ||
152 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | ||
153 | QString new_grp(last_grp + Option::dir_sep + (*dir_it)), new_grp_key(keyFor(new_grp)); | ||
154 | if(dir_it == dirs.begin()) { | ||
155 | if(!groups.contains(new_grp)) | ||
156 | project->variables()["QMAKE_PBX_GROUPS"].append(new_grp_key); | ||
157 | } else { | ||
158 | if(!groups[last_grp].contains(new_grp_key)) | ||
159 | groups[last_grp] += new_grp_key; | ||
160 | } | ||
161 | last_grp = new_grp; | ||
162 | } | ||
163 | groups[last_grp] += project_key; | ||
164 | in_root = FALSE; | ||
165 | } | ||
166 | } | ||
167 | if(in_root) | ||
168 | project->variables()["QMAKE_PBX_GROUPS"] += project_key; | ||
169 | t << "\t\t" << project_key << " = {" << "\n" | ||
170 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | ||
171 | << "\t\t\t" << "name = " << tmp_proj.first("TARGET") << ";" << "\n" | ||
172 | << "\t\t\t" << "path = " << pbxproj << ";" << "\n" | ||
173 | << "\t\t\t" << "refType = 0;" << "\n" | ||
174 | << "\t\t\t" << "sourceTree = \"<absolute>\";" << "\n" | ||
175 | << "\t\t" << "};" << "\n"; | ||
176 | //PRODUCTGROUP | ||
177 | t << "\t\t" << keyFor(pbxproj + "_PRODUCTGROUP") << " = {" << "\n" | ||
178 | << "\t\t\t" << "children = (" << "\n" | ||
179 | << "\t\t\t" << ");" << "\n" | ||
180 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
181 | << "\t\t\t" << "name = Products;" << "\n" | ||
182 | << "\t\t\t" << "refType = 4;" << "\n" | ||
183 | << "\t\t\t" << "sourceTree = \"<group>\";" << "\n" | ||
184 | << "\t\t" << "};" << "\n"; | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | nextfile: | ||
189 | QDir::setCurrent(oldpwd); | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) { | ||
194 | t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n" | ||
195 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
196 | << "\t\t\t" << "children = (" << "\n" | ||
197 | << valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
198 | << "\t\t\t" << ");" << "\n" | ||
199 | << "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n" | ||
200 | << "\t\t\t" << "refType = 4;" << "\n" | ||
201 | << "\t\t" << "};" << "\n"; | ||
202 | } | ||
203 | |||
204 | //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER | ||
205 | //BUILDSTYLE | ||
206 | QString active_buildstyle; | ||
207 | #if 0 | ||
208 | for(int as_release = 0; as_release < 2; as_release++) | ||
209 | #else | ||
210 | bool as_release = !project->isActiveConfig("debug"); | ||
211 | #endif | ||
212 | { | ||
213 | QString key = keyFor("QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG")); | ||
214 | if(project->isActiveConfig("debug") != as_release) | ||
215 | active_buildstyle = key; | ||
216 | project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key); | ||
217 | t << "\t\t" << key << " = {" << "\n" | ||
218 | << "\t\t\t" << "buildRules = (" << "\n" | ||
219 | << "\t\t\t" << ");" << "\n" | ||
220 | << "\t\t\t" << "buildSettings = {" << "\n" | ||
221 | << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n"; | ||
222 | if(as_release) | ||
223 | t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n"; | ||
224 | t << "\t\t\t" << "};" << "\n" | ||
225 | << "\t\t\t" << "isa = PBXBuildStyle;" << "\n" | ||
226 | << "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n" | ||
227 | << "\t\t" << "};" << "\n"; | ||
228 | } | ||
229 | |||
230 | //ROOT_GROUP | ||
231 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" | ||
232 | << "\t\t\t" << "children = (" << "\n" | ||
233 | << varGlue("QMAKE_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
234 | << "\t\t\t" << ");" << "\n" | ||
235 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
236 | << "\t\t\t" << "refType = 4;" << "\n" | ||
237 | << "\t\t\t" << "sourceTree = \"<group>\";" << "\n" | ||
238 | << "\t\t" << "};" << "\n"; | ||
239 | |||
240 | //ROOT | ||
241 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" | ||
242 | << "\t\t\t" << "buildSettings = {" << "\n" | ||
243 | << "\t\t\t" << "};" << "\n" | ||
244 | << "\t\t\t" << "buildStyles = (" << "\n" | ||
245 | << varGlue("QMAKE_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
246 | << "\t\t\t" << ");" << "\n" | ||
247 | << "\t\t\t" << "isa = PBXProject;" << "\n" | ||
248 | << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n" | ||
249 | << "\t\t\t" << "projectDirPath = \"\";" << "\n" | ||
250 | << "\t\t\t" << "projectReferences = (" << "\n"; | ||
251 | { | ||
252 | QStringList &libdirs = project->variables()["QMAKE_PBX_SUBDIRS"]; | ||
253 | for(QStringList::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) | ||
254 | t << "\t\t\t\t" << "{" << "\n" | ||
255 | << "\t\t\t\t\t" << "ProductGroup = " << keyFor((*it) + "_PRODUCTGROUP") << ";" << "\n" | ||
256 | << "\t\t\t\t\t" << "ProjectRef = " << keyFor((*it) + "_PROJECTREF") << ";" << "\n" | ||
257 | << "\t\t\t\t" << "}," << "\n"; | ||
258 | } | ||
259 | t << "\t\t\t" << ");" << "\n" | ||
260 | << "\t\t\t" << "targets = (" << "\n" | ||
261 | << "\t\t\t" << ");" << "\n" | ||
262 | << "\t\t" << "};" << "\n"; | ||
263 | |||
264 | //FOOTER | ||
265 | t << "\t" << "};" << "\n" | ||
266 | << "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n" | ||
267 | << "}" << endl; | ||
268 | |||
269 | return TRUE; | ||
270 | } | ||
271 | |||
272 | bool | ||
80 | ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) | 273 | ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) |
81 | { | 274 | { |
82 | int i; | 275 | int i; |
83 | QStringList tmp; | 276 | QStringList tmp; |
84 | bool did_preprocess = FALSE; | 277 | bool did_preprocess = FALSE; |
85 | 278 | ||
86 | //HEADER | 279 | //HEADER |
87 | t << "// !$*UTF8*$!" << "\n" | 280 | t << "// !$*UTF8*$!" << "\n" |
88 | << "{" << "\n" | 281 | << "{" << "\n" |
89 | << "\t" << "archiveVersion = 1;" << "\n" | 282 | << "\t" << "archiveVersion = 1;" << "\n" |
90 | << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n" | 283 | << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n" |
91 | << "\t" << "objectVersion = " << pbuilderVersion() << ";" << "\n" | 284 | << "\t" << "objectVersion = " << pbuilderVersion() << ";" << "\n" |
92 | << "\t" << "objects = {" << endl; | 285 | << "\t" << "objects = {" << endl; |
93 | 286 | ||
94 | //MAKE QMAKE equivlant | 287 | //MAKE QMAKE equivlant |
95 | if(!project->isActiveConfig("no_autoqmake") && project->projectFile() != "(stdin)") { | 288 | if(!project->isActiveConfig("no_autoqmake") && project->projectFile() != "(stdin)") { |
96 | QString mkfile = pbx_dir + Option::dir_sep + "qt_makeqmake.mak"; | 289 | QString mkfile = pbx_dir + Option::dir_sep + "qt_makeqmake.mak"; |
97 | QFile mkf(mkfile); | 290 | QFile mkf(mkfile); |
98 | if(mkf.open(IO_WriteOnly | IO_Translate)) { | 291 | if(mkf.open(IO_WriteOnly | IO_Translate)) { |
99 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); | 292 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); |
100 | QTextStream mkt(&mkf); | 293 | QTextStream mkt(&mkf); |
101 | writeHeader(mkt); | 294 | writeHeader(mkt); |
102 | mkt << "QMAKE = "<< | 295 | mkt << "QMAKE = "<< |
103 | (project->isEmpty("QMAKE_QMAKE") ? QString("$(QTDIR)/bin/qmake") : | 296 | (project->isEmpty("QMAKE_QMAKE") ? QString("$(QTDIR)/bin/qmake") : |
104 | var("QMAKE_QMAKE")) << endl; | 297 | var("QMAKE_QMAKE")) << endl; |
105 | writeMakeQmake(mkt); | 298 | writeMakeQmake(mkt); |
106 | mkf.close(); | 299 | mkf.close(); |
107 | } | 300 | } |
108 | QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE"); | 301 | QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE"); |
109 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); | 302 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); |
110 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); | 303 | project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key); |
111 | t << "\t\t" << phase_key << " = {" << "\n" | 304 | t << "\t\t" << phase_key << " = {" << "\n" |
112 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 305 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
113 | << "\t\t\t" << "files = (" << "\n" | 306 | << "\t\t\t" << "files = (" << "\n" |
114 | << "\t\t\t" << ");" << "\n" | 307 | << "\t\t\t" << ");" << "\n" |
115 | << "\t\t\t" << "generatedFileNames = (" << "\n" | 308 | << "\t\t\t" << "generatedFileNames = (" << "\n" |
116 | << "\t\t\t" << ");" << "\n" | 309 | << "\t\t\t" << ");" << "\n" |
117 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" | 310 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" |
118 | << "\t\t\t" << "name = \"Qt Qmake\";" << "\n" | 311 | << "\t\t\t" << "name = \"Qt Qmake\";" << "\n" |
119 | << "\t\t\t" << "neededFileNames = (" << "\n" | 312 | << "\t\t\t" << "neededFileNames = (" << "\n" |
120 | << "\t\t\t" << ");" << "\n" | 313 | << "\t\t\t" << ");" << "\n" |
121 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" | 314 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" |
122 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << | 315 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << |
123 | " -f " << mkfile << "\";" << "\n" | 316 | " -f " << mkfile << "\";" << "\n" |
124 | << "\t\t" << "};" << "\n"; | 317 | << "\t\t" << "};" << "\n"; |
125 | } | 318 | } |
126 | 319 | ||
127 | //DUMP SOURCES | 320 | //DUMP SOURCES |
128 | QMap<QString, QStringList> groups; | 321 | QMap<QString, QStringList> groups; |
129 | QString srcs[] = { "SOURCES", "SRCMOC", "UICIMPLS", QString::null }; | 322 | QString srcs[] = { "HEADERS", "SOURCES", "SRCMOC", "UICIMPLS", "QMAKE_IMAGE_COLLECTION", |
323 | "FORMS", "QMAKE_INTERNAL_INCLUDED_FILES", QString::null }; | ||
130 | for(i = 0; !srcs[i].isNull(); i++) { | 324 | for(i = 0; !srcs[i].isNull(); i++) { |
131 | tmp = project->variables()[srcs[i]]; | 325 | tmp = project->variables()[srcs[i]]; |
326 | if(srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES") { | ||
327 | QString pfile = project->projectFile(); | ||
328 | if(pfile != "(stdin)") | ||
329 | tmp.prepend(pfile); | ||
330 | } | ||
132 | QStringList &src_list = project->variables()["QMAKE_PBX_" + srcs[i]]; | 331 | QStringList &src_list = project->variables()["QMAKE_PBX_" + srcs[i]]; |
332 | QStringList &root_group_list = project->variables()["QMAKE_PBX_GROUPS"]; | ||
333 | |||
334 | //hard coded groups.. | ||
335 | QString src_group; | ||
336 | if(srcs[i] == "SOURCES") | ||
337 | src_group = "Sources"; | ||
338 | else if(srcs[i] == "HEADERS") | ||
339 | src_group = "Headers"; | ||
340 | else if(srcs[i] == "SRCMOC") | ||
341 | src_group = "Sources [moc]"; | ||
342 | else if(srcs[i] == "UICIMPLS" || srcs[i] == "FORMS") | ||
343 | src_group = "Sources [uic]"; | ||
344 | else if(srcs[i] == "QMAKE_IMAGE_COLLECTION") | ||
345 | src_group = "Sources [images]"; | ||
346 | else if(srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES") | ||
347 | src_group = "Sources [qmake]"; | ||
348 | |||
133 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { | 349 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { |
134 | QString file = fileFixify((*it)); | 350 | QStringList files = (*it); |
135 | if(file.endsWith(Option::moc_ext)) | 351 | bool buildable = TRUE; |
136 | continue; | 352 | if(srcs[i] == "FORMS") { |
137 | bool in_root = TRUE; | 353 | QString form_dot_h = (*it) + Option::h_ext.first(); |
138 | QString src_key = keyFor(file); | 354 | if(QFile::exists(form_dot_h)) |
139 | if(!project->isActiveConfig("flat")) { | 355 | files += form_dot_h; |
140 | QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE); | 356 | buildable = FALSE; |
141 | if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) { | 357 | } else if(srcs[i] == "HEADERS" || srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES") { |
142 | QString last_grp("QMAKE_PBX_" + srcs[i] + "_HEIR_GROUP"); | 358 | buildable = FALSE; |
143 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | 359 | } |
144 | dirs.pop_back(); //remove the file portion as it will be added via src_key | 360 | |
145 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | 361 | files = fileFixify(files); |
146 | QString new_grp(last_grp + Option::dir_sep + (*dir_it)), | 362 | for(QStringList::Iterator file_it = files.begin(); file_it != files.end(); ++file_it) { |
147 | new_grp_key(keyFor(new_grp)), last_grp_key(keyFor(last_grp)); | 363 | QString file = (*file_it); |
148 | if(dir_it == dirs.begin()) { | 364 | if(file.length() >= 2 && (file[0] == '"' || file[0] == '\'') && file[(int) file.length()-1] == file[0]) |
149 | if(!groups.contains(new_grp)) | 365 | file = file.mid(1, file.length()-2); |
150 | project->variables()["QMAKE_PBX_" + srcs[i]].append(new_grp_key); | 366 | if(file.endsWith(Option::cpp_moc_ext) || file.endsWith(Option::prl_ext)) |
151 | } else { | 367 | continue; |
152 | groups[last_grp] += new_grp_key; | 368 | bool in_root = TRUE; |
369 | QString src_key = keyFor(file), name = file; | ||
370 | if(project->isActiveConfig("flat")) { | ||
371 | QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE); | ||
372 | if(flat_file.find(Option::dir_sep) != -1) { | ||
373 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | ||
374 | name = dirs.back(); | ||
375 | } | ||
376 | } else { | ||
377 | QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE); | ||
378 | if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) { | ||
379 | QString last_grp("QMAKE_PBX_" + src_group + "_HEIR_GROUP"); | ||
380 | QStringList dirs = QStringList::split(Option::dir_sep, flat_file); | ||
381 | name = dirs.back(); | ||
382 | dirs.pop_back(); //remove the file portion as it will be added via src_key | ||
383 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | ||
384 | QString new_grp(last_grp + Option::dir_sep + (*dir_it)), new_grp_key(keyFor(new_grp)); | ||
385 | if(dir_it == dirs.begin()) { | ||
386 | if(!src_list.contains(new_grp_key)) | ||
387 | src_list.append(new_grp_key); | ||
388 | } else { | ||
389 | if(!groups[last_grp].contains(new_grp_key)) | ||
390 | groups[last_grp] += new_grp_key; | ||
391 | } | ||
392 | last_grp = new_grp; | ||
393 | } | ||
394 | groups[last_grp] += src_key; | ||
395 | in_root = FALSE; | ||
396 | } | ||
397 | } | ||
398 | if(in_root) | ||
399 | src_list.append(src_key); | ||
400 | //source reference | ||
401 | t << "\t\t" << src_key << " = {" << "\n" | ||
402 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | ||
403 | << "\t\t\t" << "name = \"" << name << "\";" << "\n" | ||
404 | << "\t\t\t" << "path = \"" << file << "\";" << "\n" | ||
405 | << "\t\t\t" << "refType = " << reftypeForFile(file) << ";" << "\n"; | ||
406 | if (ideType() == MAC_XCODE) { | ||
407 | QString filetype; | ||
408 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { | ||
409 | if(file.endsWith((*cppit))) { | ||
410 | filetype = "sourcecode.cpp.cpp"; | ||
411 | break; | ||
153 | } | 412 | } |
154 | last_grp = new_grp; | ||
155 | } | 413 | } |
156 | groups[last_grp] += src_key; | 414 | if(!filetype.isNull()) |
157 | in_root = FALSE; | 415 | t << "\t\t\t" << "lastKnownFileType = " << filetype << ";" << "\n"; |
416 | } | ||
417 | t << "\t\t" << "};" << "\n"; | ||
418 | if(buildable) { //build reference | ||
419 | QString obj_key = file + ".o"; | ||
420 | obj_key = keyFor(obj_key); | ||
421 | t << "\t\t" << obj_key << " = {" << "\n" | ||
422 | << "\t\t\t" << "fileRef = " << src_key << ";" << "\n" | ||
423 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" | ||
424 | << "\t\t\t" << "settings = {" << "\n" | ||
425 | << "\t\t\t\t" << "ATTRIBUTES = (" << "\n" | ||
426 | << "\t\t\t\t" << ");" << "\n" | ||
427 | << "\t\t\t" << "};" << "\n" | ||
428 | << "\t\t" << "};" << "\n"; | ||
429 | project->variables()["QMAKE_PBX_OBJ"].append(obj_key); | ||
158 | } | 430 | } |
159 | } | 431 | } |
160 | if(in_root) | ||
161 | src_list.append(src_key); | ||
162 | //source reference | ||
163 | t << "\t\t" << src_key << " = {" << "\n" | ||
164 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | ||
165 | << "\t\t\t" << "path = \"" << file << "\";" << "\n" | ||
166 | << "\t\t\t" << "refType = " << reftypeForFile(file) << ";" << "\n" | ||
167 | << "\t\t" << "};" << "\n"; | ||
168 | //build reference | ||
169 | QString obj_key = file + ".o"; | ||
170 | obj_key = keyFor(obj_key); | ||
171 | t << "\t\t" << obj_key << " = {" << "\n" | ||
172 | << "\t\t\t" << "fileRef = " << src_key << ";" << "\n" | ||
173 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" | ||
174 | << "\t\t\t" << "settings = {" << "\n" | ||
175 | << "\t\t\t\t" << "ATTRIBUTES = (" << "\n" | ||
176 | << "\t\t\t\t" << ");" << "\n" | ||
177 | << "\t\t\t" << "};" << "\n" | ||
178 | << "\t\t" << "};" << "\n"; | ||
179 | project->variables()["QMAKE_PBX_OBJ"].append(obj_key); | ||
180 | } | 432 | } |
181 | if(!src_list.isEmpty()) { | 433 | if(!src_list.isEmpty()) { |
182 | QString grp; | ||
183 | if(srcs[i] == "SOURCES") { | 434 | if(srcs[i] == "SOURCES") { |
184 | if(project->first("TEMPLATE") == "app" && !project->isEmpty("RC_FILE")) { //Icon | 435 | if(project->first("TEMPLATE") == "app" && !project->isEmpty("RC_FILE")) { //Icon |
185 | QString icns_file = keyFor("ICNS_FILE"); | 436 | QString icns_file = keyFor("ICNS_FILE"); |
186 | src_list.append(icns_file); | 437 | src_list.append(icns_file); |
187 | t << "\t\t" << icns_file << " = {" << "\n" | 438 | t << "\t\t" << icns_file << " = {" << "\n" |
188 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | 439 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" |
189 | << "\t\t\t" << "path = \"" << project->first("RC_FILE") << "\";" << "\n" | 440 | << "\t\t\t" << "path = \"" << project->first("RC_FILE") << "\";" << "\n" |
190 | << "\t\t\t" << "refType = " << reftypeForFile(project->first("RC_FILE")) << ";" << "\n" | 441 | << "\t\t\t" << "refType = " << reftypeForFile(project->first("RC_FILE")) << ";" << "\n" |
191 | << "\t\t" << "};" << "\n"; | 442 | << "\t\t" << "};" << "\n"; |
192 | t << "\t\t" << keyFor("ICNS_FILE_REFERENCE") << " = {" << "\n" | 443 | t << "\t\t" << keyFor("ICNS_FILE_REFERENCE") << " = {" << "\n" |
193 | << "\t\t\t" << "fileRef = " << icns_file << ";" << "\n" | 444 | << "\t\t\t" << "fileRef = " << icns_file << ";" << "\n" |
194 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" | 445 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" |
195 | << "\t\t\t" << "settings = {" << "\n" | 446 | << "\t\t\t" << "settings = {" << "\n" |
196 | << "\t\t\t" << "};" << "\n" | 447 | << "\t\t\t" << "};" << "\n" |
197 | << "\t\t" << "};" << "\n"; | 448 | << "\t\t" << "};" << "\n"; |
198 | } | 449 | } |
199 | grp = "Sources"; | ||
200 | } else if(srcs[i] == "SRCMOC") { | ||
201 | grp = "Mocables"; | ||
202 | } else if(srcs[i] == "UICIMPLS") { | ||
203 | grp = "UICables"; | ||
204 | } | 450 | } |
205 | QString grp_key = keyFor(grp); | 451 | |
206 | project->variables()["QMAKE_PBX_GROUPS"].append(grp_key); | 452 | QString src_group_key = keyFor(src_group); |
207 | t << "\t\t" << grp_key << " = {" << "\n" | 453 | if(root_group_list.findIndex(src_group_key) == -1) |
208 | << "\t\t\t" << "children = (" << "\n" | 454 | root_group_list += src_group_key; |
209 | << varGlue("QMAKE_PBX_" + srcs[i], "\t\t\t\t", ",\n\t\t\t\t", "\n") | 455 | groups[src_group] += src_list; |
210 | << "\t\t\t" << ");" << "\n" | ||
211 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
212 | << "\t\t\t" << "name = " << grp << ";" << "\n" | ||
213 | << "\t\t\t" << "refType = 4;" << "\n" | ||
214 | << "\t\t" << "};" << "\n"; | ||
215 | } | 456 | } |
216 | } | 457 | } |
217 | for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); | 458 | for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) { |
218 | grp_it != groups.end(); ++grp_it) { | ||
219 | t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n" | 459 | t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n" |
220 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | 460 | << "\t\t\t" << "isa = PBXGroup;" << "\n" |
221 | << "\t\t\t" << "children = (" << "\n" | 461 | << "\t\t\t" << "children = (" << "\n" |
222 | << valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n") | 462 | << valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n") |
223 | << "\t\t\t" << ");" << "\n" | 463 | << "\t\t\t" << ");" << "\n" |
224 | << "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n" | 464 | << "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n" |
225 | << "\t\t\t" << "refType = 4;" << "\n" | 465 | << "\t\t\t" << "refType = 4;" << "\n" |
226 | << "\t\t" << "};" << "\n"; | 466 | << "\t\t" << "};" << "\n"; |
227 | } | 467 | } |
228 | 468 | ||
229 | //PREPROCESS BUILDPHASE (just a makefile) | 469 | //PREPROCESS BUILDPHASE (just a makefile) |
230 | if(!project->isEmpty("UICIMPLS") || !project->isEmpty("SRCMOC") || | 470 | if(!project->isEmpty("UICIMPLS") || !project->isEmpty("SRCMOC") || |
231 | !project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) { | 471 | !project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) { |
232 | QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak"; | 472 | QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak"; |
233 | QFile mkf(mkfile); | 473 | QFile mkf(mkfile); |
234 | if(mkf.open(IO_WriteOnly | IO_Translate)) { | 474 | if(mkf.open(IO_WriteOnly | IO_Translate)) { |
235 | did_preprocess = TRUE; | 475 | did_preprocess = TRUE; |
236 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); | 476 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); |
237 | QTextStream mkt(&mkf); | 477 | QTextStream mkt(&mkf); |
238 | writeHeader(mkt); | 478 | writeHeader(mkt); |
239 | mkt << "MOC = " << var("QMAKE_MOC") << endl; | 479 | mkt << "MOC = " << Option::fixPathToTargetOS(var("QMAKE_MOC")) << endl; |
240 | mkt << "UIC = " << var("QMAKE_UIC") << endl; | 480 | mkt << "UIC = " << Option::fixPathToTargetOS(var("QMAKE_UIC")) << endl; |
241 | mkt << "LEX = " << var("QMAKE_LEX") << endl; | 481 | mkt << "LEX = " << var("QMAKE_LEX") << endl; |
242 | mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; | 482 | mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; |
243 | mkt << "YACC = " << var("QMAKE_YACC") << endl; | 483 | mkt << "YACC = " << var("QMAKE_YACC") << endl; |
244 | mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl; | 484 | mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl; |
245 | mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 485 | mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
246 | mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl; | 486 | mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl; |
247 | mkt << "FORMS = " << varList("UICIMPLS") << endl; | 487 | mkt << "FORMS = " << varList("UICIMPLS") << endl; |
488 | mkt << "IMAGES = " << varList("QMAKE_IMAGE_COLLECTION") << endl; | ||
248 | mkt << "MOCS = " << varList("SRCMOC") << endl; | 489 | mkt << "MOCS = " << varList("SRCMOC") << endl; |
249 | mkt << "PARSERS ="; | 490 | mkt << "PARSERS ="; |
250 | if(!project->isEmpty("YACCSOURCES")) { | 491 | if(!project->isEmpty("YACCSOURCES")) { |
251 | QStringList &yaccs = project->variables()["YACCSOURCES"]; | 492 | QStringList &yaccs = project->variables()["YACCSOURCES"]; |
252 | for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) { | 493 | for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) { |
253 | QFileInfo fi((*yit)); | 494 | QFileInfo fi((*yit)); |
254 | mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) | 495 | mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) |
255 | << Option::yacc_mod << Option::cpp_ext.first(); | 496 | << Option::yacc_mod << Option::cpp_ext.first(); |
256 | } | 497 | } |
257 | } | 498 | } |
258 | if(!project->isEmpty("LEXSOURCES")) { | 499 | if(!project->isEmpty("LEXSOURCES")) { |
259 | QStringList &lexs = project->variables()["LEXSOURCES"]; | 500 | QStringList &lexs = project->variables()["LEXSOURCES"]; |
260 | for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) { | 501 | for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) { |
261 | QFileInfo fi((*lit)); | 502 | QFileInfo fi((*lit)); |
262 | mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) | 503 | mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE) |
263 | << Option::lex_mod << Option::cpp_ext.first(); | 504 | << Option::lex_mod << Option::cpp_ext.first(); |
264 | } | 505 | } |
265 | } | 506 | } |
266 | mkt << "\n"; | 507 | mkt << "\n"; |
267 | mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS)" << endl; | 508 | mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS) $(IMAGES)" << endl; |
268 | mkt << "preprocess_clean: mocclean uiclean parser_clean" << endl << endl; | 509 | mkt << "clean preprocess_clean: mocclean uiclean parser_clean" << endl << endl; |
269 | mkt << "mocclean:" << "\n"; | 510 | mkt << "mocclean:" << "\n"; |
270 | if(!project->isEmpty("SRCMOC")) | 511 | if(!project->isEmpty("SRCMOC")) |
271 | mkt << "\t-rm -f $(MOCS)" << "\n"; | 512 | mkt << "\t-rm -f $(MOCS)" << "\n"; |
272 | mkt << "uiclean:" << "\n"; | 513 | mkt << "uiclean:" << "\n"; |
273 | if(!project->isEmpty("UICIMPLS")) | 514 | if(!project->isEmpty("UICIMPLS")) |
274 | mkt << "\t-rm -f $(FORMS)" << "\n"; | 515 | mkt << "\t-rm -f $(FORMS)" << "\n"; |
516 | if(!project->isEmpty("QMAKE_IMAGE_COLLECTION")) | ||
517 | mkt << "\t-rm -f $(IMAGES)" << "\n"; | ||
275 | mkt << "parser_clean:" << "\n"; | 518 | mkt << "parser_clean:" << "\n"; |
276 | if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) | 519 | if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) |
277 | mkt << "\t-rm -f $(PARSERS)" << "\n"; | 520 | mkt << "\t-rm -f $(PARSERS)" << "\n"; |
278 | writeUicSrc(mkt, "FORMS"); | 521 | writeUicSrc(mkt, "FORMS"); |
279 | writeMocSrc(mkt, "HEADERS"); | 522 | writeMocSrc(mkt, "HEADERS"); |
280 | writeMocSrc(mkt, "SOURCES"); | 523 | writeMocSrc(mkt, "SOURCES"); |
281 | writeMocSrc(mkt, "UICDECLS"); | 524 | writeMocSrc(mkt, "UICDECLS"); |
282 | writeYaccSrc(mkt, "YACCSOURCES"); | 525 | writeYaccSrc(mkt, "YACCSOURCES"); |
283 | writeLexSrc(mkt, "LEXSOURCES"); | 526 | writeLexSrc(mkt, "LEXSOURCES"); |
527 | writeImageSrc(mkt, "QMAKE_IMAGE_COLLECTION"); | ||
284 | mkf.close(); | 528 | mkf.close(); |
285 | } | 529 | } |
286 | QString target_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET"); | ||
287 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); | 530 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); |
288 | t << "\t\t" << target_key << " = {" << "\n" | 531 | QString phase_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET"); |
289 | << "\t\t\t" << "buildArgumentsString = \"-f " << mkfile << "\";" << "\n" | 532 | //project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); |
290 | << "\t\t\t" << "buildPhases = (" << "\n" | 533 | project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key); |
534 | t << "\t\t" << phase_key << " = {" << "\n" | ||
535 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | ||
536 | << "\t\t\t" << "files = (" << "\n" | ||
291 | << "\t\t\t" << ");" << "\n" | 537 | << "\t\t\t" << ");" << "\n" |
292 | << "\t\t\t" << "buildSettings = {" << "\n" | 538 | << "\t\t\t" << "generatedFileNames = (" << "\n" |
293 | << "\t\t\t" << "};" << "\n" | 539 | << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
294 | << "\t\t\t" << "buildToolPath = \"/usr/bin/gnumake\";"<< "\n" | ||
295 | << "\t\t\t" << "buildWorkingDirectory = \"" << QDir::currentDirPath() << "\";" << "\n" | ||
296 | << "\t\t\t" << "dependencies = (" << "\n" | ||
297 | << "\t\t\t" << ");" << "\n" | 540 | << "\t\t\t" << ");" << "\n" |
298 | << "\t\t\t" << "isa = PBXLegacyTarget;" << "\n" | 541 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" |
299 | << "\t\t\t" << "name = QtPreprocessors;" << "\n" | 542 | << "\t\t\t" << "name = \"Qt Preprocessors\";" << "\n" |
300 | << "\t\t\t" << "productName = QtPreprocessors;" << "\n" | 543 | << "\t\t\t" << "neededFileNames = (" << "\n" |
301 | << "\t\t\t" << "settingsToExpand = 6;" << "\n" | 544 | << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
302 | << "\t\t\t" << "settingsToPassInEnvironment = 287;" << "\n" | 545 | << "\t\t\t" << ");" << "\n" |
303 | << "\t\t\t" << "settingsToPassOnCommandLine = 280;" << "\n" | 546 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" |
304 | << "\t\t\t" << "shouldsUseHeadermap = 0;" << "\n" | 547 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << |
548 | " -f " << mkfile << "\";" << "\n" | ||
305 | << "\t\t" << "};" << "\n"; | 549 | << "\t\t" << "};" << "\n"; |
550 | } | ||
306 | 551 | ||
307 | QString target_depend_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET_DEPEND"); | ||
308 | project->variables()["QMAKE_PBX_TARGETDEPENDS"].append(target_depend_key); | ||
309 | t << "\t\t" << target_depend_key << " = {" << "\n" | ||
310 | << "\t\t\t" << "isa = PBXTargetDependency;" << "\n" | ||
311 | << "\t\t\t" << "target = " << target_key << ";" << "\n" | ||
312 | << "\t\t" << "};" << "\n"; | ||
313 | } | ||
314 | //SOURCE BUILDPHASE | 552 | //SOURCE BUILDPHASE |
315 | if(!project->isEmpty("QMAKE_PBX_OBJ")) { | 553 | if(!project->isEmpty("QMAKE_PBX_OBJ")) { |
316 | QString grp = "Build Sources", key = keyFor(grp); | 554 | QString grp = "Build Sources", key = keyFor(grp); |
317 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); | 555 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); |
318 | t << "\t\t" << key << " = {" << "\n" | 556 | t << "\t\t" << key << " = {" << "\n" |
319 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 557 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
320 | << "\t\t\t" << "files = (" << "\n" | 558 | << "\t\t\t" << "files = (" << "\n" |
321 | << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 559 | << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
322 | << "\t\t\t" << ");" << "\n" | 560 | << "\t\t\t" << ");" << "\n" |
323 | << "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n" | 561 | << "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n" |
324 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" | 562 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" |
325 | << "\t\t" << "};" << "\n"; | 563 | << "\t\t" << "};" << "\n"; |
326 | } | 564 | } |
327 | 565 | ||
328 | if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES | 566 | if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES |
329 | QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"]; | 567 | QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"]; |
330 | QString libs[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | 568 | QString libs[] = { "QMAKE_LFLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; |
331 | for(i = 0; !libs[i].isNull(); i++) { | 569 | for(i = 0; !libs[i].isNull(); i++) { |
332 | tmp = project->variables()[libs[i]]; | 570 | tmp = project->variables()[libs[i]]; |
333 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) { | 571 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) { |
334 | bool remove = FALSE; | 572 | bool remove = FALSE; |
335 | QString library, name, opt = (*it).stripWhiteSpace(); | 573 | QString library, name, opt = (*it).stripWhiteSpace(); |
574 | if(opt.length() >= 2 && (opt[0] == '"' || opt[0] == '\'') && opt[(int) opt.length()-1] == opt[0]) | ||
575 | opt = opt.mid(1, opt.length()-2); | ||
336 | if(opt.startsWith("-L")) { | 576 | if(opt.startsWith("-L")) { |
337 | QString r = opt.right(opt.length() - 2); | 577 | QString r = opt.right(opt.length() - 2); |
338 | fixEnvVariables(r); | 578 | fixEnvVariables(r); |
339 | libdirs.append(r); | 579 | libdirs.append(r); |
580 | } else if(opt == "-prebind") { | ||
581 | project->variables()["QMAKE_DO_PREBINDING"].append("TRUE"); | ||
582 | remove = TRUE; | ||
340 | } else if(opt.startsWith("-l")) { | 583 | } else if(opt.startsWith("-l")) { |
341 | name = opt.right(opt.length() - 2); | 584 | name = opt.right(opt.length() - 2); |
342 | QString lib("lib" + name); | 585 | QString lib("lib" + name); |
343 | for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) { | 586 | for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) { |
344 | if(project->isActiveConfig("link_prl")) { | 587 | if(project->isActiveConfig("link_prl")) { |
345 | /* This isn't real nice, but it is real useful. This looks in a prl | 588 | /* This isn't real nice, but it is real usefull. This looks in a prl |
346 | for what the library will ultimately be called so we can stick it | 589 | for what the library will ultimately be called so we can stick it |
347 | in the ProjectFile. If the prl format ever changes (not likely) then | 590 | in the ProjectFile. If the prl format ever changes (not likely) then |
348 | this will not really work. However, more concerning is that it will | 591 | this will not really work. However, more concerning is that it will |
349 | encode the version number in the Project file which might be a bad | 592 | encode the version number in the Project file which might be a bad |
350 | things in days to come? --Sam | 593 | things in days to come? --Sam |
351 | */ | 594 | */ |
352 | QString prl_file = (*lit) + Option::dir_sep + lib + Option::prl_ext; | 595 | QString lib_file = (*lit) + Option::dir_sep + lib; |
353 | if(QFile::exists(prl_file)) { | 596 | if(QMakeMetaInfo::libExists(lib_file)) { |
354 | QMakeProject proj; | 597 | QMakeMetaInfo libinfo; |
355 | if(proj.read(prl_file, QDir::currentDirPath())) { | 598 | if(libinfo.readLib(lib_file)) { |
356 | if(!proj.isEmpty("QMAKE_PRL_TARGET")) { | 599 | if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) { |
357 | library = (*lit) + Option::dir_sep + proj.first("QMAKE_PRL_TARGET"); | 600 | library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET"); |
358 | debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", | 601 | debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", |
359 | opt.latin1(), prl_file.latin1(), library.latin1()); | 602 | opt.latin1(), lib_file.latin1(), library.latin1()); |
360 | remove = TRUE; | 603 | remove = TRUE; |
361 | } | 604 | } |
362 | } | 605 | } |
363 | |||
364 | } | 606 | } |
365 | } | 607 | } |
366 | if(!remove) { | 608 | if(!remove) { |
367 | QString extns[] = { ".dylib", ".so", ".a", QString::null }; | 609 | QString extns[] = { ".dylib", ".so", ".a", QString::null }; |
368 | for(int n = 0; !remove && !extns[n].isNull(); n++) { | 610 | for(int n = 0; !remove && !extns[n].isNull(); n++) { |
369 | QString tmp = (*lit) + Option::dir_sep + lib + extns[n]; | 611 | QString tmp = (*lit) + Option::dir_sep + lib + extns[n]; |
370 | if(QFile::exists(tmp)) { | 612 | if(QFile::exists(tmp)) { |
371 | library = tmp; | 613 | library = tmp; |
372 | debug_msg(1, "pbuilder: Found library (%s) via %s", | 614 | debug_msg(1, "pbuilder: Found library (%s) via %s", |
373 | opt.latin1(), library.latin1()); | 615 | opt.latin1(), library.latin1()); |
374 | remove = TRUE; | 616 | remove = TRUE; |
375 | } | 617 | } |
376 | } | 618 | } |
377 | } | 619 | } |
378 | } | 620 | } |
379 | } else if(opt == "-framework") { | 621 | } else if(opt == "-framework") { |
380 | ++it; | 622 | ++it; |
381 | if(it == tmp.end()) | 623 | if(it == tmp.end()) |
382 | break; | 624 | break; |
383 | QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"]; | 625 | QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"]; |
384 | if(fdirs.isEmpty()) | 626 | if(fdirs.isEmpty()) |
385 | fdirs.append("/System/Library/Frameworks/"); | 627 | fdirs.append("/System/Library/Frameworks/"); |
386 | for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) { | 628 | for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) { |
387 | if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) { | 629 | if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) { |
388 | --it; | 630 | --it; |
389 | it = tmp.remove(it); | 631 | it = tmp.remove(it); |
390 | remove = TRUE; | 632 | remove = TRUE; |
391 | library = (*fit) + Option::dir_sep + (*it) + ".framework"; | 633 | library = (*fit) + Option::dir_sep + (*it) + ".framework"; |
392 | break; | 634 | break; |
393 | } | 635 | } |
394 | } | 636 | } |
637 | } else if(opt == "-undefined") { | ||
638 | ++it; //the next option is not a library.. | ||
395 | } else if(opt.left(1) != "-") { | 639 | } else if(opt.left(1) != "-") { |
396 | remove = TRUE; | 640 | remove = TRUE; |
397 | library = opt; | 641 | library = opt; |
398 | } | 642 | } |
399 | if(!library.isEmpty()) { | 643 | if(!library.isEmpty()) { |
400 | if(name.isEmpty()) { | 644 | if(name.isEmpty()) { |
401 | int slsh = library.findRev(Option::dir_sep); | 645 | int slsh = library.findRev(Option::dir_sep); |
402 | if(slsh != -1) | 646 | if(slsh != -1) |
403 | name = library.right(library.length() - slsh - 1); | 647 | name = library.right(library.length() - slsh - 1); |
404 | } | 648 | } |
405 | library = fileFixify(library); | 649 | library = fileFixify(library); |
406 | QString key = keyFor(library); | 650 | QString key = keyFor(library); |
407 | bool is_frmwrk = (library.endsWith(".framework")); | 651 | bool is_frmwrk = (library.endsWith(".framework")); |
408 | t << "\t\t" << key << " = {" << "\n" | 652 | t << "\t\t" << key << " = {" << "\n" |
409 | << "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n" | 653 | << "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n" |
410 | << "\t\t\t" << "name = \"" << name << "\";" << "\n" | 654 | << "\t\t\t" << "name = \"" << name << "\";" << "\n" |
411 | << "\t\t\t" << "path = \"" << library << "\";" << "\n" | 655 | << "\t\t\t" << "path = \"" << library << "\";" << "\n" |
412 | << "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n" | 656 | << "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n" |
413 | << "\t\t" << "};" << "\n"; | 657 | << "\t\t" << "};" << "\n"; |
414 | project->variables()["QMAKE_PBX_LIBRARIES"].append(key); | 658 | project->variables()["QMAKE_PBX_LIBRARIES"].append(key); |
415 | QString obj_key = library + ".o"; | 659 | QString obj_key = library + ".o"; |
416 | obj_key = keyFor(obj_key); | 660 | obj_key = keyFor(obj_key); |
417 | t << "\t\t" << obj_key << " = {" << "\n" | 661 | t << "\t\t" << obj_key << " = {" << "\n" |
418 | << "\t\t\t" << "fileRef = " << key << ";" << "\n" | 662 | << "\t\t\t" << "fileRef = " << key << ";" << "\n" |
419 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" | 663 | << "\t\t\t" << "isa = PBXBuildFile;" << "\n" |
420 | << "\t\t\t" << "settings = {" << "\n" | 664 | << "\t\t\t" << "settings = {" << "\n" |
421 | << "\t\t\t" << "};" << "\n" | 665 | << "\t\t\t" << "};" << "\n" |
422 | << "\t\t" << "};" << "\n"; | 666 | << "\t\t" << "};" << "\n"; |
423 | project->variables()["QMAKE_PBX_BUILD_LIBRARIES"].append(obj_key); | 667 | project->variables()["QMAKE_PBX_BUILD_LIBRARIES"].append(obj_key); |
424 | } | 668 | } |
425 | if(remove) | 669 | if(remove) |
426 | it = tmp.remove(it); | 670 | it = tmp.remove(it); |
427 | else | 671 | else |
428 | ++it; | 672 | ++it; |
429 | } | 673 | } |
430 | project->variables()[libs[i]] = tmp; | 674 | project->variables()[libs[i]] = tmp; |
431 | } | 675 | } |
432 | } | 676 | } |
433 | //SUBLIBS BUILDPHASE (just another makefile) | 677 | //SUBLIBS BUILDPHASE (just another makefile) |
434 | if(!project->isEmpty("SUBLIBS")) { | 678 | if(!project->isEmpty("SUBLIBS")) { |
435 | QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak"; | 679 | QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak"; |
436 | QFile mkf(mkfile); | 680 | QFile mkf(mkfile); |
437 | if(mkf.open(IO_WriteOnly | IO_Translate)) { | 681 | if(mkf.open(IO_WriteOnly | IO_Translate)) { |
438 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); | 682 | debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1()); |
439 | QTextStream mkt(&mkf); | 683 | QTextStream mkt(&mkf); |
440 | writeHeader(mkt); | 684 | writeHeader(mkt); |
441 | mkt << "SUBLIBS= "; | 685 | mkt << "SUBLIBS= "; |
442 | tmp = project->variables()["SUBLIBS"]; | 686 | tmp = project->variables()["SUBLIBS"]; |
443 | QStringList::Iterator it; | 687 | QStringList::Iterator it; |
444 | for(it = tmp.begin(); it != tmp.end(); ++it) | 688 | for(it = tmp.begin(); it != tmp.end(); ++it) |
445 | t << "tmp/lib" << (*it) << ".a "; | 689 | t << "tmp/lib" << (*it) << ".a "; |
446 | t << endl << endl; | 690 | t << endl << endl; |
447 | mkt << "sublibs: $(SUBLIBS)" << endl << endl; | 691 | mkt << "sublibs: $(SUBLIBS)" << endl << endl; |
448 | tmp = project->variables()["SUBLIBS"]; | 692 | tmp = project->variables()["SUBLIBS"]; |
449 | for(it = tmp.begin(); it != tmp.end(); ++it) | 693 | for(it = tmp.begin(); it != tmp.end(); ++it) |
450 | t << "tmp/lib" << (*it) << ".a" << ":\n\t" | 694 | t << "tmp/lib" << (*it) << ".a" << ":\n\t" |
451 | << var(QString("MAKELIB") + (*it)) << endl << endl; | 695 | << var(QString("MAKELIB") + (*it)) << endl << endl; |
452 | mkf.close(); | 696 | mkf.close(); |
453 | } | 697 | } |
454 | QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE"); | 698 | QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE"); |
455 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); | 699 | mkfile = fileFixify(mkfile, QDir::currentDirPath()); |
456 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); | 700 | project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key); |
457 | t << "\t\t" << phase_key << " = {" << "\n" | 701 | t << "\t\t" << phase_key << " = {" << "\n" |
458 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 702 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
459 | << "\t\t\t" << "files = (" << "\n" | 703 | << "\t\t\t" << "files = (" << "\n" |
460 | << "\t\t\t" << ");" << "\n" | 704 | << "\t\t\t" << ");" << "\n" |
461 | << "\t\t\t" << "generatedFileNames = (" << "\n" | 705 | << "\t\t\t" << "generatedFileNames = (" << "\n" |
462 | << "\t\t\t" << ");" << "\n" | 706 | << "\t\t\t" << ");" << "\n" |
463 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" | 707 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" |
464 | << "\t\t\t" << "name = \"Qt Sublibs\";" << "\n" | 708 | << "\t\t\t" << "name = \"Qt Sublibs\";" << "\n" |
465 | << "\t\t\t" << "neededFileNames = (" << "\n" | 709 | << "\t\t\t" << "neededFileNames = (" << "\n" |
466 | << "\t\t\t" << ");" << "\n" | 710 | << "\t\t\t" << ");" << "\n" |
467 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" | 711 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" |
468 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << | 712 | << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() << |
469 | " -f " << mkfile << "\";" << "\n" | 713 | " -f " << mkfile << "\";" << "\n" |
470 | << "\t\t" << "};" << "\n"; | 714 | << "\t\t" << "};" << "\n"; |
471 | } | 715 | } |
472 | //LIBRARY BUILDPHASE | 716 | //LIBRARY BUILDPHASE |
473 | if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) { | 717 | if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) { |
474 | tmp = project->variables()["QMAKE_PBX_LIBRARIES"]; | 718 | tmp = project->variables()["QMAKE_PBX_LIBRARIES"]; |
475 | if(!tmp.isEmpty()) { | 719 | if(!tmp.isEmpty()) { |
476 | QString grp("External Frameworks and Libraries"), key = keyFor(grp); | 720 | QString grp("External Frameworks and Libraries"), key = keyFor(grp); |
477 | project->variables()["QMAKE_PBX_GROUPS"].append(key); | 721 | project->variables()["QMAKE_PBX_GROUPS"].append(key); |
478 | t << "\t\t" << key << " = {" << "\n" | 722 | t << "\t\t" << key << " = {" << "\n" |
479 | << "\t\t\t" << "children = (" << "\n" | 723 | << "\t\t\t" << "children = (" << "\n" |
480 | << varGlue("QMAKE_PBX_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 724 | << varGlue("QMAKE_PBX_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
481 | << "\t\t\t" << ");" << "\n" | 725 | << "\t\t\t" << ");" << "\n" |
482 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | 726 | << "\t\t\t" << "isa = PBXGroup;" << "\n" |
483 | << "\t\t\t" << "name = \"" << grp << "\"" << ";" << "\n" | 727 | << "\t\t\t" << "name = \"" << grp << "\"" << ";" << "\n" |
484 | << "\t\t\t" << "path = \"\";" << "\n" | 728 | << "\t\t\t" << "path = \"\";" << "\n" |
485 | << "\t\t\t" << "refType = 4;" << "\n" | 729 | << "\t\t\t" << "refType = 4;" << "\n" |
486 | << "\t\t" << "};" << "\n"; | 730 | << "\t\t" << "};" << "\n"; |
487 | } | 731 | } |
488 | } | 732 | } |
489 | { | 733 | { |
490 | QString grp("Frameworks & Libraries"), key = keyFor(grp); | 734 | QString grp("Frameworks & Libraries"), key = keyFor(grp); |
491 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); | 735 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); |
492 | t << "\t\t" << key << " = {" << "\n" | 736 | t << "\t\t" << key << " = {" << "\n" |
493 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 737 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
494 | << "\t\t\t" << "files = (" << "\n" | 738 | << "\t\t\t" << "files = (" << "\n" |
495 | << varGlue("QMAKE_PBX_BUILD_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 739 | << varGlue("QMAKE_PBX_BUILD_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
496 | << "\t\t\t" << ");" << "\n" | 740 | << "\t\t\t" << ");" << "\n" |
497 | << "\t\t\t" << "isa = PBXFrameworksBuildPhase;" << "\n" | 741 | << "\t\t\t" << "isa = PBXFrameworksBuildPhase;" << "\n" |
498 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" | 742 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" |
499 | << "\t\t" << "};" << "\n"; | 743 | << "\t\t" << "};" << "\n"; |
500 | } | 744 | } |
501 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console") && | 745 | if(!project->isActiveConfig("console") && project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES |
502 | project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES | ||
503 | QString grp("Bundle Resources"), key = keyFor(grp); | 746 | QString grp("Bundle Resources"), key = keyFor(grp); |
504 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); | 747 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(key); |
505 | t << "\t\t" << key << " = {" << "\n" | 748 | t << "\t\t" << key << " = {" << "\n" |
506 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" | 749 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
507 | << "\t\t\t" << "files = (" << "\n" | 750 | << "\t\t\t" << "files = (" << "\n" |
508 | << (!project->isEmpty("RC_FILE") ? keyFor("ICNS_FILE_REFERENCE") : QString("")) | 751 | << (!project->isEmpty("RC_FILE") ? keyFor("ICNS_FILE_REFERENCE") : QString("")) |
509 | << "\t\t\t" << ");" << "\n" | 752 | << "\t\t\t" << ");" << "\n" |
510 | << "\t\t\t" << "isa = PBXResourcesBuildPhase;" << "\n" | 753 | << "\t\t\t" << "isa = PBXResourcesBuildPhase;" << "\n" |
511 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" | 754 | << "\t\t\t" << "name = \"" << grp << "\";" << "\n" |
512 | << "\t\t" << "};" << "\n"; | 755 | << "\t\t" << "};" << "\n"; |
513 | } | 756 | } |
514 | |||
515 | //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER | ||
516 | //PRODUCTS | ||
517 | { | ||
518 | QString grp("Products"), key = keyFor(grp); | ||
519 | project->variables()["QMAKE_PBX_GROUPS"].append(key); | ||
520 | t << "\t\t" << key << " = {" << "\n" | ||
521 | << "\t\t\t" << "children = (" << "\n" | ||
522 | << "\t\t\t\t" << keyFor("QMAKE_PBX_REFERENCE") << "\n" | ||
523 | << "\t\t\t" << ");" << "\n" | ||
524 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
525 | << "\t\t\t" << "name = Products;" << "\n" | ||
526 | << "\t\t\t" << "refType = 4;" << "\n" | ||
527 | << "\t\t" << "};" << "\n"; | ||
528 | } | ||
529 | { //INSTALL BUILDPHASE (sh script) | 757 | { //INSTALL BUILDPHASE (sh script) |
530 | QString targ = project->first("TARGET"); | 758 | QString targ = project->first("TARGET"); |
531 | if(project->first("TEMPLATE") == "app" || | 759 | if(project->first("TEMPLATE") == "app" || |
532 | (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && | 760 | (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && |
533 | project->isActiveConfig("frameworklib"))) | 761 | project->isActiveConfig("frameworklib"))) |
534 | targ = project->first("QMAKE_ORIG_TARGET"); | 762 | targ = project->first("QMAKE_ORIG_TARGET"); |
535 | int slsh = targ.findRev(Option::dir_sep); | 763 | int slsh = targ.findRev(Option::dir_sep); |
536 | if(slsh != -1) | 764 | if(slsh != -1) |
537 | targ = targ.right(targ.length() - slsh - 1); | 765 | targ = targ.right(targ.length() - slsh - 1); |
538 | fixEnvVariables(targ); | 766 | fixEnvVariables(targ); |
539 | QStringList links; | 767 | QStringList links; |
540 | if(project->first("TEMPLATE") == "app") { | 768 | if(project->first("TEMPLATE") == "app") { |
541 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | 769 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) |
542 | targ += ".app"; | 770 | targ += ".app"; |
543 | } else if(!project->isActiveConfig("staticlib") && | 771 | } else if(!project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") && |
544 | !project->isActiveConfig("frameworklib")) { | 772 | !project->isActiveConfig("frameworklib")) { |
545 | QString li[] = { "TARGET_", "TARGET_x", "TARGET_x.y", QString::null }; | 773 | QString li[] = { "TARGET_", "TARGET_x", "TARGET_x.y", QString::null }; |
546 | for(int n = 0; !li[n].isNull(); n++) { | 774 | for(int n = 0; !li[n].isNull(); n++) { |
547 | QString t = project->first(li[n]); | 775 | QString t = project->first(li[n]); |
548 | slsh = t.findRev(Option::dir_sep); | 776 | slsh = t.findRev(Option::dir_sep); |
549 | if(slsh != -1) | 777 | if(slsh != -1) |
550 | t = t.right(t.length() - slsh); | 778 | t = t.right(t.length() - slsh); |
551 | fixEnvVariables(t); | 779 | fixEnvVariables(t); |
552 | links << t; | 780 | links << t; |
553 | } | 781 | } |
554 | } | 782 | } |
555 | QString script = pbx_dir + Option::dir_sep + "qt_install.sh"; | 783 | QString script = pbx_dir + Option::dir_sep + "qt_install.sh"; |
556 | QFile shf(script); | 784 | QFile shf(script); |
557 | if(shf.open(IO_WriteOnly | IO_Translate)) { | 785 | if(shf.open(IO_WriteOnly | IO_Translate)) { |
558 | debug_msg(1, "pbuilder: Creating file: %s", script.latin1()); | 786 | debug_msg(1, "pbuilder: Creating file: %s", script.latin1()); |
559 | QString targ = project->first("QMAKE_ORIG_TARGET"), cpflags; | 787 | QString targ = project->first("QMAKE_ORIG_TARGET"), cpflags; |
560 | if(project->first("TEMPLATE") == "app") { | 788 | if(project->first("TEMPLATE") == "app") { |
561 | targ = project->first("TARGET"); | 789 | targ = project->first("TARGET"); |
562 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 790 | if(!project->isActiveConfig("console")) { |
563 | targ += ".app"; | 791 | targ += ".app"; |
564 | cpflags += "-r "; | 792 | cpflags += "-r "; |
565 | } | 793 | } |
566 | } else if(!project->isActiveConfig("frameworklib")) { | 794 | } else if(!project->isActiveConfig("frameworklib")) { |
567 | if(project->isActiveConfig("staticlib")) | 795 | if(project->isActiveConfig("staticlib")) |
568 | targ = project->first("TARGET"); | 796 | targ = project->first("TARGET"); |
569 | else | 797 | else |
570 | targ = project->first("TARGET_"); | 798 | targ = project->first("TARGET_"); |
571 | int slsh = targ.findRev(Option::dir_sep); | ||
572 | if(slsh != -1) | ||
573 | targ = targ.right(targ.length() - slsh - 1); | ||
574 | } | 799 | } |
575 | QTextStream sht(&shf); | 800 | int slsh = targ.findRev(Option::dir_sep); |
801 | if(slsh != -1) | ||
802 | targ = targ.right(targ.length() - slsh - 1); | ||
803 | |||
576 | QString dstdir = project->first("DESTDIR"); | 804 | QString dstdir = project->first("DESTDIR"); |
577 | fixEnvVariables(dstdir); | 805 | fixEnvVariables(dstdir); |
578 | 806 | ||
807 | QTextStream sht(&shf); | ||
579 | sht << "#!/bin/sh" << endl; | 808 | sht << "#!/bin/sh" << endl; |
580 | //copy the actual target | 809 | //copy the actual target |
581 | sht << "OUT_TARG=\"" << targ << "\"\n" | 810 | sht << "OUT_TARG=\"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"\n" |
582 | << "[ -z \"$BUILD_ROOT\" ] || OUT_TARG=\"${BUILD_ROOT}/${OUT_TARG}\"" << endl; | 811 | << "if [ -e \"$OUT_TARG\" ]; then" << "\n" |
583 | sht << "[ \"$OUT_TARG\" = \"" | 812 | << " [ \"$OUT_TARG\" = \"" |
584 | << (dstdir.isEmpty() ? QDir::currentDirPath() + QDir::separator(): dstdir) << targ << "\" ] || " | 813 | << (dstdir.isEmpty() ? QDir::currentDirPath() + QDir::separator(): dstdir) << targ << "\" ] || " |
585 | << "[ \"$OUT_TARG\" = \"" << targ << "\" ] || " | 814 | << "[ \"$OUT_TARG\" = \"" << targ << "\" ] || " |
586 | << "cp -r \"$OUT_TARG\" " << "\"" << dstdir << targ << "\"" << endl; | 815 | << "cp -r \"$OUT_TARG\" " << "\"" << dstdir << targ << "\"" << "\n" |
816 | << "fi" << endl; | ||
587 | //rename as a framework | 817 | //rename as a framework |
588 | if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("frameworklib")) | 818 | if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("frameworklib") && !project->isActiveConfig("plugin")) |
589 | sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << targ << "\"" << endl; | 819 | sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << targ << "\"" << endl; |
590 | //create all the version symlinks (just to be like unixmake) | 820 | //create all the version symlinks (just to be like unixmake) |
591 | for(QStringList::Iterator it = links.begin(); it != links.end(); ++it) { | 821 | for(QStringList::Iterator it = links.begin(); it != links.end(); ++it) { |
592 | if(targ != (*it)) | 822 | if(targ != (*it)) |
593 | sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << (*it) << "\"" << endl; | 823 | sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << (*it) << "\"" << endl; |
594 | } | 824 | } |
595 | shf.close(); | 825 | shf.close(); |
596 | #ifdef Q_OS_UNIX | 826 | #ifdef Q_OS_UNIX |
597 | chmod(script.latin1(), S_IRWXU | S_IRWXG); | 827 | chmod(script.latin1(), S_IRWXU | S_IRWXG); |
598 | #endif | 828 | #endif |
599 | QString phase_key = keyFor("QMAKE_PBX_INSTALL_BUILDPHASE"); | 829 | QString phase_key = keyFor("QMAKE_PBX_INSTALL_BUILDPHASE"); |
600 | script = fileFixify(script, QDir::currentDirPath()); | 830 | script = fileFixify(script, QDir::currentDirPath()); |
601 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); | 831 | project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); |
602 | t << "\t\t" << phase_key << " = {" << "\n" | 832 | t << "\t\t" << phase_key << " = {" << "\n" |
603 | << "\t\t\t" << "buildActionMask = 8;" << "\n" //only on install! | 833 | << "\t\t\t" << "buildActionMask = 2147483647;" << "\n" |
604 | << "\t\t\t" << "files = (" << "\n" | 834 | << "\t\t\t" << "files = (" << "\n" |
605 | << "\t\t\t" << ");" << "\n" | 835 | << "\t\t\t" << ");" << "\n" |
606 | << "\t\t\t" << "generatedFileNames = (" << "\n" | 836 | << "\t\t\t" << "generatedFileNames = (" << "\n" |
607 | << "\t\t\t" << ");" << "\n" | 837 | << "\t\t\t" << ");" << "\n" |
608 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" | 838 | << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n" |
609 | << "\t\t\t" << "name = \"Qt Install\";" << "\n" | 839 | << "\t\t\t" << "name = \"Qt Install\";" << "\n" |
610 | << "\t\t\t" << "neededFileNames = (" << "\n" | 840 | << "\t\t\t" << "neededFileNames = (" << "\n" |
611 | << "\t\t\t" << ");" << "\n" | 841 | << "\t\t\t" << ");" << "\n" |
612 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" | 842 | << "\t\t\t" << "shellPath = /bin/sh;" << "\n" |
613 | << "\t\t\t" << "shellScript = \"" << script << "\";" << "\n" | 843 | << "\t\t\t" << "shellScript = \"" << script << "\";" << "\n" |
614 | << "\t\t" << "};" << "\n"; | 844 | << "\t\t" << "};" << "\n"; |
615 | } | 845 | } |
616 | } | 846 | } |
847 | if(/*ideType() == MAC_XCODE &&*/ !project->isEmpty("QMAKE_PBX_PRESCRIPT_BUILDPHASES") && 0) { | ||
848 | // build reference | ||
849 | t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPT_BUILDREFERENCE") << " = {" << "\n" | ||
850 | << "\t\t\t" << "includeInIndex = 0;" << "\n" | ||
851 | << "\t\t\t" << "isa = PBXFileReference;" << "\n" | ||
852 | << "\t\t\t" << "path = preprocessor.out;" << "\n" | ||
853 | << "\t\t\t" << "refType = 3;" << "\n" | ||
854 | << "\t\t\t" << "sourceTree = BUILT_PRODUCTS_DIR;" << "\n" | ||
855 | << "\t\t" << "};" << "\n"; | ||
856 | project->variables()["QMAKE_PBX_PRODUCTS"].append(keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE")); | ||
857 | //build phase | ||
858 | QString prescript_key = keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE"); | ||
859 | project->variables()["QMAKE_PBX_TARGETS"].append(prescript_key); | ||
860 | t << "\t\t" << prescript_key << " = {" << "\n" | ||
861 | << "\t\t\t" << "buildPhases = (" << "\n" | ||
862 | << varGlue("QMAKE_PBX_PRESCRIPT_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
863 | << "\t\t\t" << ");" << "\n" | ||
864 | << "\t\t\t" << "buildRules = (" << "\n" | ||
865 | << "\t\t\t" << ");" << "\n" | ||
866 | << "\t\t\t" << "buildSettings = {" << "\n" | ||
867 | << "\t\t\t" << "};" << "\n" | ||
868 | << "\t\t\t" << "dependencies = (" << "\n" | ||
869 | << "\t\t\t" << ");" << "\n" | ||
870 | << "\t\t\t" << "isa = PBXNativeTarget;" << "\n" | ||
871 | << "\t\t\t" << "name = \"Qt Preprocessor Steps\";" << "\n" | ||
872 | << "\t\t\t" << "productName = \"Qt Preprocessor Steps\";" << "\n" | ||
873 | << "\t\t\t" << "productReference = " << keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE") << ";" << "\n" | ||
874 | << "\t\t\t" << "productType = \"com.apple.product-type.tool\";" << "\n" | ||
875 | << "\t\t" << "};" << "\n"; | ||
876 | //dependency | ||
877 | t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY") << " = {" << "\n" | ||
878 | << "\t\t\t" << "isa = PBXTargetDependency;" << "\n" | ||
879 | << "\t\t\t" << "target = " << keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE") << ";" << "\n" | ||
880 | << "\t\t" << "};" << "\n"; | ||
881 | project->variables()["QMAKE_PBX_TARGET_DEPENDS"].append(keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY")); | ||
882 | project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].clear(); //these are already consumed above | ||
883 | } | ||
884 | |||
885 | //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER | ||
617 | //ROOT_GROUP | 886 | //ROOT_GROUP |
618 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" | 887 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" |
619 | << "\t\t\t" << "children = (" << "\n" | 888 | << "\t\t\t" << "children = (" << "\n" |
620 | << varGlue("QMAKE_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 889 | << varGlue("QMAKE_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
621 | << "\t\t\t" << ");" << "\n" | 890 | << "\t\t\t" << ");" << "\n" |
622 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | 891 | << "\t\t\t" << "isa = PBXGroup;" << "\n" |
623 | << "\t\t\t" << "name = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n" | 892 | << "\t\t\t" << "name = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n" |
624 | << "\t\t\t" << "path = \"\";" << "\n" | 893 | << "\t\t\t" << "path = \"\";" << "\n" |
625 | << "\t\t\t" << "refType = 4;" << "\n" | 894 | << "\t\t\t" << "refType = 4;" << "\n" |
626 | << "\t\t" << "};" << "\n"; | 895 | << "\t\t" << "};" << "\n"; |
627 | //REFERENCE | 896 | //REFERENCE |
628 | t << "\t\t" << keyFor("QMAKE_PBX_REFERENCE") << " = {" << "\n"; | 897 | project->variables()["QMAKE_PBX_PRODUCTS"].append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")); |
898 | t << "\t\t" << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << " = {" << "\n" | ||
899 | << "\t\t\t" << "fallbackIsa = PBXFileReference;" << "\n"; | ||
629 | if(project->first("TEMPLATE") == "app") { | 900 | if(project->first("TEMPLATE") == "app") { |
630 | QString targ = project->first("QMAKE_ORIG_TARGET"); | 901 | QString targ = project->first("QMAKE_ORIG_TARGET"); |
631 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 902 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
632 | targ += ".app"; | 903 | targ += ".app"; |
633 | t << "\t\t\t" << "isa = PBXApplicationReference;" << "\n"; | 904 | t << "\t\t\t" << "isa = PBXApplicationReference;" << "\n"; |
634 | } else { | 905 | } else { |
635 | t << "\t\t\t" << "isa = PBXExecutableFileReference;" << "\n"; | 906 | t << "\t\t\t" << "isa = PBXExecutableFileReference;" << "\n"; |
636 | } | 907 | } |
637 | QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") : | 908 | QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") : |
638 | QDir::currentDirPath()) + Option::dir_sep + targ; | 909 | QDir::currentDirPath()) + Option::dir_sep + targ; |
639 | t << "\t\t\t" << "name = " << targ << ";" << "\n" | 910 | t << "\t\t\t" << "name = " << targ << ";" << "\n" |
640 | << "\t\t\t" << "path = \"" << targ << "\";" << "\n" | 911 | << "\t\t\t" << "path = \"" << targ << "\";" << "\n" |
641 | << "\t\t\t" << "refType = " << reftypeForFile(app) << ";" << "\n"; | 912 | << "\t\t\t" << "refType = " << reftypeForFile(app) << ";" << "\n"; |
642 | } else { | 913 | } else { |
643 | QString lib = project->first("QMAKE_ORIG_TARGET"); | 914 | QString lib = project->first("QMAKE_ORIG_TARGET"); |
644 | if(project->isActiveConfig("staticlib")) { | 915 | if(project->isActiveConfig("staticlib")) { |
645 | lib = project->first("TARGET"); | 916 | lib = project->first("TARGET"); |
646 | } else if(!project->isActiveConfig("frameworklib")) { | 917 | } else if(!project->isActiveConfig("frameworklib")) { |
647 | if(project->isActiveConfig("plugin")) | 918 | if(project->isActiveConfig("plugin")) |
648 | lib = project->first("TARGET"); | 919 | lib = project->first("TARGET"); |
649 | else | 920 | else |
650 | lib = project->first("TARGET_"); | 921 | lib = project->first("TARGET_"); |
651 | } | 922 | } |
652 | int slsh = lib.findRev(Option::dir_sep); | 923 | int slsh = lib.findRev(Option::dir_sep); |
653 | if(slsh != -1) | 924 | if(slsh != -1) |
654 | lib = lib.right(lib.length() - slsh - 1); | 925 | lib = lib.right(lib.length() - slsh - 1); |
655 | t << "\t\t\t" << "isa = PBXLibraryReference;" << "\n" | 926 | t << "\t\t\t" << "isa = PBXLibraryReference;" << "\n" |
927 | << "\t\t\t" << "expectedFileType = \"compiled.mach-o.dylib\";" << "\n" | ||
656 | << "\t\t\t" << "path = " << lib << ";\n" | 928 | << "\t\t\t" << "path = " << lib << ";\n" |
657 | << "\t\t\t" << "refType = " << reftypeForFile(lib) << ";" << "\n"; | 929 | << "\t\t\t" << "refType = " << 3/*reftypeForFile(lib)*/ << ";" << "\n" |
930 | << "\t\t\t" << "sourceTree = BUILT_PRODUCTS_DIR" << ";" << "\n"; | ||
658 | } | 931 | } |
659 | t << "\t\t" << "};" << "\n"; | 932 | t << "\t\t" << "};" << "\n"; |
933 | { //Products group | ||
934 | QString grp("Products"), key = keyFor(grp); | ||
935 | project->variables()["QMAKE_PBX_GROUPS"].append(key); | ||
936 | t << "\t\t" << key << " = {" << "\n" | ||
937 | << "\t\t\t" << "children = (" << "\n" | ||
938 | << varGlue("QMAKE_PBX_PRODUCTS", "\t\t\t\t", ",\n\t\t\t\t", "\n") | ||
939 | << "\t\t\t" << ");" << "\n" | ||
940 | << "\t\t\t" << "isa = PBXGroup;" << "\n" | ||
941 | << "\t\t\t" << "name = Products;" << "\n" | ||
942 | << "\t\t\t" << "refType = 4;" << "\n" | ||
943 | << "\t\t" << "};" << "\n"; | ||
944 | } | ||
660 | //TARGET | 945 | //TARGET |
661 | t << "\t\t" << keyFor("QMAKE_PBX_TARGET") << " = {" << "\n" | 946 | QString target_key = keyFor("QMAKE_PBX_TARGET"); |
947 | project->variables()["QMAKE_PBX_TARGETS"].append(target_key); | ||
948 | t << "\t\t" << target_key << " = {" << "\n" | ||
662 | << "\t\t\t" << "buildPhases = (" << "\n" | 949 | << "\t\t\t" << "buildPhases = (" << "\n" |
950 | << varGlue("QMAKE_PBX_PRESCRIPT_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", ",\n") | ||
663 | << varGlue("QMAKE_PBX_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 951 | << varGlue("QMAKE_PBX_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
664 | << "\t\t\t" << ");" << "\n" | 952 | << "\t\t\t" << ");" << "\n" |
665 | << "\t\t\t" << "buildSettings = {" << "\n" | 953 | << "\t\t\t" << "buildSettings = {" << "\n" |
954 | << "\t\t\t\t" << "CC = \"" << fixEnvsList("QMAKE_CC") << "\";" << "\n" | ||
955 | << "\t\t\t\t" << "CPLUSPLUS = \"" << fixEnvsList("QMAKE_CXX") << "\";" << "\n" | ||
666 | << "\t\t\t\t" << "FRAMEWORK_SEARCH_PATHS = \"\";" << "\n" | 956 | << "\t\t\t\t" << "FRAMEWORK_SEARCH_PATHS = \"\";" << "\n" |
667 | << "\t\t\t\t" << "HEADER_SEARCH_PATHS = \"" << fixEnvsList("INCLUDEPATH") << " " << fixEnvs(specdir()) << "\";" << "\n" | 957 | << "\t\t\t\t" << "HEADER_SEARCH_PATHS = \"" << fixEnvsList("INCLUDEPATH") << " " << fixEnvs(specdir()) << "\";" << "\n" |
668 | << "\t\t\t\t" << "LIBRARY_SEARCH_PATHS = \"" << var("QMAKE_PBX_LIBPATHS") << "\";" << "\n" | 958 | << "\t\t\t\t" << "LIBRARY_SEARCH_PATHS = \"" << var("QMAKE_PBX_LIBPATHS") << "\";" << "\n" |
669 | << "\t\t\t\t" << "OPTIMIZATION_CFLAGS = \"\";" << "\n" | 959 | << "\t\t\t\t" << "OPTIMIZATION_CFLAGS = \"\";" << "\n" |
670 | << "\t\t\t\t" << "OTHER_CFLAGS = \"" << | 960 | << "\t\t\t\t" << "OTHER_CFLAGS = \"" << |
671 | fixEnvsList("QMAKE_CFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") << | 961 | fixEnvsList("QMAKE_CFLAGS") << fixQuotes(varGlue("PRL_EXPORT_DEFINES"," -D"," -D","")) << |
672 | varGlue("DEFINES"," -D"," -D","") << "\";" << "\n" | 962 | fixQuotes(varGlue("DEFINES"," -D"," -D","")) << "\";" << "\n" |
673 | << "\t\t\t\t" << "LEXFLAGS = \"" << var("QMAKE_LEXFLAGS") << "\";" << "\n" | 963 | << "\t\t\t\t" << "LEXFLAGS = \"" << var("QMAKE_LEXFLAGS") << "\";" << "\n" |
674 | << "\t\t\t\t" << "YACCFLAGS = \"" << var("QMAKE_YACCFLAGS") << "\";" << "\n" | 964 | << "\t\t\t\t" << "YACCFLAGS = \"" << var("QMAKE_YACCFLAGS") << "\";" << "\n" |
675 | << "\t\t\t\t" << "OTHER_CPLUSPLUSFLAGS = \"" << | 965 | << "\t\t\t\t" << "OTHER_CPLUSPLUSFLAGS = \"" << |
676 | fixEnvsList("QMAKE_CXXFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") << | 966 | fixEnvsList("QMAKE_CXXFLAGS") << fixQuotes(varGlue("PRL_EXPORT_DEFINES"," -D"," -D","")) << |
677 | varGlue("DEFINES"," -D"," -D","") << "\";" << "\n" | 967 | fixQuotes(varGlue("DEFINES"," -D"," -D","")) << "\";" << "\n" |
678 | << "\t\t\t\t" << "OTHER_REZFLAGS = \"\";" << "\n" | 968 | << "\t\t\t\t" << "OTHER_REZFLAGS = \"\";" << "\n" |
679 | << "\t\t\t\t" << "SECTORDER_FLAGS = \"\";" << "\n" | 969 | << "\t\t\t\t" << "SECTORDER_FLAGS = \"\";" << "\n" |
680 | << "\t\t\t\t" << "WARNING_CFLAGS = \"\";" << "\n"; | 970 | << "\t\t\t\t" << "WARNING_CFLAGS = \"\";" << "\n" |
971 | << "\t\t\t\t" << "PREBINDING = " << (project->isEmpty("QMAKE_DO_PREBINDING") ? "NO" : "YES") << ";" << "\n"; | ||
972 | if(!project->isEmpty("PRECOMPILED_HEADER")) { | ||
973 | if (ideType() == MAC_XCODE) { | ||
974 | t << "\t\t\t\t" << "GCC_PRECOMPILE_PREFIX_HEADER = \"YES\";" << "\n" | ||
975 | << "\t\t\t\t" << "GCC_PREFIX_HEADER = \"" << project->first("PRECOMPILED_HEADER") << "\";" << "\n"; | ||
976 | } else { | ||
977 | t << "\t\t\t\t" << "PRECOMPILE_PREFIX_HEADER = \"YES\";" << "\n" | ||
978 | << "\t\t\t\t" << "PREFIX_HEADER = \"" << project->first("PRECOMPILED_HEADER") << "\";" << "\n"; | ||
979 | } | ||
980 | } | ||
981 | if(project->first("TEMPLATE") == "app") { | ||
982 | QString plist = fileFixify(project->first("QMAKE_INFO_PLIST")); | ||
983 | if(plist.isEmpty()) | ||
984 | plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); | ||
985 | if(QFile::exists(plist)) { | ||
986 | QFile plist_in_file(plist); | ||
987 | if(plist_in_file.open(IO_ReadOnly)) { | ||
988 | QTextStream plist_in(&plist_in_file); | ||
989 | QString plist_in_text = plist_in.read(); | ||
990 | plist_in_text = plist_in_text.replace("@ICON@", (project->isEmpty("RC_FILE") ? QString("") : project->first("RC_FILE").section(Option::dir_sep, -1))); | ||
991 | plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET")); | ||
992 | QFile plist_out_file("Info.plist"); | ||
993 | if(plist_out_file.open(IO_WriteOnly | IO_Translate)) { | ||
994 | QTextStream plist_out(&plist_out_file); | ||
995 | plist_out << plist_in_text; | ||
996 | t << "\t\t\t\t" << "INFOPLIST_FILE = \"Info.plist\";" << "\n"; | ||
997 | } | ||
998 | } | ||
999 | } | ||
1000 | } | ||
681 | #if 1 | 1001 | #if 1 |
682 | t << "\t\t\t\t" << "BUILD_ROOT = \"" << QDir::currentDirPath() << "\";" << "\n"; | 1002 | t << "\t\t\t\t" << "BUILD_ROOT = \"" << QDir::currentDirPath() << "\";" << "\n"; |
683 | #endif | 1003 | #endif |
684 | if(!project->isActiveConfig("staticlib")) | 1004 | if(!project->isActiveConfig("staticlib")) |
685 | t << "\t\t\t\t" << "OTHER_LDFLAGS = \"" << fixEnvsList("SUBLIBS") << " " << | 1005 | t << "\t\t\t\t" << "OTHER_LDFLAGS = \"" << fixEnvsList("SUBLIBS") << " " << |
686 | fixEnvsList("QMAKE_LFLAGS") << " " << fixEnvsList("QMAKE_LIBDIR_FLAGS") << | 1006 | fixEnvsList("QMAKE_LFLAGS") << " " << fixEnvsList("QMAKE_LIBDIR_FLAGS") << |
687 | " " << fixEnvsList("QMAKE_LIBS") << "\";" << "\n"; | 1007 | " " << fixEnvsList("QMAKE_LIBS") << "\";" << "\n"; |
1008 | if(!project->isEmpty("DESTDIR")) { | ||
1009 | QString dir = project->first("DESTDIR"); | ||
1010 | if (QDir::isRelativePath(dir)) | ||
1011 | dir.prepend(QDir::currentDirPath() + Option::dir_sep); | ||
1012 | t << "\t\t\t\t" << "INSTALL_DIR = \"" << dir << "\";" << "\n"; | ||
1013 | } | ||
1014 | if ( project->first("TEMPLATE") == "lib") { | ||
1015 | t << "\t\t\t\t" << "INSTALL_PATH = \"" << "\";" << "\n"; | ||
1016 | } | ||
1017 | if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") { | ||
1018 | t << "\t\t\t\t" << "DYLIB_CURRENT_VERSION = \"" << project->first("VER_MAJ") << "." | ||
1019 | << project->first("VER_MIN") << "." << project->first("VER_PAT") << "\";" << "\n"; | ||
1020 | if(project->isEmpty("COMPAT_VERSION")) | ||
1021 | t << "\t\t\t\t" << "DYLIB_COMPATIBILITY_VERSION = \"" << project->first("VER_MAJ") << "." | ||
1022 | << project->first("VER_MIN") << "\";" << "\n"; | ||
1023 | } | ||
1024 | if(!project->isEmpty("COMPAT_VERSION")) | ||
1025 | t << "\t\t\t\t" << "DYLIB_COMPATIBILITY_VERSION = \"" << project->first("COMPAT_VERSION") << "\";" << "\n"; | ||
1026 | |||
1027 | if(ideType() == MAC_XCODE) { | ||
1028 | if(!project->isEmpty("OBJECTS_DIR")) | ||
1029 | t << "\t\t\t\t" << "OBJROOT = \"" << project->first("OBJECTS_DIR") << "\";" << "\n"; | ||
1030 | } | ||
1031 | #if 0 | ||
688 | if(!project->isEmpty("DESTDIR")) | 1032 | if(!project->isEmpty("DESTDIR")) |
689 | t << "\t\t\t\t" << "INSTALL_PATH = \"" << project->first("DESTDIR") << "\";" << "\n"; | 1033 | t << "\t\t\t\t" << "SYMROOT = \"" << project->first("DESTDIR") << "\";" << "\n"; |
690 | if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") | 1034 | else |
691 | t << "\t\t\t\t" << "DYLIB_CURRENT_VERSION = \"" << project->first("VERSION") << "\";" << "\n"; | 1035 | t << "\t\t\t\t" << "SYMROOT = \"" << QDir::currentDirPath() << "\";" << "\n"; |
692 | if(!project->isEmpty("OBJECTS_DIR")) | 1036 | #endif |
693 | t << "\t\t\t\t" << "OBJECT_FILE_DIR = \"" << project->first("OBJECTS_DIR") << "\";" << "\n"; | ||
694 | if(project->first("TEMPLATE") == "app") { | 1037 | if(project->first("TEMPLATE") == "app") { |
695 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | 1038 | if(ideType() == MAC_PBUILDER && !project->isActiveConfig("console")) |
696 | t << "\t\t\t\t" << "WRAPPER_EXTENSION = app;" << "\n"; | 1039 | t << "\t\t\t\t" << "WRAPPER_EXTENSION = app;" << "\n"; |
697 | t << "\t\t\t\t" << "PRODUCT_NAME = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"; | 1040 | t << "\t\t\t\t" << "PRODUCT_NAME = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"; |
698 | } else { | 1041 | } else { |
699 | QString lib = project->first("QMAKE_ORIG_TARGET"); | ||
700 | if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) { | 1042 | if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) { |
701 | t << "\t\t\t\t" << "LIBRARY_STYLE = STATIC;" << "\n"; | 1043 | t << "\t\t\t\t" << "LIBRARY_STYLE = STATIC;" << "\n"; |
702 | lib = project->first("TARGET"); | ||
703 | } else { | 1044 | } else { |
704 | t << "\t\t\t\t" << "LIBRARY_STYLE = DYNAMIC;" << "\n"; | 1045 | t << "\t\t\t\t" << "LIBRARY_STYLE = DYNAMIC;" << "\n"; |
705 | if(!project->isActiveConfig("frameworklib")) { | ||
706 | if(project->isActiveConfig("plugin")) | ||
707 | lib = project->first("TARGET"); | ||
708 | else | ||
709 | lib = project->first("TARGET_"); | ||
710 | } | ||
711 | } | 1046 | } |
712 | int slsh = lib.findRev(Option::dir_sep); | 1047 | QString lib = project->first("QMAKE_ORIG_TARGET"); |
713 | if(slsh != -1) | 1048 | if (!project->isActiveConfig("frameworklib") && !project->isActiveConfig("staticlib")) |
714 | lib = lib.right(lib.length() - slsh - 1); | 1049 | lib.prepend("lib"); |
715 | t << "\t\t\t\t" << "PRODUCT_NAME = " << lib << ";" << "\n"; | 1050 | t << "\t\t\t\t" << "PRODUCT_NAME = " << lib << ";" << "\n"; |
716 | } | 1051 | } |
717 | tmp = project->variables()["QMAKE_PBX_VARS"]; | 1052 | tmp = project->variables()["QMAKE_PBX_VARS"]; |
718 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) | 1053 | for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { |
719 | t << "\t\t\t\t" << (*it) << " = \"" << getenv((*it)) << "\";" << "\n"; | 1054 | QString var = (*it), val = getenv(var); |
1055 | if(!val && var == "TB") | ||
1056 | val = "/usr/bin/"; | ||
1057 | t << "\t\t\t\t" << var << " = \"" << val << "\";" << "\n"; | ||
1058 | } | ||
720 | t << "\t\t\t" << "};" << "\n" | 1059 | t << "\t\t\t" << "};" << "\n" |
721 | << "\t\t\t" << "conditionalBuildSettings = {" << "\n" | 1060 | << "\t\t\t" << "conditionalBuildSettings = {" << "\n" |
722 | << "\t\t\t" << "};" << "\n" | 1061 | << "\t\t\t" << "};" << "\n" |
723 | << "\t\t\t" << "dependencies = (" << "\n" | 1062 | << "\t\t\t" << "dependencies = (" << "\n" |
724 | << varGlue("QMAKE_PBX_TARGETDEPENDS", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 1063 | << varGlue("QMAKE_PBX_TARGET_DEPENDS", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
725 | << "\t\t\t" << ");" << "\n" | 1064 | << "\t\t\t" << ");" << "\n" |
726 | << "\t\t\t" << "productReference = " << keyFor("QMAKE_PBX_REFERENCE") << ";" << "\n" | 1065 | << "\t\t\t" << "productReference = " << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << ";" << "\n" |
727 | << "\t\t\t" << "shouldUseHeadermap = 1;" << "\n"; | 1066 | << "\t\t\t" << "shouldUseHeadermap = 1;" << "\n"; |
1067 | if(ideType() == MAC_XCODE) | ||
1068 | t << "\t\t\t" << "isa = PBXNativeTarget;" << "\n"; | ||
728 | if(project->first("TEMPLATE") == "app") { | 1069 | if(project->first("TEMPLATE") == "app") { |
729 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 1070 | if(project->isActiveConfig("console")) { |
730 | t << "\t\t\t" << "isa = PBXApplicationTarget;" << "\n" | 1071 | if(ideType() == MAC_XCODE) |
731 | << "\t\t\t" << "productSettingsXML = " << "\"" << "<?xml version=" | 1072 | t << "\t\t\t" << "productType = \"com.apple.product-type.tool\";" << "\n"; |
732 | << "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n" | 1073 | else |
733 | << "\t\t\t\t" << "<!DOCTYPE plist SYSTEM \\\"file://localhost/System/" | 1074 | t << "\t\t\t" << "isa = PBXToolTarget;" << "\n"; |
734 | << "Library/DTDs/PropertyList.dtd\\\">" << "\n" | ||
735 | << "\t\t\t\t" << "<plist version=\\\"0.9\\\">" << "\n" | ||
736 | << "\t\t\t\t" << "<dict>" << "\n" | ||
737 | << "\t\t\t\t\t" << "<key>CFBundleDevelopmentRegion</key>" << "\n" | ||
738 | << "\t\t\t\t\t" << "<string>English</string>" << "\n" | ||
739 | << "\t\t\t\t\t" << "<key>CFBundleExecutable</key>" << "\n" | ||
740 | << "\t\t\t\t\t" << "<string>" << project->first("QMAKE_ORIG_TARGET") << "</string>" << "\n" | ||
741 | << "\t\t\t\t\t" << "<key>CFBundleIconFile</key>" << "\n" | ||
742 | << "\t\t\t\t\t" << "<string>" << var("RC_FILE").section(Option::dir_sep, -1) << "</string>" << "\n" | ||
743 | << "\t\t\t\t\t" << "<key>CFBundleInfoDictionaryVersion</key>" << "\n" | ||
744 | << "\t\t\t\t\t" << "<string>6.0</string>" << "\n" | ||
745 | << "\t\t\t\t\t" << "<key>CFBundlePackageType</key>" << "\n" | ||
746 | << "\t\t\t\t\t" << "<string>APPL</string>" << "\n" | ||
747 | << "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n" | ||
748 | << "\t\t\t\t\t" << "<string>????</string>" << "\n" | ||
749 | << "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n" | ||
750 | << "\t\t\t\t\t" << "<string>0.1</string>" << "\n" | ||
751 | << "\t\t\t\t\t" << "<key>CSResourcesFileMapped</key>" << "\n" | ||
752 | << "\t\t\t\t\t" << "<true/>" << "\n" | ||
753 | << "\t\t\t\t" << "</dict>" << "\n" | ||
754 | << "\t\t\t\t" << "</plist>" << "\";" << "\n"; | ||
755 | } else { | 1075 | } else { |
756 | t << "\t\t\t" << "isa = PBXToolTarget;" << "\n"; | 1076 | if(ideType() == MAC_XCODE) |
1077 | t << "\t\t\t" << "productType = \"com.apple.product-type.application\";" << "\n"; | ||
1078 | else | ||
1079 | t << "\t\t\t" << "isa = PBXApplicationReference;" << "\n"; | ||
1080 | t << "\t\t\t" << "productSettingsXML = \""; | ||
1081 | bool read_plist = false; | ||
1082 | if(QFile::exists("Info.plist")) { | ||
1083 | QFile plist("Info.plist"); | ||
1084 | if(plist.open(IO_ReadOnly)) { | ||
1085 | read_plist = true; | ||
1086 | QTextStream stream(&plist); | ||
1087 | while(!stream.eof()) | ||
1088 | t << stream.readLine().replace('"', "\\\"") << endl; | ||
1089 | } | ||
1090 | } | ||
1091 | if(!read_plist) { | ||
1092 | t << "<?xml version=" | ||
1093 | << "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n" | ||
1094 | << "\t\t\t\t" << "<!DOCTYPE plist SYSTEM \\\"file://localhost/System/" | ||
1095 | << "Library/DTDs/PropertyList.dtd\\\">" << "\n" | ||
1096 | << "\t\t\t\t" << "<plist version=\\\"0.9\\\">" << "\n" | ||
1097 | << "\t\t\t\t" << "<dict>" << "\n" | ||
1098 | << "\t\t\t\t\t" << "<key>CFBundleDevelopmentRegion</key>" << "\n" | ||
1099 | << "\t\t\t\t\t" << "<string>English</string>" << "\n" | ||
1100 | << "\t\t\t\t\t" << "<key>CFBundleExecutable</key>" << "\n" | ||
1101 | << "\t\t\t\t\t" << "<string>" << project->first("QMAKE_ORIG_TARGET") << "</string>" << "\n" | ||
1102 | << "\t\t\t\t\t" << "<key>CFBundleIconFile</key>" << "\n" | ||
1103 | << "\t\t\t\t\t" << "<string>" << var("RC_FILE").section(Option::dir_sep, -1) << "</string>" << "\n" | ||
1104 | << "\t\t\t\t\t" << "<key>CFBundleInfoDictionaryVersion</key>" << "\n" | ||
1105 | << "\t\t\t\t\t" << "<string>6.0</string>" << "\n" | ||
1106 | << "\t\t\t\t\t" << "<key>CFBundlePackageType</key>" << "\n" | ||
1107 | << "\t\t\t\t\t" << "<string>APPL</string>" << "\n" | ||
1108 | << "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n" | ||
1109 | //Although the output below looks strange it is to avoid the trigraph ??< | ||
1110 | << "\t\t\t\t\t" << "<string>????" << "</string>" << "\n" | ||
1111 | << "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n" | ||
1112 | << "\t\t\t\t\t" << "<string>0.1</string>" << "\n" | ||
1113 | << "\t\t\t\t\t" << "<key>CSResourcesFileMapped</key>" << "\n" | ||
1114 | << "\t\t\t\t\t" << "<true/>" << "\n" | ||
1115 | << "\t\t\t\t" << "</dict>" << "\n" | ||
1116 | << "\t\t\t\t" << "</plist>"; | ||
1117 | } | ||
757 | } | 1118 | } |
1119 | t << "\";" << "\n"; | ||
758 | t << "\t\t\t" << "name = \"" << project->first("QMAKE_ORIG_TARGET") << "\";" << "\n" | 1120 | t << "\t\t\t" << "name = \"" << project->first("QMAKE_ORIG_TARGET") << "\";" << "\n" |
759 | << "\t\t\t" << "productName = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"; | 1121 | << "\t\t\t" << "productName = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n"; |
760 | } else { | 1122 | } else { |
761 | QString lib = project->first("QMAKE_ORIG_TARGET"); | 1123 | QString lib = project->first("QMAKE_ORIG_TARGET"); |
762 | if(!project->isActiveConfig("frameworklib")) | 1124 | if(!project->isActiveConfig("frameworklib") && !project->isActiveConfig("staticlib")) |
763 | lib.prepend("lib"); | 1125 | lib.prepend("lib"); |
764 | t << "\t\t\t" << "isa = PBXLibraryTarget;" << "\n" | 1126 | t << "\t\t\t" << "name = \"" << lib << "\";" << "\n" |
765 | << "\t\t\t" << "name = \"" << lib << "\";" << "\n" | ||
766 | << "\t\t\t" << "productName = " << lib << ";" << "\n"; | 1127 | << "\t\t\t" << "productName = " << lib << ";" << "\n"; |
1128 | if(ideType() == MAC_XCODE) { | ||
1129 | if(project->isActiveConfig("staticlib")) | ||
1130 | t << "\t\t\t" << "productType = \"com.apple.product-type.library.static\";" << "\n"; | ||
1131 | else | ||
1132 | t << "\t\t\t" << "productType = \"com.apple.product-type.library.dynamic\";" << "\n"; | ||
1133 | } else { | ||
1134 | t << "\t\t\t" << "isa = PBXLibraryTarget;" << "\n"; | ||
1135 | } | ||
767 | } | 1136 | } |
1137 | t << "\t\t\t" << "startupPath = \"<<ProjectDirectory>>\";" << "\n"; | ||
768 | if(!project->isEmpty("DESTDIR")) | 1138 | if(!project->isEmpty("DESTDIR")) |
769 | t << "\t\t\t" << "productInstallPath = \"" << project->first("DESTDIR") << "\";" << "\n"; | 1139 | t << "\t\t\t" << "productInstallPath = \"" << project->first("DESTDIR") << "\";" << "\n"; |
770 | t << "\t\t" << "};" << "\n"; | 1140 | t << "\t\t" << "};" << "\n"; |
771 | //DEBUG/RELEASE | 1141 | //DEBUG/RELEASE |
772 | for(i = 0; i < 2; i++) { | 1142 | QString active_buildstyle; |
773 | bool as_release = !i; | 1143 | #if 0 |
774 | if(project->isActiveConfig("debug")) | 1144 | for(int as_release = 0; as_release < 2; as_release++) |
775 | as_release = i; | 1145 | #else |
776 | QString key = "QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG"); | 1146 | bool as_release = !project->isActiveConfig("debug"); |
777 | key = keyFor(key); | 1147 | #endif |
1148 | { | ||
1149 | QString key = keyFor("QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG")); | ||
1150 | if(project->isActiveConfig("debug") != as_release) | ||
1151 | active_buildstyle = key; | ||
778 | project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key); | 1152 | project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key); |
779 | t << "\t\t" << key << " = {" << "\n" | 1153 | t << "\t\t" << key << " = {" << "\n" |
780 | << "\t\t\t" << "buildRules = (" << "\n" | 1154 | << "\t\t\t" << "buildRules = (" << "\n" |
781 | << "\t\t\t" << ");" << "\n" | 1155 | << "\t\t\t" << ");" << "\n" |
782 | << "\t\t\t" << "buildSettings = {" << "\n" | 1156 | << "\t\t\t" << "buildSettings = {" << "\n" |
783 | << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n"; | 1157 | << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n"; |
784 | if(as_release) | 1158 | if(as_release) { |
785 | t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n"; | 1159 | t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n"; |
1160 | } else { | ||
1161 | t << "\t\t\t\t" << "GCC_ENABLE_FIX_AND_CONTINUE = " | ||
1162 | << (project->isActiveConfig("no_fix_and_continue") ? "NO" : "YES") << ";" << "\n" | ||
1163 | << "\t\t\t\t" << "GCC_GENERATE_DEBUGGING_SYMBOLS = YES;" << "\n" | ||
1164 | << "\t\t\t\t" << "GCC_OPTIMIZATION_LEVEL = 0;" << "\n" | ||
1165 | << "\t\t\t\t" << "ZERO_LINK =" | ||
1166 | << (project->isActiveConfig("no_zero_link") ? "NO" : "YES") << ";" << "\n"; | ||
1167 | } | ||
786 | t << "\t\t\t" << "};" << "\n" | 1168 | t << "\t\t\t" << "};" << "\n" |
787 | << "\t\t\t" << "isa = PBXBuildStyle;" << "\n" | 1169 | << "\t\t\t" << "isa = PBXBuildStyle;" << "\n" |
788 | << "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n" | 1170 | << "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n" |
789 | << "\t\t" << "};" << "\n"; | 1171 | << "\t\t" << "};" << "\n"; |
790 | } | 1172 | } |
791 | //ROOT | 1173 | //ROOT |
792 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" | 1174 | t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" |
793 | << "\t\t\t" << "buildStyles = (" << "\n" | 1175 | << "\t\t\t" << "buildStyles = (" << "\n" |
794 | << varGlue("QMAKE_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n") | 1176 | << varGlue("QMAKE_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
795 | << "\t\t\t" << ");" << "\n" | 1177 | << "\t\t\t" << ");" << "\n" |
1178 | << "\t\t\t" << "hasScannedForEncodings = 1;" << "\n" | ||
796 | << "\t\t\t" << "isa = PBXProject;" << "\n" | 1179 | << "\t\t\t" << "isa = PBXProject;" << "\n" |
797 | << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n" | 1180 | << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n" |
1181 | << "\t\t\t" << "projectDirPath = \"\";" << "\n" | ||
798 | << "\t\t\t" << "targets = (" << "\n" | 1182 | << "\t\t\t" << "targets = (" << "\n" |
799 | << "\t\t\t\t" << keyFor("QMAKE_PBX_TARGET") << "\n" | 1183 | << varGlue("QMAKE_PBX_TARGETS", "\t\t\t\t", ",\n\t\t\t\t", "\n") |
800 | << "\t\t\t" << ");" << "\n" | 1184 | << "\t\t\t" << ");" << "\n" |
801 | << "\t\t" << "};" << "\n"; | 1185 | << "\t\t" << "};" << "\n"; |
802 | 1186 | ||
803 | //FOOTER | 1187 | //FOOTER |
804 | t << "\t" << "};" << "\n" | 1188 | t << "\t" << "};" << "\n" |
805 | << "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n" | 1189 | << "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n" |
806 | << "}" << endl; | 1190 | << "}" << endl; |
807 | 1191 | ||
808 | QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), | 1192 | if(project->isActiveConfig("generate_pbxbuild_makefile")) { |
809 | QDir::currentDirPath()); | 1193 | QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), |
810 | QFile mkwrapf(mkwrap); | 1194 | QDir::currentDirPath()); |
811 | if(mkwrapf.open(IO_WriteOnly | IO_Translate)) { | 1195 | QFile mkwrapf(mkwrap); |
812 | debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1()); | 1196 | if(mkwrapf.open(IO_WriteOnly | IO_Translate)) { |
813 | QTextStream mkwrapt(&mkwrapf); | 1197 | debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1()); |
814 | writeHeader(mkwrapt); | 1198 | QTextStream mkwrapt(&mkwrapf); |
815 | const char *cleans = "uiclean mocclean preprocess_clean "; | 1199 | writeHeader(mkwrapt); |
816 | mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n" | 1200 | const char *cleans = "uiclean mocclean preprocess_clean "; |
817 | << "all:" << "\n\t" | 1201 | mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n" |
818 | << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild") << "\n" | 1202 | << "all:" << "\n\t" |
819 | << "install: all" << "\n\t" | 1203 | << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << "\n" |
820 | << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild install") << "\n" | 1204 | << "install: all" << "\n\t" |
821 | << "distclean clean: preprocess_clean" << "\n\t" | 1205 | << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " install\n" |
822 | << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild clean") << "\n" | 1206 | << "distclean clean: preprocess_clean" << "\n\t" |
823 | << (!did_preprocess ? cleans : "") << ":" << "\n"; | 1207 | << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " clean" << "\n" |
824 | if(did_preprocess) | 1208 | << (!did_preprocess ? cleans : "") << ":" << "\n"; |
825 | mkwrapt << cleans << ":" << "\n\t" | 1209 | if(did_preprocess) |
826 | << "make -f " | 1210 | mkwrapt << cleans << ":" << "\n\t" |
827 | << pbx_dir << Option::dir_sep << "qt_preprocess.mak $@" << endl; | 1211 | << "make -f " |
1212 | << pbx_dir << Option::dir_sep << "qt_preprocess.mak $@" << endl; | ||
1213 | } | ||
828 | } | 1214 | } |
829 | return TRUE; | 1215 | return TRUE; |
830 | } | 1216 | } |
831 | 1217 | ||
832 | QString | 1218 | QString |
833 | ProjectBuilderMakefileGenerator::fixEnvs(QString file) | 1219 | ProjectBuilderMakefileGenerator::fixQuotes(const QString &val) |
1220 | { | ||
1221 | QString ret(val); | ||
1222 | ret = ret.replace(QRegExp("('|\")"), "\\\\1"); | ||
1223 | return ret; | ||
1224 | } | ||
1225 | |||
1226 | QString | ||
1227 | ProjectBuilderMakefileGenerator::fixEnvs(const QString &file) | ||
834 | { | 1228 | { |
835 | QRegExp reg_var("\\$\\((.*)\\)"); | 1229 | QRegExp reg_var("\\$\\((.*)\\)"); |
836 | for(int rep = 0; (rep = reg_var.search(file, rep)) != -1; ) { | 1230 | for(int rep = 0; (rep = reg_var.search(file, rep)) != -1; ) { |
837 | if(project->variables()["QMAKE_PBX_VARS"].findIndex(reg_var.cap(1)) == -1) | 1231 | if(project->variables()["QMAKE_PBX_VARS"].findIndex(reg_var.cap(1)) == -1) |
838 | project->variables()["QMAKE_PBX_VARS"].append(reg_var.cap(1)); | 1232 | project->variables()["QMAKE_PBX_VARS"].append(reg_var.cap(1)); |
839 | rep += reg_var.matchedLength(); | 1233 | rep += reg_var.matchedLength(); |
840 | } | 1234 | } |
841 | return file; | 1235 | return file; |
842 | } | 1236 | } |
843 | 1237 | ||
844 | QString | 1238 | QString |
845 | ProjectBuilderMakefileGenerator::fixEnvsList(QString where) | 1239 | ProjectBuilderMakefileGenerator::fixEnvsList(const QString &where) |
846 | { | 1240 | { |
847 | QString ret; | 1241 | QString ret; |
848 | const QStringList &l = project->variables()[where]; | 1242 | const QStringList &l = project->variables()[where]; |
849 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1243 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
850 | fixEnvs((*it)); | 1244 | fixEnvs((*it)); |
851 | if(!ret.isEmpty()) | 1245 | if(!ret.isEmpty()) |
852 | ret += " "; | 1246 | ret += " "; |
853 | ret += (*it); | 1247 | ret += (*it); |
854 | } | 1248 | } |
855 | return ret; | 1249 | return ret; |
856 | } | 1250 | } |
857 | 1251 | ||
858 | QString | 1252 | QString |
859 | ProjectBuilderMakefileGenerator::keyFor(QString block) | 1253 | ProjectBuilderMakefileGenerator::keyFor(const QString &block) |
860 | { | 1254 | { |
861 | #if 0 //This make this code much easier to debug.. | 1255 | #if 1 //This make this code much easier to debug.. |
862 | return block; | 1256 | if(project->isActiveConfig("no_pb_munge_key")) |
1257 | return block; | ||
863 | #endif | 1258 | #endif |
864 | |||
865 | QString ret; | 1259 | QString ret; |
866 | if(!keys.contains(block)) { | 1260 | if(!keys.contains(block)) { |
867 | #if 0 | 1261 | ret = qtMD5(block.utf8()).left(24).upper(); |
868 | static unsigned int r = 0; | ||
869 | ret.sprintf("%024x", ++r); | ||
870 | #else //not really necesary, but makes it look more interesting.. | ||
871 | static struct { unsigned int a1, a2, a3; } r = { 0, 0, 0 }; | ||
872 | if(!r.a1 && !r.a2 && !r.a3) { | ||
873 | r.a1 = rand(); | ||
874 | r.a2 = rand(); | ||
875 | r.a3 = rand(); | ||
876 | } | ||
877 | switch(rand() % 3) { | ||
878 | case 0: ++r.a1; break; | ||
879 | case 1: ++r.a2; break; | ||
880 | case 2: ++r.a3; break; | ||
881 | } | ||
882 | ret.sprintf("%08x%08x%08x", r.a1, r.a2, r.a3); | ||
883 | #endif | ||
884 | ret = ret.upper(); | ||
885 | keys.insert(block, ret); | 1262 | keys.insert(block, ret); |
886 | } else { | 1263 | } else { |
887 | ret = keys[block]; | 1264 | ret = keys[block]; |
888 | } | 1265 | } |
889 | return ret; | 1266 | return ret; |
890 | } | 1267 | } |
891 | 1268 | ||
892 | bool | 1269 | bool |
893 | ProjectBuilderMakefileGenerator::openOutput(QFile &file) const | 1270 | ProjectBuilderMakefileGenerator::openOutput(QFile &file) const |
894 | { | 1271 | { |
895 | if(project->first("TEMPLATE") != "subdirs") { | 1272 | if(QDir::isRelativePath(file.name())) |
896 | QFileInfo fi(file); | 1273 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run |
897 | if(fi.extension() != "pbxproj" || file.name().isEmpty()) { | 1274 | QFileInfo fi(file); |
898 | QString output = file.name(); | 1275 | if(fi.extension() != "pbxproj" || file.name().isEmpty()) { |
899 | if(fi.isDir()) | 1276 | QString output = file.name(); |
900 | output += QDir::separator(); | 1277 | if(fi.isDir()) |
901 | if(fi.extension() != "pbproj") { | 1278 | output += QDir::separator(); |
902 | if(file.name().isEmpty() || fi.isDir()) | 1279 | if(!output.endsWith(projectSuffix())) { |
903 | output += project->first("TARGET"); | 1280 | if(file.name().isEmpty() || fi.isDir()) |
904 | output += QString(".pbproj") + QDir::separator(); | 1281 | output += project->first("TARGET"); |
905 | } else if(output[(int)output.length() - 1] != QDir::separator()) { | 1282 | output += projectSuffix() + QDir::separator(); |
906 | output += QDir::separator(); | 1283 | } else if(output[(int)output.length() - 1] != QDir::separator()) { |
907 | } | 1284 | output += QDir::separator(); |
908 | output += QString("project.pbxproj"); | ||
909 | file.setName(output); | ||
910 | } | 1285 | } |
911 | bool ret = UnixMakefileGenerator::openOutput(file); | 1286 | output += QString("project.pbxproj"); |
912 | ((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir.section(Option::dir_sep, 0, -1); | 1287 | file.setName(output); |
913 | Option::output_dir = pbx_dir.section(Option::dir_sep, 0, -2); | ||
914 | return ret; | ||
915 | } | 1288 | } |
916 | return UnixMakefileGenerator::openOutput(file); | 1289 | bool ret = UnixMakefileGenerator::openOutput(file); |
1290 | ((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir.section(Option::dir_sep, 0, -1); | ||
1291 | Option::output_dir = pbx_dir.section(Option::dir_sep, 0, -2); | ||
1292 | return ret; | ||
917 | } | 1293 | } |
918 | 1294 | ||
919 | /* This function is such a hack it is almost pointless, but it | 1295 | /* This function is such a hack it is almost pointless, but it |
920 | eliminates the warning message from ProjectBuilder that the project | 1296 | eliminates the warning message from ProjectBuilder that the project |
921 | file is for an older version. I guess this could be used someday if | 1297 | file is for an older version. I guess this could be used someday if |
922 | the format of the output is dependant upon the version of | 1298 | the format of the output is dependant upon the version of |
923 | ProjectBuilder as well. | 1299 | ProjectBuilder as well. |
924 | */ | 1300 | */ |
925 | int | 1301 | int |
926 | ProjectBuilderMakefileGenerator::pbuilderVersion() const | 1302 | ProjectBuilderMakefileGenerator::pbuilderVersion() const |
927 | { | 1303 | { |
928 | QString ret; | 1304 | QString ret; |
929 | if(project->isEmpty("QMAKE_PBUILDER_VERSION")) { | 1305 | if(project->isEmpty("QMAKE_PBUILDER_VERSION")) { |
930 | QString version, version_plist = project->first("QMAKE_PBUILDER_VERSION_PLIST"); | 1306 | QString version, version_plist = project->first("QMAKE_PBUILDER_VERSION_PLIST"); |
931 | if(version_plist.isEmpty()) | 1307 | if(version_plist.isEmpty()) { |
932 | version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist"; | 1308 | if(ideType() == MAC_XCODE && QFile::exists("/Developer/Applications/Xcode.app/Contents/version.plist")) |
933 | else | 1309 | version_plist = "/Developer/Applications/Xcode.app/Contents/version.plist"; |
1310 | else | ||
1311 | version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist"; | ||
1312 | } else { | ||
934 | version_plist = version_plist.replace(QRegExp("\""), ""); | 1313 | version_plist = version_plist.replace(QRegExp("\""), ""); |
1314 | } | ||
935 | QFile version_file(version_plist); | 1315 | QFile version_file(version_plist); |
936 | if(version_file.open(IO_ReadOnly)) { | 1316 | if(version_file.open(IO_ReadOnly)) { |
937 | debug_msg(1, "pbuilder: version.plist: Reading file: %s", version_plist.latin1()); | 1317 | debug_msg(1, "pbuilder: version.plist: Reading file: %s", version_plist.latin1()); |
938 | QTextStream plist(&version_file); | 1318 | QTextStream plist(&version_file); |
939 | 1319 | ||
940 | bool in_dict = FALSE; | 1320 | bool in_dict = FALSE; |
941 | QString current_key; | 1321 | QString current_key; |
942 | QRegExp keyreg("^<key>(.*)</key>$"), stringreg("^<string>(.*)</string>$"); | 1322 | QRegExp keyreg("^<key>(.*)</key>$"), stringreg("^<string>(.*)</string>$"); |
943 | while(!plist.eof()) { | 1323 | while(!plist.eof()) { |
944 | QString line = plist.readLine().stripWhiteSpace(); | 1324 | QString line = plist.readLine().stripWhiteSpace(); |
945 | if(line == "<dict>") | 1325 | if(line == "<dict>") |
946 | in_dict = TRUE; | 1326 | in_dict = TRUE; |
947 | else if(line == "</dict>") | 1327 | else if(line == "</dict>") |
948 | in_dict = FALSE; | 1328 | in_dict = FALSE; |
949 | else if(in_dict) { | 1329 | else if(in_dict) { |
950 | if(keyreg.exactMatch(line)) | 1330 | if(keyreg.exactMatch(line)) |
951 | current_key = keyreg.cap(1); | 1331 | current_key = keyreg.cap(1); |
952 | else if(current_key == "CFBundleShortVersionString" && stringreg.exactMatch(line)) | 1332 | else if(current_key == "CFBundleShortVersionString" && stringreg.exactMatch(line)) |
953 | version = stringreg.cap(1); | 1333 | version = stringreg.cap(1); |
954 | } | 1334 | } |
955 | } | 1335 | } |
956 | version_file.close(); | 1336 | version_file.close(); |
957 | } else debug_msg(1, "pbuilder: version.plist: Failure to open %s", version_plist.latin1()); | 1337 | } else { debug_msg(1, "pbuilder: version.plist: Failure to open %s", version_plist.latin1()); } |
958 | if(version.startsWith("2.0")) | 1338 | if(version_plist.contains("Xcode")) { |
959 | ret = "38"; | 1339 | ret = "39"; |
960 | else if(version == "1.1") | 1340 | } else { |
961 | ret = "34"; | 1341 | if(version.startsWith("2.")) |
1342 | ret = "38"; | ||
1343 | else if(version == "1.1") | ||
1344 | ret = "34"; | ||
1345 | } | ||
962 | } else { | 1346 | } else { |
963 | ret = project->first("QMAKE_PBUILDER_VERSION"); | 1347 | ret = project->first("QMAKE_PBUILDER_VERSION"); |
964 | } | 1348 | } |
965 | if(!ret.isEmpty()) { | 1349 | if(!ret.isEmpty()) { |
966 | bool ok; | 1350 | bool ok; |
967 | int int_ret = ret.toInt(&ok); | 1351 | int int_ret = ret.toInt(&ok); |
968 | if(ok) { | 1352 | if(ok) { |
969 | debug_msg(1, "pbuilder: version.plist: Got version: %d", int_ret); | 1353 | debug_msg(1, "pbuilder: version.plist: Got version: %d", int_ret); |
970 | return int_ret; | 1354 | return int_ret; |
971 | } | 1355 | } |
972 | } | 1356 | } |
973 | debug_msg(1, "pbuilder: version.plist: Fallback to default version"); | 1357 | debug_msg(1, "pbuilder: version.plist: Fallback to default version"); |
974 | return 34; //my fallback | 1358 | return 34; //my fallback |
975 | } | 1359 | } |
976 | 1360 | ||
977 | QString | 1361 | int |
978 | ProjectBuilderMakefileGenerator::reftypeForFile(QString where) | 1362 | ProjectBuilderMakefileGenerator::reftypeForFile(const QString &where) |
979 | { | 1363 | { |
1364 | int ret = 0; //absolute is the default.. | ||
980 | if(QDir::isRelativePath(where)) | 1365 | if(QDir::isRelativePath(where)) |
981 | return "4"; //relative | 1366 | ret = 4; //relative |
982 | return "0"; //absolute | 1367 | return ret; |
1368 | } | ||
1369 | |||
1370 | ProjectBuilderMakefileGenerator::IDE_TYPE | ||
1371 | ProjectBuilderMakefileGenerator::ideType() const | ||
1372 | { | ||
1373 | if(!project->isActiveConfig("no_pbx_xcode") && | ||
1374 | (QFile::exists("/Developer/Applications/Xcode.app") || project->isActiveConfig("pbx_xcode"))) | ||
1375 | return ProjectBuilderMakefileGenerator::MAC_XCODE; | ||
1376 | return ProjectBuilderMakefileGenerator::MAC_PBUILDER; | ||
1377 | } | ||
1378 | |||
1379 | QString | ||
1380 | ProjectBuilderMakefileGenerator::projectSuffix() const | ||
1381 | { | ||
1382 | if(ideType() == MAC_XCODE) | ||
1383 | return ".xcode"; | ||
1384 | return ".pbproj"; | ||
1385 | } | ||
1386 | |||
1387 | QString | ||
1388 | ProjectBuilderMakefileGenerator::pbxbuild() | ||
1389 | { | ||
1390 | if(QFile::exists("/usr/bin/pbbuild")) | ||
1391 | return "pbbuild"; | ||
1392 | if(QFile::exists("/usr/bin/xcodebuild")) | ||
1393 | return "xcodebuild"; | ||
1394 | return (ideType() == MAC_XCODE ? "xcodebuild" : "pbxbuild"); | ||
983 | } | 1395 | } |
1396 | |||
diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h index ec2e1be..4ffb9a8 100644 --- a/qmake/generators/mac/pbuilder_pbx.h +++ b/qmake/generators/mac/pbuilder_pbx.h | |||
@@ -1,68 +1,75 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ProjectBuilderMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | #ifndef __PBUILDERMAKE_H__ | 35 | |
38 | #define __PBUILDERMAKE_H__ | 36 | #ifndef __PBUILDER_PBX_H__ |
37 | #define __PBUILDER_PBX_H__ | ||
39 | 38 | ||
40 | #include "unixmake.h" | 39 | #include "unixmake.h" |
41 | 40 | ||
42 | class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator | 41 | class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator |
43 | { | 42 | { |
44 | QString pbx_dir; | 43 | QString pbx_dir; |
45 | int pbuilderVersion() const; | 44 | int pbuilderVersion() const; |
45 | bool writeSubdirs(QTextStream &, bool); | ||
46 | bool writeMakeParts(QTextStream &); | 46 | bool writeMakeParts(QTextStream &); |
47 | bool writeMakefile(QTextStream &); | 47 | bool writeMakefile(QTextStream &); |
48 | 48 | ||
49 | QString pbxbuild(); | ||
49 | QMap<QString, QString> keys; | 50 | QMap<QString, QString> keys; |
50 | QString keyFor(QString file); | 51 | QString keyFor(const QString &file); |
51 | QString fixEnvs(QString file); | 52 | QString fixQuotes(const QString &val); |
52 | QString fixEnvsList(QString where); | 53 | QString fixEnvs(const QString &file); |
53 | QString reftypeForFile(QString file); | 54 | QString fixEnvsList(const QString &where); |
55 | int reftypeForFile(const QString &where); | ||
56 | QString projectSuffix() const; | ||
57 | |||
58 | enum IDE_TYPE { MAC_XCODE, MAC_PBUILDER }; | ||
59 | IDE_TYPE ideType() const; | ||
54 | 60 | ||
55 | public: | 61 | public: |
56 | ProjectBuilderMakefileGenerator(QMakeProject *p); | 62 | ProjectBuilderMakefileGenerator(QMakeProject *p); |
57 | ~ProjectBuilderMakefileGenerator(); | 63 | ~ProjectBuilderMakefileGenerator(); |
58 | 64 | ||
59 | virtual bool openOutput(QFile &) const; | 65 | virtual bool openOutput(QFile &) const; |
60 | protected: | 66 | protected: |
67 | bool doPrecompiledHeaders() const { return FALSE; } | ||
61 | virtual bool doDepends() const { return FALSE; } //never necesary | 68 | virtual bool doDepends() const { return FALSE; } //never necesary |
62 | }; | 69 | }; |
63 | 70 | ||
64 | inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator() | 71 | inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator() |
65 | { } | 72 | { } |
66 | 73 | ||
67 | 74 | ||
68 | #endif /* __PBUILDERMAKE_H__ */ | 75 | #endif /* __PBUILDER_PBX_H__ */ |
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index c12375d..5ce387f 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp | |||
@@ -1,1873 +1,2070 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of MakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "makefile.h" | 36 | #include "makefile.h" |
39 | #include "option.h" | 37 | #include "option.h" |
38 | #include "meta.h" | ||
40 | #include <qdir.h> | 39 | #include <qdir.h> |
41 | #include <qfile.h> | 40 | #include <qfile.h> |
42 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
43 | #include <qregexp.h> | 42 | #include <qregexp.h> |
44 | #include <qdict.h> | 43 | #include <qdict.h> |
45 | #if defined(Q_OS_UNIX) | 44 | #if defined(Q_OS_UNIX) |
46 | #include <unistd.h> | 45 | #include <unistd.h> |
47 | #else | 46 | #else |
48 | #include <io.h> | 47 | #include <io.h> |
49 | #endif | 48 | #endif |
50 | #include <stdio.h> | 49 | #include <stdio.h> |
51 | #include <stdlib.h> | 50 | #include <stdlib.h> |
52 | #include <time.h> | 51 | #include <time.h> |
53 | #include <fcntl.h> | 52 | #include <fcntl.h> |
54 | #include <sys/types.h> | 53 | #include <sys/types.h> |
55 | #include <sys/stat.h> | 54 | #include <sys/stat.h> |
56 | 55 | ||
57 | // Well, Windows doesn't have this, so here's the macro | 56 | // Well, Windows doesn't have this, so here's the macro |
58 | #ifndef S_ISDIR | 57 | #ifndef S_ISDIR |
59 | #define S_ISDIR(m)(((m) & S_IFMT) == S_IFDIR) | 58 | #define S_ISDIR(m)(((m) & S_IFMT) == S_IFDIR) |
60 | #endif | 59 | #endif |
60 | #define QMAKE_EOL(x) (x == '\r' || x == '\n') | ||
61 | 61 | ||
62 | static QString mkdir_p_asstring(const QString &dir) | 62 | QString mkdir_p_asstring(const QString &dir) |
63 | { | 63 | { |
64 | QString ret = "@$(CHK_DIR_EXISTS) \"" + dir + "\" "; | 64 | QString ret = "@$(CHK_DIR_EXISTS) \"" + dir + "\" "; |
65 | if(Option::target_mode == Option::TARG_WIN_MODE) | 65 | if(Option::target_mode == Option::TARG_WIN_MODE) |
66 | ret += "$(MKDIR)"; | 66 | ret += "$(MKDIR)"; |
67 | else | 67 | else |
68 | ret += "|| $(MKDIR)"; | 68 | ret += "|| $(MKDIR)"; |
69 | ret += " \"" + dir + "\""; | 69 | ret += " \"" + dir + "\""; |
70 | return ret; | 70 | return ret; |
71 | } | 71 | } |
72 | 72 | ||
73 | static bool createDir(const QString& fullPath) | 73 | static bool createDir(const QString& fullPath) |
74 | { | 74 | { |
75 | if(QFile::exists(fullPath)) | 75 | if(QFile::exists(fullPath)) |
76 | return FALSE; | 76 | return FALSE; |
77 | |||
78 | QDir dirTmp; | 77 | QDir dirTmp; |
79 | bool ret = TRUE; | 78 | bool ret = TRUE; |
80 | QString pathComponent, tmpPath; | 79 | QString pathComponent, tmpPath; |
81 | QStringList hierarchy = QStringList::split(QString(Option::dir_sep), fullPath, TRUE); | 80 | QStringList hierarchy = QStringList::split(QString(Option::dir_sep), fullPath, TRUE); |
82 | for(QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it) { | 81 | for(QStringList::Iterator it = hierarchy.begin(); it != hierarchy.end(); ++it) { |
83 | pathComponent = *it + QDir::separator(); | 82 | pathComponent = *it + QDir::separator(); |
84 | tmpPath += pathComponent; | 83 | tmpPath += pathComponent; |
85 | if(!dirTmp.mkdir(tmpPath)) { | 84 | if(!dirTmp.mkdir(tmpPath)) { |
86 | ret = FALSE; | 85 | ret = FALSE; |
87 | // break; | 86 | // break; |
88 | } | 87 | } |
89 | } | 88 | } |
90 | return ret; | 89 | return ret; |
91 | } | 90 | } |
92 | 91 | ||
93 | 92 | ||
94 | MakefileGenerator::MakefileGenerator(QMakeProject *p) : init_opath_already(FALSE), | 93 | MakefileGenerator::MakefileGenerator(QMakeProject *p) : init_opath_already(FALSE), |
95 | init_already(FALSE), moc_aware(FALSE), | 94 | init_already(FALSE), moc_aware(FALSE), |
96 | no_io(FALSE), project(p) | 95 | no_io(FALSE), project(p) |
97 | { | 96 | { |
98 | } | 97 | } |
99 | 98 | ||
100 | static char *gimme_buffer(off_t s) | 99 | static char *gimme_buffer(off_t s) |
101 | { | 100 | { |
102 | static char *big_buffer = NULL; | 101 | static char *big_buffer = NULL; |
103 | static int big_buffer_size = 0; | 102 | static int big_buffer_size = 0; |
104 | if(!big_buffer || big_buffer_size < s) | 103 | if(!big_buffer || big_buffer_size < s) |
105 | big_buffer = (char *)realloc(big_buffer, s); | 104 | big_buffer = (char *)realloc(big_buffer, s); |
106 | return big_buffer; | 105 | return big_buffer; |
107 | } | 106 | } |
108 | 107 | ||
109 | bool | 108 | bool |
110 | MakefileGenerator::generateMocList(const QString &fn_target) | 109 | MakefileGenerator::generateMocList(const QString &fn_target) |
111 | { | 110 | { |
112 | if(!findMocDestination(fn_target).isEmpty()) | 111 | if(!findMocDestination(fn_target).isEmpty()) |
113 | return TRUE; | 112 | return TRUE; |
114 | 113 | ||
115 | QString fn_local = Option::fixPathToLocalOS(fileFixify(fn_target, QDir::currentDirPath(), Option::output_dir)); | 114 | QString fn_local = Option::fixPathToLocalOS(fileFixify(fn_target, QDir::currentDirPath(), Option::output_dir)); |
116 | 115 | ||
117 | int file = open(fn_local.latin1(), O_RDONLY); | 116 | int file = open(fn_local.latin1(), O_RDONLY); |
118 | if(file == -1) | 117 | if(file == -1) |
119 | return FALSE; | 118 | return FALSE; |
120 | 119 | ||
121 | struct stat fst; | 120 | struct stat fst; |
122 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) | 121 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) |
123 | return FALSE; //shouldn't happen | 122 | return FALSE; //shouldn't happen |
124 | char *big_buffer = gimme_buffer(fst.st_size); | 123 | char *big_buffer = gimme_buffer(fst.st_size); |
125 | 124 | ||
126 | int total_size_read; | 125 | int total_size_read; |
127 | for(int have_read = total_size_read = 0; | 126 | for(int have_read = total_size_read = 0; |
128 | (have_read = read(file, big_buffer + total_size_read, | 127 | (have_read = read(file, big_buffer + total_size_read, |
129 | fst.st_size - total_size_read)); | 128 | fst.st_size - total_size_read)); |
130 | total_size_read += have_read); | 129 | total_size_read += have_read); |
131 | close(file); | 130 | close(file); |
132 | 131 | ||
133 | bool ignore_qobject = FALSE; | 132 | bool ignore_qobject = FALSE; |
134 | int line_count = 1; | 133 | int line_count = 1; |
135 | /* qmake ignore Q_OBJECT */ | 134 | /* qmake ignore Q_OBJECT */ |
136 | #define COMP_LEN 8 //strlen("Q_OBJECT") | 135 | #define COMP_LEN 8 //strlen("Q_OBJECT") |
137 | #define OBJ_LEN 8 //strlen("Q_OBJECT") | 136 | #define OBJ_LEN 8 //strlen("Q_OBJECT") |
138 | #define DIS_LEN 10 //strlen("Q_DISPATCH") | 137 | #define DIS_LEN 10 //strlen("Q_DISPATCH") |
139 | int x; | 138 | int x; |
140 | for(x = 0; x < (total_size_read-COMP_LEN); x++) { | 139 | for(x = 0; x < (total_size_read-COMP_LEN); x++) { |
141 | if(*(big_buffer + x) == '/') { | 140 | if(*(big_buffer + x) == '/') { |
142 | x++; | 141 | x++; |
143 | if(total_size_read >= x) { | 142 | if(total_size_read >= x) { |
144 | if(*(big_buffer + x) == '/') { //c++ style comment | 143 | if(*(big_buffer + x) == '/') { //c++ style comment |
145 | for( ;x < total_size_read && *(big_buffer + x) != '\n'; x++); | 144 | for( ;x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); |
146 | line_count++; | 145 | line_count++; |
147 | } else if(*(big_buffer + x) == '*') { //c style comment | 146 | } else if(*(big_buffer + x) == '*') { //c style comment |
148 | for( ;x < total_size_read; x++) { | 147 | for( ;x < total_size_read; x++) { |
149 | if(*(big_buffer + x) == 't' || *(big_buffer + x) == 'q') { //ignore | 148 | if(*(big_buffer + x) == 't' || *(big_buffer + x) == 'q') { //ignore |
150 | if(total_size_read >= (x + 20)) { | 149 | if(total_size_read >= (x + 20)) { |
151 | if(!strncmp(big_buffer + x + 1, "make ignore Q_OBJECT", 20)) { | 150 | if(!strncmp(big_buffer + x + 1, "make ignore Q_OBJECT", 20)) { |
152 | debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_OBJECT\"", | 151 | debug_msg(2, "Mocgen: %s:%d Found \"qmake ignore Q_OBJECT\"", |
153 | fn_target.latin1(), line_count); | 152 | fn_target.latin1(), line_count); |
154 | x += 20; | 153 | x += 20; |
155 | ignore_qobject = TRUE; | 154 | ignore_qobject = TRUE; |
156 | } | 155 | } |
157 | } | 156 | } |
158 | } else if(*(big_buffer + x) == '*') { | 157 | } else if(*(big_buffer + x) == '*') { |
159 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { | 158 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { |
160 | x += 2; | 159 | x += 2; |
161 | break; | 160 | break; |
162 | } | 161 | } |
163 | } else if(*(big_buffer + x) == '\n') { | 162 | } else if(QMAKE_EOL(*(big_buffer + x))) { |
164 | line_count++; | 163 | line_count++; |
165 | } | 164 | } |
166 | } | 165 | } |
167 | } | 166 | } |
168 | } | 167 | } |
169 | } | 168 | } |
170 | #define SYMBOL_CHAR(x) ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z') || \ | 169 | #define SYMBOL_CHAR(x) ((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z') || \ |
171 | (x <= '0' && x >= '9') || x == '_') | 170 | (x <= '0' && x >= '9') || x == '_') |
172 | 171 | ||
173 | bool interesting = *(big_buffer+x) == 'Q' && (!strncmp(big_buffer+x, "Q_OBJECT", OBJ_LEN) || | 172 | bool interesting = *(big_buffer+x) == 'Q' && (!strncmp(big_buffer+x, "Q_OBJECT", OBJ_LEN) || |
174 | !strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)); | 173 | !strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)); |
175 | if(interesting) { | 174 | if(interesting) { |
176 | int len = 0; | 175 | int len = 0; |
177 | if(!strncmp(big_buffer+x, "Q_OBJECT", OBJ_LEN)) { | 176 | if(!strncmp(big_buffer+x, "Q_OBJECT", OBJ_LEN)) { |
178 | if(ignore_qobject) { | 177 | if(ignore_qobject) { |
179 | debug_msg(2, "Mocgen: %s:%d Ignoring Q_OBJECT", fn_target.latin1(), line_count); | 178 | debug_msg(2, "Mocgen: %s:%d Ignoring Q_OBJECT", fn_target.latin1(), line_count); |
180 | interesting = FALSE; | 179 | interesting = FALSE; |
181 | } | 180 | } |
182 | len=OBJ_LEN; | 181 | len=OBJ_LEN; |
183 | } else if(!strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)) { | 182 | } else if(!strncmp(big_buffer+x, "Q_DISPATCH", DIS_LEN)) { |
184 | len=DIS_LEN; | 183 | len=DIS_LEN; |
185 | } | 184 | } |
186 | if(SYMBOL_CHAR(*(big_buffer+x+len))) | 185 | if(SYMBOL_CHAR(*(big_buffer+x+len))) |
187 | interesting = FALSE; | 186 | interesting = FALSE; |
188 | if(interesting) { | 187 | if(interesting) { |
189 | *(big_buffer+x+len) = '\0'; | 188 | *(big_buffer+x+len) = '\0'; |
190 | debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), | 189 | debug_msg(2, "Mocgen: %s:%d Found MOC symbol %s", fn_target.latin1(), |
191 | line_count, big_buffer+x); | 190 | line_count, big_buffer+x); |
192 | 191 | ||
193 | int ext_pos = fn_target.findRev('.'); | 192 | int ext_pos = fn_target.findRev('.'); |
194 | int ext_len = fn_target.length() - ext_pos; | 193 | int ext_len = fn_target.length() - ext_pos; |
195 | int dir_pos = fn_target.findRev(Option::dir_sep, ext_pos); | 194 | int dir_pos = fn_target.findRev(Option::dir_sep, ext_pos); |
196 | QString mocFile; | 195 | QString mocFile; |
197 | if(!project->isEmpty("MOC_DIR")) | 196 | if(!project->isEmpty("MOC_DIR")) |
198 | mocFile = project->first("MOC_DIR"); | 197 | mocFile = project->first("MOC_DIR"); |
199 | else if(dir_pos != -1) | 198 | else if(dir_pos != -1) |
200 | mocFile = fn_target.left(dir_pos+1); | 199 | mocFile = fn_target.left(dir_pos+1); |
201 | 200 | ||
202 | bool cpp_ext = FALSE; | 201 | bool cpp_ext = FALSE; |
203 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 202 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
204 | cppit != Option::cpp_ext.end(); ++cppit) { | 203 | cppit != Option::cpp_ext.end(); ++cppit) { |
205 | if((cpp_ext = (fn_target.right(ext_len) == (*cppit)))) | 204 | if((cpp_ext = (fn_target.right(ext_len) == (*cppit)))) |
206 | break; | 205 | break; |
207 | } | 206 | } |
208 | if(cpp_ext) { | 207 | if(cpp_ext) { |
209 | mocFile += fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::moc_ext; | 208 | mocFile += Option::cpp_moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + Option::cpp_moc_ext; |
210 | project->variables()["_SRCMOC"].append(mocFile); | 209 | project->variables()["_SRCMOC"].append(mocFile); |
211 | } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { | 210 | } else if(project->variables()["HEADERS"].findIndex(fn_target) != -1) { |
212 | for(QStringList::Iterator hit = Option::h_ext.begin(); | 211 | for(QStringList::Iterator hit = Option::h_ext.begin(); |
213 | hit != Option::h_ext.end(); ++hit) { | 212 | hit != Option::h_ext.end(); ++hit) { |
214 | if((fn_target.right(ext_len) == (*hit))) { | 213 | if((fn_target.right(ext_len) == (*hit))) { |
215 | mocFile += Option::moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + | 214 | mocFile += Option::h_moc_mod + fn_target.mid(dir_pos+1, ext_pos - dir_pos-1) + |
216 | Option::cpp_ext.first(); | 215 | Option::h_moc_ext; |
217 | logicWarn(mocFile, "SOURCES"); | 216 | logicWarn(mocFile, "SOURCES"); |
218 | project->variables()["_HDRMOC"].append(mocFile); | 217 | project->variables()["_HDRMOC"].append(mocFile); |
219 | break; | 218 | break; |
220 | } | 219 | } |
221 | } | 220 | } |
222 | } | 221 | } |
223 | 222 | ||
224 | if(!mocFile.isEmpty()) { | 223 | if(!mocFile.isEmpty()) { |
225 | mocFile = Option::fixPathToTargetOS(mocFile); | 224 | mocFile = Option::fixPathToTargetOS(mocFile); |
226 | mocablesToMOC[cleanFilePath(fn_target)] = mocFile; | 225 | mocablesToMOC[cleanFilePath(fn_target)] = mocFile; |
227 | mocablesFromMOC[cleanFilePath(mocFile)] = fn_target; | 226 | mocablesFromMOC[cleanFilePath(mocFile)] = fn_target; |
228 | } | 227 | } |
229 | break; | 228 | break; |
230 | } | 229 | } |
231 | } | 230 | } |
232 | 231 | ||
233 | while(x < total_size_read && SYMBOL_CHAR(*(big_buffer+x))) | 232 | while(x < total_size_read && SYMBOL_CHAR(*(big_buffer+x))) |
234 | x++; | 233 | x++; |
235 | if(*(big_buffer+x) == '\n') | 234 | if(QMAKE_EOL(*(big_buffer+x))) |
236 | line_count++; | 235 | line_count++; |
237 | } | 236 | } |
238 | #undef OBJ_LEN | 237 | #undef OBJ_LEN |
239 | #undef DIS_LEN | 238 | #undef DIS_LEN |
240 | return TRUE; | 239 | return TRUE; |
241 | } | 240 | } |
242 | 241 | ||
243 | bool | 242 | bool |
244 | MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &f, bool recurse) | 243 | MakefileGenerator::generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &f, bool recurse) |
245 | { | 244 | { |
246 | QStringList &fndeps = findDependencies(f); | 245 | if(processedDependencies(f)) |
247 | if(!fndeps.isEmpty()) | ||
248 | return TRUE; | 246 | return TRUE; |
247 | setProcessedDependencies(f, TRUE); | ||
248 | |||
249 | QStringList &fndeps = findDependencies(f); | ||
249 | QString fn = fileFixify(f, QDir::currentDirPath(), Option::output_dir); | 250 | QString fn = fileFixify(f, QDir::currentDirPath(), Option::output_dir); |
250 | fn = Option::fixPathToLocalOS(fn, FALSE); | 251 | fn = Option::fixPathToLocalOS(fn, FALSE); |
251 | QString fix_env_fn = Option::fixPathToLocalOS(fn); | 252 | QString fix_env_fn = Option::fixPathToLocalOS(fn); |
252 | int file = open(fix_env_fn.latin1(), O_RDONLY); | 253 | int file = open(fix_env_fn.latin1(), O_RDONLY); |
253 | if(file == -1) | 254 | if(file == -1) |
254 | return FALSE; | 255 | return FALSE; |
255 | struct stat fst; | 256 | struct stat fst; |
256 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) | 257 | if(fstat(file, &fst) || S_ISDIR(fst.st_mode)) |
257 | return FALSE; //shouldn't happen | 258 | return FALSE; //shouldn't happen |
258 | 259 | ||
259 | QString fndir, fix_env_fndir; | 260 | QString fndir, fix_env_fndir; |
260 | int dl = fn.findRev(Option::dir_sep); | 261 | int dl = fn.findRev(Option::dir_sep); |
261 | if(dl != -1) | 262 | if(dl != -1) |
262 | fndir = fn.left(dl+1); | 263 | fndir = fn.left(dl+1); |
263 | dl = fix_env_fn.findRev(Option::dir_sep); | 264 | dl = fix_env_fn.findRev(Option::dir_sep); |
264 | if(dl != -1) | 265 | if(dl != -1) |
265 | fix_env_fndir = fix_env_fn.left(dl + 1); | 266 | fix_env_fndir = fix_env_fn.left(dl + 1); |
266 | 267 | ||
267 | int line_count = 1; | 268 | int line_count = 1; |
268 | char *big_buffer = gimme_buffer(fst.st_size); | 269 | char *big_buffer = gimme_buffer(fst.st_size); |
269 | 270 | ||
270 | int total_size_read; | 271 | int total_size_read; |
271 | for(int have_read = total_size_read = 0; | 272 | for(int have_read = total_size_read = 0; |
272 | (have_read = read(file, big_buffer + total_size_read, | 273 | (have_read = read(file, big_buffer + total_size_read, |
273 | fst.st_size - total_size_read)); | 274 | fst.st_size - total_size_read)); |
274 | total_size_read += have_read); | 275 | total_size_read += have_read); |
275 | close(file); | 276 | close(file); |
276 | 277 | ||
277 | bool ui_file = fn.endsWith(Option::ui_ext); | 278 | bool ui_file = fn.endsWith(Option::ui_ext); |
278 | for(int x = 0; x < total_size_read; x++) { | 279 | for(int x = 0; x < total_size_read; x++) { |
279 | QStringList *outdeps=&fndeps; | 280 | QStringList *outdeps=&fndeps; |
280 | QString inc; | 281 | QString inc; |
281 | if(!ui_file) { | 282 | if(!ui_file) { |
282 | if(*(big_buffer + x) == '/') { | 283 | if(*(big_buffer + x) == '/') { |
283 | x++; | 284 | x++; |
284 | if(total_size_read >= x) { | 285 | if(total_size_read >= x) { |
285 | if(*(big_buffer + x) == '/') { //c++ style comment | 286 | if(*(big_buffer + x) == '/') { //c++ style comment |
286 | for( ; x < total_size_read && *(big_buffer + x) != '\n'; x++); | 287 | for( ; x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); |
287 | } else if(*(big_buffer + x) == '*') { //c style comment | 288 | } else if(*(big_buffer + x) == '*') { //c style comment |
288 | for( ; x < total_size_read; x++) { | 289 | for( ; x < total_size_read; x++) { |
289 | if(*(big_buffer + x) == '*') { | 290 | if(*(big_buffer + x) == '*') { |
290 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { | 291 | if(total_size_read >= (x+1) && *(big_buffer + (x+1)) == '/') { |
291 | x += 2; | 292 | x += 2; |
292 | break; | 293 | break; |
293 | } | 294 | } |
294 | } else if(*(big_buffer + x) == '\n') { | 295 | } else if(QMAKE_EOL(*(big_buffer + x))) { |
295 | line_count++; | 296 | line_count++; |
296 | } | 297 | } |
297 | } | 298 | } |
298 | } | 299 | } |
299 | } | 300 | } |
300 | } | 301 | } |
302 | while(x < total_size_read && //Skip spaces | ||
303 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | ||
304 | x++; | ||
301 | if(*(big_buffer + x) == '#') { | 305 | if(*(big_buffer + x) == '#') { |
302 | x++; | 306 | x++; |
303 | while(x < total_size_read && //Skip spaces after hash | 307 | while(x < total_size_read && //Skip spaces after hash |
304 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | 308 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) |
305 | x++; | 309 | x++; |
306 | if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && | 310 | if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && |
307 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '\t' || | 311 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '\t' || |
308 | *(big_buffer + x + 7) == '<' || *(big_buffer + x + 7) == '"')) { | 312 | *(big_buffer + x + 7) == '<' || *(big_buffer + x + 7) == '"')) { |
309 | for(x+=7; //skip spaces after keyword | 313 | for(x+=7; //skip spaces after keyword |
310 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); | 314 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); |
311 | x++); | 315 | x++); |
312 | char term = *(big_buffer + x); | 316 | char term = *(big_buffer + x); |
313 | if(term == '"'); | 317 | if(term == '"'); |
314 | else if(term == '<') | 318 | else if(term == '<') |
315 | term = '>'; | 319 | term = '>'; |
316 | else | 320 | else |
317 | continue; //wtf? | 321 | continue; //wtf? |
318 | x++; | 322 | x++; |
319 | 323 | ||
320 | int inc_len; | 324 | int inc_len; |
321 | for(inc_len = 0; *(big_buffer + x + inc_len) != term; inc_len++); | 325 | for(inc_len = 0; *(big_buffer + x + inc_len) != term && |
326 | !QMAKE_EOL(*(big_buffer + x + inc_len)); inc_len++); | ||
322 | *(big_buffer + x + inc_len) = '\0'; | 327 | *(big_buffer + x + inc_len) = '\0'; |
323 | inc = big_buffer + x; | 328 | inc = big_buffer + x; |
324 | } else if(total_size_read >= x + 14 && !strncmp(big_buffer + x, "qmake_warning ", 14)) { | 329 | } else if(total_size_read >= x + 14 && !strncmp(big_buffer + x, "qmake_warning ", 14)) { |
325 | for(x+=14; //skip spaces after keyword | 330 | for(x+=14; //skip spaces after keyword |
326 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); | 331 | x < total_size_read && (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t'); |
327 | x++); | 332 | x++); |
328 | char term = '\n'; | 333 | char term = 0; |
329 | if(*(big_buffer + x) == '"') | 334 | if(*(big_buffer + x) == '"') |
330 | term = '"'; | 335 | term = '"'; |
331 | if(*(big_buffer + x) == '\'') | 336 | if(*(big_buffer + x) == '\'') |
332 | term = '\''; | 337 | term = '\''; |
333 | if(term != '\n') | 338 | if(term) |
334 | x++; | 339 | x++; |
335 | 340 | ||
336 | int msg_len; | 341 | int msg_len; |
337 | for(msg_len = 0; *(big_buffer + x + msg_len) != term; msg_len++); | 342 | for(msg_len = 0; (term && *(big_buffer + x + msg_len) != term) && |
343 | !QMAKE_EOL(*(big_buffer + x + msg_len)); msg_len++); | ||
344 | const char saved_term = *(big_buffer + x + msg_len); | ||
338 | *(big_buffer + x + msg_len) = '\0'; | 345 | *(big_buffer + x + msg_len) = '\0'; |
339 | QString msg = big_buffer + x; | 346 | QString msg = big_buffer + x; |
340 | debug_msg(0, "%s:%d qmake_warning -- %s", fix_env_fn.latin1(), | 347 | debug_msg(0, "%s:%d qmake_warning -- %s", fix_env_fn.latin1(), |
341 | line_count, msg.latin1()); | 348 | line_count, msg.latin1()); |
342 | *(big_buffer + x + msg_len) = term; //put it back | 349 | *(big_buffer + x + msg_len) = saved_term; //put it back |
343 | } | 350 | } |
344 | } | 351 | } |
345 | } else if(ui_file) { | 352 | } else if(ui_file) { |
346 | // skip whitespaces | 353 | // skip whitespaces |
347 | while(x < total_size_read && | 354 | while(x < total_size_read && |
348 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) | 355 | (*(big_buffer+x) == ' ' || *(big_buffer+x) == '\t')) |
349 | x++; | 356 | x++; |
350 | if(*(big_buffer + x) == '<') { | 357 | if(*(big_buffer + x) == '<') { |
351 | x++; | 358 | x++; |
352 | if(total_size_read >= x + 12 && !strncmp(big_buffer + x, "includehint", 11) && | 359 | if(total_size_read >= x + 12 && !strncmp(big_buffer + x, "includehint", 11) && |
353 | (*(big_buffer + x + 11) == ' ' || *(big_buffer + x + 11) == '>')) { | 360 | (*(big_buffer + x + 11) == ' ' || *(big_buffer + x + 11) == '>')) { |
354 | for(x += 12; *(big_buffer + x) != '>'; x++); | 361 | for(x += 11; *(big_buffer + x) != '>'; x++); |
355 | int inc_len = 0; | 362 | int inc_len = 0; |
356 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); | 363 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); |
357 | *(big_buffer + x + inc_len) = '\0'; | 364 | *(big_buffer + x + inc_len) = '\0'; |
358 | inc = big_buffer + x; | 365 | inc = big_buffer + x; |
366 | } else if(total_size_read >= x + 13 && !strncmp(big_buffer + x, "customwidget", 12) && | ||
367 | (*(big_buffer + x + 12) == ' ' || *(big_buffer + x + 12) == '>')) { | ||
368 | for(x += 13; *(big_buffer + x) != '>'; x++); //skip up to > | ||
369 | while(x < total_size_read) { | ||
370 | for(x++; *(big_buffer + x) != '<'; x++); //skip up to < | ||
371 | x++; | ||
372 | if(total_size_read >= x + 7 && !strncmp(big_buffer+x, "header", 6) && | ||
373 | (*(big_buffer + x + 6) == ' ' || *(big_buffer + x + 6) == '>')) { | ||
374 | for(x += 7; *(big_buffer + x) != '>'; x++); //skip up to > | ||
375 | int inc_len = 0; | ||
376 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); | ||
377 | *(big_buffer + x + inc_len) = '\0'; | ||
378 | inc = big_buffer + x; | ||
379 | break; | ||
380 | } else if(total_size_read >= x + 14 && !strncmp(big_buffer+x, "/customwidget", 13) && | ||
381 | (*(big_buffer + x + 13) == ' ' || *(big_buffer + x + 13) == '>')) { | ||
382 | x += 14; | ||
383 | break; | ||
384 | } | ||
385 | } | ||
359 | } else if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && | 386 | } else if(total_size_read >= x + 8 && !strncmp(big_buffer + x, "include", 7) && |
360 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '>')) { | 387 | (*(big_buffer + x + 7) == ' ' || *(big_buffer + x + 7) == '>')) { |
361 | for(x += 8; *(big_buffer + x) != '>'; x++) { | 388 | for(x += 8; *(big_buffer + x) != '>'; x++) { |
362 | if(total_size_read >= x + 9 && *(big_buffer + x) == 'i' && | 389 | if(total_size_read >= x + 9 && *(big_buffer + x) == 'i' && |
363 | !strncmp(big_buffer + x, "impldecl", 8)) { | 390 | !strncmp(big_buffer + x, "impldecl", 8)) { |
364 | for(x += 8; *(big_buffer + x) != '='; x++); | 391 | for(x += 8; *(big_buffer + x) != '='; x++); |
365 | if(*(big_buffer + x) != '=') | 392 | if(*(big_buffer + x) != '=') |
366 | continue; | 393 | continue; |
367 | for(x++; *(big_buffer+x) == '\t' || *(big_buffer+x) == ' '; x++); | 394 | for(x++; *(big_buffer+x) == '\t' || *(big_buffer+x) == ' '; x++); |
368 | char quote = 0; | 395 | char quote = 0; |
369 | if(*(big_buffer+x) == '\'' || *(big_buffer+x) == '"') { | 396 | if(*(big_buffer+x) == '\'' || *(big_buffer+x) == '"') { |
370 | quote = *(big_buffer + x); | 397 | quote = *(big_buffer + x); |
371 | x++; | 398 | x++; |
372 | } | 399 | } |
373 | int val_len; | 400 | int val_len; |
374 | for(val_len = 0; TRUE; val_len++) { | 401 | for(val_len = 0; TRUE; val_len++) { |
375 | if(quote) { | 402 | if(quote) { |
376 | if(*(big_buffer+x+val_len) == quote) | 403 | if(*(big_buffer+x+val_len) == quote) |
377 | break; | 404 | break; |
378 | } else if(*(big_buffer + x + val_len) == '>' || | 405 | } else if(*(big_buffer + x + val_len) == '>' || |
379 | *(big_buffer + x + val_len) == ' ') { | 406 | *(big_buffer + x + val_len) == ' ') { |
380 | break; | 407 | break; |
381 | } | 408 | } |
382 | } | 409 | } |
383 | char saved = *(big_buffer + x + val_len); | 410 | char saved = *(big_buffer + x + val_len); |
384 | *(big_buffer + x + val_len) = '\0'; | 411 | *(big_buffer + x + val_len) = '\0'; |
385 | QString where = big_buffer + x; | 412 | QString where = big_buffer + x; |
386 | *(big_buffer + x + val_len) = saved; | 413 | *(big_buffer + x + val_len) = saved; |
387 | if(where == "in implementation") { | 414 | if(where == "in implementation") { |
388 | QString cpp = fn.left(fn.length() - Option::ui_ext.length()) + | 415 | QString cpp = fn.left(fn.length() - Option::ui_ext.length()) + |
389 | Option::cpp_ext.first(); | 416 | Option::cpp_ext.first(); |
390 | outdeps = &findDependencies(cpp); | 417 | outdeps = &findDependencies(cpp); |
391 | } | 418 | } |
392 | } | 419 | } |
393 | } | 420 | } |
394 | int inc_len = 0; | 421 | int inc_len = 0; |
395 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); | 422 | for(x += 1 ; *(big_buffer + x + inc_len) != '<'; inc_len++); |
396 | *(big_buffer + x + inc_len) = '\0'; | 423 | *(big_buffer + x + inc_len) = '\0'; |
397 | inc = big_buffer + x; | 424 | inc = big_buffer + x; |
398 | } | 425 | } |
399 | } | 426 | } |
400 | } | 427 | } |
401 | 428 | ||
402 | if(!inc.isEmpty()) { | 429 | if(!inc.isEmpty()) { |
403 | bool from_source_dir = TRUE; | 430 | bool from_source_dir = TRUE; |
404 | debug_msg(5, "%s:%d Found dependency to %s", fix_env_fn.latin1(), | 431 | debug_msg(5, "%s:%d Found dependency to %s", fix_env_fn.latin1(), |
405 | line_count, inc.latin1()); | 432 | line_count, inc.latin1()); |
406 | if(!project->isEmpty("SKIP_DEPENDS")) { | 433 | if(!project->isEmpty("SKIP_DEPENDS")) { |
407 | bool found = FALSE; | 434 | bool found = FALSE; |
408 | QStringList &nodeplist = project->values("SKIP_DEPENDS"); | 435 | QStringList &nodeplist = project->values("SKIP_DEPENDS"); |
409 | for(QStringList::Iterator it = nodeplist.begin(); | 436 | for(QStringList::Iterator it = nodeplist.begin(); |
410 | it != nodeplist.end(); ++it) { | 437 | it != nodeplist.end(); ++it) { |
411 | QRegExp regx((*it)); | 438 | QRegExp regx((*it)); |
412 | if(regx.search(inc) != -1) { | 439 | if(regx.search(inc) != -1) { |
413 | found = TRUE; | 440 | found = TRUE; |
414 | break; | 441 | break; |
415 | } | 442 | } |
416 | } | 443 | } |
417 | if(found) | 444 | if(found) |
418 | continue; | 445 | continue; |
419 | } | 446 | } |
420 | |||
421 | QString fqn; | 447 | QString fqn; |
422 | if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && | 448 | if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && |
423 | !stat(fix_env_fndir + inc, &fst) && !S_ISDIR(fst.st_mode)) { | 449 | !stat(fix_env_fndir + inc, &fst) && !S_ISDIR(fst.st_mode)) { |
424 | fqn = fndir + inc; | 450 | fqn = fndir + inc; |
425 | goto handle_fqn; | 451 | goto handle_fqn; |
452 | } else if(project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH") && | ||
453 | !stat(inc, &fst) && !S_ISDIR(fst.st_mode)) { | ||
454 | fqn = inc; | ||
455 | goto handle_fqn; | ||
426 | } else { | 456 | } else { |
427 | if((Option::target_mode == Option::TARG_MAC9_MODE && inc.find(':')) || | 457 | if((Option::target_mode == Option::TARG_MAC9_MODE && inc.find(':')) || |
428 | (Option::target_mode == Option::TARG_WIN_MODE && inc[1] != ':') || | 458 | (Option::target_mode == Option::TARG_WIN_MODE && inc[1] != ':') || |
429 | ((Option::target_mode == Option::TARG_UNIX_MODE || | 459 | ((Option::target_mode == Option::TARG_UNIX_MODE || |
430 | Option::target_mode == Option::TARG_QNX6_MODE || | 460 | Option::target_mode == Option::TARG_QNX6_MODE || |
431 | Option::target_mode == Option::TARG_MACX_MODE) && | 461 | Option::target_mode == Option::TARG_MACX_MODE) && |
432 | inc[0] != '/')) { | 462 | inc[0] != '/')) { |
433 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { | 463 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { |
434 | if(!stat(mdd->local_dir + QDir::separator() + inc, &fst) && | 464 | if(!stat(mdd->local_dir + QDir::separator() + inc, &fst) && |
435 | !S_ISDIR(fst.st_mode)) { | 465 | !S_ISDIR(fst.st_mode)) { |
436 | fqn = mdd->real_dir + QDir::separator() + inc; | 466 | fqn = mdd->real_dir + QDir::separator() + inc; |
437 | goto handle_fqn; | 467 | goto handle_fqn; |
438 | } | 468 | } |
439 | } | 469 | } |
440 | } | 470 | } |
441 | } | 471 | } |
442 | if(fqn.isEmpty() && Option::mkfile::do_dep_heuristics) { | 472 | if(fqn.isEmpty() && Option::mkfile::do_dep_heuristics) { |
443 | //these are some hacky heuristics it will try to do on an include | 473 | //these are some hacky heuristics it will try to do on an include |
444 | //however these can be turned off at runtime, I'm not sure how | 474 | //however these can be turned off at runtime, I'm not sure how |
445 | //reliable these will be, most likely when problems arise turn it off | 475 | //reliable these will be, most likely when problems arise turn it off |
446 | //and see if they go away.. | 476 | //and see if they go away.. |
447 | if(depHeuristics.contains(inc)) { | 477 | if(depHeuristics.contains(inc)) { |
448 | fqn = depHeuristics[inc]; | 478 | fqn = depHeuristics[inc]; |
479 | from_source_dir = FALSE; | ||
449 | } else if(Option::mkfile::do_dep_heuristics) { //some heuristics.. | 480 | } else if(Option::mkfile::do_dep_heuristics) { //some heuristics.. |
450 | //is it a file from a .ui? | 481 | //is it a file from a .ui? |
451 | QString inc_file = inc.section(Option::dir_sep, -1); | 482 | QString inc_file = inc.section(Option::dir_sep, -1); |
452 | int extn = inc_file.findRev('.'); | 483 | int extn = inc_file.findRev('.'); |
453 | if(extn != -1 && | 484 | if(extn != -1 && |
454 | (inc_file.right(inc_file.length()-extn) == Option::cpp_ext.first() || | 485 | (inc_file.right(inc_file.length()-extn) == Option::cpp_ext.first() || |
455 | inc_file.right(inc_file.length()-extn) == Option::h_ext.first())) { | 486 | inc_file.right(inc_file.length()-extn) == Option::h_ext.first())) { |
456 | QString uip = inc_file.left(extn) + Option::ui_ext; | 487 | QString uip = inc_file.left(extn) + Option::ui_ext; |
457 | QStringList uil = project->variables()["FORMS"]; | 488 | QStringList uil = project->variables()["FORMS"]; |
458 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); ++it) { | 489 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); ++it) { |
459 | if((*it).section(Option::dir_sep, -1) == uip) { | 490 | if((*it).section(Option::dir_sep, -1) == uip) { |
460 | if(!project->isEmpty("UI_DIR")) | 491 | if(!project->isEmpty("UI_DIR")) |
461 | fqn = project->first("UI_DIR"); | 492 | fqn = project->first("UI_DIR"); |
462 | else if(!project->isEmpty("UI_HEADERS_DIR")) | 493 | else if(!project->isEmpty("UI_HEADERS_DIR")) |
463 | fqn = project->first("UI_HEADERS_DIR"); | 494 | fqn = project->first("UI_HEADERS_DIR"); |
464 | else | 495 | else |
465 | fqn = (*it).section(Option::dir_sep, 0, -2); | 496 | fqn = (*it).section(Option::dir_sep, 0, -2); |
466 | if(!fqn.isEmpty() && !fqn.endsWith(Option::dir_sep)) | 497 | if(!fqn.isEmpty() && !fqn.endsWith(Option::dir_sep)) |
467 | fqn += Option::dir_sep; | 498 | fqn += Option::dir_sep; |
468 | fqn += inc_file; | 499 | fqn += inc_file; |
469 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) | 500 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) |
470 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); | 501 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); |
471 | goto handle_fqn; | 502 | goto cache_fqn; |
472 | } | 503 | } |
473 | } | 504 | } |
474 | } | 505 | } |
475 | if(project->isActiveConfig("lex_included")) { //is this the lex file? | 506 | if(project->isActiveConfig("lex_included")) { //is this the lex file? |
476 | QString rhs = Option::lex_mod + Option::cpp_ext.first(); | 507 | QString rhs = Option::lex_mod + Option::cpp_ext.first(); |
477 | if(inc.endsWith(rhs)) { | 508 | if(inc.endsWith(rhs)) { |
478 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::lex_ext; | 509 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::lex_ext; |
479 | QStringList ll = project->variables()["LEXSOURCES"]; | 510 | QStringList ll = project->variables()["LEXSOURCES"]; |
480 | for(QStringList::Iterator it = ll.begin(); it != ll.end(); ++it) { | 511 | for(QStringList::Iterator it = ll.begin(); it != ll.end(); ++it) { |
481 | QString s = (*it), d; | 512 | QString s = (*it), d; |
482 | int slsh = s.findRev(Option::dir_sep); | 513 | int slsh = s.findRev(Option::dir_sep); |
483 | if(slsh != -1) { | 514 | if(slsh != -1) { |
484 | d = s.left(slsh + 1); | 515 | d = s.left(slsh + 1); |
485 | s = s.right(s.length() - slsh - 1); | 516 | s = s.right(s.length() - slsh - 1); |
486 | } | 517 | } |
487 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 518 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
488 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); | 519 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); |
489 | if(s == lhs) { | 520 | if(s == lhs) { |
490 | fqn = d + inc; | 521 | fqn = d + inc; |
491 | goto handle_fqn; | 522 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) |
523 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); | ||
524 | goto cache_fqn; | ||
492 | } | 525 | } |
493 | } | 526 | } |
494 | } | 527 | } |
495 | } | 528 | } |
496 | { //is it from a .y? | 529 | { //is it from a .y? |
497 | QString rhs = Option::yacc_mod + Option::h_ext.first(); | 530 | QString rhs = Option::yacc_mod + Option::h_ext.first(); |
498 | if(inc.endsWith(rhs)) { | 531 | if(inc.endsWith(rhs)) { |
499 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::yacc_ext; | 532 | QString lhs = inc.left(inc.length() - rhs.length()) + Option::yacc_ext; |
500 | QStringList yl = project->variables()["YACCSOURCES"]; | 533 | QStringList yl = project->variables()["YACCSOURCES"]; |
501 | for(QStringList::Iterator it = yl.begin(); it != yl.end(); ++it) { | 534 | for(QStringList::Iterator it = yl.begin(); it != yl.end(); ++it) { |
502 | QString s = (*it), d; | 535 | QString s = (*it), d; |
503 | int slsh = s.findRev(Option::dir_sep); | 536 | int slsh = s.findRev(Option::dir_sep); |
504 | if(slsh != -1) { | 537 | if(slsh != -1) { |
505 | d = s.left(slsh + 1); | 538 | d = s.left(slsh + 1); |
506 | s = s.right(s.length() - slsh - 1); | 539 | s = s.right(s.length() - slsh - 1); |
507 | } | 540 | } |
508 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 541 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
509 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); | 542 | d = project->first("QMAKE_ABSOLUTE_SOURCE_PATH"); |
510 | if(s == lhs) { | 543 | if(s == lhs) { |
511 | fqn = d + inc; | 544 | fqn = d + inc; |
512 | goto handle_fqn; | 545 | from_source_dir = FALSE; //uics go in the output_dir (so don't fix them) |
546 | fqn = fileFixify(fqn, QDir::currentDirPath(), Option::output_dir); | ||
547 | goto cache_fqn; | ||
513 | } | 548 | } |
514 | } | 549 | } |
515 | } | 550 | } |
516 | } | 551 | } |
517 | if(mocAware() && //is it a moc file? | 552 | if( mocAware() && //is it a moc file? |
518 | (inc.endsWith(Option::cpp_ext.first()) || inc.endsWith(Option::moc_ext))) { | 553 | ( inc.endsWith(Option::cpp_ext.first()) || inc.endsWith(Option::cpp_moc_ext) ) |
554 | || ( (Option::cpp_ext.first() != Option::h_moc_ext) && inc.endsWith(Option::h_moc_ext) )) { | ||
519 | QString mocs[] = { QString("_HDRMOC"), QString("_SRCMOC"), QString::null }; | 555 | QString mocs[] = { QString("_HDRMOC"), QString("_SRCMOC"), QString::null }; |
520 | for(int moc = 0; !mocs[moc].isNull(); moc++) { | 556 | for(int moc = 0; !mocs[moc].isNull(); moc++) { |
521 | QStringList &l = project->variables()[mocs[moc]]; | 557 | QStringList &l = project->variables()[mocs[moc]]; |
522 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 558 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
523 | QString file = Option::fixPathToTargetOS((*it)); | 559 | QString file = Option::fixPathToTargetOS((*it)); |
524 | if(file.section(Option::dir_sep, -(inc.contains('/')+1)) == inc) { | 560 | if(file.section(Option::dir_sep, -(inc.contains('/')+1)) == inc) { |
525 | fqn = (*it); | 561 | fqn = (*it); |
526 | if(mocs[moc] == "_HDRMOC") { | 562 | if(mocs[moc] == "_HDRMOC") { |
527 | //Since it is include, no need to link it in as well | 563 | //Since it is include, no need to link it in as well |
528 | project->variables()["_SRCMOC"].append((*it)); | 564 | project->variables()["_SRCMOC"].append((*it)); |
529 | l.remove(it); | 565 | l.remove(it); |
530 | } else if(!findMocSource(fqn).endsWith(fn)) { | 566 | } else if(!findMocSource(fqn).endsWith(fileFixify(fn))) { |
531 | /* Not really a very good test, but this will at least avoid | 567 | /* Not really a very good test, but this will at least avoid |
532 | confusion if it really does happen (since tmake/qmake | 568 | confusion if it really does happen (since tmake/qmake |
533 | previously didn't even allow this the test is mostly accurate) */ | 569 | previously didn't even allow this the test is mostly accurate) */ |
534 | warn_msg(WarnLogic, | 570 | warn_msg(WarnLogic, |
535 | "Found potential multiple MOC include %s (%s) in '%s'", | 571 | "Found potential multiple MOC include %s (%s) in '%s'", |
536 | inc.latin1(), fqn.latin1(), fix_env_fn.latin1()); | 572 | inc.latin1(), fqn.latin1(), fix_env_fn.latin1()); |
537 | } | 573 | } |
538 | from_source_dir = FALSE; //mocs go in the output_dir (so don't fix them) | 574 | from_source_dir = FALSE; //mocs go in the output_dir (so don't fix them) |
539 | goto handle_fqn; | 575 | goto cache_fqn; |
540 | } | 576 | } |
541 | } | 577 | } |
542 | } | 578 | } |
543 | } | 579 | } |
580 | fqn = findDependency(inc); //all else fails.. | ||
581 | cache_fqn: | ||
582 | if(from_source_dir) { | ||
583 | fqn = fileFixify(fqn); | ||
584 | from_source_dir = FALSE; | ||
585 | } | ||
544 | depHeuristics.insert(inc, fqn); | 586 | depHeuristics.insert(inc, fqn); |
545 | } | 587 | } |
546 | } | 588 | } |
547 | handle_fqn: | 589 | handle_fqn: |
548 | if(fqn.isEmpty()) //I give up | 590 | if(fqn.isEmpty()) //I give up |
549 | continue; | 591 | continue; |
550 | fqn = Option::fixPathToTargetOS(fqn, FALSE); | 592 | fqn = Option::fixPathToTargetOS(fqn, FALSE); |
551 | if(from_source_dir) | 593 | if(from_source_dir) |
552 | fqn = fileFixify(fqn); | 594 | fqn = fileFixify(fqn); |
553 | debug_msg(4, "Resolved dependency of %s to %s", inc.latin1(), fqn.latin1()); | 595 | debug_msg(4, "Resolved dependency of %s to %s", inc.latin1(), fqn.latin1()); |
554 | if(outdeps && outdeps->findIndex(fqn) == -1) | 596 | if(outdeps && outdeps->findIndex(fqn) == -1) |
555 | outdeps->append(fqn); | 597 | outdeps->append(fqn); |
556 | } | 598 | } |
557 | //read past new line now.. | 599 | //read past new line now.. |
558 | for( ; x < total_size_read && (*(big_buffer + x) != '\n'); x++); | 600 | for( ; x < total_size_read && !QMAKE_EOL(*(big_buffer + x)); x++); |
559 | line_count++; | 601 | line_count++; |
560 | } | 602 | } |
561 | 603 | ||
562 | if(recurse) { | 604 | if(recurse) { |
563 | for(QStringList::Iterator fnit = fndeps.begin(); fnit != fndeps.end(); ++fnit) { | 605 | for(QStringList::Iterator fnit = fndeps.begin(); fnit != fndeps.end(); ++fnit) { |
564 | generateDependencies(dirs, (*fnit), recurse); | 606 | generateDependencies(dirs, (*fnit), recurse); |
565 | QStringList &deplist = findDependencies((*fnit)); | 607 | QStringList &deplist = findDependencies((*fnit)); |
566 | for(QStringList::Iterator it = deplist.begin(); it != deplist.end(); ++it) | 608 | for(QStringList::Iterator it = deplist.begin(); it != deplist.end(); ++it) |
567 | if(fndeps.findIndex((*it)) == -1) | 609 | if(fndeps.findIndex((*it)) == -1 && (*it) != fn) |
568 | fndeps.append((*it)); | 610 | fndeps.append((*it)); |
569 | } | 611 | } |
570 | } | 612 | } |
571 | debug_msg(2, "Dependencies: %s -> %s", fn.latin1(), fndeps.join(" :: ").latin1()); | 613 | debug_msg(2, "Dependencies: %s -> %s", fn.latin1(), fndeps.join(" :: ").latin1()); |
572 | return TRUE; | 614 | return TRUE; |
573 | } | 615 | } |
574 | 616 | ||
575 | void | 617 | void |
576 | MakefileGenerator::initOutPaths() | 618 | MakefileGenerator::initOutPaths() |
577 | { | 619 | { |
578 | if(init_opath_already) | 620 | if(init_opath_already) |
579 | return; | 621 | return; |
580 | init_opath_already = TRUE; | 622 | init_opath_already = TRUE; |
581 | QMap<QString, QStringList> &v = project->variables(); | 623 | QMap<QString, QStringList> &v = project->variables(); |
582 | if(!v.contains("QMAKE_ABSOLUTE_SOURCE_PATH")) { | 624 | if(!v.contains("QMAKE_ABSOLUTE_SOURCE_PATH")) { |
583 | if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty() && | 625 | if(Option::mkfile::do_cache && !Option::mkfile::cachefile.isEmpty() && |
584 | v.contains("QMAKE_ABSOLUTE_SOURCE_ROOT")) { | 626 | v.contains("QMAKE_ABSOLUTE_SOURCE_ROOT")) { |
585 | QString root = v["QMAKE_ABSOLUTE_SOURCE_ROOT"].first(); | 627 | QString root = v["QMAKE_ABSOLUTE_SOURCE_ROOT"].first(); |
586 | root = Option::fixPathToTargetOS( root ); | 628 | root = Option::fixPathToTargetOS( root ); |
587 | if(!root.isEmpty()) { | 629 | if(!root.isEmpty()) { |
588 | QFileInfo fi(Option::mkfile::cachefile); | 630 | QFileInfo fi(Option::mkfile::cachefile); |
589 | if(!fi.convertToAbs()) { | 631 | if(!fi.convertToAbs()) { |
590 | QString cache_r = fi.dirPath(), pwd = Option::output_dir; | 632 | QString cache_r = fi.dirPath(), pwd = Option::output_dir; |
591 | if ( pwd.startsWith(cache_r) && !pwd.startsWith(root) ) { | 633 | if ( pwd.startsWith(cache_r) && !pwd.startsWith(root) ) { |
592 | pwd = Option::fixPathToTargetOS(root + pwd.mid(cache_r.length())); | 634 | pwd = Option::fixPathToTargetOS(root + pwd.mid(cache_r.length())); |
593 | if(QFile::exists(pwd)) | 635 | if(QFile::exists(pwd)) |
594 | v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", pwd); | 636 | v.insert("QMAKE_ABSOLUTE_SOURCE_PATH", pwd); |
595 | } | 637 | } |
596 | } | 638 | } |
597 | } | 639 | } |
598 | } | 640 | } |
599 | } | 641 | } |
600 | if(!v["QMAKE_ABSOLUTE_SOURCE_PATH"].isEmpty()) { | 642 | if(!v["QMAKE_ABSOLUTE_SOURCE_PATH"].isEmpty()) { |
601 | QString &asp = v["QMAKE_ABSOLUTE_SOURCE_PATH"].first(); | 643 | QString &asp = v["QMAKE_ABSOLUTE_SOURCE_PATH"].first(); |
602 | asp = Option::fixPathToTargetOS( asp ); | 644 | asp = Option::fixPathToTargetOS( asp ); |
603 | if(asp.isEmpty() || asp == Option::output_dir) //if they're the same, why bother? | 645 | if(asp.isEmpty() || asp == Option::output_dir) //if they're the same, why bother? |
604 | v["QMAKE_ABSOLUTE_SOURCE_PATH"].clear(); | 646 | v["QMAKE_ABSOLUTE_SOURCE_PATH"].clear(); |
605 | } | 647 | } |
606 | QString currentDir = QDir::currentDirPath(); | 648 | QString currentDir = QDir::currentDirPath(); |
607 | QString dirs[] = { QString("OBJECTS_DIR"), QString("MOC_DIR"), QString("UI_HEADERS_DIR"), | 649 | QString dirs[] = { QString("OBJECTS_DIR"), QString("MOC_DIR"), QString("UI_HEADERS_DIR"), |
608 | QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString("DESTDIR"), | 650 | QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString("DESTDIR"), |
609 | QString("SUBLIBS_DIR"), QString::null }; | 651 | QString("SUBLIBS_DIR"), QString("DLLDESTDIR"), QString::null }; |
610 | for(int x = 0; dirs[x] != QString::null; x++) { | 652 | for(int x = 0; dirs[x] != QString::null; x++) { |
611 | if ( !v[dirs[x]].isEmpty() ) { | 653 | if ( !v[dirs[x]].isEmpty() ) { |
612 | QString orig_path = v[dirs[x]].first(); | 654 | QString orig_path = v[dirs[x]].first(); |
655 | #ifdef Q_WS_WIN | ||
656 | // We don't want to add a separator for DLLDESTDIR on Windows | ||
657 | if (!(dirs[x] == "DLLDESTDIR")) | ||
658 | #endif | ||
613 | { | 659 | { |
614 | QString &path = v[dirs[x]].first(); | 660 | QString &path = v[dirs[x]].first(); |
615 | path = fileFixify(path, Option::output_dir, Option::output_dir); | 661 | path = fileFixify(path, Option::output_dir, Option::output_dir); |
616 | if(path.right(Option::dir_sep.length()) != Option::dir_sep) | 662 | if(path.right(Option::dir_sep.length()) != Option::dir_sep) |
617 | path += Option::dir_sep; | 663 | path += Option::dir_sep; |
618 | } | 664 | } |
619 | if(noIO()) | 665 | if(noIO()) |
620 | continue; | 666 | continue; |
621 | 667 | ||
622 | QString path = project->first(dirs[x]); //not to be changed any further | 668 | QString path = project->first(dirs[x]); //not to be changed any further |
623 | path = Option::fixPathToTargetOS(fileFixify(path, QDir::currentDirPath(), Option::output_dir)); | 669 | path = Option::fixPathToTargetOS(fileFixify(path, QDir::currentDirPath(), Option::output_dir)); |
624 | debug_msg(3, "Fixed output_dir %s (%s) into %s (%s)", dirs[x].latin1(), orig_path.latin1(), | 670 | debug_msg(3, "Fixed output_dir %s (%s) into %s (%s)", dirs[x].latin1(), orig_path.latin1(), |
625 | v[dirs[x]].join("::").latin1(), path.latin1()); | 671 | v[dirs[x]].join("::").latin1(), path.latin1()); |
626 | 672 | ||
627 | QDir d; | 673 | QDir d; |
628 | if(path.startsWith(Option::dir_sep)) { | 674 | if(path.startsWith(Option::dir_sep)) { |
629 | d.cd(Option::dir_sep); | 675 | d.cd(Option::dir_sep); |
630 | path = path.right(path.length() - 1); | 676 | path = path.right(path.length() - 1); |
631 | } | 677 | } |
632 | #ifdef Q_WS_WIN | 678 | #ifdef Q_WS_WIN |
633 | bool driveExists = TRUE; | 679 | bool driveExists = TRUE; |
634 | if ( !QDir::isRelativePath( path ) ) { | 680 | if ( !QDir::isRelativePath( path ) ) { |
635 | if ( QFile::exists( path.left( 3 ) ) ) { | 681 | if ( QFile::exists( path.left( 3 ) ) ) { |
636 | d.cd( path.left( 3 ) ); | 682 | d.cd( path.left( 3 ) ); |
637 | path = path.right( path.length() - 3 ); | 683 | path = path.right( path.length() - 3 ); |
638 | } else { | 684 | } else { |
639 | warn_msg(WarnLogic, "%s: Cannot access drive '%s' (%s)", dirs[x].latin1(), | 685 | warn_msg(WarnLogic, "%s: Cannot access drive '%s' (%s)", dirs[x].latin1(), |
640 | path.left( 3 ).latin1(), path.latin1() ); | 686 | path.left( 3 ).latin1(), path.latin1() ); |
641 | driveExists = FALSE; | 687 | driveExists = FALSE; |
642 | } | 688 | } |
643 | } | 689 | } |
644 | if ( driveExists ) { | 690 | if ( driveExists ) { |
645 | #endif | 691 | #endif |
646 | QStringList subs = QStringList::split(Option::dir_sep, path); | 692 | QStringList subs = QStringList::split(Option::dir_sep, path); |
647 | for(QStringList::Iterator subit = subs.begin(); subit != subs.end(); ++subit) { | 693 | for(QStringList::Iterator subit = subs.begin(); subit != subs.end(); ++subit) { |
648 | if(!d.cd(*subit)) { | 694 | if(!d.cd(*subit)) { |
649 | d.mkdir((*subit)); | 695 | d.mkdir((*subit)); |
650 | if ( d.exists( (*subit) ) ) | 696 | if ( d.exists( (*subit) ) ) |
651 | d.cd((*subit)); | 697 | d.cd((*subit)); |
652 | else { | 698 | else { |
653 | warn_msg(WarnLogic, "%s: Cannot access directory '%s' (%s)", dirs[x].latin1(), | 699 | warn_msg(WarnLogic, "%s: Cannot access directory '%s' (%s)", dirs[x].latin1(), |
654 | (*subit).latin1(), path.latin1() ); | 700 | (*subit).latin1(), path.latin1() ); |
655 | break; | 701 | break; |
656 | } | 702 | } |
657 | } | 703 | } |
658 | } | 704 | } |
659 | #ifdef Q_WS_WIN | 705 | #ifdef Q_WS_WIN |
660 | } | 706 | } |
661 | #endif | 707 | #endif |
662 | } | 708 | } |
663 | } | 709 | } |
710 | if ( !v["DESTDIR"].isEmpty() ) { | ||
711 | QDir d(v["DESTDIR"].first()); | ||
712 | if(Option::fixPathToLocalOS(d.absPath()) == Option::fixPathToLocalOS(Option::output_dir)) | ||
713 | v.remove("DESTDIR"); | ||
714 | } | ||
664 | QDir::current().cd( currentDir ); | 715 | QDir::current().cd( currentDir ); |
665 | } | 716 | } |
666 | 717 | ||
667 | void | 718 | void |
668 | MakefileGenerator::init() | 719 | MakefileGenerator::init() |
669 | { | 720 | { |
670 | initOutPaths(); | 721 | initOutPaths(); |
671 | if(init_already) | 722 | if(init_already) |
672 | return; | 723 | return; |
673 | init_already = TRUE; | 724 | init_already = TRUE; |
674 | 725 | ||
675 | QMap<QString, QStringList> &v = project->variables(); | 726 | QMap<QString, QStringList> &v = project->variables(); |
676 | QString paths[] = { QString("SOURCES"), QString("FORMS"), QString("YACCSOURCES"), QString("INCLUDEPATH"), | 727 | QString paths[] = { QString("SOURCES"), QString("FORMS"), QString("YACCSOURCES"), QString("INCLUDEPATH"), |
677 | QString("HEADERS"), QString("HEADERS_ORIG"), | 728 | QString("HEADERS"), QString("HEADERS_ORIG"), QString("LEXSOURCES"), |
678 | QString("LEXSOURCES"), QString("QMAKE_INTERNAL_INCLUDED_FILES"), QString::null }; | 729 | QString("QMAKE_INTERNAL_INCLUDED_FILES"), |
730 | QString("PRECOMPILED_HEADER"), QString::null }; | ||
679 | for(int y = 0; paths[y] != QString::null; y++) { | 731 | for(int y = 0; paths[y] != QString::null; y++) { |
680 | QStringList &l = v[paths[y]]; | 732 | QStringList &l = v[paths[y]]; |
681 | if(!l.isEmpty()) | 733 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
682 | l = fileFixify(l); | 734 | if ((*it).isEmpty()) |
735 | continue; | ||
736 | if(QFile::exists((*it))) | ||
737 | (*it) = fileFixify((*it)); | ||
738 | } | ||
683 | } | 739 | } |
684 | 740 | ||
685 | /* get deps and mocables */ | 741 | /* get deps and mocables */ |
686 | QDict<void> cache_found_files; | 742 | QDict<void> cache_found_files; |
687 | QString cache_file(".qmake.internal.cache"); | 743 | QString cache_file(".qmake.internal.cache"); |
688 | if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) | 744 | if(!project->isEmpty("QMAKE_INTERNAL_CACHE_FILE")) |
689 | cache_file = Option::fixPathToLocalOS(project->first("QMAKE_INTERNAL_CACHE_FILE")); | 745 | 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.. | 746 | if(cache_file.find(QDir::separator()) == -1) //guess they know what they are doing.. |
691 | cache_file.prepend(Option::output_dir + QDir::separator()); | 747 | cache_file.prepend(Option::output_dir + QDir::separator()); |
692 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | 748 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || |
693 | Option::mkfile::do_deps || Option::mkfile::do_mocs) && !noIO()) { | 749 | Option::mkfile::do_deps || Option::mkfile::do_mocs) && !noIO()) { |
694 | QPtrList<MakefileDependDir> deplist; | 750 | QPtrList<MakefileDependDir> deplist; |
695 | deplist.setAutoDelete(TRUE); | 751 | deplist.setAutoDelete(TRUE); |
696 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || Option::mkfile::do_deps) && | 752 | if((Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || Option::mkfile::do_deps) && |
697 | doDepends()) { | 753 | doDepends()) { |
698 | QStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; | 754 | QStringList incDirs = v["DEPENDPATH"] + v["QMAKE_ABSOLUTE_SOURCE_PATH"]; |
699 | if(project->isActiveConfig("depend_includepath")) | 755 | if(project->isActiveConfig("depend_includepath")) |
700 | incDirs += v["INCLUDEPATH"]; | 756 | incDirs += v["INCLUDEPATH"]; |
701 | for(QStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) { | 757 | for(QStringList::Iterator it = incDirs.begin(); it != incDirs.end(); ++it) { |
702 | QString r = (*it), l = Option::fixPathToLocalOS((*it)); | 758 | QString r = (*it), l = Option::fixPathToLocalOS((*it)); |
703 | deplist.append(new MakefileDependDir(r.replace("\"",""), | 759 | deplist.append(new MakefileDependDir(r.replace("\"",""), |
704 | l.replace("\"",""))); | 760 | l.replace("\"",""))); |
705 | } | 761 | } |
706 | debug_msg(1, "Dependency Directories: %s", incDirs.join(" :: ").latin1()); | 762 | debug_msg(1, "Dependency Directories: %s", incDirs.join(" :: ").latin1()); |
707 | if(Option::output.name() != "-" && project->isActiveConfig("qmake_cache")) { | 763 | if(Option::output.name() != "-" && project->isActiveConfig("qmake_cache")) { |
708 | QFile cachef(cache_file); | 764 | QFile cachef(cache_file); |
709 | if(cachef.open(IO_ReadOnly | IO_Translate)) { | 765 | if(cachef.open(IO_ReadOnly | IO_Translate)) { |
710 | QFileInfo cachefi(cache_file); | 766 | QFileInfo cachefi(cache_file); |
711 | debug_msg(2, "Trying internal cache information: %s", cache_file.latin1()); | 767 | debug_msg(2, "Trying internal cache information: %s", cache_file.latin1()); |
712 | QTextStream cachet(&cachef); | 768 | QTextStream cachet(&cachef); |
713 | QString line, file; | 769 | QString line, file; |
714 | enum { CacheInfo, CacheDepend, CacheMoc } state = CacheInfo; | 770 | enum { CacheInfo, CacheDepend, CacheMoc } state = CacheInfo; |
715 | while (!cachet.eof()) { | 771 | while (!cachet.eof()) { |
716 | line = cachet.readLine().stripWhiteSpace(); | 772 | line = cachet.readLine().stripWhiteSpace(); |
717 | int sep = line.find('='); | 773 | int sep = line.find('='); |
718 | if(line == "[depend]") { | 774 | if(line == "[depend]") { |
719 | state = CacheDepend; | 775 | state = CacheDepend; |
720 | } else if(line == "[mocable]") { | 776 | } else if(line == "[mocable]") { |
721 | state = CacheMoc; | 777 | state = CacheMoc; |
722 | } else if(line == "[check]") { | 778 | } else if(line == "[check]") { |
723 | state = CacheInfo; | 779 | state = CacheInfo; |
724 | } else if(!line.isEmpty() && sep != -1) { | 780 | } else if(!line.isEmpty() && sep != -1) { |
725 | file = line.left(sep).stripWhiteSpace(); | 781 | file = line.left(sep).stripWhiteSpace(); |
726 | line = line.right(line.length() - sep - 1).stripWhiteSpace(); | 782 | line = line.right(line.length() - sep - 1).stripWhiteSpace(); |
727 | if(state == CacheInfo) { | 783 | if(state == CacheInfo) { |
728 | if(file == "QMAKE_CACHE_VERSION") { | 784 | if(file == "QMAKE_CACHE_VERSION") { |
729 | if(line != qmake_version()) | 785 | if(line != qmake_version()) |
730 | break; | 786 | break; |
731 | } else { | 787 | } else { |
732 | const QStringList &l = project->variables()[file]; | 788 | const QStringList &l = project->variables()[file]; |
733 | if(!l.isEmpty() && !line.isEmpty() && l.join(" ") != line) | 789 | if(!l.isEmpty() && !line.isEmpty() && l.join(" ") != line) |
734 | break; | 790 | break; |
735 | } | 791 | } |
736 | } else if(state == CacheDepend) { | 792 | } else if(state == CacheDepend) { |
737 | bool found = (bool)cache_found_files[file]; | 793 | bool found = (bool)cache_found_files[file]; |
738 | QStringList files = QStringList::split(" ", line); | 794 | QStringList files = QStringList::split(" ", line); |
739 | if(!found) { | 795 | if(!found) { |
740 | QFileInfo fi(fileFixify(file, QDir::currentDirPath(), Option::output_dir)); | 796 | QFileInfo fi(fileFixify(file, QDir::currentDirPath(), Option::output_dir)); |
741 | if(fi.exists() && fi.lastModified() < cachefi.lastModified()) { | 797 | if(fi.exists() && fi.lastModified() < cachefi.lastModified()) { |
742 | cache_found_files.insert(file, (void *)1); | 798 | cache_found_files.insert(file, (void *)1); |
743 | found = TRUE; | 799 | found = TRUE; |
744 | } | 800 | } |
745 | } | 801 | } |
746 | if(found) { | 802 | if(found) { |
747 | for(QStringList::Iterator dep_it = files.begin(); | 803 | for(QStringList::Iterator dep_it = files.begin(); |
748 | dep_it != files.end(); ++dep_it) { | 804 | dep_it != files.end(); ++dep_it) { |
749 | if(!cache_found_files[(*dep_it)]) { | 805 | if(!cache_found_files[(*dep_it)]) { |
750 | QFileInfo fi(fileFixify((*dep_it), QDir::currentDirPath(), Option::output_dir)); | 806 | QFileInfo fi(fileFixify((*dep_it), QDir::currentDirPath(), Option::output_dir)); |
751 | if(fi.exists() && | 807 | if(fi.exists() && |
752 | fi.lastModified() < cachefi.lastModified()) { | 808 | fi.lastModified() < cachefi.lastModified()) { |
753 | cache_found_files.insert((*dep_it), (void *)1); | 809 | cache_found_files.insert((*dep_it), (void *)1); |
754 | } else { | 810 | } else { |
755 | found = FALSE; | 811 | found = FALSE; |
756 | break; | 812 | break; |
757 | } | 813 | } |
758 | } | 814 | } |
759 | } | 815 | } |
760 | if(found) { | 816 | if(found) { |
761 | debug_msg(2, "Dependencies (cached): %s -> %s", file.latin1(), | 817 | debug_msg(2, "Dependencies (cached): %s -> %s", file.latin1(), |
762 | files.join(" :: ").latin1()); | 818 | files.join(" :: ").latin1()); |
763 | findDependencies(file) = files; | 819 | findDependencies(file) = files; |
820 | setProcessedDependencies(file, TRUE); | ||
764 | } | 821 | } |
765 | } | 822 | } |
766 | } else { | 823 | } else { |
767 | void *found = cache_found_files[file]; | 824 | void *found = cache_found_files[file]; |
768 | if(found != (void *)2) { | 825 | if(found != (void *)2) { |
769 | if(found) { | 826 | if(found) { |
770 | cache_found_files.replace(file, (void *)2); | 827 | cache_found_files.replace(file, (void *)2); |
771 | } else { | 828 | } else { |
772 | QFileInfo fi(fileFixify(file, QDir::currentDirPath(), Option::output_dir)); | 829 | QFileInfo fi(fileFixify(file, QDir::currentDirPath(), Option::output_dir)); |
773 | if(fi.exists() && fi.lastModified() < cachefi.lastModified()) { | 830 | if(fi.exists() && fi.lastModified() < cachefi.lastModified()) { |
774 | cache_found_files.insert(file, (void *)2); | 831 | cache_found_files.insert(file, (void *)2); |
775 | found = (void*)1; | 832 | found = (void*)1; |
776 | } | 833 | } |
777 | } | 834 | } |
778 | } | 835 | } |
779 | if(found && line != "*qmake_ignore*") { | 836 | if(found && line != "*qmake_ignore*") { |
780 | int ext_len = file.length() - file.findRev('.'); | 837 | int ext_len = file.length() - file.findRev('.'); |
781 | bool cpp_ext = FALSE; | 838 | bool cpp_ext = FALSE; |
782 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 839 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
783 | cppit != Option::cpp_ext.end(); ++cppit) { | 840 | cppit != Option::cpp_ext.end(); ++cppit) { |
784 | if((cpp_ext = (file.right(ext_len) == (*cppit)))) | 841 | if((cpp_ext = (file.right(ext_len) == (*cppit)))) |
785 | break; | 842 | break; |
786 | } | 843 | } |
787 | if(cpp_ext) { | 844 | if(cpp_ext) { |
788 | project->variables()["_SRCMOC"].append(line); | 845 | project->variables()["_SRCMOC"].append(line); |
789 | } else if(project->variables()["HEADERS"].findIndex(file) != -1) { | 846 | } else if(project->variables()["HEADERS"].findIndex(file) != -1) { |
790 | for(QStringList::Iterator hit = Option::h_ext.begin(); | 847 | for(QStringList::Iterator hit = Option::h_ext.begin(); |
791 | hit != Option::h_ext.end(); ++hit) { | 848 | hit != Option::h_ext.end(); ++hit) { |
792 | if((file.right(ext_len) == (*hit))) { | 849 | if((file.right(ext_len) == (*hit))) { |
793 | project->variables()["_HDRMOC"].append(line); | 850 | project->variables()["_HDRMOC"].append(line); |
794 | break; | 851 | break; |
795 | } | 852 | } |
796 | } | 853 | } |
797 | } | 854 | } |
798 | debug_msg(2, "Mocgen (cached): %s -> %s", file.latin1(), | 855 | debug_msg(2, "Mocgen (cached): %s -> %s", file.latin1(), |
799 | line.latin1()); | 856 | line.latin1()); |
800 | mocablesToMOC[file] = line; | 857 | mocablesToMOC[file] = line; |
801 | mocablesFromMOC[line] = file; | 858 | mocablesFromMOC[line] = file; |
802 | } | 859 | } |
803 | } | 860 | } |
804 | } | 861 | } |
805 | } | 862 | } |
806 | cachef.close(); | 863 | cachef.close(); |
807 | } | 864 | } |
808 | } | 865 | } |
809 | } | 866 | } |
810 | if(!noIO()) { | 867 | if(!noIO()) { |
811 | QString sources[] = { QString("OBJECTS"), QString("LEXSOURCES"), QString("YACCSOURCES"), | 868 | QString sources[] = { QString("OBJECTS"), QString("LEXSOURCES"), QString("YACCSOURCES"), |
812 | QString("HEADERS"), QString("SOURCES"), QString("FORMS"), | 869 | QString("HEADERS"), QString("SOURCES"), QString("FORMS"), |
813 | QString::null }; | 870 | QString("PRECOMPILED_HEADER"), QString::null }; |
814 | depHeuristics.clear(); | 871 | depHeuristics.clear(); |
815 | bool write_cache = FALSE, read_cache = QFile::exists(cache_file); | 872 | bool write_cache = FALSE, read_cache = QFile::exists(cache_file); |
816 | for(int x = 0; sources[x] != QString::null; x++) { | 873 | int x; |
874 | for(x = 0; sources[x] != QString::null; x++) { | ||
817 | QStringList vpath, &l = v[sources[x]]; | 875 | QStringList vpath, &l = v[sources[x]]; |
818 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 876 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
819 | if(!(*val_it).isEmpty()) { | 877 | if(!(*val_it).isEmpty()) { |
820 | QString file = Option::fixPathToLocalOS((*val_it)); | 878 | QString file = fileFixify((*val_it), QDir::currentDirPath(), Option::output_dir); |
821 | QStringList file_list(file); | ||
822 | if(!QFile::exists(file)) { | 879 | if(!QFile::exists(file)) { |
823 | bool found = FALSE; | 880 | bool found = FALSE; |
824 | if(QDir::isRelativePath(file)) { | 881 | if(QDir::isRelativePath((*val_it))) { |
825 | if(vpath.isEmpty()) | 882 | if(vpath.isEmpty()) |
826 | vpath = v["VPATH_" + sources[x]] + v["VPATH"] + | 883 | vpath = v["VPATH_" + sources[x]] + v["VPATH"] + |
827 | v["QMAKE_ABSOLUTE_SOURCE_PATH"] + v["DEPENDPATH"]; | 884 | v["QMAKE_ABSOLUTE_SOURCE_PATH"] + v["DEPENDPATH"]; |
828 | 885 | ||
829 | for(QStringList::Iterator vpath_it = vpath.begin(); | 886 | for(QStringList::Iterator vpath_it = vpath.begin(); |
830 | vpath_it != vpath.end(); ++vpath_it) { | 887 | vpath_it != vpath.end(); ++vpath_it) { |
831 | QString real_dir = Option::fixPathToLocalOS((*vpath_it)); | 888 | QString real_dir = Option::fixPathToLocalOS((*vpath_it)); |
832 | if(QFile::exists(real_dir + QDir::separator() + (*val_it))) { | 889 | if(QFile::exists(real_dir + QDir::separator() + (*val_it))) { |
833 | QString dir = (*vpath_it); | 890 | QString dir = (*vpath_it); |
834 | if(dir.right(Option::dir_sep.length()) != Option::dir_sep) | 891 | if(dir.right(Option::dir_sep.length()) != Option::dir_sep) |
835 | dir += Option::dir_sep; | 892 | dir += Option::dir_sep; |
836 | (*val_it) = fileFixify(dir + (*val_it)); | 893 | (*val_it) = fileFixify(dir + (*val_it)); |
837 | found = TRUE; | 894 | found = TRUE; |
838 | debug_msg(1, "Found file through vpath %s -> %s", | 895 | debug_msg(1, "Found file through vpath %s -> %s", |
839 | file.latin1(), (*val_it).latin1()); | 896 | file.latin1(), (*val_it).latin1()); |
840 | break; | 897 | break; |
841 | } | 898 | } |
842 | } | 899 | } |
843 | } | 900 | } |
844 | if(!found) { | 901 | if(!found) { |
845 | QString dir, regex = (*val_it), real_dir; | 902 | QString dir, regex = (*val_it), real_dir; |
846 | if(regex.findRev(Option::dir_sep) != -1) { | 903 | if(regex.findRev(Option::dir_sep) != -1) { |
847 | dir = regex.left(regex.findRev(Option::dir_sep) + 1); | 904 | dir = regex.left(regex.findRev(Option::dir_sep) + 1); |
848 | real_dir = fileFixify(Option::fixPathToLocalOS(dir), | 905 | real_dir = fileFixify(Option::fixPathToLocalOS(dir), |
849 | QDir::currentDirPath(), Option::output_dir); | 906 | QDir::currentDirPath(), Option::output_dir); |
850 | regex = regex.right(regex.length() - dir.length()); | 907 | regex = regex.right(regex.length() - dir.length()); |
851 | } | 908 | } |
852 | if(real_dir.isEmpty() || QFile::exists(real_dir)) { | 909 | if(real_dir.isEmpty() || QFile::exists(real_dir)) { |
853 | QDir d(real_dir, regex); | 910 | QDir d(real_dir, regex); |
854 | if(!d.count()) { | 911 | if(!d.count()) { |
855 | debug_msg(1, "%s:%d Failure to find %s in vpath (%s)", | 912 | debug_msg(1, "%s:%d Failure to find %s in vpath (%s)", |
856 | __FILE__, __LINE__, | 913 | __FILE__, __LINE__, |
857 | (*val_it).latin1(), vpath.join("::").latin1()); | 914 | (*val_it).latin1(), vpath.join("::").latin1()); |
858 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); | 915 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); |
859 | continue; | 916 | continue; |
860 | } else { | 917 | } else { |
861 | file_list.clear(); | ||
862 | for(int i = 0; i < (int)d.count(); i++) { | 918 | for(int i = 0; i < (int)d.count(); i++) { |
863 | file_list.append(dir + d[i]); | 919 | QString file = fileFixify(dir + d[i]); |
864 | if(i == (int)d.count() - 1) | 920 | if(i == (int)d.count() - 1) |
865 | (*val_it) = dir + d[i]; | 921 | (*val_it) = file; |
866 | else | 922 | else |
867 | l.insert(val_it, dir + d[i]); | 923 | l.insert(val_it, file); |
868 | } | 924 | } |
869 | } | 925 | } |
870 | } else { | 926 | } else { |
871 | debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", | 927 | debug_msg(1, "%s:%d Cannot match %s%c%s, as %s does not exist.", |
872 | __FILE__, __LINE__, | 928 | __FILE__, __LINE__, |
873 | real_dir.latin1(), QDir::separator(), regex.latin1(), | 929 | real_dir.latin1(), QDir::separator(), regex.latin1(), |
874 | real_dir.latin1()); | 930 | real_dir.latin1()); |
875 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); | 931 | warn_msg(WarnLogic, "Failure to find: %s", (*val_it).latin1()); |
876 | } | 932 | } |
877 | } | 933 | } |
878 | } | 934 | } |
879 | for(QStringList::Iterator file_it = file_list.begin(); | 935 | } |
880 | file_it != file_list.end(); ++file_it) { | 936 | } |
881 | QString file_list_file = fileFixify((*file_it)); | 937 | } |
882 | bool found_cache_moc = FALSE, found_cache_dep = FALSE; | 938 | for(x = 0; sources[x] != QString::null; x++) { |
883 | if(read_cache && Option::output.name() != "-" && | 939 | QStringList &l = v[sources[x]]; |
884 | project->isActiveConfig("qmake_cache")) { | 940 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
885 | if(!findDependencies(file_list_file).isEmpty()) | 941 | bool found_cache_moc = FALSE, found_cache_dep = FALSE; |
886 | found_cache_dep = TRUE; | 942 | if(read_cache && Option::output.name() != "-" && |
887 | if(cache_found_files[(*file_it)] == (void *)2) | 943 | project->isActiveConfig("qmake_cache")) { |
888 | found_cache_moc = TRUE; | 944 | if(processedDependencies((*val_it))) |
889 | if(!found_cache_moc || !found_cache_dep) | 945 | found_cache_dep = TRUE; |
890 | write_cache = TRUE; | 946 | if(cache_found_files[(*val_it)] == (void *)2) |
891 | } | 947 | found_cache_moc = TRUE; |
892 | /* Do moc before dependency checking since some includes can come from | 948 | if(!found_cache_moc || !found_cache_dep) |
893 | moc_*.cpp files */ | 949 | write_cache = TRUE; |
894 | if(found_cache_moc) { | 950 | } |
895 | QString moc = findMocDestination(file_list_file); | 951 | /* Do moc before dependency checking since some includes can come from |
896 | if(!moc.isEmpty()) { | 952 | moc_*.cpp files */ |
897 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 953 | if(found_cache_moc) { |
898 | cppit != Option::cpp_ext.end(); ++cppit) { | 954 | QString fixed_file(fileFixify((*val_it), QDir::currentDirPath(), Option::output_dir)); |
899 | if(file_list_file.endsWith((*cppit))) { | 955 | QString moc = findMocDestination(fixed_file); |
900 | QStringList &deps = findDependencies(file_list_file); | 956 | if(!moc.isEmpty()) { |
901 | if(!deps.contains(moc)) | 957 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
902 | deps.append(moc); | 958 | cppit != Option::cpp_ext.end(); ++cppit) { |
903 | break; | 959 | if(fixed_file.endsWith((*cppit))) { |
904 | } | 960 | QStringList &deps = findDependencies(fixed_file); |
905 | } | 961 | if(!deps.contains(moc)) |
962 | deps.append(moc); | ||
963 | break; | ||
906 | } | 964 | } |
907 | } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && | ||
908 | (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | ||
909 | Option::mkfile::do_mocs)) { | ||
910 | generateMocList((*file_it)); | ||
911 | } | ||
912 | if(!found_cache_dep && sources[x] != "OBJECTS") { | ||
913 | debug_msg(5, "Looking for dependencies for %s", (*file_it).latin1()); | ||
914 | generateDependencies(deplist, (*file_it), doDepends()); | ||
915 | } | 965 | } |
916 | } | 966 | } |
967 | } else if(mocAware() && (sources[x] == "SOURCES" || sources[x] == "HEADERS") && | ||
968 | (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT || | ||
969 | Option::mkfile::do_mocs)) { | ||
970 | generateMocList((*val_it)); | ||
971 | } | ||
972 | if(!found_cache_dep && sources[x] != "OBJECTS") { | ||
973 | debug_msg(5, "Looking for dependencies for %s", (*val_it).latin1()); | ||
974 | generateDependencies(deplist, (*val_it), doDepends()); | ||
917 | } | 975 | } |
918 | } | 976 | } |
919 | } | 977 | } |
920 | if(project->isActiveConfig("qmake_cache") && (write_cache || !read_cache)) { | 978 | if(project->isActiveConfig("qmake_cache") && (write_cache || !read_cache)) { |
921 | QFile cachef(cache_file); | 979 | QFile cachef(cache_file); |
922 | if(cachef.open(IO_WriteOnly | IO_Translate)) { | 980 | if(cachef.open(IO_WriteOnly | IO_Translate)) { |
923 | debug_msg(2, "Writing internal cache information: %s", cache_file.latin1()); | 981 | debug_msg(2, "Writing internal cache information: %s", cache_file.latin1()); |
924 | QTextStream cachet(&cachef); | 982 | QTextStream cachet(&cachef); |
925 | cachet << "[check]" << "\n" | 983 | cachet << "[check]" << "\n" |
926 | << "QMAKE_CACHE_VERSION = " << qmake_version() << "\n" | 984 | << "QMAKE_CACHE_VERSION = " << qmake_version() << "\n" |
927 | << "QMAKE_ABSOLUTE_SOURCE_PATH = " << var("QMAKE_ABSOLUTE_SOURCE_PATH") << "\n" | 985 | << "QMAKE_ABSOLUTE_SOURCE_PATH = " << var("QMAKE_ABSOLUTE_SOURCE_PATH") << "\n" |
928 | << "MOC_DIR = " << var("MOC_DIR") << "\n" | 986 | << "MOC_DIR = " << var("MOC_DIR") << "\n" |
929 | << "UI_DIR = " << var("UI_DIR") << "\n" | 987 | << "UI_DIR = " << var("UI_DIR") << "\n" |
930 | << "UI_HEADERS_DIR = " << var("UI_HEADERS_DIR") << "\n" | 988 | << "UI_HEADERS_DIR = " << var("UI_HEADERS_DIR") << "\n" |
931 | << "UI_SOURCES_DIR = " << var("UI_SOURCES_DIR") << "\n"; | 989 | << "UI_SOURCES_DIR = " << var("UI_SOURCES_DIR") << "\n"; |
932 | cachet << "[depend]" << endl; | 990 | cachet << "[depend]" << endl; |
933 | for(QMap<QString, QStringList>::Iterator it = depends.begin(); | 991 | for(QMap<QString, QStringList>::Iterator it = depends.begin(); |
934 | it != depends.end(); ++it) | 992 | it != depends.end(); ++it) |
935 | cachet << depKeyMap[it.key()] << " = " << it.data().join(" ") << endl; | 993 | cachet << dependencyKey(it.key()) << " = " << it.data().join(" ") << endl; |
936 | cachet << "[mocable]" << endl; | 994 | cachet << "[mocable]" << endl; |
937 | QString mc, moc_sources[] = { QString("HEADERS"), QString("SOURCES"), QString::null }; | 995 | QString mc, moc_sources[] = { QString("HEADERS"), QString("SOURCES"), QString::null }; |
938 | for(int x = 0; moc_sources[x] != QString::null; x++) { | 996 | for(int x = 0; moc_sources[x] != QString::null; x++) { |
939 | QStringList &l = v[moc_sources[x]]; | 997 | QStringList &l = v[moc_sources[x]]; |
940 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 998 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
941 | QString f = fileFixify((*val_it)); | 999 | QString f = fileFixify((*val_it)); |
942 | if(!f.isEmpty()) { | 1000 | if(!f.isEmpty()) { |
943 | mc = mocablesToMOC[f]; | 1001 | mc = mocablesToMOC[f]; |
944 | if(mc.isEmpty()) | 1002 | if(mc.isEmpty()) |
945 | mc = "*qmake_ignore*"; | 1003 | mc = "*qmake_ignore*"; |
946 | cachet << f << " = " << mc << endl; | 1004 | cachet << f << " = " << mc << endl; |
947 | } | 1005 | } |
948 | } | 1006 | } |
949 | } | 1007 | } |
950 | cachef.close(); | 1008 | cachef.close(); |
951 | } | 1009 | } |
952 | } | 1010 | } |
953 | } | 1011 | } |
954 | } | 1012 | } |
955 | v["OBJECTS"] = createObjectList("SOURCES") + v["OBJECTS"]; // init variables | 1013 | v["OBJECTS"] = createObjectList("SOURCES") + v["OBJECTS"]; // init variables |
956 | 1014 | ||
957 | //lex files | 1015 | //lex files |
958 | { | 1016 | { |
959 | QStringList &impls = v["LEXIMPLS"]; | 1017 | QStringList &impls = v["LEXIMPLS"]; |
960 | QStringList &l = v["LEXSOURCES"]; | 1018 | QStringList &l = v["LEXSOURCES"]; |
961 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1019 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
962 | QString dir; | 1020 | QString dir; |
963 | QFileInfo fi((*it)); | 1021 | QFileInfo fi((*it)); |
964 | if(fi.dirPath() != ".") | 1022 | if(fi.dirPath() != ".") |
965 | dir = fi.dirPath() + Option::dir_sep; | 1023 | dir = fi.dirPath() + Option::dir_sep; |
966 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 1024 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
967 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1025 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
968 | dir += Option::dir_sep; | 1026 | dir += Option::dir_sep; |
969 | QString impl = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | 1027 | QString impl = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); |
970 | logicWarn(impl, "SOURCES"); | 1028 | logicWarn(impl, "SOURCES"); |
971 | logicWarn(impl, "SOURCES"); | 1029 | logicWarn(impl, "SOURCES"); |
972 | impls.append(impl); | 1030 | impls.append(impl); |
973 | if( ! project->isActiveConfig("lex_included")) { | 1031 | if( ! project->isActiveConfig("lex_included")) { |
974 | v["SOURCES"].append(impl); | 1032 | v["SOURCES"].append(impl); |
975 | // attribute deps of lex file to impl file | 1033 | // attribute deps of lex file to impl file |
976 | QStringList &lexdeps = findDependencies((*it)); | 1034 | QStringList &lexdeps = findDependencies((*it)); |
977 | QStringList &impldeps = findDependencies(impl); | 1035 | QStringList &impldeps = findDependencies(impl); |
978 | for(QStringList::ConstIterator d = lexdeps.begin(); d != lexdeps.end(); ++d) { | 1036 | for(QStringList::ConstIterator d = lexdeps.begin(); d != lexdeps.end(); ++d) { |
979 | if(!impldeps.contains(*d)) | 1037 | if(!impldeps.contains(*d)) |
980 | impldeps.append(*d); | 1038 | impldeps.append(*d); |
981 | } | 1039 | } |
982 | lexdeps.clear(); | 1040 | lexdeps.clear(); |
983 | } | 1041 | } |
984 | } | 1042 | } |
985 | if( ! project->isActiveConfig("lex_included")) | 1043 | if( ! project->isActiveConfig("lex_included")) |
986 | v["OBJECTS"] += (v["LEXOBJECTS"] = createObjectList("LEXIMPLS")); | 1044 | v["OBJECTS"] += (v["LEXOBJECTS"] = createObjectList("LEXIMPLS")); |
987 | } | 1045 | } |
988 | //yacc files | 1046 | //yacc files |
989 | { | 1047 | { |
990 | QStringList &decls = v["YACCCDECLS"], &impls = v["YACCIMPLS"]; | 1048 | QStringList &decls = v["YACCCDECLS"], &impls = v["YACCIMPLS"]; |
991 | QStringList &l = v["YACCSOURCES"]; | 1049 | QStringList &l = v["YACCSOURCES"]; |
992 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1050 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
993 | QString dir; | 1051 | QString dir; |
994 | QFileInfo fi((*it)); | 1052 | QFileInfo fi((*it)); |
995 | if(fi.dirPath() != ".") | 1053 | if(fi.dirPath() != ".") |
996 | dir = fi.dirPath() + Option::dir_sep; | 1054 | dir = fi.dirPath() + Option::dir_sep; |
997 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 1055 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
998 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1056 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
999 | dir += Option::dir_sep; | 1057 | dir += Option::dir_sep; |
1000 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | 1058 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); |
1001 | logicWarn(impl, "SOURCES"); | 1059 | logicWarn(impl, "SOURCES"); |
1002 | QString decl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | 1060 | QString decl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); |
1003 | logicWarn(decl, "HEADERS"); | 1061 | logicWarn(decl, "HEADERS"); |
1004 | 1062 | ||
1005 | decls.append(decl); | 1063 | decls.append(decl); |
1006 | impls.append(impl); | 1064 | impls.append(impl); |
1007 | v["SOURCES"].append(impl); | 1065 | v["SOURCES"].append(impl); |
1008 | QStringList &impldeps = findDependencies(impl); | 1066 | QStringList &impldeps = findDependencies(impl); |
1009 | impldeps.append(decl); | 1067 | impldeps.append(decl); |
1010 | // attribute deps of yacc file to impl file | 1068 | // attribute deps of yacc file to impl file |
1011 | QStringList &yaccdeps = findDependencies((*it)); | 1069 | QStringList &yaccdeps = findDependencies((*it)); |
1012 | for(QStringList::ConstIterator d = yaccdeps.begin(); d != yaccdeps.end(); ++d) { | 1070 | for(QStringList::ConstIterator d = yaccdeps.begin(); d != yaccdeps.end(); ++d) { |
1013 | if(!impldeps.contains(*d)) | 1071 | if(!impldeps.contains(*d)) |
1014 | impldeps.append(*d); | 1072 | impldeps.append(*d); |
1015 | } | 1073 | } |
1016 | if( project->isActiveConfig("lex_included")) { | 1074 | if( project->isActiveConfig("lex_included")) { |
1017 | // is there a matching lex file ? Transfer its dependencies. | 1075 | // is there a matching lex file ? Transfer its dependencies. |
1018 | QString lexsrc = fi.baseName(TRUE) + Option::lex_ext; | 1076 | QString lexsrc = fi.baseName(TRUE) + Option::lex_ext; |
1019 | if(fi.dirPath() != ".") | 1077 | if(fi.dirPath() != ".") |
1020 | lexsrc.prepend(fi.dirPath() + Option::dir_sep); | 1078 | lexsrc.prepend(fi.dirPath() + Option::dir_sep); |
1021 | if(v["LEXSOURCES"].findIndex(lexsrc) != -1) { | 1079 | if(v["LEXSOURCES"].findIndex(lexsrc) != -1) { |
1022 | QString trg = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | 1080 | QString trg = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); |
1023 | impldeps.append(trg); | 1081 | impldeps.append(trg); |
1024 | impldeps += findDependencies(lexsrc); | 1082 | impldeps += findDependencies(lexsrc); |
1025 | depends[lexsrc].clear(); | 1083 | depends[lexsrc].clear(); |
1026 | } | 1084 | } |
1027 | } | 1085 | } |
1028 | yaccdeps.clear(); | 1086 | yaccdeps.clear(); |
1029 | } | 1087 | } |
1030 | v["OBJECTS"] += (v["YACCOBJECTS"] = createObjectList("YACCIMPLS")); | 1088 | v["OBJECTS"] += (v["YACCOBJECTS"] = createObjectList("YACCIMPLS")); |
1031 | } | 1089 | } |
1032 | 1090 | ||
1033 | //UI files | 1091 | //UI files |
1034 | { | 1092 | { |
1035 | QStringList &includepath = project->variables()["INCLUDEPATH"]; | 1093 | QStringList &includepath = project->variables()["INCLUDEPATH"]; |
1036 | if(!project->isEmpty("UI_DIR")) | 1094 | if(!project->isEmpty("UI_DIR")) |
1037 | includepath.append(project->first("UI_DIR")); | 1095 | includepath.append(project->first("UI_DIR")); |
1038 | else if(!project->isEmpty("UI_HEADERS_DIR")) | 1096 | else if(!project->isEmpty("UI_HEADERS_DIR")) |
1039 | includepath.append(project->first("UI_HEADERS_DIR")); | 1097 | includepath.append(project->first("UI_HEADERS_DIR")); |
1040 | QStringList &decls = v["UICDECLS"], &impls = v["UICIMPLS"]; | 1098 | QStringList &decls = v["UICDECLS"], &impls = v["UICIMPLS"]; |
1041 | QStringList &l = v["FORMS"]; | 1099 | QStringList &l = v["FORMS"]; |
1042 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1100 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1043 | QString impl, decl; | 1101 | QString impl, decl; |
1044 | QFileInfo fi(Option::fixPathToLocalOS((*it))); | 1102 | QFileInfo fi(Option::fixPathToLocalOS((*it))); |
1045 | if ( !project->isEmpty("UI_DIR") ) { | 1103 | if ( !project->isEmpty("UI_DIR") ) { |
1046 | impl = decl = project->first("UI_DIR"); | 1104 | impl = decl = project->first("UI_DIR"); |
1047 | QString d = fi.dirPath(); | 1105 | QString d = fi.dirPath(); |
1048 | if( d == ".") | 1106 | if( d == ".") |
1049 | d = QDir::currentDirPath(); | 1107 | d = QDir::currentDirPath(); |
1050 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); | 1108 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); |
1051 | if(!includepath.contains(d)) | 1109 | if(!includepath.contains(d)) |
1052 | includepath.append(d); | 1110 | includepath.append(d); |
1053 | } else { | 1111 | } else { |
1054 | if(decl.isEmpty() && !project->isEmpty("UI_HEADERS_DIR")) | 1112 | if(decl.isEmpty() && !project->isEmpty("UI_HEADERS_DIR")) |
1055 | decl = project->first("UI_HEADERS_DIR"); | 1113 | decl = project->first("UI_HEADERS_DIR"); |
1056 | if(!decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && | 1114 | if(!decl.isEmpty() || (project->isEmpty("UI_HEADERS_DIR") && |
1057 | !project->isEmpty("UI_SOURCES_DIR")) ) { | 1115 | !project->isEmpty("UI_SOURCES_DIR")) ) { |
1058 | QString d = fi.dirPath(); | 1116 | QString d = fi.dirPath(); |
1059 | if( d == ".") | 1117 | if( d == ".") |
1060 | d = QDir::currentDirPath(); | 1118 | d = QDir::currentDirPath(); |
1061 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); | 1119 | d = fileFixify(d, QDir::currentDirPath(), Option::output_dir); |
1062 | if(includepath.contains(d)) | 1120 | if(includepath.contains(d)) |
1063 | includepath.append(d); | 1121 | includepath.append(d); |
1064 | } | 1122 | } |
1065 | if(impl.isEmpty() && !project->isEmpty("UI_SOURCES_DIR")) | 1123 | if(impl.isEmpty() && !project->isEmpty("UI_SOURCES_DIR")) |
1066 | impl = project->first("UI_SOURCES_DIR"); | 1124 | impl = project->first("UI_SOURCES_DIR"); |
1067 | if(fi.dirPath() != ".") { | 1125 | if(fi.dirPath() != ".") { |
1068 | if(impl.isEmpty()) | 1126 | if(impl.isEmpty()) |
1069 | impl = fi.dirPath() + Option::dir_sep; | 1127 | impl = fi.dirPath() + Option::dir_sep; |
1070 | if(decl.isEmpty()) | 1128 | if(decl.isEmpty()) |
1071 | decl = fi.dirPath() + Option::dir_sep; | 1129 | decl = fi.dirPath() + Option::dir_sep; |
1072 | } | 1130 | } |
1073 | } | 1131 | } |
1074 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); | 1132 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); |
1075 | if(!impl.isEmpty()) | 1133 | if(!impl.isEmpty() && !impl.endsWith(Option::dir_sep)) |
1076 | impl += Option::dir_sep; | 1134 | impl += Option::dir_sep; |
1077 | impl += fi.baseName(TRUE) + Option::cpp_ext.first(); | 1135 | impl += fi.baseName(TRUE) + Option::cpp_ext.first(); |
1078 | if(Option::output_dir != QDir::currentDirPath() && | 1136 | if(Option::output_dir != QDir::currentDirPath() && |
1079 | project->isEmpty("UI_DIR") && project->isEmpty("UI_HEADERS_DIR")) { | 1137 | project->isEmpty("UI_DIR") && project->isEmpty("UI_HEADERS_DIR")) { |
1080 | QString decl_fixed = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | 1138 | QString decl_fixed = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); |
1081 | if(!includepath.contains(decl_fixed)) | 1139 | if(!includepath.contains(decl_fixed)) |
1082 | includepath.append(decl_fixed); | 1140 | includepath.append(decl_fixed); |
1083 | if(!includepath.contains(decl)) | 1141 | if(!includepath.contains(decl)) |
1084 | project->variables()["INCLUDEPATH"].append(decl); | 1142 | project->variables()["INCLUDEPATH"].append(decl); |
1085 | } | 1143 | } |
1086 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | 1144 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); |
1087 | if(!decl.isEmpty()) | 1145 | if(!decl.isEmpty() && !decl.endsWith(Option::dir_sep)) |
1088 | decl += Option::dir_sep; | 1146 | decl += Option::dir_sep; |
1089 | decl += fi.baseName(TRUE) + Option::h_ext.first(); | 1147 | decl += fi.baseName(TRUE) + Option::h_ext.first(); |
1090 | logicWarn(impl, "SOURCES"); | 1148 | logicWarn(impl, "SOURCES"); |
1091 | logicWarn(decl, "HEADERS"); | 1149 | logicWarn(decl, "HEADERS"); |
1092 | decls.append(decl); | 1150 | decls.append(decl); |
1093 | impls.append(impl); | 1151 | impls.append(impl); |
1094 | findDependencies(impl).append(decl); | 1152 | findDependencies(impl).append(decl); |
1095 | 1153 | ||
1096 | QString mocable = Option::moc_mod + fi.baseName(TRUE) + Option::cpp_ext.first(); | 1154 | QString mocable = Option::h_moc_mod + fi.baseName(TRUE) + Option::h_moc_ext; |
1097 | if(!v["MOC_DIR"].isEmpty()) | 1155 | if(!v["MOC_DIR"].isEmpty()) |
1098 | mocable.prepend(v["MOC_DIR"].first()); | 1156 | mocable.prepend(v["MOC_DIR"].first()); |
1099 | else if(fi.dirPath() != ".") | 1157 | else if(fi.dirPath() != ".") |
1100 | mocable.prepend(fi.dirPath() + Option::dir_sep); | 1158 | mocable.prepend(fi.dirPath() + Option::dir_sep); |
1101 | logicWarn(mocable, "SOURCES"); | 1159 | logicWarn(mocable, "SOURCES"); |
1102 | mocablesToMOC[cleanFilePath(decl)] = mocable; | 1160 | mocablesToMOC[cleanFilePath(decl)] = mocable; |
1103 | mocablesFromMOC[cleanFilePath(mocable)] = decl; | 1161 | mocablesFromMOC[cleanFilePath(mocable)] = decl; |
1104 | v["_UIMOC"].append(mocable); | 1162 | v["_UIMOC"].append(mocable); |
1105 | } | 1163 | } |
1106 | v["OBJECTS"] += (v["UICOBJECTS"] = createObjectList("UICDECLS")); | 1164 | v["OBJECTS"] += (v["UICOBJECTS"] = createObjectList("UICDECLS")); |
1107 | } | 1165 | } |
1108 | 1166 | ||
1167 | //Translation files | ||
1168 | if(!project->isEmpty("TRANSLATIONS")) { | ||
1169 | QStringList &trf = project->variables()["TRANSLATIONS"]; | ||
1170 | for(QStringList::Iterator it = trf.begin(); it != trf.end(); ++it) { | ||
1171 | (*it) = Option::fixPathToLocalOS((*it)); | ||
1172 | } | ||
1173 | } | ||
1174 | |||
1109 | //Image files | 1175 | //Image files |
1110 | if(!project->isEmpty("IMAGES")) { | 1176 | if(!project->isEmpty("IMAGES")) { |
1111 | if(project->isEmpty("QMAKE_IMAGE_COLLECTION")) | 1177 | if(project->isEmpty("QMAKE_IMAGE_COLLECTION")) |
1112 | v["QMAKE_IMAGE_COLLECTION"].append("qmake_image_collection" + Option::cpp_ext.first()); | 1178 | v["QMAKE_IMAGE_COLLECTION"].append("qmake_image_collection" + Option::cpp_ext.first()); |
1113 | QString imgfile = project->first("QMAKE_IMAGE_COLLECTION"); | 1179 | QString imgfile = project->first("QMAKE_IMAGE_COLLECTION"); |
1114 | Option::fixPathToTargetOS(imgfile); | 1180 | Option::fixPathToTargetOS(imgfile); |
1115 | if(!project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { | 1181 | if(!project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { |
1116 | if(imgfile.find(Option::dir_sep) != -1) | 1182 | if(imgfile.find(Option::dir_sep) != -1) |
1117 | imgfile = imgfile.right(imgfile.findRev(Option::dir_sep) + 1); | 1183 | imgfile = imgfile.right(imgfile.findRev(Option::dir_sep) + 1); |
1118 | imgfile.prepend( (project->isEmpty("UI_DIR") ? project->first("UI_SOURCES_DIR") : | 1184 | imgfile.prepend( (project->isEmpty("UI_DIR") ? project->first("UI_SOURCES_DIR") : |
1119 | project->first("UI_DIR")) ); | 1185 | project->first("UI_DIR")) ); |
1120 | v["QMAKE_IMAGE_COLLECTION"] = QStringList(imgfile); | 1186 | v["QMAKE_IMAGE_COLLECTION"] = QStringList(imgfile); |
1121 | } | 1187 | } |
1122 | logicWarn(imgfile, "SOURCES"); | 1188 | logicWarn(imgfile, "SOURCES"); |
1123 | if(!noIO()) { | 1189 | if(!noIO()) { |
1124 | QStringList &l = v["IMAGES"]; | 1190 | QStringList &l = v["IMAGES"]; |
1125 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1191 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1126 | if(!QFile::exists((*it))) { | 1192 | if(!QFile::exists((*it))) { |
1127 | warn_msg(WarnLogic, "Failure to open: %s", (*it).latin1()); | 1193 | warn_msg(WarnLogic, "Failure to open: %s", (*it).latin1()); |
1128 | continue; | 1194 | continue; |
1129 | } | 1195 | } |
1130 | findDependencies(imgfile).append(fileFixify((*it))); | 1196 | findDependencies(imgfile).append(fileFixify((*it))); |
1131 | } | 1197 | } |
1132 | } | 1198 | } |
1133 | v["OBJECTS"] += (v["IMAGEOBJECTS"] = createObjectList("QMAKE_IMAGE_COLLECTION")); | 1199 | v["OBJECTS"] += (v["IMAGEOBJECTS"] = createObjectList("QMAKE_IMAGE_COLLECTION")); |
1134 | } | 1200 | } |
1135 | if(Option::output_dir != QDir::currentDirPath()) | 1201 | if(Option::output_dir != QDir::currentDirPath()) |
1136 | project->variables()["INCLUDEPATH"].append(fileFixify(Option::output_dir, Option::output_dir, | 1202 | project->variables()["INCLUDEPATH"].append(fileFixify(Option::output_dir, Option::output_dir, |
1137 | Option::output_dir)); | 1203 | Option::output_dir)); |
1138 | 1204 | ||
1139 | //moc files | 1205 | //moc files |
1140 | if ( mocAware() ) { | 1206 | if ( mocAware() ) { |
1141 | if(!project->isEmpty("MOC_DIR")) | 1207 | if(!project->isEmpty("MOC_DIR")) |
1142 | project->variables()["INCLUDEPATH"].append(project->first("MOC_DIR")); | 1208 | project->variables()["INCLUDEPATH"].append(project->first("MOC_DIR")); |
1143 | v["OBJMOC"] = createObjectList("_HDRMOC") + createObjectList("_UIMOC"); | 1209 | if ( Option::h_moc_ext == Option::cpp_ext.first() ) |
1210 | v["OBJMOC"] = createObjectList("_HDRMOC") + createObjectList("_UIMOC"); | ||
1144 | 1211 | ||
1145 | QStringList &l = v["SRCMOC"]; | 1212 | QStringList &l = v["SRCMOC"]; |
1146 | l = v["_HDRMOC"] + v["_UIMOC"] + v["_SRCMOC"]; | 1213 | l = v["_HDRMOC"] + v["_UIMOC"] + v["_SRCMOC"]; |
1147 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 1214 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
1148 | if(!(*val_it).isEmpty()) | 1215 | if(!(*val_it).isEmpty()) |
1149 | (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); | 1216 | (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); |
1150 | } | 1217 | } |
1151 | } | 1218 | } |
1219 | |||
1220 | QString fixpaths[] = { QString("PRE_TARGETDEPS"), QString("POST_TARGETDEPS"), QString::null }; | ||
1221 | for(int path = 0; !fixpaths[path].isNull(); path++) { | ||
1222 | QStringList &l = v[fixpaths[path]]; | ||
1223 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | ||
1224 | if(!(*val_it).isEmpty()) | ||
1225 | (*val_it) = Option::fixPathToTargetOS((*val_it), FALSE); | ||
1226 | } | ||
1227 | } | ||
1228 | |||
1229 | // Make sure the INCLUDEPATH doesn't contain any empty(/null) entries | ||
1230 | QStringList &ipl = project->variables()["INCLUDEPATH"]; | ||
1231 | for(QStringList::Iterator ipl_it = ipl.begin(); ipl_it != ipl.end();) { | ||
1232 | if ((*ipl_it).isEmpty()) | ||
1233 | ipl_it = ipl.remove(ipl_it); | ||
1234 | else | ||
1235 | ++ipl_it; | ||
1236 | } | ||
1152 | } | 1237 | } |
1153 | 1238 | ||
1154 | bool | 1239 | bool |
1155 | MakefileGenerator::processPrlFile(QString &file) | 1240 | MakefileGenerator::processPrlFile(QString &file) |
1156 | { | 1241 | { |
1157 | bool ret = FALSE, try_replace_file=FALSE; | 1242 | bool ret = FALSE, try_replace_file=FALSE; |
1158 | QString prl_file; | 1243 | QString meta_file, orig_file = file; |
1159 | if(file.endsWith(Option::prl_ext)) { | 1244 | if(QMakeMetaInfo::libExists(file)) { |
1160 | try_replace_file = TRUE; | 1245 | try_replace_file = TRUE; |
1161 | prl_file = file; | 1246 | meta_file = file; |
1162 | file = ""; | 1247 | file = ""; |
1163 | } else { | 1248 | } else { |
1164 | QString tmp = file; | 1249 | QString tmp = file; |
1165 | int ext = tmp.findRev('.'); | 1250 | int ext = tmp.findRev('.'); |
1166 | if(ext != -1) | 1251 | if(ext != -1) |
1167 | tmp = tmp.left(ext); | 1252 | tmp = tmp.left(ext); |
1168 | prl_file = tmp + Option::prl_ext; | 1253 | meta_file = tmp; |
1169 | } | 1254 | } |
1170 | prl_file = fileFixify(prl_file); | 1255 | meta_file = fileFixify(meta_file); |
1171 | if(!QFile::exists(fileFixify(prl_file, QDir::currentDirPath(), Option::output_dir)) && | 1256 | if(!QMakeMetaInfo::libExists(fileFixify(meta_file, QDir::currentDirPath(), Option::output_dir)) && |
1172 | project->isActiveConfig("qt")) { | 1257 | project->isActiveConfig("qt")) { |
1173 | QString stem = prl_file, dir, extn; | 1258 | QString stem = meta_file, dir, extn; |
1174 | int slsh = stem.findRev('/'), hadlib = 0; | 1259 | int slsh = stem.findRev('/'), hadlib = 0; |
1175 | if(slsh != -1) { | 1260 | if(slsh != -1) { |
1176 | dir = stem.left(slsh + 1); | 1261 | dir = stem.left(slsh + 1); |
1177 | stem = stem.right(stem.length() - slsh - 1); | 1262 | stem = stem.right(stem.length() - slsh - 1); |
1178 | } | 1263 | } |
1179 | if(stem.startsWith("lib")) { | 1264 | if(stem.startsWith("lib")) { |
1180 | hadlib = 1; | 1265 | hadlib = 1; |
1181 | stem = stem.right(stem.length() - 3); | 1266 | stem = stem.right(stem.length() - 3); |
1182 | } | 1267 | } |
1183 | int dot = stem.find('.'); | 1268 | int dot = stem.find('.'); |
1184 | if(dot != -1) { | 1269 | if(dot != -1) { |
1185 | extn = stem.right(stem.length() - dot); | 1270 | extn = stem.right(stem.length() - dot); |
1186 | stem = stem.left(dot); | 1271 | stem = stem.left(dot); |
1187 | } | 1272 | } |
1188 | if(stem == "qt" || stem == "qte" || stem == "qte-mt" || stem == "qt-mt") { | 1273 | if(stem == "qt" || stem == "qte" || stem == "qte-mt" || stem == "qt-mt") { |
1189 | if(stem.endsWith("-mt")) | 1274 | if(stem.endsWith("-mt")) |
1190 | stem = stem.left(stem.length() - 3); //lose the -mt | 1275 | stem = stem.left(stem.length() - 3); //lose the -mt |
1191 | else | 1276 | else |
1192 | stem += "-mt"; //try the thread case | 1277 | stem += "-mt"; //try the thread case |
1193 | prl_file = dir; | 1278 | meta_file = dir; |
1194 | if(hadlib) | 1279 | if(hadlib) |
1195 | prl_file += "lib"; | 1280 | meta_file += "lib"; |
1196 | prl_file += stem + extn; | 1281 | meta_file += stem + extn; |
1197 | try_replace_file = TRUE; | 1282 | try_replace_file = TRUE; |
1198 | } | 1283 | } |
1199 | } | 1284 | } |
1200 | QString real_prl_file = Option::fixPathToLocalOS(prl_file); | 1285 | QString real_meta_file = Option::fixPathToLocalOS(meta_file); |
1201 | if(project->variables()["QMAKE_PRL_INTERNAL_FILES"].findIndex(prl_file) != -1) { | 1286 | if(project->variables()["QMAKE_PRL_INTERNAL_FILES"].findIndex(QMakeMetaInfo::findLib(meta_file)) != -1) { |
1202 | ret = TRUE; | 1287 | ret = TRUE; |
1203 | } else if(!real_prl_file.isEmpty() && | 1288 | } else if(!meta_file.isEmpty()) { |
1204 | QFile::exists(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir))) { | 1289 | QString f = fileFixify(real_meta_file, QDir::currentDirPath(), Option::output_dir); |
1205 | project->variables()["QMAKE_PRL_INTERNAL_FILES"].append(prl_file); | 1290 | if(QMakeMetaInfo::libExists(f)) { |
1206 | QMakeProject proj; | 1291 | QMakeMetaInfo libinfo; |
1207 | debug_msg(1, "Processing PRL file: %s", real_prl_file.latin1()); | 1292 | debug_msg(1, "Processing PRL file: %s", real_meta_file.latin1()); |
1208 | if(!proj.read(fileFixify(real_prl_file, QDir::currentDirPath(), Option::output_dir), | 1293 | if(!libinfo.readLib(f)) { |
1209 | QDir::currentDirPath(), TRUE)) { | 1294 | fprintf(stderr, "Error processing meta file: %s\n", real_meta_file.latin1()); |
1210 | fprintf(stderr, "Error processing prl file: %s\n", real_prl_file.latin1()); | 1295 | } else if(project->isActiveConfig("no_read_prl_" + libinfo.type().lower())) { |
1211 | } else { | 1296 | debug_msg(2, "Ignored meta file %s [%s]", real_meta_file.latin1(), libinfo.type().latin1()); |
1212 | ret = TRUE; | 1297 | } else { |
1213 | QMap<QString, QStringList> &vars = proj.variables(); | 1298 | ret = TRUE; |
1214 | for( QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) | 1299 | QMap<QString, QStringList> &vars = libinfo.variables(); |
1215 | processPrlVariable(it.key(), it.data()); | 1300 | for( QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) |
1216 | if(try_replace_file && !proj.isEmpty("QMAKE_PRL_TARGET")) { | 1301 | processPrlVariable(it.key(), it.data()); |
1217 | QString dir; | 1302 | if(try_replace_file && !libinfo.isEmpty("QMAKE_PRL_TARGET")) { |
1218 | int slsh = real_prl_file.findRev(Option::dir_sep); | 1303 | QString dir; |
1219 | if(slsh != -1) | 1304 | int slsh = real_meta_file.findRev(Option::dir_sep); |
1220 | dir = real_prl_file.left(slsh+1); | 1305 | if(slsh != -1) |
1221 | file = dir + proj.first("QMAKE_PRL_TARGET"); | 1306 | dir = real_meta_file.left(slsh+1); |
1307 | file = libinfo.first("QMAKE_PRL_TARGET"); | ||
1308 | if(QDir::isRelativePath(file)) | ||
1309 | file.prepend(dir); | ||
1310 | } | ||
1222 | } | 1311 | } |
1223 | } | 1312 | } |
1224 | if(ret) | 1313 | if(ret) { |
1225 | project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].append(prl_file); | 1314 | QString mf = QMakeMetaInfo::findLib(meta_file); |
1315 | project->variables()["QMAKE_PRL_INTERNAL_FILES"].append(mf); | ||
1316 | project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].append(mf); | ||
1317 | } | ||
1318 | } | ||
1319 | if(try_replace_file && file.isEmpty()) { | ||
1320 | #if 0 | ||
1321 | warn_msg(WarnLogic, "Found prl [%s] file with no target [%s]!", meta_file.latin1(), | ||
1322 | orig_file.latin1()); | ||
1323 | #endif | ||
1324 | file = orig_file; | ||
1226 | } | 1325 | } |
1227 | return ret; | 1326 | return ret; |
1228 | } | 1327 | } |
1229 | 1328 | ||
1230 | void | 1329 | void |
1231 | MakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 1330 | MakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
1232 | { | 1331 | { |
1233 | if(var == "QMAKE_PRL_LIBS") { | 1332 | if(var == "QMAKE_PRL_LIBS") { |
1234 | QString where = "QMAKE_LIBS"; | 1333 | QString where = "QMAKE_LIBS"; |
1235 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 1334 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
1236 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); | 1335 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); |
1237 | QStringList &out = project->variables()[where]; | 1336 | QStringList &out = project->variables()[where]; |
1238 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1337 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
1239 | if( out.findIndex((*it)) == -1) | 1338 | if( out.findIndex((*it)) == -1) |
1240 | out.append((*it)); | 1339 | out.append((*it)); |
1241 | } | 1340 | } |
1242 | } else if(var == "QMAKE_PRL_DEFINES") { | 1341 | } else if(var == "QMAKE_PRL_DEFINES") { |
1243 | QStringList &out = project->variables()["DEFINES"]; | 1342 | QStringList &out = project->variables()["DEFINES"]; |
1244 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1343 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
1245 | if(out.findIndex((*it)) == -1 && | 1344 | if(out.findIndex((*it)) == -1 && |
1246 | project->variables()["PRL_EXPORT_DEFINES"].findIndex((*it)) == -1) | 1345 | project->variables()["PRL_EXPORT_DEFINES"].findIndex((*it)) == -1) |
1247 | out.append((*it)); | 1346 | out.append((*it)); |
1248 | } | 1347 | } |
1249 | } | 1348 | } |
1250 | } | 1349 | } |
1251 | 1350 | ||
1252 | void | 1351 | void |
1253 | MakefileGenerator::processPrlFiles() | 1352 | MakefileGenerator::processPrlFiles() |
1254 | { | 1353 | { |
1255 | QDict<void> processed; | 1354 | QDict<void> processed; |
1256 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 1355 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
1257 | //read in any prl files included.. | 1356 | //read in any prl files included.. |
1258 | QStringList l_out; | 1357 | QStringList l_out; |
1259 | QString where = "QMAKE_LIBS"; | 1358 | QString where = "QMAKE_LIBS"; |
1260 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 1359 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
1261 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); | 1360 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); |
1262 | QStringList &l = project->variables()[where]; | 1361 | QStringList &l = project->variables()[where]; |
1263 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1362 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1264 | QString file = (*it); | 1363 | QString file = (*it); |
1265 | if(!processed[file] && processPrlFile(file)) { | 1364 | if(!processed[file] && processPrlFile(file)) { |
1266 | processed.insert(file, (void*)1); | 1365 | processed.insert(file, (void*)1); |
1267 | ret = TRUE; | 1366 | ret = TRUE; |
1268 | } | 1367 | } |
1269 | if(!file.isEmpty()) | 1368 | if(!file.isEmpty()) |
1270 | l_out.append(file); | 1369 | l_out.append(file); |
1271 | } | 1370 | } |
1272 | if(ret) | 1371 | if(ret) |
1273 | l = l_out; | 1372 | l = l_out; |
1274 | else | 1373 | else |
1275 | break; | 1374 | break; |
1276 | } | 1375 | } |
1277 | } | 1376 | } |
1278 | 1377 | ||
1279 | void | 1378 | void |
1280 | MakefileGenerator::writePrlFile(QTextStream &t) | 1379 | MakefileGenerator::writePrlFile(QTextStream &t) |
1281 | { | 1380 | { |
1282 | QString target = project->first("TARGET"); | 1381 | QString target = project->first("TARGET"); |
1283 | int slsh = target.findRev(Option::dir_sep); | 1382 | int slsh = target.findRev(Option::dir_sep); |
1284 | if(slsh != -1) | 1383 | if(slsh != -1) |
1285 | target = target.right(target.length() - slsh - 1); | 1384 | target = target.right(target.length() - slsh - 1); |
1286 | QString bdir = Option::output_dir; | 1385 | QString bdir = Option::output_dir; |
1287 | if(bdir.isEmpty()) | 1386 | if(bdir.isEmpty()) |
1288 | bdir = QDir::currentDirPath(); | 1387 | bdir = QDir::currentDirPath(); |
1289 | t << "QMAKE_PRL_BUILD_DIR = " << bdir << endl; | 1388 | t << "QMAKE_PRL_BUILD_DIR = " << bdir << endl; |
1290 | 1389 | ||
1291 | if(!project->projectFile().isEmpty() && project->projectFile() != "-") | 1390 | if(!project->projectFile().isEmpty() && project->projectFile() != "-") |
1292 | t << "QMAKE_PRO_INPUT = " << project->projectFile().section('/', -1) << endl; | 1391 | t << "QMAKE_PRO_INPUT = " << project->projectFile().section('/', -1) << endl; |
1293 | 1392 | ||
1294 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 1393 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
1295 | t << "QMAKE_PRL_SOURCE_DIR = " << project->first("QMAKE_ABSOLUTE_SOURCE_PATH") << endl; | 1394 | t << "QMAKE_PRL_SOURCE_DIR = " << project->first("QMAKE_ABSOLUTE_SOURCE_PATH") << endl; |
1296 | t << "QMAKE_PRL_TARGET = " << target << endl; | 1395 | t << "QMAKE_PRL_TARGET = " << target << endl; |
1297 | if(!project->isEmpty("PRL_EXPORT_DEFINES")) | 1396 | if(!project->isEmpty("PRL_EXPORT_DEFINES")) |
1298 | t << "QMAKE_PRL_DEFINES = " << project->variables()["PRL_EXPORT_DEFINES"].join(" ") << endl; | 1397 | t << "QMAKE_PRL_DEFINES = " << project->variables()["PRL_EXPORT_DEFINES"].join(" ") << endl; |
1398 | if(!project->isEmpty("PRL_EXPORT_CFLAGS")) | ||
1399 | t << "QMAKE_PRL_CFLAGS = " << project->variables()["PRL_EXPORT_CFLAGS"].join(" ") << endl; | ||
1400 | if(!project->isEmpty("PRL_EXPORT_CXXFLAGS")) | ||
1401 | t << "QMAKE_PRL_CXXFLAGS = " << project->variables()["PRL_EXPORT_CXXFLAGS"].join(" ") << endl; | ||
1299 | if(!project->isEmpty("CONFIG")) | 1402 | if(!project->isEmpty("CONFIG")) |
1300 | t << "QMAKE_PRL_CONFIG = " << project->variables()["CONFIG"].join(" ") << endl; | 1403 | t << "QMAKE_PRL_CONFIG = " << project->variables()["CONFIG"].join(" ") << endl; |
1301 | if(!project->isEmpty("VERSION")) | 1404 | if(!project->isEmpty("VERSION")) |
1302 | t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl; | 1405 | t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl; |
1303 | if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { | 1406 | if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) { |
1304 | QStringList libs; | 1407 | QStringList libs; |
1305 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 1408 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
1306 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; | 1409 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; |
1307 | else | 1410 | else |
1308 | libs << "QMAKE_LIBS"; //obvious one | 1411 | libs << "QMAKE_LIBS"; //obvious one |
1309 | t << "QMAKE_PRL_LIBS = "; | 1412 | t << "QMAKE_PRL_LIBS = "; |
1310 | for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) | 1413 | for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) |
1311 | t << project->variables()[(*it)].join(" ") << " "; | 1414 | t << project->variables()[(*it)].join(" ") << " "; |
1312 | t << endl; | 1415 | t << endl; |
1313 | } | 1416 | } |
1314 | } | 1417 | } |
1315 | 1418 | ||
1316 | bool | 1419 | bool |
1317 | MakefileGenerator::write() | 1420 | MakefileGenerator::write() |
1318 | { | 1421 | { |
1422 | usePlatformDir(); | ||
1319 | init(); | 1423 | init(); |
1320 | findLibraries(); | 1424 | findLibraries(); |
1321 | if((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl | 1425 | if((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl |
1322 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) && | 1426 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) && |
1427 | project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty() && | ||
1323 | project->isActiveConfig("create_prl") && project->first("TEMPLATE") == "lib" && | 1428 | project->isActiveConfig("create_prl") && project->first("TEMPLATE") == "lib" && |
1324 | !project->isActiveConfig("plugin")) { | 1429 | !project->isActiveConfig("plugin")) { |
1325 | QString prl = var("TARGET"); | 1430 | QString prl = var("TARGET"); |
1326 | int slsh = prl.findRev(Option::dir_sep); | 1431 | int slsh = prl.findRev(Option::dir_sep); |
1327 | if(slsh != -1) | 1432 | if(slsh != -1) |
1328 | prl = prl.right(prl.length() - slsh); | 1433 | prl = prl.right(prl.length() - slsh); |
1329 | int dot = prl.find('.'); | 1434 | int dot = prl.find('.'); |
1330 | if(dot != -1) | 1435 | if(dot != -1) |
1331 | prl = prl.left(dot); | 1436 | prl = prl.left(dot); |
1332 | prl += Option::prl_ext; | 1437 | prl += Option::prl_ext; |
1333 | if(!project->isEmpty("DESTDIR")) | 1438 | if(!project->isEmpty("DESTDIR")) |
1334 | prl.prepend(var("DESTDIR")); | 1439 | prl.prepend(var("DESTDIR")); |
1335 | QString local_prl = Option::fixPathToLocalOS(fileFixify(prl, QDir::currentDirPath(), Option::output_dir)); | 1440 | QString local_prl = Option::fixPathToLocalOS(fileFixify(prl, QDir::currentDirPath(), Option::output_dir)); |
1336 | QFile ft(local_prl); | 1441 | QFile ft(local_prl); |
1337 | if(ft.open(IO_WriteOnly)) { | 1442 | if(ft.open(IO_WriteOnly)) { |
1338 | project->variables()["ALL_DEPS"].append(prl); | 1443 | project->variables()["ALL_DEPS"].append(prl); |
1339 | project->variables()["QMAKE_INTERNAL_PRL_FILE"].append(prl); | 1444 | project->variables()["QMAKE_INTERNAL_PRL_FILE"].append(prl); |
1340 | QTextStream t(&ft); | 1445 | QTextStream t(&ft); |
1341 | writePrlFile(t); | 1446 | writePrlFile(t); |
1342 | ft.close(); | 1447 | ft.close(); |
1343 | } | 1448 | } |
1344 | } | 1449 | } |
1345 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && | 1450 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE && |
1346 | project->isActiveConfig("link_prl")) //load up prl's' | 1451 | project->isActiveConfig("link_prl")) //load up prl's' |
1347 | processPrlFiles(); | 1452 | processPrlFiles(); |
1348 | 1453 | ||
1349 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 1454 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || //write prl file |
1350 | Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { | 1455 | Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { |
1351 | QTextStream t(&Option::output); | 1456 | QTextStream t(&Option::output); |
1352 | writeMakefile(t); | 1457 | writeMakefile(t); |
1353 | } | 1458 | } |
1354 | return TRUE; | 1459 | return TRUE; |
1355 | } | 1460 | } |
1356 | 1461 | ||
1462 | // Manipulate directories, so it's possible to build | ||
1463 | // several cross-platform targets concurrently | ||
1464 | void | ||
1465 | MakefileGenerator::usePlatformDir() | ||
1466 | { | ||
1467 | QString pltDir(project->first("QMAKE_PLATFORM_DIR")); | ||
1468 | if(pltDir.isEmpty()) | ||
1469 | return; | ||
1470 | char sep = QDir::separator(); | ||
1471 | QString slashPltDir = sep + pltDir; | ||
1472 | |||
1473 | QString filePath = project->first("DESTDIR"); | ||
1474 | project->variables()["DESTDIR"] = filePath | ||
1475 | + (filePath.isEmpty() ? pltDir : slashPltDir); | ||
1476 | |||
1477 | filePath = project->first("DLLDESTDIR"); | ||
1478 | project->variables()["DLLDESTDIR"] = filePath | ||
1479 | + (filePath.isEmpty() ? pltDir : slashPltDir); | ||
1480 | |||
1481 | filePath = project->first("OBJECTS_DIR"); | ||
1482 | project->variables()["OBJECTS_DIR"] = filePath | ||
1483 | + (filePath.isEmpty() ? pltDir : slashPltDir); | ||
1484 | |||
1485 | filePath = project->first("QMAKE_LIBDIR_QT"); | ||
1486 | project->variables()["QMAKE_LIBDIR_QT"] = filePath | ||
1487 | + (filePath.isEmpty() ? pltDir : slashPltDir); | ||
1488 | |||
1489 | filePath = project->first("QMAKE_LIBS_QT"); | ||
1490 | int fpi = filePath.findRev(sep); | ||
1491 | if (fpi == -1) | ||
1492 | project->variables()["QMAKE_LIBS_QT"].prepend(pltDir + sep); | ||
1493 | else | ||
1494 | project->variables()["QMAKE_LIBS_QT"] = filePath.left(fpi) | ||
1495 | + slashPltDir | ||
1496 | + filePath.mid(fpi); | ||
1497 | |||
1498 | filePath = project->first("QMAKE_LIBS_QT_THREAD"); | ||
1499 | fpi = filePath.findRev(sep); | ||
1500 | if (fpi == -1) | ||
1501 | project->variables()["QMAKE_LIBS_QT_THREAD"].prepend(pltDir + sep); | ||
1502 | else | ||
1503 | project->variables()["QMAKE_LIBS_QT_THREAD"] = filePath.left(fpi) | ||
1504 | + slashPltDir | ||
1505 | + filePath.mid(fpi); | ||
1506 | |||
1507 | filePath = project->first("QMAKE_LIBS_QT_ENTRY"); | ||
1508 | fpi = filePath.findRev(sep); | ||
1509 | if (fpi == -1) | ||
1510 | project->variables()["QMAKE_LIBS_QT_ENTRY"].prepend(pltDir + sep); | ||
1511 | else | ||
1512 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = filePath.left(fpi) | ||
1513 | + slashPltDir | ||
1514 | + filePath.mid(fpi); | ||
1515 | } | ||
1516 | |||
1357 | void | 1517 | void |
1358 | MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &src) | 1518 | MakefileGenerator::writeObj(QTextStream &t, const QString &obj, const QString &src) |
1359 | { | 1519 | { |
1360 | QStringList &objl = project->variables()[obj]; | 1520 | QStringList &objl = project->variables()[obj]; |
1361 | QStringList &srcl = project->variables()[src]; | 1521 | QStringList &srcl = project->variables()[src]; |
1362 | 1522 | ||
1363 | QStringList::Iterator oit = objl.begin(); | 1523 | QStringList::Iterator oit = objl.begin(); |
1364 | QStringList::Iterator sit = srcl.begin(); | 1524 | QStringList::Iterator sit = srcl.begin(); |
1365 | QString stringSrc("$src"); | 1525 | QString stringSrc("$src"); |
1366 | QString stringObj("$obj"); | 1526 | QString stringObj("$obj"); |
1367 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { | 1527 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { |
1368 | if((*sit).isEmpty()) | 1528 | if((*sit).isEmpty()) |
1369 | continue; | 1529 | continue; |
1370 | 1530 | ||
1371 | if(!doDepends()) { | 1531 | if(!doDepends()) { |
1372 | QString sdep, odep = (*sit) + " "; | 1532 | QString sdep, odep = (*sit) + " "; |
1373 | QStringList deps = findDependencies((*sit)); | 1533 | QStringList deps = findDependencies((*sit)); |
1374 | for(QStringList::Iterator dit = deps.begin(); dit != deps.end(); dit++) { | 1534 | for(QStringList::Iterator dit = deps.begin(); dit != deps.end(); dit++) { |
1375 | if((*dit).endsWith(Option::moc_ext)) | 1535 | if((*dit).endsWith(Option::cpp_moc_ext)) |
1376 | odep += (*dit) + " "; | 1536 | odep += (*dit) + " "; |
1377 | else | 1537 | else |
1378 | sdep += (*dit) + " "; | 1538 | sdep += (*dit) + " "; |
1379 | } | 1539 | } |
1380 | t << (*sit) << ": " << sdep << endl | 1540 | t << (*sit) << ": " << sdep << endl |
1381 | << (*oit) << ": " << odep ; | 1541 | << (*oit) << ": " << odep ; |
1382 | } else { | 1542 | } else { |
1383 | t << (*oit) << ": " << (*sit) << " " << findDependencies((*sit)).join(" \\\n\t\t"); | 1543 | t << (*oit) << ": " << (*sit) << " " << findDependencies((*sit)).join(" \\\n\t\t"); |
1384 | } | 1544 | } |
1385 | 1545 | ||
1386 | QString comp, cimp; | 1546 | QString comp, cimp; |
1387 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { | 1547 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { |
1388 | if((*sit).endsWith((*cppit))) { | 1548 | if((*sit).endsWith((*cppit))) { |
1389 | comp = "QMAKE_RUN_CXX"; | 1549 | comp = "QMAKE_RUN_CXX"; |
1390 | cimp = "QMAKE_RUN_CXX_IMP"; | 1550 | cimp = "QMAKE_RUN_CXX_IMP"; |
1391 | break; | 1551 | break; |
1392 | } | 1552 | } |
1393 | } | 1553 | } |
1394 | if(comp.isEmpty()) { | 1554 | if(comp.isEmpty()) { |
1395 | comp = "QMAKE_RUN_CC"; | 1555 | comp = "QMAKE_RUN_CC"; |
1396 | cimp = "QMAKE_RUN_CC_IMP"; | 1556 | cimp = "QMAKE_RUN_CC_IMP"; |
1397 | } | 1557 | } |
1398 | bool use_implicit_rule = !project->isEmpty(cimp); | 1558 | bool use_implicit_rule = !project->isEmpty(cimp); |
1399 | if(use_implicit_rule) { | 1559 | if(use_implicit_rule) { |
1400 | if(!project->isEmpty("OBJECTS_DIR")) { | 1560 | if(!project->isEmpty("OBJECTS_DIR")) { |
1401 | use_implicit_rule = FALSE; | 1561 | use_implicit_rule = FALSE; |
1402 | } else { | 1562 | } else { |
1403 | int dot = (*sit).findRev('.'); | 1563 | int dot = (*sit).findRev('.'); |
1404 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) | 1564 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) |
1405 | use_implicit_rule = FALSE; | 1565 | use_implicit_rule = FALSE; |
1406 | } | 1566 | } |
1407 | } | 1567 | } |
1408 | if (!use_implicit_rule && !project->isEmpty(comp)) { | 1568 | if (!use_implicit_rule && !project->isEmpty(comp)) { |
1409 | QString p = var(comp); | 1569 | QString p = var(comp), srcf(*sit); |
1410 | p.replace(stringSrc, (*sit)); | 1570 | p.replace(stringSrc, srcf); |
1411 | p.replace(stringObj, (*oit)); | 1571 | p.replace(stringObj, (*oit)); |
1412 | t << "\n\t" << p; | 1572 | t << "\n\t" << p; |
1413 | } | 1573 | } |
1414 | t << endl << endl; | 1574 | t << endl << endl; |
1415 | } | 1575 | } |
1416 | } | 1576 | } |
1417 | 1577 | ||
1418 | 1578 | ||
1419 | void | 1579 | void |
1420 | MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) | 1580 | MakefileGenerator::writeUicSrc(QTextStream &t, const QString &ui) |
1421 | { | 1581 | { |
1422 | QStringList &uil = project->variables()[ui]; | 1582 | QStringList &uil = project->variables()[ui]; |
1423 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); it++) { | 1583 | for(QStringList::Iterator it = uil.begin(); it != uil.end(); it++) { |
1424 | QString deps = findDependencies((*it)).join(" \\\n\t\t"), decl, impl; | 1584 | QString decl, impl; |
1425 | { | 1585 | { |
1426 | QString tmp = (*it), impl_dir, decl_dir; | 1586 | QString tmp = (*it), impl_dir, decl_dir; |
1427 | decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); | 1587 | decl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::h_ext.first()); |
1428 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); | 1588 | int dlen = decl.findRev(Option::dir_sep) + 1; |
1429 | int dlen = decl.findRev(Option::dir_sep) + 1; | ||
1430 | tmp = (*it); | 1589 | tmp = (*it); |
1431 | impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); | 1590 | impl = tmp.replace(QRegExp("\\" + Option::ui_ext + "$"), Option::cpp_ext.first()); |
1432 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); | 1591 | int ilen = decl.findRev(Option::dir_sep) + 1; |
1433 | int ilen = decl.findRev(Option::dir_sep) + 1; | ||
1434 | if(!project->isEmpty("UI_DIR")) { | 1592 | if(!project->isEmpty("UI_DIR")) { |
1435 | impl_dir = project->first("UI_DIR"); | 1593 | impl_dir = project->first("UI_DIR"); |
1436 | decl = project->first("UI_DIR") + decl.right(decl.length() - dlen); | 1594 | decl = project->first("UI_DIR") + decl.right(decl.length() - dlen); |
1437 | impl = project->first("UI_DIR") + impl.right(impl.length() - ilen); | 1595 | impl = project->first("UI_DIR") + impl.right(impl.length() - ilen); |
1438 | } else { | 1596 | } else { |
1439 | if(!project->isEmpty("UI_HEADERS_DIR")) { | 1597 | if(!project->isEmpty("UI_HEADERS_DIR")) { |
1440 | decl_dir = project->first("UI_HEADERS_DIR"); | 1598 | decl_dir = project->first("UI_HEADERS_DIR"); |
1441 | decl = project->first("UI_HEADERS_DIR") + decl.right(decl.length() - dlen); | 1599 | decl = project->first("UI_HEADERS_DIR") + decl.right(decl.length() - dlen); |
1442 | } | 1600 | } |
1443 | if(!project->isEmpty("UI_SOURCES_DIR")) { | 1601 | if(!project->isEmpty("UI_SOURCES_DIR")) { |
1444 | impl_dir = project->first("UI_SOURCES_DIR"); | 1602 | impl_dir = project->first("UI_SOURCES_DIR"); |
1445 | impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - ilen); | 1603 | impl = project->first("UI_SOURCES_DIR") + impl.right(impl.length() - ilen); |
1446 | } | 1604 | } |
1447 | } | 1605 | } |
1448 | if(decl_dir.isEmpty()) | 1606 | impl = fileFixify(impl, QDir::currentDirPath(), Option::output_dir); |
1449 | decl_dir = decl.left(dlen); | 1607 | decl = fileFixify(decl, QDir::currentDirPath(), Option::output_dir); |
1450 | if(impl_dir.isEmpty()) | 1608 | if(decl_dir.isEmpty()) |
1451 | impl_dir = impl.left(ilen); | 1609 | decl_dir = decl.section(Option::dir_sep,0,-2); |
1452 | if(!impl_dir.isEmpty()) | 1610 | if(impl_dir.isEmpty()) |
1453 | createDir(Option::output_dir + Option::dir_sep + impl_dir); | 1611 | impl_dir = impl.section(Option::dir_sep,0,-2); |
1454 | if(!decl_dir.isEmpty() && decl_dir != impl_dir) | 1612 | if (QDir::isRelativePath(impl_dir)) |
1455 | createDir(Option::output_dir + Option::dir_sep + decl_dir); | 1613 | impl_dir.prepend(Option::output_dir + Option::dir_sep); |
1456 | } | 1614 | if (QDir::isRelativePath(decl_dir)) |
1457 | t << decl << ": " << (*it) << " " << deps << "\n\t" | 1615 | decl_dir.prepend(Option::output_dir + Option::dir_sep); |
1616 | createDir(impl_dir); | ||
1617 | createDir(decl_dir); | ||
1618 | } | ||
1619 | QStringList deps = findDependencies((*it)); | ||
1620 | deps.remove(decl); //avoid circular dependencies.. | ||
1621 | t << decl << ": " << (*it) << " " << deps.join(" \\\n\t\t") << "\n\t" | ||
1458 | << "$(UIC) " << (*it) << " -o " << decl << endl << endl; | 1622 | << "$(UIC) " << (*it) << " -o " << decl << endl << endl; |
1459 | 1623 | ||
1460 | QString mildDecl = decl; | 1624 | QString mildDecl = decl; |
1461 | int k = mildDecl.findRev( Option::dir_sep ); | 1625 | int k = mildDecl.findRev(Option::dir_sep); |
1462 | if ( k != -1 ) | 1626 | if ( k != -1 ) |
1463 | mildDecl = mildDecl.mid( k + 1 ); | 1627 | mildDecl = mildDecl.mid( k + 1 ); |
1464 | 1628 | t << impl << ": " << decl << " " << (*it) << " " << deps.join(" \\\n\t\t") << "\n\t" | |
1465 | t << impl << ": " << decl << " " << (*it) << " " << deps << "\n\t" | 1629 | << "$(UIC)"; |
1466 | << "$(UIC) " << (*it) << " -i " << mildDecl << " -o " << impl << endl << endl; | 1630 | t << " " << (*it) << " -i " << mildDecl << " -o " << impl << endl << endl; |
1467 | } | 1631 | } |
1468 | } | 1632 | } |
1469 | 1633 | ||
1470 | 1634 | ||
1471 | void | 1635 | void |
1472 | MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString &src) | 1636 | MakefileGenerator::writeMocObj(QTextStream &t, const QString &obj, const QString &src) |
1473 | { | 1637 | { |
1474 | QStringList &objl = project->variables()[obj], | 1638 | QStringList &objl = project->variables()[obj], |
1475 | &srcl = project->variables()[src]; | 1639 | &srcl = project->variables()[src]; |
1476 | QStringList::Iterator oit = objl.begin(), sit = srcl.begin(); | 1640 | QStringList::Iterator oit = objl.begin(), sit = srcl.begin(); |
1477 | QString stringSrc("$src"), stringObj("$obj"); | 1641 | QString stringSrc("$src"), stringObj("$obj"); |
1478 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { | 1642 | for( ;sit != srcl.end() && oit != objl.end(); oit++, sit++) { |
1479 | QString hdr = findMocSource((*sit)); | 1643 | QString hdr = findMocSource((*sit)); |
1480 | t << (*oit) << ": " << (*sit) << " " | 1644 | t << (*oit) << ": " |
1645 | << (*sit) << " " << findDependencies((*sit)).join(" \\\n\t\t") << " " | ||
1481 | << hdr << " " << findDependencies(hdr).join(" \\\n\t\t"); | 1646 | << hdr << " " << findDependencies(hdr).join(" \\\n\t\t"); |
1482 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); | 1647 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); |
1483 | if(use_implicit_rule) { | 1648 | if(use_implicit_rule) { |
1484 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("MOC_DIR")) { | 1649 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("MOC_DIR")) { |
1485 | use_implicit_rule = FALSE; | 1650 | use_implicit_rule = FALSE; |
1486 | } else { | 1651 | } else { |
1487 | int dot = (*sit).findRev('.'); | 1652 | int dot = (*sit).findRev('.'); |
1488 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) | 1653 | if(dot == -1 || ((*sit).left(dot) + Option::obj_ext != (*oit))) |
1489 | use_implicit_rule = FALSE; | 1654 | use_implicit_rule = FALSE; |
1490 | } | 1655 | } |
1491 | } | 1656 | } |
1492 | if (!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { | 1657 | if (!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { |
1493 | QString p = var("QMAKE_RUN_CXX"); | 1658 | QString p = var("QMAKE_RUN_CXX"), srcf(*sit); |
1494 | p.replace(stringSrc, (*sit)); | 1659 | p.replace(stringSrc, srcf); |
1495 | p.replace(stringObj, (*oit)); | 1660 | p.replace(stringObj, (*oit)); |
1496 | t << "\n\t" << p; | 1661 | t << "\n\t" << p; |
1497 | } | 1662 | } |
1498 | t << endl << endl; | 1663 | t << endl << endl; |
1499 | } | 1664 | } |
1500 | } | 1665 | } |
1501 | 1666 | ||
1502 | 1667 | ||
1503 | void | 1668 | void |
1504 | MakefileGenerator::writeMocSrc(QTextStream &t, const QString &src) | 1669 | MakefileGenerator::writeMocSrc(QTextStream &t, const QString &src) |
1505 | { | 1670 | { |
1506 | QStringList &l = project->variables()[src]; | 1671 | QStringList &l = project->variables()[src]; |
1507 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1672 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1508 | QString m = Option::fixPathToTargetOS(findMocDestination(*it)); | 1673 | QString m = Option::fixPathToTargetOS(findMocDestination(*it)); |
1509 | if ( !m.isEmpty()) { | 1674 | if ( !m.isEmpty()) { |
1510 | QString deps; | 1675 | QString deps; |
1511 | if(!project->isActiveConfig("no_mocdepend")) | 1676 | if(!project->isActiveConfig("no_mocdepend")) |
1512 | deps += "$(MOC) "; | 1677 | deps += "$(MOC) "; |
1513 | deps += (*it); | 1678 | deps += (*it); |
1514 | t << m << ": " << deps << "\n\t" | 1679 | t << m << ": " << deps << "\n\t" |
1515 | << "$(MOC) " << (*it) << " -o " << m << endl << endl; | 1680 | << "$(MOC)"; |
1681 | t << " " << (*it) << " -o " << m << endl << endl; | ||
1516 | } | 1682 | } |
1517 | } | 1683 | } |
1518 | } | 1684 | } |
1519 | 1685 | ||
1520 | void | 1686 | void |
1521 | MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) | 1687 | MakefileGenerator::writeYaccSrc(QTextStream &t, const QString &src) |
1522 | { | 1688 | { |
1523 | QStringList &l = project->variables()[src]; | 1689 | QStringList &l = project->variables()[src]; |
1524 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) | 1690 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) |
1525 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected." | 1691 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected." |
1526 | "This can lead to link problems.\n"); | 1692 | "This can lead to link problems.\n"); |
1527 | QString default_out_h = "y.tab.h", default_out_c = "y.tab.c"; | 1693 | QString default_out_h = "y.tab.h", default_out_c = "y.tab.c"; |
1528 | if(!project->isEmpty("QMAKE_YACC_HEADER")) | 1694 | if(!project->isEmpty("QMAKE_YACC_HEADER")) |
1529 | default_out_h = project->first("QMAKE_YACC_HEADER"); | 1695 | default_out_h = project->first("QMAKE_YACC_HEADER"); |
1530 | if(!project->isEmpty("QMAKE_YACC_SOURCE")) | 1696 | if(!project->isEmpty("QMAKE_YACC_SOURCE")) |
1531 | default_out_c = project->first("QMAKE_YACC_SOURCE"); | 1697 | default_out_c = project->first("QMAKE_YACC_SOURCE"); |
1532 | QString stringBase("$base"); | 1698 | QString stringBase("$base"); |
1533 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1699 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1534 | QFileInfo fi((*it)); | 1700 | QFileInfo fi((*it)); |
1535 | QString dir; | 1701 | QString dir; |
1536 | if(fi.dirPath() != ".") | 1702 | if(fi.dirPath() != ".") |
1537 | dir = fi.dirPath() + Option::dir_sep; | 1703 | dir = fi.dirPath() + Option::dir_sep; |
1538 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 1704 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
1539 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1705 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
1540 | dir += Option::dir_sep; | 1706 | dir += Option::dir_sep; |
1541 | 1707 | ||
1542 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | 1708 | QString impl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); |
1543 | QString decl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | 1709 | QString decl = dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); |
1544 | 1710 | ||
1545 | QString yaccflags = "$(YACCFLAGS)", mangle = "y"; | 1711 | QString yaccflags = "$(YACCFLAGS)", mangle = "y"; |
1546 | if(!project->isActiveConfig("yacc_no_name_mangle")) { | 1712 | if(!project->isActiveConfig("yacc_no_name_mangle")) { |
1547 | mangle = fi.baseName(TRUE); | 1713 | mangle = fi.baseName(TRUE); |
1548 | yaccflags += " -p " + mangle; | 1714 | if(!project->isEmpty("QMAKE_YACCFLAGS_MANGLE")) |
1715 | yaccflags += " " + var("QMAKE_YACCFLAGS_MANGLE").replace(stringBase, mangle); | ||
1716 | else | ||
1717 | yaccflags += " -p " + mangle; | ||
1549 | } | 1718 | } |
1550 | QString out_h = default_out_h, out_c = default_out_c; | 1719 | QString out_h = default_out_h, out_c = default_out_c; |
1551 | if(!mangle.isEmpty()) { | 1720 | if(!mangle.isEmpty()) { |
1552 | out_h.replace(stringBase, mangle); | 1721 | out_h.replace(stringBase, mangle); |
1553 | out_c.replace(stringBase, mangle); | 1722 | out_c.replace(stringBase, mangle); |
1554 | } | 1723 | } |
1555 | 1724 | ||
1556 | t << impl << ": " << (*it) << "\n\t" | 1725 | t << impl << ": " << (*it) << "\n\t" |
1557 | << "$(YACC) " << yaccflags << " " << (*it) << "\n\t" | 1726 | << "$(YACC) " << yaccflags << " " << (*it) << "\n\t" |
1558 | << "-$(DEL_FILE) " << impl << " " << decl << "\n\t" | 1727 | << "-$(DEL_FILE) " << impl << " " << decl << "\n\t" |
1559 | << "-$(MOVE) " << out_h << " " << decl << "\n\t" | 1728 | << "-$(MOVE) " << out_h << " " << decl << "\n\t" |
1560 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; | 1729 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; |
1561 | t << decl << ": " << impl << endl << endl; | 1730 | t << decl << ": " << impl << endl << endl; |
1562 | } | 1731 | } |
1563 | } | 1732 | } |
1564 | 1733 | ||
1565 | void | 1734 | void |
1566 | MakefileGenerator::writeLexSrc(QTextStream &t, const QString &src) | 1735 | MakefileGenerator::writeLexSrc(QTextStream &t, const QString &src) |
1567 | { | 1736 | { |
1568 | QStringList &l = project->variables()[src]; | 1737 | QStringList &l = project->variables()[src]; |
1569 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) | 1738 | if(project->isActiveConfig("yacc_no_name_mangle") && l.count() > 1) |
1570 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected.\n" | 1739 | warn_msg(WarnLogic, "yacc_no_name_mangle specified, but multiple parsers expected.\n" |
1571 | "This can lead to link problems.\n"); | 1740 | "This can lead to link problems.\n"); |
1572 | QString default_out_c = "lex.$base.c"; | 1741 | QString default_out_c = "lex.$base.c"; |
1573 | if(!project->isEmpty("QMAKE_LEX_SOURCE")) | 1742 | if(!project->isEmpty("QMAKE_LEX_SOURCE")) |
1574 | default_out_c = project->first("QMAKE_LEX_SOURCE"); | 1743 | default_out_c = project->first("QMAKE_LEX_SOURCE"); |
1575 | QString stringBase("$base"); | 1744 | QString stringBase("$base"); |
1576 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1745 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1577 | QFileInfo fi((*it)); | 1746 | QFileInfo fi((*it)); |
1578 | QString dir; | 1747 | QString dir; |
1579 | if(fi.dirPath() != ".") | 1748 | if(fi.dirPath() != ".") |
1580 | dir = fi.dirPath() + Option::dir_sep; | 1749 | dir = fi.dirPath() + Option::dir_sep; |
1581 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 1750 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
1582 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 1751 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
1583 | dir += Option::dir_sep; | 1752 | dir += Option::dir_sep; |
1584 | QString impl = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | 1753 | QString impl = dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); |
1585 | 1754 | ||
1586 | QString lexflags = "$(LEXFLAGS)", stub="yy"; | 1755 | QString lexflags = "$(LEXFLAGS)", stub="yy"; |
1587 | if(!project->isActiveConfig("yacc_no_name_mangle")) { | 1756 | if(!project->isActiveConfig("yacc_no_name_mangle")) { |
1588 | stub = fi.baseName(TRUE); | 1757 | stub = fi.baseName(TRUE); |
1589 | lexflags += " -P" + stub; | 1758 | lexflags += " -P" + stub; |
1590 | } | 1759 | } |
1591 | QString out_c = default_out_c; | 1760 | QString out_c = default_out_c; |
1592 | if(!stub.isEmpty()) | 1761 | if(!stub.isEmpty()) |
1593 | out_c.replace(stringBase, stub); | 1762 | out_c.replace(stringBase, stub); |
1594 | 1763 | ||
1595 | t << impl << ": " << (*it) << " " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" | 1764 | t << impl << ": " << (*it) << " " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" |
1596 | << ( "$(LEX) " + lexflags + " " ) << (*it) << "\n\t" | 1765 | << ( "$(LEX) " + lexflags + " " ) << (*it) << "\n\t" |
1597 | << "-$(DEL_FILE) " << impl << " " << "\n\t" | 1766 | << "-$(DEL_FILE) " << impl << " " << "\n\t" |
1598 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; | 1767 | << "-$(MOVE) " << out_c << " " << impl << endl << endl; |
1599 | } | 1768 | } |
1600 | } | 1769 | } |
1601 | 1770 | ||
1602 | void | 1771 | void |
1603 | MakefileGenerator::writeImageObj(QTextStream &t, const QString &obj) | 1772 | MakefileGenerator::writeImageObj(QTextStream &t, const QString &obj) |
1604 | { | 1773 | { |
1605 | QStringList &objl = project->variables()[obj]; | 1774 | QStringList &objl = project->variables()[obj]; |
1606 | QString stringSrc("$src"); | 1775 | QString stringSrc("$src"); |
1607 | QString stringObj("$obj"); | 1776 | QString stringObj("$obj"); |
1608 | 1777 | ||
1609 | QString uidir; | 1778 | QString uidir; |
1610 | for(QStringList::Iterator oit = objl.begin(); oit != objl.end(); oit++) { | 1779 | for(QStringList::Iterator oit = objl.begin(); oit != objl.end(); oit++) { |
1611 | QString src(project->first("QMAKE_IMAGE_COLLECTION")); | 1780 | QString src(project->first("QMAKE_IMAGE_COLLECTION")); |
1612 | t << (*oit) << ": " << src; | 1781 | t << (*oit) << ": " << src; |
1613 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); | 1782 | bool use_implicit_rule = !project->isEmpty("QMAKE_RUN_CXX_IMP"); |
1614 | if(use_implicit_rule) { | 1783 | if(use_implicit_rule) { |
1615 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { | 1784 | if(!project->isEmpty("OBJECTS_DIR") || !project->isEmpty("UI_DIR") || !project->isEmpty("UI_SOURCES_DIR")) { |
1616 | use_implicit_rule = FALSE; | 1785 | use_implicit_rule = FALSE; |
1617 | } else { | 1786 | } else { |
1618 | int dot = src.findRev('.'); | 1787 | int dot = src.findRev('.'); |
1619 | if(dot == -1 || (src.left(dot) + Option::obj_ext != (*oit))) | 1788 | if(dot == -1 || (src.left(dot) + Option::obj_ext != (*oit))) |
1620 | use_implicit_rule = FALSE; | 1789 | use_implicit_rule = FALSE; |
1621 | } | 1790 | } |
1622 | } | 1791 | } |
1623 | if(!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { | 1792 | if(!use_implicit_rule && !project->isEmpty("QMAKE_RUN_CXX")) { |
1624 | QString p = var("QMAKE_RUN_CXX"); | 1793 | QString p = var("QMAKE_RUN_CXX"), srcf(src); |
1625 | p.replace( stringSrc, src); | 1794 | p.replace(stringSrc, srcf); |
1626 | p.replace( stringObj, (*oit)); | 1795 | p.replace(stringObj, (*oit)); |
1627 | t << "\n\t" << p; | 1796 | t << "\n\t" << p; |
1628 | } | 1797 | } |
1629 | t << endl << endl; | 1798 | t << endl << endl; |
1630 | } | 1799 | } |
1631 | } | 1800 | } |
1632 | 1801 | ||
1633 | 1802 | ||
1634 | void | 1803 | void |
1635 | MakefileGenerator::writeImageSrc(QTextStream &t, const QString &src) | 1804 | MakefileGenerator::writeImageSrc(QTextStream &t, const QString &src) |
1636 | { | 1805 | { |
1637 | QStringList &l = project->variables()[src]; | 1806 | QStringList &l = project->variables()[src]; |
1638 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1807 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1639 | QString gen = project->first("MAKEFILE_GENERATOR"); | 1808 | QString gen = project->first("MAKEFILE_GENERATOR"); |
1640 | if ( gen == "MSVC" ) { | 1809 | if ( gen == "MSVC" ) { |
1641 | t << (*it) << ": " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" | 1810 | t << (*it) << ": " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" |
1642 | << "$(UIC) -o " << (*it) << " -embed " << project->first("QMAKE_ORIG_TARGET") | 1811 | << "$(UIC) -o " << (*it) << " -embed " << project->first("QMAKE_ORIG_TARGET") |
1643 | << " -f <<\n" << findDependencies((*it)).join(" ") << "\n<<" << endl << endl; | 1812 | << " -f <<\n" << findDependencies((*it)).join(" ") << "\n<<" << endl << endl; |
1644 | } else if ( gen == "BMAKE" ) { | 1813 | } else if ( gen == "BMAKE" ) { |
1645 | t << (*it) << ": " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" | 1814 | t << (*it) << ": " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" |
1646 | << "$(UIC) " << " -embed " << project->first("QMAKE_ORIG_TARGET") | 1815 | << "$(UIC) " << " -embed " << project->first("QMAKE_ORIG_TARGET") |
1647 | << " -f &&|\n" << findDependencies((*it)).join(" ") << "\n| -o " << (*it) << endl << endl; | 1816 | << " -f &&|\n" << findDependencies((*it)).join(" ") << "\n| -o " << (*it) << endl << endl; |
1648 | } else { | 1817 | } else { |
1649 | t << (*it) << ": " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" | 1818 | t << (*it) << ": " << findDependencies((*it)).join(" \\\n\t\t") << "\n\t" |
1650 | << "$(UIC) " << " -embed " << project->first("QMAKE_ORIG_TARGET") | 1819 | << "$(UIC) " << " -embed " << project->first("QMAKE_ORIG_TARGET") |
1651 | << " " << findDependencies((*it)).join(" ") << " -o " << (*it) << endl << endl; | 1820 | << " " << findDependencies((*it)).join(" ") << " -o " << (*it) << endl << endl; |
1652 | } | 1821 | } |
1653 | } | 1822 | } |
1654 | } | 1823 | } |
1655 | 1824 | ||
1656 | 1825 | ||
1657 | void | 1826 | void |
1658 | MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) | 1827 | MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs) |
1659 | { | 1828 | { |
1660 | QString all_installs, all_uninstalls; | 1829 | QString all_installs, all_uninstalls; |
1661 | QStringList &l = project->variables()[installs]; | 1830 | QStringList &l = project->variables()[installs]; |
1662 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 1831 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1663 | QString pvar = (*it) + ".path"; | 1832 | QString pvar = (*it) + ".path"; |
1664 | if(project->variables()[pvar].isEmpty()) { | 1833 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_path") == -1 && |
1834 | project->variables()[pvar].isEmpty()) { | ||
1665 | warn_msg(WarnLogic, "%s is not defined: install target not created\n", pvar.latin1()); | 1835 | warn_msg(WarnLogic, "%s is not defined: install target not created\n", pvar.latin1()); |
1666 | continue; | 1836 | continue; |
1667 | } | 1837 | } |
1668 | 1838 | ||
1669 | bool do_default = TRUE; | 1839 | bool do_default = TRUE; |
1670 | const QString root = "$(INSTALL_ROOT)"; | 1840 | const QString root = "$(INSTALL_ROOT)"; |
1671 | QString target, dst= fileFixify(project->variables()[pvar].first()); | 1841 | QString target, dst= fileFixify(project->variables()[pvar].first()); |
1672 | #ifndef Q_WS_WIN | ||
1673 | if(dst.right(1) != Option::dir_sep) | 1842 | if(dst.right(1) != Option::dir_sep) |
1674 | dst += Option::dir_sep; | 1843 | dst += Option::dir_sep; |
1675 | #endif | 1844 | QStringList tmp, uninst = project->variables()[(*it) + ".uninstall"]; |
1676 | QStringList tmp, &uninst = project->variables()[(*it) + ".uninstall"]; | ||
1677 | //other | 1845 | //other |
1678 | tmp = project->variables()[(*it) + ".extra"]; | 1846 | tmp = project->variables()[(*it) + ".extra"]; |
1847 | if(tmp.isEmpty()) | ||
1848 | tmp = project->variables()[(*it) + ".commands"]; //to allow compatible name | ||
1679 | if(!tmp.isEmpty()) { | 1849 | if(!tmp.isEmpty()) { |
1680 | do_default = FALSE; | 1850 | do_default = FALSE; |
1681 | if(!target.isEmpty()) | 1851 | if(!target.isEmpty()) |
1682 | target += "\n\t"; | 1852 | target += "\n\t"; |
1683 | target += tmp.join(" "); | 1853 | target += tmp.join(" "); |
1684 | } | 1854 | } |
1685 | //masks | 1855 | //masks |
1686 | tmp = project->variables()[(*it) + ".files"]; | 1856 | tmp = project->variables()[(*it) + ".files"]; |
1687 | if(!tmp.isEmpty()) { | 1857 | if(!tmp.isEmpty()) { |
1688 | if(!target.isEmpty()) | 1858 | if(!target.isEmpty()) |
1689 | target += "\n"; | 1859 | target += "\n"; |
1690 | do_default = FALSE; | 1860 | do_default = FALSE; |
1691 | for(QStringList::Iterator wild_it = tmp.begin(); wild_it != tmp.end(); ++wild_it) { | 1861 | for(QStringList::Iterator wild_it = tmp.begin(); wild_it != tmp.end(); ++wild_it) { |
1692 | QString wild = Option::fixPathToLocalOS((*wild_it), FALSE), wild_var = fileFixify(wild); | 1862 | QString wild = Option::fixPathToLocalOS((*wild_it), FALSE), wild_var = fileFixify(wild); |
1693 | QString dirstr = QDir::currentDirPath(), filestr = wild; | 1863 | QString dirstr = QDir::currentDirPath(), filestr = wild; |
1694 | int slsh = filestr.findRev(Option::dir_sep); | 1864 | int slsh = filestr.findRev(Option::dir_sep); |
1695 | if(slsh != -1) { | 1865 | if(slsh != -1) { |
1696 | dirstr = filestr.left(slsh+1); | 1866 | dirstr = filestr.left(slsh+1); |
1697 | filestr = filestr.right(filestr.length() - slsh - 1); | 1867 | filestr = filestr.right(filestr.length() - slsh - 1); |
1698 | } | 1868 | } |
1699 | if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) | 1869 | if(dirstr.right(Option::dir_sep.length()) != Option::dir_sep) |
1700 | dirstr += Option::dir_sep; | 1870 | dirstr += Option::dir_sep; |
1701 | if(QFile::exists(wild)) { //real file | 1871 | if(QFile::exists(wild)) { //real file |
1702 | QString file = wild; | 1872 | QString file = wild; |
1703 | QFileInfo fi(wild); | 1873 | QFileInfo fi(wild); |
1704 | if(!target.isEmpty()) | 1874 | if(!target.isEmpty()) |
1705 | target += "\t"; | 1875 | target += "\t"; |
1706 | target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + | 1876 | QString cmd = QString(fi.isDir() ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + |
1707 | Option::fixPathToTargetOS(fileFixify(wild), FALSE) + "\" \"" + root + dst + "\"\n"; | 1877 | Option::fixPathToTargetOS(fileFixify(wild, QString::null, |
1878 | QString::null, FALSE, FALSE), FALSE) + | ||
1879 | "\" \"" + root + dst + "\"\n"; | ||
1880 | target += cmd; | ||
1708 | if(!project->isActiveConfig("debug") && | 1881 | if(!project->isActiveConfig("debug") && |
1709 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) | 1882 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) |
1710 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + filestr) + "\"\n"; | 1883 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + |
1884 | root + fileFixify(dst + filestr, QString::null, QString::null, FALSE, FALSE) + | ||
1885 | "\"\n"; | ||
1711 | if(!uninst.isEmpty()) | 1886 | if(!uninst.isEmpty()) |
1712 | uninst.append("\n\t"); | 1887 | uninst.append("\n\t"); |
1713 | uninst.append( | 1888 | uninst.append( |
1714 | #ifdef Q_WS_WIN | 1889 | #ifdef Q_WS_WIN |
1715 | QString("-$(DEL_FILE)") | 1890 | QString("-$(DEL_FILE)") |
1716 | #else | 1891 | #else |
1717 | QString("-$(DEL_FILE) -r") | 1892 | QString("-$(DEL_FILE) -r") |
1718 | #endif | 1893 | #endif |
1719 | + " \"" + root + fileFixify(dst + filestr) + "\""); | 1894 | + " \"" + root + fileFixify(dst + filestr, QString::null, QString::null, FALSE, FALSE) + "\""); |
1720 | continue; | 1895 | continue; |
1721 | } | 1896 | } |
1897 | fixEnvVariables(dirstr); | ||
1722 | QDir dir(dirstr, filestr); //wild | 1898 | QDir dir(dirstr, filestr); //wild |
1723 | for(uint x = 0; x < dir.count(); x++) { | 1899 | for(uint x = 0; x < dir.count(); x++) { |
1724 | QString file = dir[x]; | 1900 | QString file = dir[x]; |
1725 | if(file == "." || file == "..") //blah | 1901 | if(file == "." || file == "..") //blah |
1726 | continue; | 1902 | continue; |
1727 | if(!uninst.isEmpty()) | 1903 | if(!uninst.isEmpty()) |
1728 | uninst.append("\n\t"); | 1904 | uninst.append("\n\t"); |
1729 | uninst.append( | 1905 | uninst.append( |
1730 | #ifdef Q_WS_WIN | 1906 | #ifdef Q_WS_WIN |
1731 | QString("-$(DEL_FILE)") | 1907 | QString("-$(DEL_FILE)") |
1732 | #else | 1908 | #else |
1733 | QString("-$(DEL_FILE) -r") | 1909 | QString("-$(DEL_FILE) -r") |
1734 | #endif | 1910 | #endif |
1735 | + " \"" + root + fileFixify(dst + file) + "\""); | 1911 | + " \"" + root + fileFixify(dst + file, QString::null, QString::null, FALSE, FALSE) + |
1736 | QFileInfo fi(file); | 1912 | "\""); |
1913 | QFileInfo fi(Option::fixPathToTargetOS(fileFixify(dirstr + file), TRUE)); | ||
1737 | if(!target.isEmpty()) | 1914 | if(!target.isEmpty()) |
1738 | target += "\t"; | 1915 | target += "\t"; |
1739 | target += QString(fi.isDir() ? "-$(COPY_DIR)" : "-$(COPY_FILE)") + " \"" + | 1916 | QString cmd = QString(fi.isDir() ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + |
1740 | Option::fixPathToTargetOS(fileFixify(dirstr + file), FALSE) + | 1917 | Option::fixPathToTargetOS(fileFixify(dirstr + file, QString::null, |
1741 | "\" \"" + root + fileFixify(dst) + "\"\n"; | 1918 | QString::null, FALSE, FALSE), FALSE) + |
1919 | "\" \"" + root + dst + "\"\n"; | ||
1920 | target += cmd; | ||
1742 | if(!project->isActiveConfig("debug") && | 1921 | if(!project->isActiveConfig("debug") && |
1743 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) | 1922 | !fi.isDir() && fi.isExecutable() && !project->isEmpty("QMAKE_STRIP")) |
1744 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + root + fileFixify(dst + file) + "\"\n"; | 1923 | target += QString("\t-") + var("QMAKE_STRIP") + " \"" + |
1924 | root + fileFixify(dst + file, QString::null, QString::null, FALSE, FALSE) + | ||
1925 | "\"\n"; | ||
1745 | } | 1926 | } |
1746 | } | 1927 | } |
1747 | } | 1928 | } |
1748 | //default? | 1929 | //default? |
1749 | if(do_default) | 1930 | if(do_default) { |
1750 | target = defaultInstall((*it)); | 1931 | target = defaultInstall((*it)); |
1932 | uninst = project->variables()[(*it) + ".uninstall"]; | ||
1933 | } | ||
1751 | 1934 | ||
1752 | if(!target.isEmpty()) { | 1935 | if(!target.isEmpty()) { |
1753 | t << "install_" << (*it) << ": " << "\n\t"; | 1936 | t << "install_" << (*it) << ": all "; |
1937 | const QStringList &deps = project->variables()[(*it) + ".depends"]; | ||
1938 | if(!deps.isEmpty()) { | ||
1939 | for(QStringList::ConstIterator dep_it = deps.begin(); dep_it != deps.end(); ++dep_it) { | ||
1940 | QString targ = var((*dep_it) + ".target"); | ||
1941 | if(targ.isEmpty()) | ||
1942 | targ = (*dep_it); | ||
1943 | t << targ; | ||
1944 | } | ||
1945 | } | ||
1946 | t << "\n\t"; | ||
1754 | const QStringList &dirs = project->variables()[pvar]; | 1947 | const QStringList &dirs = project->variables()[pvar]; |
1755 | for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { | 1948 | for(QStringList::ConstIterator pit = dirs.begin(); pit != dirs.end(); ++pit) { |
1756 | QString tmp_dst = fileFixify((*pit)); | 1949 | QString tmp_dst = fileFixify((*pit)); |
1757 | #ifndef Q_WS_WIN | 1950 | #ifndef Q_WS_WIN |
1758 | if(tmp_dst.right(1) != Option::dir_sep) | 1951 | if(tmp_dst.right(1) != Option::dir_sep) |
1759 | tmp_dst += Option::dir_sep; | 1952 | tmp_dst += Option::dir_sep; |
1760 | #endif | 1953 | #endif |
1761 | t << mkdir_p_asstring(root+tmp_dst) << "\n\t"; | 1954 | t << mkdir_p_asstring(root+tmp_dst) << "\n\t"; |
1762 | } | 1955 | } |
1763 | t << target << endl << endl; | 1956 | t << target << endl << endl; |
1764 | all_installs += QString("install_") + (*it) + " "; | ||
1765 | if(!uninst.isEmpty()) { | 1957 | if(!uninst.isEmpty()) { |
1766 | t << "uninstall_" << (*it) << ": " << "\n\t" | 1958 | t << "uninstall_" << (*it) << ": " << "\n\t" |
1767 | << uninst.join("") << "\n\t" | 1959 | << uninst.join("") << "\n\t" |
1768 | << "-$(DEL_DIR) \"" << ( root + dst ) << "\"" << endl << endl; | 1960 | << "-$(DEL_DIR) \"" << ( root + dst ) << "\"" << endl << endl; |
1769 | all_uninstalls += "uninstall_" + (*it) + " "; | ||
1770 | } | 1961 | } |
1771 | t << endl; | 1962 | t << endl; |
1963 | |||
1964 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_default_install") == -1) { | ||
1965 | all_installs += QString("install_") + (*it) + " "; | ||
1966 | if(!uninst.isEmpty()) | ||
1967 | all_uninstalls += "uninstall_" + (*it) + " "; | ||
1968 | } | ||
1772 | } else { | 1969 | } else { |
1773 | debug_msg(1, "no definition for install %s: install target not created",(*it).latin1()); | 1970 | debug_msg(1, "no definition for install %s: install target not created",(*it).latin1()); |
1774 | } | 1971 | } |
1775 | } | 1972 | } |
1776 | t << "install: all " << all_installs << "\n\n"; | 1973 | t << "install: " << all_installs << " " << var("INSTALLDEPS") << "\n\n"; |
1777 | t << "uninstall: " << all_uninstalls << "\n\n"; | 1974 | t << "uninstall: " << all_uninstalls << " " << var("UNINSTALLDEPS") << "\n\n"; |
1778 | } | 1975 | } |
1779 | 1976 | ||
1780 | QString | 1977 | QString |
1781 | MakefileGenerator::var(const QString &var) | 1978 | MakefileGenerator::var(const QString &var) |
1782 | { | 1979 | { |
1783 | return val(project->variables()[var]); | 1980 | return val(project->variables()[var]); |
1784 | } | 1981 | } |
1785 | 1982 | ||
1786 | QString | 1983 | QString |
1787 | MakefileGenerator::val(const QStringList &varList) | 1984 | MakefileGenerator::val(const QStringList &varList) |
1788 | { | 1985 | { |
1789 | return valGlue(varList, "", " ", ""); | 1986 | return valGlue(varList, "", " ", ""); |
1790 | } | 1987 | } |
1791 | 1988 | ||
1792 | QString | 1989 | QString |
1793 | MakefileGenerator::varGlue(const QString &var, const QString &before, const QString &glue, const QString &after) | 1990 | MakefileGenerator::varGlue(const QString &var, const QString &before, const QString &glue, const QString &after) |
1794 | { | 1991 | { |
1795 | return valGlue(project->variables()[var], before, glue, after); | 1992 | return valGlue(project->variables()[var], before, glue, after); |
1796 | } | 1993 | } |
1797 | 1994 | ||
1798 | QString | 1995 | QString |
1799 | MakefileGenerator::valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after) | 1996 | MakefileGenerator::valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after) |
1800 | { | 1997 | { |
1801 | QString ret; | 1998 | QString ret; |
1802 | for(QStringList::ConstIterator it = varList.begin(); it != varList.end(); ++it) { | 1999 | for(QStringList::ConstIterator it = varList.begin(); it != varList.end(); ++it) { |
1803 | if(!(*it).isEmpty()) { | 2000 | if(!(*it).isEmpty()) { |
1804 | if(!ret.isEmpty()) | 2001 | if(!ret.isEmpty()) |
1805 | ret += glue; | 2002 | ret += glue; |
1806 | ret += (*it); | 2003 | ret += (*it); |
1807 | } | 2004 | } |
1808 | } | 2005 | } |
1809 | return ret.isEmpty() ? QString("") : before + ret + after; | 2006 | return ret.isEmpty() ? QString("") : before + ret + after; |
1810 | } | 2007 | } |
1811 | 2008 | ||
1812 | 2009 | ||
1813 | QString | 2010 | QString |
1814 | MakefileGenerator::varList(const QString &var) | 2011 | MakefileGenerator::varList(const QString &var) |
1815 | { | 2012 | { |
1816 | return valList(project->variables()[var]); | 2013 | return valList(project->variables()[var]); |
1817 | } | 2014 | } |
1818 | 2015 | ||
1819 | QString | 2016 | QString |
1820 | MakefileGenerator::valList(const QStringList &varList) | 2017 | MakefileGenerator::valList(const QStringList &varList) |
1821 | { | 2018 | { |
1822 | return valGlue(varList, "", " \\\n\t\t", ""); | 2019 | return valGlue(varList, "", " \\\n\t\t", ""); |
1823 | } | 2020 | } |
1824 | 2021 | ||
1825 | 2022 | ||
1826 | QStringList | 2023 | QStringList |
1827 | MakefileGenerator::createObjectList(const QString &var) | 2024 | MakefileGenerator::createObjectList(const QString &var) |
1828 | { | 2025 | { |
1829 | QStringList &l = project->variables()[var], ret; | 2026 | QStringList &l = project->variables()[var], ret; |
1830 | QString objdir, dir; | 2027 | QString objdir, dir; |
1831 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) | 2028 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) |
1832 | objdir = project->first("OBJECTS_DIR"); | 2029 | objdir = project->first("OBJECTS_DIR"); |
1833 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 2030 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
1834 | QFileInfo fi(Option::fixPathToLocalOS((*it))); | 2031 | QFileInfo fi(Option::fixPathToLocalOS((*it))); |
1835 | if(objdir.isEmpty() && project->isActiveConfig("object_with_source")) { | 2032 | if(objdir.isEmpty() && project->isActiveConfig("object_with_source")) { |
1836 | QString fName = Option::fixPathToTargetOS((*it), FALSE); | 2033 | QString fName = Option::fixPathToTargetOS((*it), FALSE); |
1837 | int dl = fName.findRev(Option::dir_sep); | 2034 | int dl = fName.findRev(Option::dir_sep); |
1838 | if(dl != -1) | 2035 | if(dl != -1) |
1839 | dir = fName.left(dl + 1); | 2036 | dir = fName.left(dl + 1); |
1840 | } else { | 2037 | } else { |
1841 | dir = objdir; | 2038 | dir = objdir; |
1842 | } | 2039 | } |
1843 | ret.append(dir + fi.baseName(TRUE) + Option::obj_ext); | 2040 | ret.append(dir + fi.baseName(TRUE) + Option::obj_ext); |
1844 | } | 2041 | } |
1845 | return ret; | 2042 | return ret; |
1846 | } | 2043 | } |
1847 | 2044 | ||
1848 | bool | 2045 | bool |
1849 | MakefileGenerator::writeMakefile(QTextStream &t) | 2046 | MakefileGenerator::writeMakefile(QTextStream &t) |
1850 | { | 2047 | { |
1851 | t << "####### Compile" << endl << endl; | 2048 | t << "####### Compile" << endl << endl; |
1852 | writeObj(t, "OBJECTS", "SOURCES"); | 2049 | writeObj(t, "OBJECTS", "SOURCES"); |
1853 | writeUicSrc(t, "FORMS"); | 2050 | writeUicSrc(t, "FORMS"); |
1854 | writeObj(t, "UICOBJECTS", "UICIMPLS"); | 2051 | writeObj(t, "UICOBJECTS", "UICIMPLS"); |
1855 | writeMocObj(t, "OBJMOC", "SRCMOC" ); | 2052 | writeMocObj(t, "OBJMOC", "SRCMOC" ); |
1856 | writeMocSrc(t, "HEADERS"); | 2053 | writeMocSrc(t, "HEADERS"); |
1857 | writeMocSrc(t, "SOURCES"); | 2054 | writeMocSrc(t, "SOURCES"); |
1858 | writeMocSrc(t, "UICDECLS"); | 2055 | writeMocSrc(t, "UICDECLS"); |
1859 | writeYaccSrc(t, "YACCSOURCES"); | 2056 | writeYaccSrc(t, "YACCSOURCES"); |
1860 | writeLexSrc(t, "LEXSOURCES"); | 2057 | writeLexSrc(t, "LEXSOURCES"); |
1861 | writeImageObj(t, "IMAGEOBJECTS"); | 2058 | writeImageObj(t, "IMAGEOBJECTS"); |
1862 | writeImageSrc(t, "QMAKE_IMAGE_COLLECTION"); | 2059 | writeImageSrc(t, "QMAKE_IMAGE_COLLECTION"); |
1863 | 2060 | ||
1864 | t << "####### Install" << endl << endl; | 2061 | t << "####### Install" << endl << endl; |
1865 | writeInstalls(t, "INSTALLS"); | 2062 | writeInstalls(t, "INSTALLS"); |
1866 | return TRUE; | 2063 | return TRUE; |
1867 | } | 2064 | } |
1868 | 2065 | ||
1869 | QString MakefileGenerator::buildArgs() | 2066 | QString MakefileGenerator::buildArgs() |
1870 | { | 2067 | { |
1871 | static QString ret; | 2068 | static QString ret; |
1872 | if(ret.isEmpty()) { | 2069 | if(ret.isEmpty()) { |
1873 | //special variables | 2070 | //special variables |
@@ -1878,386 +2075,423 @@ QString MakefileGenerator::buildArgs() | |||
1878 | else if(Option::warn_level == WarnNone) | 2075 | else if(Option::warn_level == WarnNone) |
1879 | ret += " -Wnone"; | 2076 | ret += " -Wnone"; |
1880 | else if(Option::warn_level == WarnAll) | 2077 | else if(Option::warn_level == WarnAll) |
1881 | ret += " -Wall"; | 2078 | ret += " -Wall"; |
1882 | else if(Option::warn_level & WarnParser) | 2079 | else if(Option::warn_level & WarnParser) |
1883 | ret += " -Wparser"; | 2080 | ret += " -Wparser"; |
1884 | //other options | 2081 | //other options |
1885 | if(!Option::user_template.isEmpty()) | 2082 | if(!Option::user_template.isEmpty()) |
1886 | ret += " -t " + Option::user_template; | 2083 | ret += " -t " + Option::user_template; |
1887 | if(!Option::mkfile::do_cache) | 2084 | if(!Option::mkfile::do_cache) |
1888 | ret += " -nocache"; | 2085 | ret += " -nocache"; |
1889 | if(!Option::mkfile::do_deps) | 2086 | if(!Option::mkfile::do_deps) |
1890 | ret += " -nodepend"; | 2087 | ret += " -nodepend"; |
1891 | if(!Option::mkfile::do_mocs) | 2088 | if(!Option::mkfile::do_mocs) |
1892 | ret += " -nomoc"; | 2089 | ret += " -nomoc"; |
1893 | if(!Option::mkfile::do_dep_heuristics) | 2090 | if(!Option::mkfile::do_dep_heuristics) |
1894 | ret += " -nodependheuristics"; | 2091 | ret += " -nodependheuristics"; |
1895 | if(!Option::mkfile::qmakespec_commandline.isEmpty()) | 2092 | if(!Option::mkfile::qmakespec_commandline.isEmpty()) |
1896 | ret += " -spec " + Option::mkfile::qmakespec_commandline; | 2093 | ret += " -spec " + Option::mkfile::qmakespec_commandline; |
1897 | 2094 | ||
1898 | //arguments | 2095 | //arguments |
1899 | for(QStringList::Iterator it = Option::before_user_vars.begin(); | 2096 | for(QStringList::Iterator it = Option::before_user_vars.begin(); |
1900 | it != Option::before_user_vars.end(); ++it) { | 2097 | it != Option::before_user_vars.end(); ++it) { |
1901 | if((*it).left(qstrlen("QMAKE_ABSOLUTE_SOURCE_PATH")) != "QMAKE_ABSOLUTE_SOURCE_PATH") | 2098 | if((*it).left(qstrlen("QMAKE_ABSOLUTE_SOURCE_PATH")) != "QMAKE_ABSOLUTE_SOURCE_PATH") |
1902 | ret += " \"" + (*it) + "\""; | 2099 | ret += " \"" + (*it) + "\""; |
1903 | } | 2100 | } |
1904 | if(Option::after_user_vars.count()) { | 2101 | if(Option::after_user_vars.count()) { |
1905 | ret += " -after "; | 2102 | ret += " -after "; |
1906 | for(QStringList::Iterator it = Option::after_user_vars.begin(); | 2103 | for(QStringList::Iterator it = Option::after_user_vars.begin(); |
1907 | it != Option::after_user_vars.end(); ++it) { | 2104 | it != Option::after_user_vars.end(); ++it) { |
1908 | if((*it).left(qstrlen("QMAKE_ABSOLUTE_SOURCE_PATH")) != "QMAKE_ABSOLUTE_SOURCE_PATH") | 2105 | if((*it).left(qstrlen("QMAKE_ABSOLUTE_SOURCE_PATH")) != "QMAKE_ABSOLUTE_SOURCE_PATH") |
1909 | ret += " \"" + (*it) + "\""; | 2106 | ret += " \"" + (*it) + "\""; |
1910 | } | 2107 | } |
1911 | } | 2108 | } |
1912 | } | 2109 | } |
1913 | return ret; | 2110 | return ret; |
1914 | } | 2111 | } |
1915 | 2112 | ||
1916 | //could get stored argv, but then it would have more options than are | 2113 | //could get stored argv, but then it would have more options than are |
1917 | //probably necesary this will try to guess the bare minimum.. | 2114 | //probably necesary this will try to guess the bare minimum.. |
1918 | QString MakefileGenerator::build_args() | 2115 | QString MakefileGenerator::build_args() |
1919 | { | 2116 | { |
1920 | static QString ret; | 2117 | static QString ret; |
1921 | if(ret.isEmpty()) { | 2118 | if(ret.isEmpty()) { |
1922 | ret = "$(QMAKE)"; | 2119 | ret = "$(QMAKE)"; |
1923 | 2120 | ||
1924 | // general options and arguments | 2121 | // general options and arguments |
1925 | ret += buildArgs(); | 2122 | ret += buildArgs(); |
1926 | 2123 | ||
1927 | //output | 2124 | //output |
1928 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.name())); | 2125 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.name())); |
1929 | if (!ofile.isEmpty() && ofile != project->first("QMAKE_MAKEFILE")) | 2126 | if (!ofile.isEmpty() && ofile != project->first("QMAKE_MAKEFILE")) |
1930 | ret += " -o " + ofile; | 2127 | ret += " -o " + ofile; |
1931 | 2128 | ||
1932 | //inputs | 2129 | //inputs |
1933 | QStringList files = fileFixify(Option::mkfile::project_files); | 2130 | QStringList files = fileFixify(Option::mkfile::project_files); |
1934 | ret += " " + files.join(" "); | 2131 | ret += " " + files.join(" "); |
1935 | } | 2132 | } |
1936 | return ret; | 2133 | return ret; |
1937 | } | 2134 | } |
1938 | 2135 | ||
1939 | bool | 2136 | bool |
1940 | MakefileGenerator::writeHeader(QTextStream &t) | 2137 | MakefileGenerator::writeHeader(QTextStream &t) |
1941 | { | 2138 | { |
1942 | time_t foo = time(NULL); | 2139 | time_t foo = time(NULL); |
1943 | t << "#############################################################################" << endl; | 2140 | t << "#############################################################################" << endl; |
1944 | t << "# Makefile for building: " << var("TARGET") << endl; | 2141 | t << "# Makefile for building: " << var("TARGET") << endl; |
1945 | t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: " << ctime(&foo); | 2142 | t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: " << ctime(&foo); |
1946 | t << "# Project: " << fileFixify(project->projectFile()) << endl; | 2143 | t << "# Project: " << fileFixify(project->projectFile()) << endl; |
1947 | t << "# Template: " << var("TEMPLATE") << endl; | 2144 | t << "# Template: " << var("TEMPLATE") << endl; |
1948 | t << "# Command: " << build_args() << endl; | 2145 | t << "# Command: " << build_args() << endl; |
1949 | t << "#############################################################################" << endl; | 2146 | t << "#############################################################################" << endl; |
1950 | t << endl; | 2147 | t << endl; |
1951 | return TRUE; | 2148 | return TRUE; |
1952 | } | 2149 | } |
1953 | 2150 | ||
1954 | 2151 | ||
1955 | //makes my life easier.. | 2152 | //makes my life easier.. |
1956 | bool | 2153 | bool |
1957 | MakefileGenerator::writeMakeQmake(QTextStream &t) | 2154 | MakefileGenerator::writeMakeQmake(QTextStream &t) |
1958 | { | 2155 | { |
1959 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.name())); | 2156 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.name())); |
1960 | if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake") && | 2157 | if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake") && |
1961 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | 2158 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { |
1962 | QStringList files = fileFixify(Option::mkfile::project_files); | 2159 | QStringList files = fileFixify(Option::mkfile::project_files); |
1963 | t << project->first("QMAKE_INTERNAL_PRL_FILE") << ": " << "\n\t" | 2160 | t << project->first("QMAKE_INTERNAL_PRL_FILE") << ": " << "\n\t" |
1964 | << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl; | 2161 | << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl; |
1965 | } | 2162 | } |
1966 | 2163 | ||
1967 | QString pfile = project->projectFile(); | 2164 | QString pfile = project->projectFile(); |
1968 | if(pfile != "(stdin)") { | 2165 | if(pfile != "(stdin)") { |
1969 | QString qmake = build_args(); | 2166 | QString qmake = build_args(); |
1970 | if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) { | 2167 | if(!ofile.isEmpty() && !project->isActiveConfig("no_autoqmake")) { |
1971 | t << ofile << ": " << fileFixify(pfile) << " "; | 2168 | t << ofile << ": " << fileFixify(pfile) << " "; |
1972 | if(Option::mkfile::do_cache) | 2169 | if(Option::mkfile::do_cache) |
1973 | t << fileFixify(Option::mkfile::cachefile) << " "; | 2170 | t << fileFixify(Option::mkfile::cachefile) << " "; |
1974 | if(!specdir().isEmpty()) | 2171 | if(!specdir().isEmpty()) { |
1975 | t << specdir() << Option::dir_sep << "qmake.conf" << " "; | 2172 | if (QFile::exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf"))) |
2173 | t << specdir() << Option::dir_sep << "qmake.conf" << " "; | ||
2174 | else if (QFile::exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"tmake.conf"))) | ||
2175 | t << specdir() << Option::dir_sep << "tmake.conf" << " "; | ||
2176 | } | ||
1976 | t << project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].join(" \\\n\t\t") << "\n\t" | 2177 | t << project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"].join(" \\\n\t\t") << "\n\t" |
1977 | << qmake <<endl; | 2178 | << qmake <<endl; |
1978 | } | 2179 | } |
1979 | if(project->first("QMAKE_ORIG_TARGET") != "qmake") { | 2180 | if(project->first("QMAKE_ORIG_TARGET") != "qmake") { |
1980 | t << "qmake: " << | 2181 | t << "qmake: " << |
1981 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].join(" \\\n\t\t") << "\n\t" | 2182 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].join(" \\\n\t\t") << "\n\t" |
1982 | << "@" << qmake << endl << endl; | 2183 | << "@" << qmake << endl << endl; |
1983 | } | 2184 | } |
1984 | } | 2185 | } |
1985 | return TRUE; | 2186 | return TRUE; |
1986 | } | 2187 | } |
1987 | 2188 | ||
1988 | QStringList | 2189 | QStringList |
1989 | MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, const QString &in_dir, bool force_fix) const | 2190 | MakefileGenerator::fileFixify(const QStringList& files, const QString &out_dir, const QString &in_dir, |
2191 | bool force_fix, bool canon) const | ||
1990 | { | 2192 | { |
1991 | if(files.isEmpty()) | 2193 | if(files.isEmpty()) |
1992 | return files; | 2194 | return files; |
1993 | QStringList ret; | 2195 | QStringList ret; |
1994 | for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { | 2196 | for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it) { |
1995 | if(!(*it).isEmpty()) | 2197 | if(!(*it).isEmpty()) |
1996 | ret << fileFixify((*it), out_dir, in_dir, force_fix); | 2198 | ret << fileFixify((*it), out_dir, in_dir, force_fix, canon); |
1997 | } | 2199 | } |
1998 | return ret; | 2200 | return ret; |
1999 | } | 2201 | } |
2000 | 2202 | ||
2001 | QString | 2203 | QString |
2002 | MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, const QString &in_d, bool force_fix) const | 2204 | MakefileGenerator::fileFixify(const QString& file0, const QString &out_d, |
2205 | const QString &in_d, bool force_fix, bool canon) const | ||
2003 | { | 2206 | { |
2004 | if(file0.isEmpty()) | 2207 | if(file0.isEmpty()) |
2005 | return file0; | 2208 | return file0; |
2006 | QString key = file0; | 2209 | QString key = file0; |
2007 | if(!in_d.isEmpty() || !out_d.isEmpty() || force_fix) | 2210 | if(QDir::isRelativePath(file0)) |
2008 | key.prepend(in_d + "--" + out_d + "--" + QString::number((int)force_fix) + "-"); | 2211 | key.prepend(QDir::currentDirPath() + "--"); |
2009 | if(fileFixed.contains(key)) | 2212 | if(!in_d.isEmpty() || !out_d.isEmpty() || force_fix || !canon) |
2213 | key.prepend(in_d + "--" + out_d + "--" + QString::number((int)force_fix) + "--" + | ||
2214 | QString::number((int)canon) + "-"); | ||
2215 | if(fileFixed.contains(key)) | ||
2010 | return fileFixed[key]; | 2216 | return fileFixed[key]; |
2011 | 2217 | ||
2012 | QString file = file0; | 2218 | QString file = file0; |
2013 | int depth = 4; | 2219 | int depth = 4; |
2014 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 2220 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || |
2015 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { | 2221 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { |
2016 | if(project && !project->isEmpty("QMAKE_PROJECT_DEPTH")) | 2222 | if(project && !project->isEmpty("QMAKE_PROJECT_DEPTH")) |
2017 | depth = project->first("QMAKE_PROJECT_DEPTH").toInt(); | 2223 | depth = project->first("QMAKE_PROJECT_DEPTH").toInt(); |
2018 | else if(Option::mkfile::cachefile_depth != -1) | 2224 | else if(Option::mkfile::cachefile_depth != -1) |
2019 | depth = Option::mkfile::cachefile_depth; | 2225 | depth = Option::mkfile::cachefile_depth; |
2020 | } | 2226 | } |
2021 | 2227 | ||
2022 | QChar quote; | 2228 | QChar quote; |
2023 | if((file.startsWith("'") || file.startsWith("\"")) && file.startsWith(file.right(1))) { | 2229 | if((file.startsWith("'") || file.startsWith("\"")) && file.startsWith(file.right(1))) { |
2024 | quote = file.at(0); | 2230 | quote = file.at(0); |
2025 | file = file.mid(1, file.length() - 2); | 2231 | file = file.mid(1, file.length() - 2); |
2026 | } | 2232 | } |
2027 | QString orig_file = file; | 2233 | QString orig_file = file; |
2028 | if(!force_fix && project->isActiveConfig("no_fixpath")) { | 2234 | if(!force_fix && project->isActiveConfig("no_fixpath")) { |
2029 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) { //absoluteify it | 2235 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) { //absoluteify it |
2030 | QString qfile = Option::fixPathToLocalOS(file); | 2236 | QString qfile = Option::fixPathToLocalOS(file, TRUE, canon); |
2031 | if(QDir::isRelativePath(file)) { //already absolute | 2237 | if(QDir::isRelativePath(file)) { //already absolute |
2032 | QFileInfo fi(qfile); | 2238 | QFileInfo fi(qfile); |
2033 | if(!fi.convertToAbs()) //strange | 2239 | if(!fi.convertToAbs()) //strange |
2034 | file = fi.filePath(); | 2240 | file = fi.filePath(); |
2035 | } | 2241 | } |
2036 | } | 2242 | } |
2037 | } else { //fix it.. | 2243 | } else { //fix it.. |
2038 | QString qfile(Option::fixPathToLocalOS(file, TRUE)), in_dir(in_d), out_dir(out_d); | 2244 | QString qfile(Option::fixPathToLocalOS(file, TRUE, canon)), in_dir(in_d), out_dir(out_d); |
2039 | { | 2245 | { |
2040 | if(out_dir.isNull()) | 2246 | if(out_dir.isNull() || QDir::isRelativePath(out_dir)) |
2041 | out_dir = Option::output_dir; | 2247 | out_dir.prepend(Option::output_dir + QDir::separator()); |
2042 | if(out_dir == ".") | 2248 | if(out_dir == ".") |
2043 | out_dir = QDir::currentDirPath(); | 2249 | out_dir = QDir::currentDirPath(); |
2044 | if(in_dir.isEmpty() || in_dir == ".") | 2250 | if(in_dir.isEmpty() || QDir::isRelativePath(in_dir)) |
2251 | in_dir.prepend(QDir::currentDirPath() + QDir::separator()); | ||
2252 | if(in_dir == ".") | ||
2045 | in_dir = QDir::currentDirPath(); | 2253 | in_dir = QDir::currentDirPath(); |
2254 | |||
2046 | if(!QDir::isRelativePath(in_dir) || !QDir::isRelativePath(out_dir)) { | 2255 | if(!QDir::isRelativePath(in_dir) || !QDir::isRelativePath(out_dir)) { |
2047 | QFileInfo in_fi(in_dir); | 2256 | QFileInfo in_fi(in_dir); |
2048 | if(!in_fi.convertToAbs()) | 2257 | if(!in_fi.convertToAbs()) |
2049 | in_dir = in_fi.filePath(); | 2258 | in_dir = in_fi.filePath(); |
2050 | QFileInfo out_fi(out_dir); | 2259 | QFileInfo out_fi(out_dir); |
2051 | if(!out_fi.convertToAbs()) | 2260 | if(!out_fi.convertToAbs()) |
2052 | out_dir = out_fi.filePath(); | 2261 | out_dir = out_fi.filePath(); |
2053 | } | 2262 | } |
2054 | QString in_canonical_dir = QDir(in_dir).canonicalPath(), | 2263 | QString in_canonical_dir = QDir(in_dir).canonicalPath(), |
2055 | out_canonical_dir = QDir(out_dir).canonicalPath(); | 2264 | out_canonical_dir = QDir(out_dir).canonicalPath(); |
2056 | if(!in_canonical_dir.isEmpty()) | 2265 | if(!in_canonical_dir.isEmpty()) |
2057 | in_dir = in_canonical_dir; | 2266 | in_dir = in_canonical_dir; |
2058 | if(!out_canonical_dir.isEmpty()) | 2267 | if(!out_canonical_dir.isEmpty()) |
2059 | out_dir = out_canonical_dir; | 2268 | out_dir = out_canonical_dir; |
2060 | } | 2269 | } |
2061 | if(out_dir != in_dir || !QDir::isRelativePath(qfile)) { | 2270 | if(out_dir != in_dir || !QDir::isRelativePath(qfile)) { |
2062 | if(QDir::isRelativePath(qfile)) { | 2271 | if(QDir::isRelativePath(qfile)) { |
2063 | if(file.left(Option::dir_sep.length()) != Option::dir_sep && | 2272 | if(file.left(Option::dir_sep.length()) != Option::dir_sep && |
2064 | in_dir.right(Option::dir_sep.length()) != Option::dir_sep) | 2273 | in_dir.right(Option::dir_sep.length()) != Option::dir_sep) |
2065 | file.prepend(Option::dir_sep); | 2274 | file.prepend(Option::dir_sep); |
2066 | file.prepend(in_dir); | 2275 | file.prepend(in_dir); |
2067 | } | 2276 | } |
2068 | file = Option::fixPathToTargetOS(file, FALSE); | 2277 | file = Option::fixPathToTargetOS(file, FALSE, canon); |
2069 | if(QFile::exists(file) && file == Option::fixPathToTargetOS(file, TRUE)) { | 2278 | if(canon && QFile::exists(file) && file == Option::fixPathToTargetOS(file, TRUE, canon)) { |
2070 | QString real_file = QDir(file).canonicalPath(); | 2279 | QString real_file = QDir(file).canonicalPath(); |
2071 | if(!real_file.isEmpty()) | 2280 | if(!real_file.isEmpty()) |
2072 | file = real_file; | 2281 | file = real_file; |
2073 | } | 2282 | } |
2074 | QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE); | 2283 | QString match_dir = Option::fixPathToTargetOS(out_dir, FALSE, canon); |
2075 | if(file == match_dir) { | 2284 | if(file == match_dir) { |
2076 | file = ""; | 2285 | file = ""; |
2077 | } else if(file.startsWith(match_dir) && | 2286 | } else if(file.startsWith(match_dir) && |
2078 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { | 2287 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { |
2079 | file = file.right(file.length() - (match_dir.length() + 1)); | 2288 | file = file.right(file.length() - (match_dir.length() + 1)); |
2080 | } else { | 2289 | } else { |
2081 | for(int i = 1; i <= depth; i++) { | 2290 | for(int i = 1; i <= depth; i++) { |
2082 | int sl = match_dir.findRev(Option::dir_sep); | 2291 | int sl = match_dir.findRev(Option::dir_sep); |
2083 | if(sl == -1) | 2292 | if(sl == -1) |
2084 | break; | 2293 | break; |
2085 | match_dir = match_dir.left(sl); | 2294 | match_dir = match_dir.left(sl); |
2086 | if(match_dir.isEmpty()) | 2295 | if(match_dir.isEmpty()) |
2087 | break; | 2296 | break; |
2088 | if(file.startsWith(match_dir) && | 2297 | if(file.startsWith(match_dir) && |
2089 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { | 2298 | file.mid(match_dir.length(), Option::dir_sep.length()) == Option::dir_sep) { |
2090 | //concat | 2299 | //concat |
2091 | int remlen = file.length() - (match_dir.length() + 1); | 2300 | int remlen = file.length() - (match_dir.length() + 1); |
2092 | if (remlen < 0) | 2301 | if (remlen < 0) |
2093 | remlen = 0; | 2302 | remlen = 0; |
2094 | file = file.right(remlen); | 2303 | file = file.right(remlen); |
2095 | //prepend | 2304 | //prepend |
2096 | for(int o = 0; o < i; o++) | 2305 | for(int o = 0; o < i; o++) |
2097 | file.prepend(".." + Option::dir_sep); | 2306 | file.prepend(".." + Option::dir_sep); |
2098 | } | 2307 | } |
2099 | } | 2308 | } |
2100 | } | 2309 | } |
2101 | } | 2310 | } |
2102 | } | 2311 | } |
2103 | file = Option::fixPathToTargetOS(file, FALSE); | 2312 | file = Option::fixPathToTargetOS(file, FALSE, canon); |
2104 | if(file.isEmpty()) | 2313 | if(file.isEmpty()) |
2105 | file = "."; | 2314 | file = "."; |
2106 | if(!quote.isNull()) | 2315 | if(!quote.isNull()) |
2107 | file = quote + file + quote; | 2316 | file = quote + file + quote; |
2108 | debug_msg(3, "Fixed %s :: to :: %s (%d)", orig_file.latin1(), file.latin1(), depth); | 2317 | debug_msg(3, "Fixed %s :: to :: %s (%d) [%s::%s]", orig_file.latin1(), file.latin1(), depth, |
2318 | in_d.latin1(), out_d.latin1()); | ||
2109 | ((MakefileGenerator*)this)->fileFixed.insert(key, file); | 2319 | ((MakefileGenerator*)this)->fileFixed.insert(key, file); |
2110 | return file; | 2320 | return file; |
2111 | } | 2321 | } |
2112 | 2322 | ||
2113 | QString | 2323 | QString |
2114 | MakefileGenerator::cleanFilePath(const QString &file) const | 2324 | MakefileGenerator::cleanFilePath(const QString &file) const |
2115 | { | 2325 | { |
2116 | return fileFixify(Option::fixPathToTargetOS(file)); | 2326 | return fileFixify(Option::fixPathToTargetOS(file)); |
2117 | } | 2327 | } |
2118 | 2328 | ||
2119 | void MakefileGenerator::logicWarn(const QString &f, const QString &w) | 2329 | void MakefileGenerator::logicWarn(const QString &f, const QString &w) |
2120 | { | 2330 | { |
2121 | if(!(Option::warn_level & WarnLogic)) | 2331 | if(!(Option::warn_level & WarnLogic)) |
2122 | return; | 2332 | return; |
2123 | QString file = f; | 2333 | QString file = f; |
2124 | int slsh = f.findRev(Option::dir_sep); | 2334 | int slsh = f.findRev(Option::dir_sep); |
2125 | if(slsh != -1) | 2335 | if(slsh != -1) |
2126 | file = file.right(file.length() - slsh - 1); | 2336 | file = file.right(file.length() - slsh - 1); |
2127 | QStringList &l = project->variables()[w]; | 2337 | QStringList &l = project->variables()[w]; |
2128 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 2338 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
2129 | QString file2((*val_it)); | 2339 | QString file2((*val_it)); |
2130 | slsh = file2.findRev(Option::dir_sep); | 2340 | slsh = file2.findRev(Option::dir_sep); |
2131 | if(slsh != -1) | 2341 | if(slsh != -1) |
2132 | file2 = file2.right(file2.length() - slsh - 1); | 2342 | file2 = file2.right(file2.length() - slsh - 1); |
2133 | if(file2 == file) { | 2343 | if(file2 == file) { |
2134 | warn_msg(WarnLogic, "Found potential symbol conflict of %s (%s) in %s", | 2344 | warn_msg(WarnLogic, "Found potential symbol conflict of %s (%s) in %s", |
2135 | file.latin1(), (*val_it).latin1(), w.latin1()); | 2345 | file.latin1(), (*val_it).latin1(), w.latin1()); |
2136 | break; | 2346 | break; |
2137 | } | 2347 | } |
2138 | } | 2348 | } |
2139 | } | 2349 | } |
2140 | 2350 | ||
2351 | QString | ||
2352 | MakefileGenerator::dependencyKey(const QString &file) const | ||
2353 | { | ||
2354 | QString key = file; | ||
2355 | Option::fixPathToTargetOS(key); | ||
2356 | if(key.find(Option::dir_sep)) | ||
2357 | key = key.right(key.length() - key.findRev(Option::dir_sep) - 1); | ||
2358 | return key; | ||
2359 | } | ||
2360 | |||
2361 | void | ||
2362 | MakefileGenerator::setProcessedDependencies(const QString &file, bool b) | ||
2363 | { | ||
2364 | depProcessed[dependencyKey(file)] = b; | ||
2365 | } | ||
2366 | |||
2367 | bool | ||
2368 | MakefileGenerator::processedDependencies(const QString &file) | ||
2369 | { | ||
2370 | QString key = dependencyKey(file); | ||
2371 | if(!depProcessed.contains(key)) | ||
2372 | return FALSE; | ||
2373 | return depProcessed[key]; | ||
2374 | } | ||
2375 | |||
2141 | QStringList | 2376 | QStringList |
2142 | &MakefileGenerator::findDependencies(const QString &file) | 2377 | &MakefileGenerator::findDependencies(const QString &file) |
2143 | { | 2378 | { |
2144 | QString key = file; | 2379 | return depends[dependencyKey(file)]; |
2145 | Option::fixPathToTargetOS(key); | ||
2146 | if(key.find(Option::dir_sep)) | ||
2147 | key = key.right(key.length() - key.findRev(Option::dir_sep) - 1); | ||
2148 | if(!depKeyMap.contains(key)) | ||
2149 | depKeyMap.insert(key, file); | ||
2150 | return depends[key]; | ||
2151 | } | 2380 | } |
2152 | 2381 | ||
2153 | 2382 | ||
2154 | QString | 2383 | QString |
2155 | MakefileGenerator::specdir() | 2384 | MakefileGenerator::specdir() |
2156 | { | 2385 | { |
2157 | if(!spec.isEmpty()) | 2386 | if(!spec.isEmpty()) |
2158 | return spec; | 2387 | return spec; |
2159 | spec = Option::mkfile::qmakespec; | 2388 | spec = Option::mkfile::qmakespec; |
2160 | const char *d = getenv("QTDIR"); | 2389 | #if 0 |
2161 | if(d) { | 2390 | if(const char *d = getenv("QTDIR")) { |
2162 | QString qdir = Option::fixPathToTargetOS(QString(d)); | 2391 | QString qdir = Option::fixPathToTargetOS(QString(d)); |
2163 | if(qdir.endsWith(QString(QChar(QDir::separator())))) | 2392 | if(qdir.endsWith(QString(QChar(QDir::separator())))) |
2164 | qdir.truncate(qdir.length()-1); | 2393 | qdir.truncate(qdir.length()-1); |
2165 | //fix path | 2394 | //fix path |
2166 | QFileInfo fi(spec); | 2395 | QFileInfo fi(spec); |
2167 | QString absSpec(fi.absFilePath()); | 2396 | QString absSpec(fi.absFilePath()); |
2168 | absSpec = Option::fixPathToTargetOS(absSpec); | 2397 | absSpec = Option::fixPathToTargetOS(absSpec); |
2169 | //replace what you can | 2398 | //replace what you can |
2170 | if(absSpec.startsWith(qdir)) { | 2399 | if(absSpec.startsWith(qdir)) { |
2171 | absSpec.replace(0, qdir.length(), "$(QTDIR)"); | 2400 | absSpec.replace(0, qdir.length(), "$(QTDIR)"); |
2172 | spec = absSpec; | 2401 | spec = absSpec; |
2173 | } | 2402 | } |
2174 | } | 2403 | } |
2404 | #else | ||
2405 | spec = Option::fixPathToTargetOS(spec); | ||
2406 | #endif | ||
2175 | return spec; | 2407 | return spec; |
2176 | } | 2408 | } |
2177 | 2409 | ||
2178 | bool | 2410 | bool |
2179 | MakefileGenerator::openOutput(QFile &file) const | 2411 | MakefileGenerator::openOutput(QFile &file) const |
2180 | { | 2412 | { |
2181 | { | 2413 | { |
2182 | QString outdir; | 2414 | QString outdir; |
2183 | if(!file.name().isEmpty()) { | 2415 | if(!file.name().isEmpty()) { |
2416 | if(QDir::isRelativePath(file.name())) | ||
2417 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run | ||
2184 | QFileInfo fi(file); | 2418 | QFileInfo fi(file); |
2185 | if(fi.isDir()) | 2419 | if(fi.isDir()) |
2186 | outdir = file.name() + QDir::separator(); | 2420 | outdir = file.name() + QDir::separator(); |
2187 | } | 2421 | } |
2188 | if(!outdir.isEmpty() || file.name().isEmpty()) { | 2422 | if(!outdir.isEmpty() || file.name().isEmpty()) { |
2189 | QString fname = "Makefile"; | 2423 | QString fname = "Makefile"; |
2190 | if(!project->isEmpty("MAKEFILE")) | 2424 | if(!project->isEmpty("MAKEFILE")) |
2191 | fname = project->first("MAKEFILE"); | 2425 | fname = project->first("MAKEFILE"); |
2192 | file.setName(outdir + fname); | 2426 | file.setName(outdir + fname); |
2193 | } | 2427 | } |
2194 | } | 2428 | } |
2195 | if(QDir::isRelativePath(file.name())) | 2429 | if(QDir::isRelativePath(file.name())) |
2196 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run | 2430 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run |
2197 | if(project->isEmpty("QMAKE_MAKEFILE")) | 2431 | if(project->isEmpty("QMAKE_MAKEFILE")) |
2198 | project->variables()["QMAKE_MAKEFILE"].append(file.name()); | 2432 | project->variables()["QMAKE_MAKEFILE"].append(file.name()); |
2199 | int slsh = file.name().findRev(Option::dir_sep); | 2433 | int slsh = file.name().findRev(Option::dir_sep); |
2200 | if(slsh != -1) | 2434 | if(slsh != -1) |
2201 | createDir(file.name().left(slsh)); | 2435 | createDir(file.name().left(slsh)); |
2202 | if(file.open(IO_WriteOnly | IO_Translate)) { | 2436 | if(file.open(IO_WriteOnly | IO_Translate)) { |
2203 | QFileInfo fi(Option::output); | 2437 | QFileInfo fi(Option::output); |
2204 | QString od = Option::fixPathToTargetOS((fi.isSymLink() ? fi.readLink() : fi.dirPath()) ); | 2438 | QString od = Option::fixPathToTargetOS((fi.isSymLink() ? fi.readLink() : fi.dirPath()) ); |
2205 | if(QDir::isRelativePath(od)) | 2439 | if(QDir::isRelativePath(od)) |
2206 | od.prepend(Option::output_dir); | 2440 | od.prepend(Option::output_dir); |
2207 | Option::output_dir = od; | 2441 | Option::output_dir = od; |
2208 | return TRUE; | 2442 | return TRUE; |
2209 | } | 2443 | } |
2210 | return FALSE; | 2444 | return FALSE; |
2211 | } | 2445 | } |
2212 | 2446 | ||
2213 | 2447 | ||
2214 | 2448 | ||
2215 | //Factory thing | 2449 | //Factory thing |
2216 | #include "unixmake.h" | 2450 | #include "unixmake.h" |
2217 | #include "msvc_nmake.h" | 2451 | #include "msvc_nmake.h" |
2218 | #include "borland_bmake.h" | 2452 | #include "borland_bmake.h" |
2219 | #include "mingw_make.h" | 2453 | #include "mingw_make.h" |
2220 | #include "msvc_dsp.h" | 2454 | #include "msvc_dsp.h" |
2221 | #include "msvc_vcproj.h" | 2455 | #include "msvc_vcproj.h" |
2222 | #include "metrowerks_xml.h" | 2456 | #include "metrowerks_xml.h" |
2223 | #include "pbuilder_pbx.h" | 2457 | #include "pbuilder_pbx.h" |
2224 | #include "projectgenerator.h" | 2458 | #include "projectgenerator.h" |
2225 | 2459 | ||
2226 | MakefileGenerator * | 2460 | MakefileGenerator * |
2227 | MakefileGenerator::create(QMakeProject *proj) | 2461 | MakefileGenerator::create(QMakeProject *proj) |
2228 | { | 2462 | { |
2229 | if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) | 2463 | if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) |
2230 | return new ProjectGenerator(proj); | 2464 | return new ProjectGenerator(proj); |
2231 | 2465 | ||
2232 | MakefileGenerator *mkfile = NULL; | 2466 | MakefileGenerator *mkfile = NULL; |
2233 | QString gen = proj->first("MAKEFILE_GENERATOR"); | 2467 | QString gen = proj->first("MAKEFILE_GENERATOR"); |
2234 | if(gen.isEmpty()) { | 2468 | if(gen.isEmpty()) { |
2235 | fprintf(stderr, "No generator specified in config file: %s\n", | 2469 | fprintf(stderr, "No generator specified in config file: %s\n", |
2236 | proj->projectFile().latin1()); | 2470 | proj->projectFile().latin1()); |
2237 | } else if(gen == "UNIX") { | 2471 | } else if(gen == "UNIX") { |
2238 | mkfile = new UnixMakefileGenerator(proj); | 2472 | mkfile = new UnixMakefileGenerator(proj); |
2239 | } else if(gen == "MSVC") { | 2473 | } else if(gen == "MSVC") { |
2240 | // Visual Studio =< v6.0 | 2474 | // Visual Studio =< v6.0 |
2241 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) | 2475 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) |
2242 | mkfile = new DspMakefileGenerator(proj); | 2476 | mkfile = new DspMakefileGenerator(proj); |
2243 | else | 2477 | else |
2244 | mkfile = new NmakeMakefileGenerator(proj); | 2478 | mkfile = new NmakeMakefileGenerator(proj); |
2245 | } else if(gen == "MSVC.NET") { | 2479 | } else if(gen == "MSVC.NET") { |
2246 | // Visual Studio >= v7.0 | 2480 | // Visual Studio >= v7.0 |
2247 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) | 2481 | if(proj->first("TEMPLATE").find(QRegExp("^vc.*")) != -1) |
2248 | mkfile = new VcprojGenerator(proj); | 2482 | mkfile = new VcprojGenerator(proj); |
2249 | else | 2483 | else |
2250 | mkfile = new NmakeMakefileGenerator(proj); | 2484 | mkfile = new NmakeMakefileGenerator(proj); |
2251 | } else if(gen == "BMAKE") { | 2485 | } else if(gen == "BMAKE") { |
2252 | mkfile = new BorlandMakefileGenerator(proj); | 2486 | mkfile = new BorlandMakefileGenerator(proj); |
2253 | } else if(gen == "MINGW") { | 2487 | } else if(gen == "MINGW") { |
2254 | mkfile = new MingwMakefileGenerator(proj); | 2488 | mkfile = new MingwMakefileGenerator(proj); |
2255 | } else if(gen == "METROWERKS") { | 2489 | } else if(gen == "METROWERKS") { |
2256 | mkfile = new MetrowerksMakefileGenerator(proj); | 2490 | mkfile = new MetrowerksMakefileGenerator(proj); |
2257 | } else if(gen == "PROJECTBUILDER") { | 2491 | } else if(gen == "PROJECTBUILDER") { |
2258 | mkfile = new ProjectBuilderMakefileGenerator(proj); | 2492 | mkfile = new ProjectBuilderMakefileGenerator(proj); |
2259 | } else { | 2493 | } else { |
2260 | fprintf(stderr, "Unknown generator specified: %s\n", gen.latin1()); | 2494 | fprintf(stderr, "Unknown generator specified: %s\n", gen.latin1()); |
2261 | } | 2495 | } |
2262 | return mkfile; | 2496 | return mkfile; |
2263 | } | 2497 | } |
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 4fdabe8..e818089 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h | |||
@@ -1,173 +1,190 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of MakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | #ifndef __MAKEFILE_H__ | 35 | #ifndef __MAKEFILE_H__ |
38 | #define __MAKEFILE_H__ | 36 | #define __MAKEFILE_H__ |
39 | 37 | ||
40 | #include "option.h" | 38 | #include "option.h" |
41 | #include "project.h" | 39 | #include "project.h" |
42 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
43 | 41 | ||
42 | #ifdef Q_OS_WIN32 | ||
43 | #define QT_POPEN _popen | ||
44 | #else | ||
45 | #define QT_POPEN popen | ||
46 | #endif | ||
47 | |||
44 | class MakefileGenerator | 48 | class MakefileGenerator |
45 | { | 49 | { |
46 | QString spec; | 50 | QString spec; |
47 | bool init_opath_already, init_already, moc_aware, no_io; | 51 | bool init_opath_already, init_already, moc_aware, no_io; |
48 | QStringList createObjectList(const QString &var); | 52 | QStringList createObjectList(const QString &var); |
49 | QString build_args(); | 53 | QString build_args(); |
50 | QMap<QString, QString> depHeuristics, depKeyMap, fileFixed; | 54 | QString dependencyKey(const QString &file) const; |
55 | QMap<QString, bool> depProcessed; | ||
56 | QMap<QString, QString> depHeuristics, fileFixed; | ||
51 | QMap<QString, QString> mocablesToMOC, mocablesFromMOC; | 57 | QMap<QString, QString> mocablesToMOC, mocablesFromMOC; |
52 | QMap<QString, QStringList> depends; | 58 | QMap<QString, QStringList> depends; |
53 | 59 | ||
54 | protected: | 60 | protected: |
55 | void writeObj(QTextStream &, const QString &obj, const QString &src); | 61 | void writeObj(QTextStream &, const QString &obj, const QString &src); |
56 | void writeUicSrc(QTextStream &, const QString &ui); | 62 | void writeUicSrc(QTextStream &, const QString &ui); |
57 | void writeMocObj(QTextStream &, const QString &obj, const QString &src); | 63 | void writeMocObj(QTextStream &, const QString &obj, const QString &src); |
58 | void writeMocSrc(QTextStream &, const QString &src); | 64 | void writeMocSrc(QTextStream &, const QString &src); |
59 | void writeLexSrc(QTextStream &, const QString &lex); | 65 | void writeLexSrc(QTextStream &, const QString &lex); |
60 | void writeYaccSrc(QTextStream &, const QString &yac); | 66 | void writeYaccSrc(QTextStream &, const QString &yac); |
61 | void writeInstalls(QTextStream &t, const QString &installs); | 67 | void writeInstalls(QTextStream &t, const QString &installs); |
62 | void writeImageObj(QTextStream &t, const QString &obj); | 68 | void writeImageObj(QTextStream &t, const QString &obj); |
63 | void writeImageSrc(QTextStream &t, const QString &images); | 69 | void writeImageSrc(QTextStream &t, const QString &images); |
64 | 70 | ||
65 | protected: | 71 | protected: |
66 | 72 | ||
67 | QMakeProject *project; | 73 | QMakeProject *project; |
68 | 74 | ||
69 | class MakefileDependDir { | 75 | class MakefileDependDir { |
70 | public: | 76 | public: |
71 | MakefileDependDir(const QString &r, const QString &l) : real_dir(r), local_dir(l) { } | 77 | MakefileDependDir(const QString &r, const QString &l) : real_dir(r), local_dir(l) { } |
72 | QString real_dir, local_dir; | 78 | QString real_dir, local_dir; |
73 | }; | 79 | }; |
74 | bool generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &x, bool recurse); | 80 | bool generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &x, bool recurse); |
75 | 81 | ||
76 | QString buildArgs(); | 82 | QString buildArgs(); |
77 | 83 | ||
78 | QString specdir(); | 84 | QString specdir(); |
79 | QString cleanFilePath(const QString &file) const; | 85 | QString cleanFilePath(const QString &file) const; |
80 | bool generateMocList(const QString &fn); | 86 | bool generateMocList(const QString &fn); |
81 | 87 | ||
82 | QString findMocSource(const QString &moc_file) const; | 88 | QString findMocSource(const QString &moc_file) const; |
83 | QString findMocDestination(const QString &src_file) const; | 89 | QString findMocDestination(const QString &src_file) const; |
84 | QStringList &findDependencies(const QString &file); | 90 | virtual QStringList &findDependencies(const QString &file); |
85 | 91 | ||
86 | void setNoIO(bool o); | 92 | void setNoIO(bool o); |
87 | bool noIO() const; | 93 | bool noIO() const; |
88 | 94 | ||
89 | void setMocAware(bool o); | 95 | void setMocAware(bool o); |
90 | bool mocAware() const; | 96 | bool mocAware() const; |
91 | void logicWarn(const QString &, const QString &); | 97 | void logicWarn(const QString &, const QString &); |
92 | 98 | ||
93 | virtual bool doDepends() const { return Option::mkfile::do_deps; } | 99 | virtual bool doDepends() const { return Option::mkfile::do_deps; } |
94 | bool writeHeader(QTextStream &); | 100 | bool writeHeader(QTextStream &); |
95 | virtual bool writeMakefile(QTextStream &); | 101 | virtual bool writeMakefile(QTextStream &); |
96 | virtual bool writeMakeQmake(QTextStream &); | 102 | virtual bool writeMakeQmake(QTextStream &); |
97 | void initOutPaths(); | 103 | void initOutPaths(); |
98 | virtual void init(); | 104 | virtual void init(); |
99 | 105 | ||
106 | //for cross-platform dependent directories | ||
107 | virtual void usePlatformDir(); | ||
108 | |||
100 | //for installs | 109 | //for installs |
101 | virtual QString defaultInstall(const QString &); | 110 | virtual QString defaultInstall(const QString &); |
102 | 111 | ||
103 | //for prl | 112 | //for prl |
104 | bool processPrlFile(QString &); | 113 | bool processPrlFile(QString &); |
105 | virtual void processPrlVariable(const QString &, const QStringList &); | 114 | virtual void processPrlVariable(const QString &, const QStringList &); |
106 | virtual void processPrlFiles(); | 115 | virtual void processPrlFiles(); |
107 | virtual void writePrlFile(QTextStream &); | 116 | virtual void writePrlFile(QTextStream &); |
108 | 117 | ||
109 | //make sure libraries are found | 118 | //make sure libraries are found |
110 | virtual bool findLibraries(); | 119 | virtual bool findLibraries(); |
120 | virtual QString findDependency(const QString &); | ||
111 | 121 | ||
112 | QString var(const QString &var); | 122 | void setProcessedDependencies(const QString &file, bool b); |
123 | bool processedDependencies(const QString &file); | ||
124 | |||
125 | virtual QString var(const QString &var); | ||
113 | QString varGlue(const QString &var, const QString &before, const QString &glue, const QString &after); | 126 | QString varGlue(const QString &var, const QString &before, const QString &glue, const QString &after); |
114 | QString varList(const QString &var); | 127 | QString varList(const QString &var); |
115 | QString val(const QStringList &varList); | 128 | QString val(const QStringList &varList); |
116 | QString valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after); | 129 | QString valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after); |
117 | QString valList(const QStringList &varList); | 130 | QString valList(const QStringList &varList); |
118 | 131 | ||
119 | 132 | ||
120 | QString fileFixify(const QString& file, const QString &out_dir=QString::null, | 133 | QString fileFixify(const QString& file, const QString &out_dir=QString::null, |
121 | const QString &in_dir=QString::null, bool force_fix=FALSE) const; | 134 | const QString &in_dir=QString::null, bool force_fix=FALSE, bool canon=TRUE) const; |
122 | QStringList fileFixify(const QStringList& files, const QString &out_dir=QString::null, | 135 | QStringList fileFixify(const QStringList& files, const QString &out_dir=QString::null, |
123 | const QString &in_dir=QString::null, bool force_fix=FALSE) const; | 136 | const QString &in_dir=QString::null, bool force_fix=FALSE, bool canon=TRUE) const; |
124 | public: | 137 | public: |
125 | MakefileGenerator(QMakeProject *p); | 138 | MakefileGenerator(QMakeProject *p); |
126 | virtual ~MakefileGenerator(); | 139 | virtual ~MakefileGenerator(); |
127 | 140 | ||
128 | static MakefileGenerator *create(QMakeProject *); | 141 | static MakefileGenerator *create(QMakeProject *); |
129 | bool write(); | 142 | virtual bool write(); |
130 | virtual bool openOutput(QFile &) const; | 143 | virtual bool openOutput(QFile &) const; |
131 | }; | 144 | }; |
132 | 145 | ||
133 | inline QString MakefileGenerator::findMocSource(const QString &moc_file) const | 146 | inline QString MakefileGenerator::findMocSource(const QString &moc_file) const |
134 | { | 147 | { |
135 | QString tmp = cleanFilePath(moc_file); | 148 | QString tmp = cleanFilePath(moc_file); |
136 | if (mocablesFromMOC.contains(tmp)) | 149 | if (mocablesFromMOC.contains(tmp)) |
137 | return mocablesFromMOC[tmp]; | 150 | return mocablesFromMOC[tmp]; |
138 | else | 151 | else |
139 | return QString(""); | 152 | return QString(""); |
140 | } | 153 | } |
141 | 154 | ||
142 | inline QString MakefileGenerator::findMocDestination(const QString &src_file) const | 155 | inline QString MakefileGenerator::findMocDestination(const QString &src_file) const |
143 | { | 156 | { |
144 | QString tmp = cleanFilePath(src_file); | 157 | QString tmp = cleanFilePath(src_file); |
145 | if (mocablesToMOC.contains(tmp)) | 158 | if (mocablesToMOC.contains(tmp)) |
146 | return mocablesToMOC[tmp]; | 159 | return mocablesToMOC[tmp]; |
147 | else | 160 | else |
148 | return QString(""); | 161 | return QString(""); |
149 | } | 162 | } |
150 | 163 | ||
151 | inline void MakefileGenerator::setMocAware(bool o) | 164 | inline void MakefileGenerator::setMocAware(bool o) |
152 | { moc_aware = o; } | 165 | { moc_aware = o; } |
153 | 166 | ||
154 | inline bool MakefileGenerator::mocAware() const | 167 | inline bool MakefileGenerator::mocAware() const |
155 | { return moc_aware; } | 168 | { return moc_aware; } |
156 | 169 | ||
157 | inline void MakefileGenerator::setNoIO(bool o) | 170 | inline void MakefileGenerator::setNoIO(bool o) |
158 | { no_io = o; } | 171 | { no_io = o; } |
159 | 172 | ||
160 | inline bool MakefileGenerator::noIO() const | 173 | inline bool MakefileGenerator::noIO() const |
161 | { return no_io; } | 174 | { return no_io; } |
162 | 175 | ||
163 | inline QString MakefileGenerator::defaultInstall(const QString &) | 176 | inline QString MakefileGenerator::defaultInstall(const QString &) |
164 | { return QString(""); } | 177 | { return QString(""); } |
165 | 178 | ||
166 | inline bool MakefileGenerator::findLibraries() | 179 | inline bool MakefileGenerator::findLibraries() |
167 | { return TRUE; } | 180 | { return TRUE; } |
168 | 181 | ||
182 | inline QString MakefileGenerator::findDependency(const QString &) | ||
183 | { return QString(""); } | ||
184 | |||
169 | inline MakefileGenerator::~MakefileGenerator() | 185 | inline MakefileGenerator::~MakefileGenerator() |
170 | { } | 186 | { } |
171 | 187 | ||
188 | QString mkdir_p_asstring(const QString &dir); | ||
172 | 189 | ||
173 | #endif /* __MAKEFILE_H__ */ | 190 | #endif /* __MAKEFILE_H__ */ |
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index 1515216..1c17379 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp | |||
@@ -1,482 +1,488 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of ProjectGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "projectgenerator.h" | 36 | #include "projectgenerator.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qdir.h> | 38 | #include <qdir.h> |
41 | #include <qfile.h> | 39 | #include <qfile.h> |
42 | #include <qfileinfo.h> | 40 | #include <qfileinfo.h> |
43 | #include <qregexp.h> | 41 | #include <qregexp.h> |
44 | 42 | ||
45 | QString project_builtin_regx() //calculate the builtin regular expression.. | 43 | QString project_builtin_regx() //calculate the builtin regular expression.. |
46 | { | 44 | { |
47 | QString ret; | 45 | QString ret; |
48 | QStringList builtin_exts(".c"); | 46 | QStringList builtin_exts(".c"); |
49 | builtin_exts << Option::ui_ext << Option::yacc_ext << Option::lex_ext << ".ts"; | 47 | builtin_exts << Option::ui_ext << Option::yacc_ext << Option::lex_ext << ".ts"; |
50 | builtin_exts += Option::h_ext + Option::cpp_ext; | 48 | builtin_exts += Option::h_ext + Option::cpp_ext; |
51 | for(QStringList::Iterator ext_it = builtin_exts.begin(); | 49 | for(QStringList::Iterator ext_it = builtin_exts.begin(); |
52 | ext_it != builtin_exts.end(); ++ext_it) { | 50 | ext_it != builtin_exts.end(); ++ext_it) { |
53 | if(!ret.isEmpty()) | 51 | if(!ret.isEmpty()) |
54 | ret += "; "; | 52 | ret += "; "; |
55 | ret += QString("*") + (*ext_it); | 53 | ret += QString("*") + (*ext_it); |
56 | } | 54 | } |
57 | return ret; | 55 | return ret; |
58 | } | 56 | } |
59 | 57 | ||
60 | 58 | ||
61 | 59 | ||
62 | ProjectGenerator::ProjectGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) | 60 | ProjectGenerator::ProjectGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) |
63 | { | 61 | { |
64 | } | 62 | } |
65 | 63 | ||
66 | void | 64 | void |
67 | ProjectGenerator::init() | 65 | ProjectGenerator::init() |
68 | { | 66 | { |
69 | if(init_flag) | 67 | if(init_flag) |
70 | return; | 68 | return; |
71 | int file_count = 0; | 69 | int file_count = 0; |
72 | init_flag = TRUE; | 70 | init_flag = TRUE; |
73 | 71 | ||
74 | QMap<QString, QStringList> &v = project->variables(); | 72 | QMap<QString, QStringList> &v = project->variables(); |
75 | QString templ = Option::user_template.isEmpty() ? QString("app") : Option::user_template; | 73 | QString templ = Option::user_template.isEmpty() ? QString("app") : Option::user_template; |
76 | if(!Option::user_template_prefix.isEmpty()) | 74 | if(!Option::user_template_prefix.isEmpty()) |
77 | templ.prepend(Option::user_template_prefix); | 75 | templ.prepend(Option::user_template_prefix); |
78 | v["TEMPLATE_ASSIGN"] += templ; | 76 | v["TEMPLATE_ASSIGN"] += templ; |
79 | 77 | ||
80 | //figure out target | 78 | //figure out target |
81 | if(Option::output.name() == "-" || Option::output.name().isEmpty()) | 79 | if(Option::output.name() == "-" || Option::output.name().isEmpty()) |
82 | v["TARGET"] = QStringList("unknown"); | 80 | v["TARGET"] = QStringList("unknown"); |
83 | 81 | ||
84 | //the scary stuff | 82 | //the scary stuff |
85 | if(project->first("TEMPLATE_ASSIGN") != "subdirs") { | 83 | if(project->first("TEMPLATE_ASSIGN") != "subdirs") { |
86 | QString builtin_regex = project_builtin_regx(); | 84 | QString builtin_regex = project_builtin_regx(); |
87 | QStringList dirs = Option::projfile::project_dirs; | 85 | QStringList dirs = Option::projfile::project_dirs; |
88 | if(Option::projfile::do_pwd) { | 86 | if(Option::projfile::do_pwd) { |
89 | if(!v["INCLUDEPATH"].contains(".")) | 87 | if(!v["INCLUDEPATH"].contains(".")) |
90 | v["INCLUDEPATH"] += "."; | 88 | v["INCLUDEPATH"] += "."; |
91 | dirs.prepend(QDir::currentDirPath()); | 89 | dirs.prepend(QDir::currentDirPath()); |
92 | } | 90 | } |
93 | 91 | ||
94 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { | 92 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { |
95 | QString dir, regex; | 93 | QString dir, regex; |
96 | bool add_depend = FALSE; | 94 | bool add_depend = FALSE; |
97 | if(QFile::exists((*pd))) { | 95 | if(QFile::exists((*pd))) { |
98 | QFileInfo fi((*pd)); | 96 | QFileInfo fi((*pd)); |
99 | if(fi.isDir()) { | 97 | if(fi.isDir()) { |
100 | dir = (*pd); | 98 | dir = (*pd); |
101 | add_depend = TRUE; | 99 | add_depend = TRUE; |
102 | if(dir.right(1) != Option::dir_sep) | 100 | if(dir.right(1) != Option::dir_sep) |
103 | dir += Option::dir_sep; | 101 | dir += Option::dir_sep; |
104 | if(Option::projfile::do_recursive) { | 102 | if(Option::projfile::do_recursive) { |
105 | QDir d(dir); | 103 | QDir d(dir); |
106 | d.setFilter(QDir::Dirs); | 104 | d.setFilter(QDir::Dirs); |
107 | for(int i = 0; i < (int)d.count(); i++) { | 105 | for(int i = 0; i < (int)d.count(); i++) { |
108 | if(d[i] != "." && d[i] != "..") | 106 | if(d[i] != "." && d[i] != "..") |
109 | dirs.append(dir + d[i] + QDir::separator() + builtin_regex); | 107 | dirs.append(dir + d[i] + QDir::separator() + builtin_regex); |
110 | } | 108 | } |
111 | } | 109 | } |
112 | regex = builtin_regex; | 110 | regex = builtin_regex; |
113 | } else { | 111 | } else { |
114 | QString file = (*pd); | 112 | QString file = (*pd); |
115 | int s = file.findRev(Option::dir_sep); | 113 | int s = file.findRev(Option::dir_sep); |
116 | if(s != -1) | 114 | if(s != -1) |
117 | dir = file.left(s+1); | 115 | dir = file.left(s+1); |
118 | if(addFile(file)) { | 116 | if(addFile(file)) { |
119 | add_depend = TRUE; | 117 | add_depend = TRUE; |
120 | file_count++; | 118 | file_count++; |
121 | } | 119 | } |
122 | } | 120 | } |
123 | } else { //regexp | 121 | } else { //regexp |
124 | regex = (*pd); | 122 | regex = (*pd); |
125 | } | 123 | } |
126 | if(!regex.isEmpty()) { | 124 | if(!regex.isEmpty()) { |
127 | int s = regex.findRev(Option::dir_sep); | 125 | int s = regex.findRev(Option::dir_sep); |
128 | if(s != -1) { | 126 | if(s != -1) { |
129 | dir = regex.left(s+1); | 127 | dir = regex.left(s+1); |
130 | regex = regex.right(regex.length() - (s+1)); | 128 | regex = regex.right(regex.length() - (s+1)); |
131 | } | 129 | } |
132 | if(Option::projfile::do_recursive) { | 130 | if(Option::projfile::do_recursive) { |
133 | QDir d(dir); | 131 | QDir d(dir); |
134 | d.setFilter(QDir::Dirs); | 132 | d.setFilter(QDir::Dirs); |
135 | for(int i = 0; i < (int)d.count(); i++) { | 133 | for(int i = 0; i < (int)d.count(); i++) { |
136 | if(d[i] != "." && d[i] != "..") | 134 | if(d[i] != "." && d[i] != "..") |
137 | dirs.append(dir + d[i] + QDir::separator() + regex); | 135 | dirs.append(dir + d[i] + QDir::separator() + regex); |
138 | } | 136 | } |
139 | } | 137 | } |
140 | QDir d(dir, regex); | 138 | QDir d(dir, regex); |
141 | for(int i = 0; i < (int)d.count(); i++) { | 139 | for(int i = 0; i < (int)d.count(); i++) { |
142 | QString file = dir + d[i]; | 140 | QString file = dir + d[i]; |
143 | if (addFile(file)) { | 141 | if (addFile(file)) { |
144 | add_depend = TRUE; | 142 | add_depend = TRUE; |
145 | file_count++; | 143 | file_count++; |
146 | } | 144 | } |
147 | } | 145 | } |
148 | } | 146 | } |
149 | if(add_depend && !dir.isEmpty() && !v["DEPENDPATH"].contains(dir)) { | 147 | if(add_depend && !dir.isEmpty() && !v["DEPENDPATH"].contains(dir)) { |
150 | QFileInfo fi(dir); | 148 | QFileInfo fi(dir); |
151 | if(fi.absFilePath() != QDir::currentDirPath()) | 149 | if(fi.absFilePath() != QDir::currentDirPath()) |
152 | v["DEPENDPATH"] += fileFixify(dir); | 150 | v["DEPENDPATH"] += fileFixify(dir); |
153 | } | 151 | } |
154 | } | 152 | } |
155 | } | 153 | } |
156 | if(!file_count) { //shall we try a subdir? | 154 | if(!file_count) { //shall we try a subdir? |
157 | QStringList dirs = Option::projfile::project_dirs; | 155 | QStringList dirs = Option::projfile::project_dirs; |
158 | if(Option::projfile::do_pwd) | 156 | if(Option::projfile::do_pwd) |
159 | dirs.prepend("."); | 157 | dirs.prepend("."); |
158 | const QString out_file = fileFixify(Option::output.name()); | ||
160 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { | 159 | for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { |
161 | if(QFile::exists((*pd))) { | 160 | if(QFile::exists((*pd))) { |
162 | QString newdir = (*pd); | 161 | QString newdir = (*pd); |
163 | QFileInfo fi(newdir); | 162 | QFileInfo fi(newdir); |
164 | if(fi.isDir()) { | 163 | if(fi.isDir()) { |
165 | newdir = fileFixify(newdir); | 164 | newdir = fileFixify(newdir); |
166 | QStringList &subdirs = v["SUBDIRS"]; | 165 | QStringList &subdirs = v["SUBDIRS"]; |
167 | if(QFile::exists(fi.filePath() + QDir::separator() + fi.fileName() + ".pro") && | 166 | if(QFile::exists(fi.filePath() + QDir::separator() + fi.fileName() + ".pro") && |
168 | !subdirs.contains(newdir)) { | 167 | !subdirs.contains(newdir)) { |
169 | subdirs.append(newdir); | 168 | subdirs.append(newdir); |
170 | } else { | 169 | } else { |
171 | QDir d(newdir, "*.pro"); | 170 | QDir d(newdir, "*.pro"); |
172 | d.setFilter(QDir::Files); | 171 | d.setFilter(QDir::Files); |
173 | for(int i = 0; i < (int)d.count(); i++) { | 172 | for(int i = 0; i < (int)d.count(); i++) { |
174 | QString nd = newdir + QDir::separator() + d[i]; | 173 | QString nd = newdir; |
174 | if(nd == ".") | ||
175 | nd = ""; | ||
176 | else if(!nd.isEmpty() && !nd.endsWith(QString(QChar(QDir::separator())))) | ||
177 | nd += QDir::separator(); | ||
178 | nd += d[i]; | ||
175 | fileFixify(nd); | 179 | fileFixify(nd); |
176 | if(d[i] != "." && d[i] != ".." && !subdirs.contains(nd)) { | 180 | if(d[i] != "." && d[i] != ".." && !subdirs.contains(nd) && !out_file.endsWith(nd)) |
177 | if(newdir + d[i] != Option::output_dir + Option::output.name()) | 181 | subdirs.append(nd); |
178 | subdirs.append(nd); | ||
179 | } | ||
180 | } | 182 | } |
181 | } | 183 | } |
182 | if(Option::projfile::do_recursive) { | 184 | if(Option::projfile::do_recursive) { |
183 | QDir d(newdir); | 185 | QDir d(newdir); |
184 | d.setFilter(QDir::Dirs); | 186 | d.setFilter(QDir::Dirs); |
185 | for(int i = 0; i < (int)d.count(); i++) { | 187 | for(int i = 0; i < (int)d.count(); i++) { |
186 | QString nd = fileFixify(newdir + QDir::separator() + d[i]); | 188 | QString nd = fileFixify(newdir + QDir::separator() + d[i]); |
187 | if(d[i] != "." && d[i] != ".." && !dirs.contains(nd)) | 189 | if(d[i] != "." && d[i] != ".." && !dirs.contains(nd)) |
188 | dirs.append(nd); | 190 | dirs.append(nd); |
189 | } | 191 | } |
190 | } | 192 | } |
191 | } | 193 | } |
192 | } else { //regexp | 194 | } else { //regexp |
193 | QString regx = (*pd), dir; | 195 | QString regx = (*pd), dir; |
194 | int s = regx.findRev(Option::dir_sep); | 196 | int s = regx.findRev(Option::dir_sep); |
195 | if(s != -1) { | 197 | if(s != -1) { |
196 | dir = regx.left(s+1); | 198 | dir = regx.left(s+1); |
197 | regx = regx.right(regx.length() - (s+1)); | 199 | regx = regx.right(regx.length() - (s+1)); |
198 | } | 200 | } |
199 | QDir d(dir, regx); | 201 | QDir d(dir, regx); |
200 | d.setFilter(QDir::Dirs); | 202 | d.setFilter(QDir::Dirs); |
201 | QStringList &subdirs = v["SUBDIRS"]; | 203 | QStringList &subdirs = v["SUBDIRS"]; |
202 | for(int i = 0; i < (int)d.count(); i++) { | 204 | for(int i = 0; i < (int)d.count(); i++) { |
203 | QString newdir(dir + d[i]); | 205 | QString newdir(dir + d[i]); |
204 | QFileInfo fi(newdir); | 206 | QFileInfo fi(newdir); |
205 | if(fi.fileName() != "." && fi.fileName() != "..") { | 207 | if(fi.fileName() != "." && fi.fileName() != "..") { |
206 | newdir = fileFixify(newdir); | 208 | newdir = fileFixify(newdir); |
207 | if(QFile::exists(fi.filePath() + QDir::separator() + fi.fileName() + ".pro") && | 209 | if(QFile::exists(fi.filePath() + QDir::separator() + fi.fileName() + ".pro") && |
208 | !subdirs.contains(newdir)) { | 210 | !subdirs.contains(newdir)) { |
209 | subdirs.append(newdir); | 211 | subdirs.append(newdir); |
210 | } else { | 212 | } else { |
211 | QDir d(newdir, "*.pro"); | 213 | QDir d(newdir, "*.pro"); |
212 | d.setFilter(QDir::Files); | 214 | d.setFilter(QDir::Files); |
213 | for(int i = 0; i < (int)d.count(); i++) { | 215 | for(int i = 0; i < (int)d.count(); i++) { |
214 | QString nd = newdir + QDir::separator() + d[i]; | 216 | QString nd = newdir + QDir::separator() + d[i]; |
215 | fileFixify(nd); | 217 | fileFixify(nd); |
216 | if(d[i] != "." && d[i] != ".." && !subdirs.contains(nd)) { | 218 | if(d[i] != "." && d[i] != ".." && !subdirs.contains(nd)) { |
217 | if(newdir + d[i] != Option::output_dir + Option::output.name()) | 219 | if(newdir + d[i] != Option::output_dir + Option::output.name()) |
218 | subdirs.append(nd); | 220 | subdirs.append(nd); |
219 | } | 221 | } |
220 | } | 222 | } |
221 | } | 223 | } |
222 | if(Option::projfile::do_recursive && !dirs.contains(newdir)) | 224 | if(Option::projfile::do_recursive && !dirs.contains(newdir)) |
223 | dirs.append(newdir); | 225 | dirs.append(newdir); |
224 | } | 226 | } |
225 | } | 227 | } |
226 | } | 228 | } |
227 | } | 229 | } |
228 | v["TEMPLATE_ASSIGN"] = "subdirs"; | 230 | v["TEMPLATE_ASSIGN"] = "subdirs"; |
229 | return; | 231 | return; |
230 | } | 232 | } |
231 | 233 | ||
232 | QPtrList<MakefileDependDir> deplist; | 234 | QPtrList<MakefileDependDir> deplist; |
233 | deplist.setAutoDelete(TRUE); | 235 | deplist.setAutoDelete(TRUE); |
234 | { | 236 | { |
235 | QStringList &d = v["DEPENDPATH"]; | 237 | QStringList &d = v["DEPENDPATH"]; |
236 | for(QStringList::Iterator it = d.begin(); it != d.end(); ++it) { | 238 | for(QStringList::Iterator it = d.begin(); it != d.end(); ++it) { |
237 | QString r = (*it), l = Option::fixPathToLocalOS((*it)); | 239 | QString r = (*it), l = Option::fixPathToLocalOS((*it)); |
238 | deplist.append(new MakefileDependDir(r, l)); | 240 | deplist.append(new MakefileDependDir(r, l)); |
239 | } | 241 | } |
240 | } | 242 | } |
241 | QStringList &h = v["HEADERS"]; | 243 | QStringList &h = v["HEADERS"]; |
242 | bool no_qt_files = TRUE; | 244 | bool no_qt_files = TRUE; |
243 | QString srcs[] = { "SOURCES", "YACCSOURCES", "LEXSOURCES", "INTERFACES", QString::null }; | 245 | QString srcs[] = { "SOURCES", "YACCSOURCES", "LEXSOURCES", "INTERFACES", QString::null }; |
244 | for(int i = 0; !srcs[i].isNull(); i++) { | 246 | for(int i = 0; !srcs[i].isNull(); i++) { |
245 | QStringList &l = v[srcs[i]]; | 247 | QStringList &l = v[srcs[i]]; |
246 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { | 248 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { |
247 | if(generateDependencies(deplist, (*val_it), TRUE)) { | 249 | if(generateDependencies(deplist, (*val_it), TRUE)) { |
248 | QStringList &tmp = findDependencies((*val_it)); | 250 | QStringList &tmp = findDependencies((*val_it)); |
249 | if(!tmp.isEmpty()) { | 251 | if(!tmp.isEmpty()) { |
250 | for(QStringList::Iterator dep_it = tmp.begin(); dep_it != tmp.end(); ++dep_it) { | 252 | for(QStringList::Iterator dep_it = tmp.begin(); dep_it != tmp.end(); ++dep_it) { |
251 | QString file_dir = (*dep_it).section(Option::dir_sep, 0, -2), | 253 | QString file_dir = (*dep_it).section(Option::dir_sep, 0, -2), |
252 | file_no_path = (*dep_it).section(Option::dir_sep, -1); | 254 | file_no_path = (*dep_it).section(Option::dir_sep, -1); |
253 | if(!file_dir.isEmpty()) { | 255 | if(!file_dir.isEmpty()) { |
254 | for(MakefileDependDir *mdd = deplist.first(); mdd; mdd = deplist.next()) { | 256 | for(MakefileDependDir *mdd = deplist.first(); mdd; mdd = deplist.next()) { |
255 | if(mdd->local_dir == file_dir && !v["INCLUDEPATH"].contains(mdd->real_dir)) | 257 | if(mdd->local_dir == file_dir && !v["INCLUDEPATH"].contains(mdd->real_dir)) |
256 | v["INCLUDEPATH"] += mdd->real_dir; | 258 | v["INCLUDEPATH"] += mdd->real_dir; |
257 | } | 259 | } |
258 | } | 260 | } |
259 | if(no_qt_files && file_no_path.find(QRegExp("^q[a-z_0-9].h$")) != -1) | 261 | if(no_qt_files && file_no_path.find(QRegExp("^q[a-z_0-9].h$")) != -1) |
260 | no_qt_files = FALSE; | 262 | no_qt_files = FALSE; |
261 | QString h_ext; | 263 | QString h_ext; |
262 | for(QStringList::Iterator hit = Option::h_ext.begin(); | 264 | for(QStringList::Iterator hit = Option::h_ext.begin(); |
263 | hit != Option::h_ext.end(); ++hit) { | 265 | hit != Option::h_ext.end(); ++hit) { |
264 | if((*dep_it).endsWith((*hit))) { | 266 | if((*dep_it).endsWith((*hit))) { |
265 | h_ext = (*hit); | 267 | h_ext = (*hit); |
266 | break; | 268 | break; |
267 | } | 269 | } |
268 | } | 270 | } |
269 | if(!h_ext.isEmpty()) { | 271 | if(!h_ext.isEmpty()) { |
270 | if((*dep_it).left(1).lower() == "q") { | 272 | if((*dep_it).left(1).lower() == "q") { |
271 | QString qhdr = (*dep_it).lower(); | 273 | QString qhdr = (*dep_it).lower(); |
272 | if(file_no_path == "qthread.h") | 274 | if(file_no_path == "qthread.h") |
273 | addConfig("thread"); | 275 | addConfig("thread"); |
274 | } | 276 | } |
275 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 277 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
276 | cppit != Option::cpp_ext.end(); ++cppit) { | 278 | cppit != Option::cpp_ext.end(); ++cppit) { |
277 | QString src((*dep_it).left((*dep_it).length() - h_ext.length()) + | 279 | QString src((*dep_it).left((*dep_it).length() - h_ext.length()) + |
278 | (*cppit)); | 280 | (*cppit)); |
279 | if(QFile::exists(src)) { | 281 | if(QFile::exists(src)) { |
280 | bool exists = FALSE; | 282 | bool exists = FALSE; |
281 | QStringList &srcl = v["SOURCES"]; | 283 | QStringList &srcl = v["SOURCES"]; |
282 | for(QStringList::Iterator src_it = srcl.begin(); | 284 | for(QStringList::Iterator src_it = srcl.begin(); |
283 | src_it != srcl.end(); ++src_it) { | 285 | src_it != srcl.end(); ++src_it) { |
284 | if((*src_it).lower() == src.lower()) { | 286 | if((*src_it).lower() == src.lower()) { |
285 | exists = TRUE; | 287 | exists = TRUE; |
286 | break; | 288 | break; |
287 | } | 289 | } |
288 | } | 290 | } |
289 | if(!exists) | 291 | if(!exists) |
290 | srcl.append(src); | 292 | srcl.append(src); |
291 | } | 293 | } |
292 | } | 294 | } |
293 | } else if((*dep_it).endsWith(Option::lex_ext) && | 295 | } else if((*dep_it).endsWith(Option::lex_ext) && |
294 | file_no_path.startsWith(Option::lex_mod)) { | 296 | file_no_path.startsWith(Option::lex_mod)) { |
295 | addConfig("lex_included"); | 297 | addConfig("lex_included"); |
296 | } | 298 | } |
297 | if(!h.contains((*dep_it))) { | 299 | if(!h.contains((*dep_it))) { |
298 | if(generateMocList((*dep_it)) && !findMocDestination((*dep_it)).isEmpty()) | 300 | if(generateMocList((*dep_it)) && !findMocDestination((*dep_it)).isEmpty()) |
299 | h += (*dep_it); | 301 | h += (*dep_it); |
300 | } | 302 | } |
301 | } | 303 | } |
302 | } | 304 | } |
303 | } | 305 | } |
304 | } | 306 | } |
305 | } | 307 | } |
306 | if(h.isEmpty()) | 308 | if(h.isEmpty()) |
307 | addConfig("moc", FALSE); | 309 | addConfig("moc", FALSE); |
308 | 310 | ||
309 | //if we find a file that matches an forms it needn't be included in the project | 311 | //if we find a file that matches an forms it needn't be included in the project |
310 | QStringList &u = v["INTERFACES"]; | 312 | QStringList &u = v["INTERFACES"]; |
311 | QString no_ui[] = { "SOURCES", "HEADERS", QString::null }; | 313 | QString no_ui[] = { "SOURCES", "HEADERS", QString::null }; |
312 | { | 314 | { |
313 | for(int i = 0; !no_ui[i].isNull(); i++) { | 315 | for(int i = 0; !no_ui[i].isNull(); i++) { |
314 | QStringList &l = v[no_ui[i]]; | 316 | QStringList &l = v[no_ui[i]]; |
315 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ) { | 317 | for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ) { |
316 | bool found = FALSE; | 318 | bool found = FALSE; |
317 | for(QStringList::Iterator ui_it = u.begin(); ui_it != u.end(); ++ui_it) { | 319 | for(QStringList::Iterator ui_it = u.begin(); ui_it != u.end(); ++ui_it) { |
318 | QString s1 = (*val_it).right((*val_it).length() - ((*val_it).findRev(Option::dir_sep) + 1)); | 320 | QString s1 = (*val_it).right((*val_it).length() - ((*val_it).findRev(Option::dir_sep) + 1)); |
319 | if(s1.findRev('.') != -1) | 321 | if(s1.findRev('.') != -1) |
320 | s1 = s1.left(s1.findRev('.')) + Option::ui_ext; | 322 | s1 = s1.left(s1.findRev('.')) + Option::ui_ext; |
321 | QString u1 = (*ui_it).right((*ui_it).length() - ((*ui_it).findRev(Option::dir_sep) + 1)); | 323 | QString u1 = (*ui_it).right((*ui_it).length() - ((*ui_it).findRev(Option::dir_sep) + 1)); |
322 | if(s1 == u1) { | 324 | if(s1 == u1) { |
323 | found = TRUE; | 325 | found = TRUE; |
324 | break; | 326 | break; |
325 | } | 327 | } |
326 | } | 328 | } |
327 | if(!found && (*val_it).endsWith(Option::moc_ext)) | 329 | if(!found && (*val_it).endsWith(Option::cpp_moc_ext)) |
328 | found = TRUE; | 330 | found = TRUE; |
329 | if(found) | 331 | if(found) |
330 | val_it = l.remove(val_it); | 332 | val_it = l.remove(val_it); |
331 | else | 333 | else |
332 | ++val_it; | 334 | ++val_it; |
333 | } | 335 | } |
334 | } | 336 | } |
335 | } | 337 | } |
336 | } | 338 | } |
337 | 339 | ||
338 | 340 | ||
339 | bool | 341 | bool |
340 | ProjectGenerator::writeMakefile(QTextStream &t) | 342 | ProjectGenerator::writeMakefile(QTextStream &t) |
341 | { | 343 | { |
342 | t << "######################################################################" << endl; | 344 | t << "######################################################################" << endl; |
343 | t << "# Automatically generated by qmake (" << qmake_version() << ") " << QDateTime::currentDateTime().toString() << endl; | 345 | t << "# Automatically generated by qmake (" << qmake_version() << ") " << QDateTime::currentDateTime().toString() << endl; |
344 | t << "######################################################################" << endl << endl; | 346 | t << "######################################################################" << endl << endl; |
345 | QStringList::Iterator it; | 347 | QStringList::Iterator it; |
346 | for(it = Option::before_user_vars.begin(); it != Option::before_user_vars.end(); ++it) | 348 | for(it = Option::before_user_vars.begin(); it != Option::before_user_vars.end(); ++it) |
347 | t << (*it) << endl; | 349 | t << (*it) << endl; |
348 | t << getWritableVar("TEMPLATE_ASSIGN", FALSE); | 350 | t << getWritableVar("TEMPLATE_ASSIGN", FALSE); |
349 | if(project->first("TEMPLATE_ASSIGN") == "subdirs") { | 351 | if(project->first("TEMPLATE_ASSIGN") == "subdirs") { |
350 | t << endl << "# Directories" << "\n" | 352 | t << endl << "# Directories" << "\n" |
351 | << getWritableVar("SUBDIRS"); | 353 | << getWritableVar("SUBDIRS"); |
352 | } else { | 354 | } else { |
353 | t << getWritableVar("TARGET") | 355 | t << getWritableVar("TARGET") |
354 | << getWritableVar("CONFIG", FALSE) | 356 | << getWritableVar("CONFIG", FALSE) |
355 | << getWritableVar("CONFIG_REMOVE", FALSE) | 357 | << getWritableVar("CONFIG_REMOVE", FALSE) |
356 | << getWritableVar("DEPENDPATH") | 358 | << getWritableVar("DEPENDPATH") |
357 | << getWritableVar("INCLUDEPATH") << endl; | 359 | << getWritableVar("INCLUDEPATH") << endl; |
358 | 360 | ||
359 | t << "# Input" << "\n"; | 361 | t << "# Input" << "\n"; |
360 | t << getWritableVar("HEADERS") | 362 | t << getWritableVar("HEADERS") |
361 | << getWritableVar("INTERFACES") | 363 | << getWritableVar("INTERFACES") |
362 | << getWritableVar("LEXSOURCES") | 364 | << getWritableVar("LEXSOURCES") |
363 | << getWritableVar("YACCSOURCES") | 365 | << getWritableVar("YACCSOURCES") |
364 | << getWritableVar("SOURCES") | 366 | << getWritableVar("SOURCES") |
365 | << getWritableVar("TRANSLATIONS"); | 367 | << getWritableVar("TRANSLATIONS"); |
366 | } | 368 | } |
367 | for(it = Option::after_user_vars.begin(); it != Option::after_user_vars.end(); ++it) | 369 | for(it = Option::after_user_vars.begin(); it != Option::after_user_vars.end(); ++it) |
368 | t << (*it) << endl; | 370 | t << (*it) << endl; |
369 | return TRUE; | 371 | return TRUE; |
370 | } | 372 | } |
371 | 373 | ||
372 | bool | 374 | bool |
373 | ProjectGenerator::addConfig(const QString &cfg, bool add) | 375 | ProjectGenerator::addConfig(const QString &cfg, bool add) |
374 | { | 376 | { |
375 | QString where = "CONFIG"; | 377 | QString where = "CONFIG"; |
376 | if(!add) | 378 | if(!add) |
377 | where = "CONFIG_REMOVE"; | 379 | where = "CONFIG_REMOVE"; |
378 | if(!project->variables()[where].contains(cfg)) { | 380 | if(!project->variables()[where].contains(cfg)) { |
379 | project->variables()[where] += cfg; | 381 | project->variables()[where] += cfg; |
380 | return TRUE; | 382 | return TRUE; |
381 | } | 383 | } |
382 | return FALSE; | 384 | return FALSE; |
383 | } | 385 | } |
384 | 386 | ||
385 | 387 | ||
386 | bool | 388 | bool |
387 | ProjectGenerator::addFile(QString file) | 389 | ProjectGenerator::addFile(QString file) |
388 | { | 390 | { |
389 | file = fileFixify(file, QDir::currentDirPath()); | 391 | file = fileFixify(file, QDir::currentDirPath()); |
390 | QString dir; | 392 | QString dir; |
391 | int s = file.findRev(Option::dir_sep); | 393 | int s = file.findRev(Option::dir_sep); |
392 | if(s != -1) | 394 | if(s != -1) |
393 | dir = file.left(s+1); | 395 | dir = file.left(s+1); |
394 | if(file.mid(dir.length(), Option::moc_mod.length()) == Option::moc_mod) | 396 | if(file.mid(dir.length(), Option::h_moc_mod.length()) == Option::h_moc_mod) |
395 | return FALSE; | 397 | return FALSE; |
396 | 398 | ||
397 | QString where; | 399 | QString where; |
398 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { | 400 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { |
399 | if(file.endsWith((*cppit))) { | 401 | if(file.endsWith((*cppit))) { |
400 | if(QFile::exists(file.left(file.length() - (*cppit).length()) + Option::ui_ext)) | 402 | if(QFile::exists(file.left(file.length() - (*cppit).length()) + Option::ui_ext)) |
401 | return FALSE; | 403 | return FALSE; |
402 | else | 404 | else |
403 | where = "SOURCES"; | 405 | where = "SOURCES"; |
404 | break; | 406 | break; |
405 | } | 407 | } |
406 | } | 408 | } |
407 | if(where.isEmpty()) { | 409 | if(where.isEmpty()) { |
408 | for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { | 410 | for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { |
409 | if(file.endsWith((*hit))) { | 411 | if(file.endsWith((*hit))) { |
410 | where = "HEADERS"; | 412 | where = "HEADERS"; |
411 | break; | 413 | break; |
412 | } | 414 | } |
413 | } | 415 | } |
414 | } | 416 | } |
415 | if(where.isEmpty()) { | 417 | if(where.isEmpty()) { |
416 | if(file.endsWith(Option::ui_ext)) | 418 | if(file.endsWith(Option::ui_ext)) |
417 | where = "INTERFACES"; | 419 | where = "INTERFACES"; |
418 | else if(file.endsWith(".c")) | 420 | else if(file.endsWith(".c")) |
419 | where = "SOURCES"; | 421 | where = "SOURCES"; |
420 | else if(file.endsWith(Option::lex_ext)) | 422 | else if(file.endsWith(Option::lex_ext)) |
421 | where = "LEXSOURCES"; | 423 | where = "LEXSOURCES"; |
422 | else if(file.endsWith(Option::yacc_ext)) | 424 | else if(file.endsWith(Option::yacc_ext)) |
423 | where = "YACCSOURCES"; | 425 | where = "YACCSOURCES"; |
424 | else if(file.endsWith(".ts")) | 426 | else if(file.endsWith(".ts")) |
425 | where = "TRANSLATIONS"; | 427 | where = "TRANSLATIONS"; |
426 | } | 428 | } |
427 | 429 | ||
428 | QString newfile = fileFixify(file); | 430 | QString newfile = fileFixify(file); |
429 | if(!where.isEmpty() && !project->variables()[where].contains(file)) { | 431 | if(!where.isEmpty() && !project->variables()[where].contains(file)) { |
430 | project->variables()[where] += newfile; | 432 | project->variables()[where] += newfile; |
431 | return TRUE; | 433 | return TRUE; |
432 | } | 434 | } |
433 | return FALSE; | 435 | return FALSE; |
434 | } | 436 | } |
435 | 437 | ||
436 | 438 | ||
437 | QString | 439 | QString |
438 | ProjectGenerator::getWritableVar(const QString &v, bool /*fixPath*/) | 440 | ProjectGenerator::getWritableVar(const QString &v, bool fixPath) |
439 | { | 441 | { |
440 | QStringList &vals = project->variables()[v]; | 442 | QStringList &vals = project->variables()[v]; |
441 | if(vals.isEmpty()) | 443 | if(vals.isEmpty()) |
442 | return ""; | 444 | return ""; |
443 | 445 | ||
444 | QString ret; | 446 | QString ret; |
445 | if(v.endsWith("_REMOVE")) | 447 | if(v.endsWith("_REMOVE")) |
446 | ret = v.left(v.length() - 7) + " -= "; | 448 | ret = v.left(v.length() - 7) + " -= "; |
447 | else if(v.endsWith("_ASSIGN")) | 449 | else if(v.endsWith("_ASSIGN")) |
448 | ret = v.left(v.length() - 7) + " = "; | 450 | ret = v.left(v.length() - 7) + " = "; |
449 | else | 451 | else |
450 | ret = v + " += "; | 452 | ret = v + " += "; |
451 | QString join = vals.join(" "); | 453 | QString join = vals.join(" "); |
452 | if(ret.length() + join.length() > 80) { | 454 | if(ret.length() + join.length() > 80) { |
453 | QString spaces; | 455 | QString spaces; |
454 | for(unsigned int i = 0; i < ret.length(); i++) | 456 | for(unsigned int i = 0; i < ret.length(); i++) |
455 | spaces += " "; | 457 | spaces += " "; |
456 | join = vals.join(" \\\n" + spaces); | 458 | join = vals.join(" \\\n" + spaces); |
457 | } | 459 | } |
460 | #if 0 | ||
458 | // ### Commented out for now so that project generation works. | 461 | // ### Commented out for now so that project generation works. |
459 | // Sam: can you look at why this was needed? | 462 | // Sam: it had to do with trailing \'s (ie considered continuation lines) |
460 | /* if(fixPath) | 463 | if(fixPath) |
461 | join = join.replace("\\", "/");*/ | 464 | join = join.replace("\\", "/"); |
465 | #else | ||
466 | Q_UNUSED(fixPath); | ||
467 | #endif | ||
462 | return ret + join + "\n"; | 468 | return ret + join + "\n"; |
463 | } | 469 | } |
464 | 470 | ||
465 | bool | 471 | bool |
466 | ProjectGenerator::openOutput(QFile &file) const | 472 | ProjectGenerator::openOutput(QFile &file) const |
467 | { | 473 | { |
468 | QString outdir; | 474 | QString outdir; |
469 | if(!file.name().isEmpty()) { | 475 | if(!file.name().isEmpty()) { |
470 | QFileInfo fi(file); | 476 | QFileInfo fi(file); |
471 | if(fi.isDir()) | 477 | if(fi.isDir()) |
472 | outdir = fi.dirPath() + QDir::separator(); | 478 | outdir = fi.dirPath() + QDir::separator(); |
473 | } | 479 | } |
474 | if(!outdir.isEmpty() || file.name().isEmpty()) { | 480 | if(!outdir.isEmpty() || file.name().isEmpty()) { |
475 | QString dir = QDir::currentDirPath(); | 481 | QString dir = QDir::currentDirPath(); |
476 | int s = dir.findRev('/'); | 482 | int s = dir.findRev('/'); |
477 | if(s != -1) | 483 | if(s != -1) |
478 | dir = dir.right(dir.length() - (s + 1)); | 484 | dir = dir.right(dir.length() - (s + 1)); |
479 | file.setName(outdir + dir + ".pro"); | 485 | file.setName(outdir + dir + ".pro"); |
480 | } | 486 | } |
481 | return MakefileGenerator::openOutput(file); | 487 | return MakefileGenerator::openOutput(file); |
482 | } | 488 | } |
diff --git a/qmake/generators/projectgenerator.h b/qmake/generators/projectgenerator.h index 055a784..bebb259 100644 --- a/qmake/generators/projectgenerator.h +++ b/qmake/generators/projectgenerator.h | |||
@@ -1,61 +1,59 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ProjectGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | #ifndef __PROJECTGENERATOR_H__ | 35 | #ifndef __PROJECTGENERATOR_H__ |
38 | #define __PROJECTGENERATOR_H__ | 36 | #define __PROJECTGENERATOR_H__ |
39 | 37 | ||
40 | #include "makefile.h" | 38 | #include "makefile.h" |
41 | 39 | ||
42 | class ProjectGenerator : public MakefileGenerator | 40 | class ProjectGenerator : public MakefileGenerator |
43 | { | 41 | { |
44 | bool init_flag; | 42 | bool init_flag; |
45 | bool addFile(QString); | 43 | bool addFile(QString); |
46 | bool addConfig(const QString &, bool add=TRUE); | 44 | bool addConfig(const QString &, bool add=TRUE); |
47 | QString getWritableVar(const QString &, bool fixPath=TRUE); | 45 | QString getWritableVar(const QString &, bool fixPath=TRUE); |
48 | protected: | 46 | protected: |
49 | virtual void init(); | 47 | virtual void init(); |
50 | virtual bool writeMakefile(QTextStream &); | 48 | virtual bool writeMakefile(QTextStream &); |
51 | public: | 49 | public: |
52 | ProjectGenerator(QMakeProject *p); | 50 | ProjectGenerator(QMakeProject *p); |
53 | ~ProjectGenerator(); | 51 | ~ProjectGenerator(); |
54 | virtual bool openOutput(QFile &) const; | 52 | virtual bool openOutput(QFile &) const; |
55 | }; | 53 | }; |
56 | 54 | ||
57 | inline ProjectGenerator::~ProjectGenerator() | 55 | inline ProjectGenerator::~ProjectGenerator() |
58 | { } | 56 | { } |
59 | 57 | ||
60 | 58 | ||
61 | #endif /* __PROJECTGENERATOR_H__ */ | 59 | #endif /* __PROJECTGENERATOR_H__ */ |
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index e274481..caaddee 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp | |||
@@ -1,604 +1,877 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of UnixMakefileGenerator class. |
5 | ** | ||
6 | ** Created : 970521 | ||
7 | ** | 5 | ** |
8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 7 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "unixmake.h" | 36 | #include "unixmake.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qregexp.h> | 38 | #include <qregexp.h> |
41 | #include <qfile.h> | 39 | #include <qfile.h> |
42 | #include <qdict.h> | 40 | #include <qdict.h> |
43 | #include <qdir.h> | 41 | #include <qdir.h> |
44 | #include <time.h> | 42 | #include <time.h> |
45 | 43 | ||
46 | 44 | ||
47 | void | 45 | void |
48 | UnixMakefileGenerator::init() | 46 | UnixMakefileGenerator::init() |
49 | { | 47 | { |
50 | if(init_flag) | 48 | if(init_flag) |
51 | return; | 49 | return; |
52 | init_flag = TRUE; | 50 | init_flag = TRUE; |
53 | 51 | ||
54 | if(!project->isEmpty("QMAKE_FAILED_REQUIREMENTS")) /* no point */ | 52 | if(!project->isEmpty("QMAKE_FAILED_REQUIREMENTS")) /* no point */ |
55 | return; | 53 | return; |
56 | 54 | ||
57 | QStringList &configs = project->variables()["CONFIG"]; | 55 | QStringList &configs = project->variables()["CONFIG"]; |
58 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 56 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
59 | if(project->first("TEMPLATE") == "app") | 57 | if(project->first("TEMPLATE") == "app") |
60 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 58 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
61 | else if(project->first("TEMPLATE") == "lib") | 59 | else if(project->first("TEMPLATE") == "lib") |
62 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 60 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
63 | else if(project->first("TEMPLATE") == "subdirs") { | 61 | else if(project->first("TEMPLATE") == "subdirs") { |
64 | MakefileGenerator::init(); | 62 | MakefileGenerator::init(); |
65 | if(project->isEmpty("MAKEFILE")) | 63 | if(project->isEmpty("MAKEFILE")) |
66 | project->variables()["MAKEFILE"].append("Makefile"); | 64 | project->variables()["MAKEFILE"].append("Makefile"); |
67 | if(project->isEmpty("QMAKE")) | 65 | if(project->isEmpty("QMAKE")) |
68 | project->variables()["QMAKE"].append("qmake"); | 66 | project->variables()["QMAKE"].append("qmake"); |
69 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) | 67 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) |
70 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); | 68 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); |
71 | return; /* subdirs is done */ | 69 | return; /* subdirs is done */ |
72 | } | 70 | } |
73 | 71 | ||
74 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { | 72 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { |
75 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { | 73 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
76 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); | 74 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); |
77 | } else { | 75 | } else { |
78 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); | 76 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); |
79 | } | 77 | } |
80 | } | 78 | } |
79 | if( project->isEmpty("QMAKE_CFLAGS_PRECOMPILE")) | ||
80 | project->variables()["QMAKE_CFLAGS_PRECOMPILE"].append("-x c-header -c"); | ||
81 | if( project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE")) | ||
82 | project->variables()["QMAKE_CXXFLAGS_PRECOMPILE"].append("-x c++-header -c"); | ||
83 | if( project->isEmpty("QMAKE_CFLAGS_USE_PRECOMPILE")) | ||
84 | project->variables()["QMAKE_CFLAGS_USE_PRECOMPILE"].append("-include"); | ||
85 | if( project->isEmpty("QMAKE_EXTENSION_PLUGIN") ) | ||
86 | project->variables()["QMAKE_EXTENSION_PLUGIN"].append(project->first("QMAKE_EXTENSION_SHLIB")); | ||
81 | if( project->isEmpty("QMAKE_COPY_FILE") ) | 87 | if( project->isEmpty("QMAKE_COPY_FILE") ) |
82 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" ); | 88 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY)" ); |
83 | if( project->isEmpty("QMAKE_COPY_DIR") ) | 89 | if( project->isEmpty("QMAKE_COPY_DIR") ) |
84 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" ); | 90 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -R" ); |
91 | if( project->isEmpty("QMAKE_INSTALL_FILE") ) | ||
92 | project->variables()["QMAKE_INSTALL_FILE"].append( "$(COPY_FILE)" ); | ||
93 | if( project->isEmpty("QMAKE_INSTALL_DIR") ) | ||
94 | project->variables()["QMAKE_INSTALL_DIR"].append( "$(COPY_DIR)" ); | ||
95 | if( project->isEmpty("QMAKE_LIBTOOL") ) | ||
96 | project->variables()["QMAKE_LIBTOOL"].append( "libtool --silent" ); | ||
85 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET | 97 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET |
86 | if(!project->isEmpty("TARGET")) { | 98 | if(!project->isEmpty("TARGET")) { |
87 | QString targ = project->first("TARGET"); | 99 | QString targ = project->first("TARGET"); |
88 | int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); | 100 | int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); |
89 | if(slsh != -1) { | 101 | if(slsh != -1) { |
90 | if(project->isEmpty("DESTDIR")) | 102 | if(project->isEmpty("DESTDIR")) |
91 | project->values("DESTDIR").append(""); | 103 | project->values("DESTDIR").append(""); |
92 | else if(project->first("DESTDIR").right(1) != Option::dir_sep) | 104 | else if(project->first("DESTDIR").right(1) != Option::dir_sep) |
93 | project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; | 105 | project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; |
94 | project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); | 106 | project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); |
95 | project->variables()["TARGET"] = targ.mid(slsh+1); | 107 | project->variables()["TARGET"] = targ.mid(slsh+1); |
96 | } | 108 | } |
97 | } | 109 | } |
98 | 110 | ||
99 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 111 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
100 | 112 | ||
101 | bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" || | 113 | bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" || |
102 | project->first("TARGET") == "qt-mt" || project->first("TARGET") == "qte-mt"); | 114 | project->first("TARGET") == "qt-mt" || project->first("TARGET") == "qte-mt"); |
103 | bool extern_libs = !project->isEmpty("QMAKE_APP_FLAG") || | 115 | bool extern_libs = !project->isEmpty("QMAKE_APP_FLAG") || |
104 | (!project->isEmpty("QMAKE_LIB_FLAG") && | 116 | (!project->isEmpty("QMAKE_LIB_FLAG") && |
105 | project->isActiveConfig("dll")) || is_qt; | 117 | project->isActiveConfig("dll")) || is_qt; |
106 | if(!project->isActiveConfig("global_init_link_order")) | 118 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
107 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | ||
108 | if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) || | 119 | if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) || |
109 | (project->isActiveConfig("qt") && project->isActiveConfig( "plugin" ) )) { | 120 | (project->isActiveConfig("qt") && project->isActiveConfig( "plugin" ) )) { |
110 | if(configs.findIndex("dll") == -1) configs.append("dll"); | 121 | if(configs.findIndex("dll") == -1) configs.append("dll"); |
111 | } else if ( !project->isEmpty("QMAKE_APP_FLAG") || project->isActiveConfig("dll") ) { | 122 | } else if ( !project->isEmpty("QMAKE_APP_FLAG") || project->isActiveConfig("dll") ) { |
112 | configs.remove("staticlib"); | 123 | configs.remove("staticlib"); |
113 | } | 124 | } |
114 | if ( project->isActiveConfig("warn_off") ) { | 125 | if ( project->isActiveConfig("warn_off") ) { |
115 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | 126 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; |
116 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | 127 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; |
117 | } else if ( project->isActiveConfig("warn_on") ) { | 128 | } else if ( project->isActiveConfig("warn_on") ) { |
118 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | 129 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; |
119 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | 130 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; |
120 | } | 131 | } |
121 | if ( project->isActiveConfig("debug") ) { | 132 | if ( project->isActiveConfig("debug") ) { |
122 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | 133 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; |
123 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | 134 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; |
124 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | 135 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; |
125 | } else { | 136 | } else { |
126 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | 137 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; |
127 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | 138 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; |
128 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | 139 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; |
129 | } | 140 | } |
130 | if(!project->isEmpty("QMAKE_INCREMENTAL")) | 141 | if(!project->isEmpty("QMAKE_INCREMENTAL")) |
131 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; | 142 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; |
132 | else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && | 143 | else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && |
133 | !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && | 144 | !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && |
134 | project->isActiveConfig("dll")) | 145 | project->isActiveConfig("dll")) |
135 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; | 146 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; |
136 | if(!project->isEmpty("QMAKE_INCDIR")) | 147 | if(!project->isEmpty("QMAKE_INCDIR")) |
137 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | 148 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; |
138 | if(!project->isEmpty("QMAKE_LIBDIR")) { | 149 | if(!project->isEmpty("QMAKE_LIBDIR")) { |
139 | if ( !project->isEmpty("QMAKE_RPATH") ) | 150 | if ( !project->isEmpty("QMAKE_RPATH") ) |
140 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), | 151 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), |
141 | " " + var("QMAKE_RPATH"), ""); | 152 | " " + var("QMAKE_RPATH"), ""); |
142 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); | 153 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); |
143 | } | 154 | } |
144 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { | 155 | if ( project->isActiveConfig("qtopia") ) { |
145 | if(configs.findIndex("x11lib") == -1) | 156 | if(configs.findIndex("qtopialib") == -1) |
146 | configs.append("x11lib"); | 157 | configs.append("qtopialib"); |
147 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) | 158 | if(configs.findIndex("qtopiainc") == -1) |
148 | configs.append("x11inc"); | 159 | configs.append("qtopiainc"); |
149 | } | 160 | } |
150 | if ( project->isActiveConfig("x11") ) { | 161 | if ( project->isActiveConfig("qtopiainc") ) |
151 | if(configs.findIndex("x11lib") == -1) | 162 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; |
152 | configs.append("x11lib"); | 163 | if ( project->isActiveConfig("qtopialib") ) { |
153 | if(configs.findIndex("x11inc") == -1) | 164 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) |
154 | configs.append("x11inc"); | 165 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QTOPIA", "-L", " -L", ""); |
166 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
155 | } | 167 | } |
156 | if ( project->isActiveConfig("qt") ) { | 168 | if ( project->isActiveConfig("qt") ) { |
157 | if ( project->isActiveConfig("accessibility" ) ) | 169 | if ( project->isActiveConfig("accessibility" ) ) |
158 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 170 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
159 | if ( project->isActiveConfig("tablet") ) | 171 | if ( project->isActiveConfig("tablet") ) |
160 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 172 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
161 | if(configs.findIndex("moc")) configs.append("moc"); | 173 | if(configs.findIndex("moc")) configs.append("moc"); |
162 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; | 174 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; |
163 | if ( !project->isActiveConfig("debug") ) | 175 | if ( !project->isActiveConfig("debug") ) |
164 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 176 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
165 | if ( !is_qt ) { | 177 | if ( !is_qt ) { |
166 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) { | 178 | if ( !project->isEmpty("QMAKE_RPATH") ) { |
167 | if ( !project->isEmpty("QMAKE_RPATH") ) | 179 | if ( !project->isEmpty("QMAKE_RTLDIR_QT") ) |
168 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), | 180 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_RTLDIR_QT", " " + var("QMAKE_RPATH"), |
169 | " " + var("QMAKE_RPATH"), ""); | 181 | " " + var("QMAKE_RPATH"), ""); |
170 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); | 182 | else if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) |
183 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), | ||
184 | " " + var("QMAKE_RPATH"), ""); | ||
171 | } | 185 | } |
172 | if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD")) | 186 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) |
187 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); | ||
188 | if ( project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD") ) | ||
173 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 189 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
174 | else | 190 | else |
175 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 191 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
176 | } | 192 | } |
177 | } | 193 | } |
178 | if ( project->isActiveConfig("opengl") ) { | 194 | if ( project->isActiveConfig("opengl") && !project->isActiveConfig("dlopen_opengl")) { |
179 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; | 195 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; |
180 | if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) | 196 | if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) |
181 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); | 197 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); |
182 | if ( is_qt ) | 198 | if ( is_qt ) |
183 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; | 199 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; |
184 | else | 200 | else |
185 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 201 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
186 | } | 202 | } |
187 | if(project->isActiveConfig("global_init_link_order")) | 203 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { |
188 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 204 | if(configs.findIndex("x11lib") == -1) |
205 | configs.append("x11lib"); | ||
206 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) | ||
207 | configs.append("x11inc"); | ||
208 | } | ||
209 | if ( project->isActiveConfig("x11") ) { | ||
210 | if(configs.findIndex("x11lib") == -1) | ||
211 | configs.append("x11lib"); | ||
212 | if(configs.findIndex("x11inc") == -1) | ||
213 | configs.append("x11inc"); | ||
214 | } | ||
189 | if ( project->isActiveConfig("x11inc") ) | 215 | if ( project->isActiveConfig("x11inc") ) |
190 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; | 216 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; |
191 | if ( project->isActiveConfig("x11lib") ) { | 217 | if ( project->isActiveConfig("x11lib") ) { |
192 | if(!project->isEmpty("QMAKE_LIBDIR_X11")) | 218 | if(!project->isEmpty("QMAKE_LIBDIR_X11")) |
193 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); | 219 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); |
194 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; | 220 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; |
195 | } | 221 | } |
196 | if ( project->isActiveConfig("x11sm") ) | 222 | if ( project->isActiveConfig("x11sm") ) |
197 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; | 223 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; |
198 | if ( project->isActiveConfig("dylib") ) | 224 | if ( project->isActiveConfig("dylib") ) |
199 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; | 225 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; |
200 | if ( project->isActiveConfig("thread") ) { | 226 | if ( project->isActiveConfig("thread") ) { |
201 | if(project->isActiveConfig("qt")) | 227 | if(project->isActiveConfig("qt")) |
202 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | 228 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); |
203 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | 229 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) { |
204 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | 230 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; |
205 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | 231 | project->variables()["PRL_EXPORT_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; |
232 | } | ||
233 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) { | ||
206 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | 234 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; |
235 | project->variables()["PRL_EXPORT_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
236 | } | ||
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | 237 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; |
208 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; | 238 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; |
209 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) | 239 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) |
210 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; | 240 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; |
211 | } | 241 | } |
212 | if ( project->isActiveConfig("moc") ) | 242 | if ( project->isActiveConfig("moc") ) |
213 | setMocAware(TRUE); | 243 | setMocAware(TRUE); |
214 | if ( project->isEmpty("QMAKE_RUN_CC") ) | 244 | QString compile_flag = var("QMAKE_COMPILE_FLAG"); |
215 | project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src"); | 245 | if(compile_flag.isEmpty()) |
216 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) | 246 | compile_flag = "-c"; |
217 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<"); | 247 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) { |
218 | if ( project->isEmpty("QMAKE_RUN_CXX") ) | 248 | QString prefix_flags = project->first("QMAKE_CFLAGS_PREFIX_INCLUDE"); |
219 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src"); | 249 | if(prefix_flags.isEmpty()) |
220 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) | 250 | prefix_flags = "-include"; |
221 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<"); | 251 | compile_flag += " " + prefix_flags + " " + project->first("QMAKE_ORIG_TARGET"); |
222 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); | 252 | } |
223 | if ( !project->isEmpty("PRECOMPH") ) { | 253 | if(!project->isEmpty("ALLMOC_HEADER")) { |
224 | initOutPaths(); // Need to fix MOC_DIR since we do this before init() | 254 | initOutPaths(); // Need to fix outdirs since we do this before init() (because we could add to SOURCES et al) |
225 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); | 255 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); |
226 | project->variables()["SOURCES"].prepend(allmoc); | 256 | project->variables()["SOURCES"].prepend(allmoc); |
227 | project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"]; | 257 | project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"]; |
228 | project->variables()["HEADERS"].clear(); | 258 | project->variables()["HEADERS"].clear(); |
229 | } | 259 | } |
260 | if ( project->isEmpty("QMAKE_RUN_CC") ) | ||
261 | project->variables()["QMAKE_RUN_CC"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $obj $src"); | ||
262 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) | ||
263 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $@ $<"); | ||
264 | if ( project->isEmpty("QMAKE_RUN_CXX") ) | ||
265 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $obj $src"); | ||
266 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) | ||
267 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $@ $<"); | ||
268 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); | ||
230 | if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) | 269 | if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) |
231 | include_deps = TRUE; //do not generate deps | 270 | include_deps = TRUE; //do not generate deps |
271 | if(project->isActiveConfig("compile_libtool")) | ||
272 | Option::obj_ext = ".lo"; //override the .o | ||
232 | 273 | ||
233 | MakefileGenerator::init(); | 274 | MakefileGenerator::init(); |
234 | if ( project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 275 | if ( project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
235 | if(!project->isEmpty("QMAKE_APP_FLAG")) { | 276 | if(!project->isEmpty("QMAKE_APP_FLAG")) { |
236 | if(project->isEmpty("DESTDIR")) | 277 | if(project->isEmpty("DESTDIR")) |
237 | project->values("DESTDIR").append(""); | 278 | project->values("DESTDIR").append(""); |
238 | project->variables()["DESTDIR"].first() += project->variables()["TARGET"].first() + | 279 | project->variables()["DESTDIR"].first() += project->variables()["TARGET"].first() + |
239 | ".app/Contents/MacOS/"; | 280 | ".app/Contents/MacOS/"; |
240 | project->variables()["QMAKE_PKGINFO"].append(project->first("DESTDIR") + "../PkgInfo"); | 281 | project->variables()["QMAKE_PKGINFO"].append(project->first("DESTDIR") + "../PkgInfo"); |
241 | project->variables()["ALL_DEPS"] += project->first("QMAKE_PKGINFO"); | 282 | project->variables()["ALL_DEPS"] += project->first("QMAKE_PKGINFO"); |
242 | 283 | ||
243 | QString plist = specdir() + QDir::separator() + "Info.plist." + | 284 | QString plist = fileFixify(project->first("QMAKE_INFO_PLIST")); |
244 | project->first("TEMPLATE"); | 285 | if(plist.isEmpty()) |
286 | plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); | ||
245 | if(QFile::exists(Option::fixPathToLocalOS(plist))) { | 287 | if(QFile::exists(Option::fixPathToLocalOS(plist))) { |
246 | project->variables()["QMAKE_INFO_PLIST"].append(plist); | 288 | if(project->isEmpty("QMAKE_INFO_PLIST")) |
289 | project->variables()["QMAKE_INFO_PLIST"].append(plist); | ||
247 | project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") + | 290 | project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") + |
248 | "../Info.plist"); | 291 | "../Info.plist"); |
249 | project->variables()["ALL_DEPS"] += project->first("QMAKE_INFO_PLIST_OUT"); | 292 | project->variables()["ALL_DEPS"] += project->first("QMAKE_INFO_PLIST_OUT"); |
250 | if(!project->isEmpty("RC_FILE")) | 293 | if(!project->isEmpty("RC_FILE")) |
251 | project->variables()["ALL_DEPS"] += project->first("DESTDIR") + | 294 | project->variables()["ALL_DEPS"] += project->first("DESTDIR") + |
252 | "../Resources/application.icns"; | 295 | "../Resources/application.icns"; |
253 | } | 296 | } |
254 | } | 297 | } |
255 | } | 298 | } |
256 | 299 | ||
257 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) | 300 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) |
258 | project->variables()["DISTFILES"] += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; | 301 | project->variables()["DISTFILES"] += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; |
259 | project->variables()["DISTFILES"] += Option::mkfile::project_files; | 302 | project->variables()["DISTFILES"] += Option::mkfile::project_files; |
260 | 303 | ||
261 | init2(); | 304 | init2(); |
262 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_LIBDIR_FLAGS" << "QMAKE_LIBS"; | 305 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_LIBDIR_FLAGS" << "QMAKE_LIBS"; |
263 | if(!project->isEmpty("QMAKE_MAX_FILES_PER_AR")) { | 306 | if(!project->isEmpty("QMAKE_MAX_FILES_PER_AR")) { |
264 | bool ok; | 307 | bool ok; |
265 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(&ok); | 308 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(&ok); |
266 | QStringList ar_sublibs, objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"]; | 309 | QStringList ar_sublibs, objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"]; |
267 | if(ok && max_files > 5 && max_files < (int)objs.count()) { | 310 | if(ok && max_files > 5 && max_files < (int)objs.count()) { |
268 | int obj_cnt = 0, lib_cnt = 0; | 311 | int obj_cnt = 0, lib_cnt = 0; |
269 | QString lib; | 312 | QString lib; |
270 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { | 313 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { |
271 | if((++obj_cnt) >= max_files) { | 314 | if((++obj_cnt) >= max_files) { |
272 | if(lib_cnt) { | 315 | if(lib_cnt) { |
273 | lib.sprintf("lib%s-tmp%d.a", project->first("QMAKE_ORIG_TARGET").latin1(), lib_cnt); | 316 | lib.sprintf("lib%s-tmp%d.a", project->first("QMAKE_ORIG_TARGET").latin1(), lib_cnt); |
274 | ar_sublibs << lib; | 317 | ar_sublibs << lib; |
275 | obj_cnt = 0; | 318 | obj_cnt = 0; |
276 | } | 319 | } |
277 | lib_cnt++; | 320 | lib_cnt++; |
278 | } | 321 | } |
279 | } | 322 | } |
280 | } | 323 | } |
281 | if(!ar_sublibs.isEmpty()) { | 324 | if(!ar_sublibs.isEmpty()) { |
282 | project->variables()["QMAKE_AR_SUBLIBS"] = ar_sublibs; | 325 | project->variables()["QMAKE_AR_SUBLIBS"] = ar_sublibs; |
283 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_AR_SUBLIBS"; | 326 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_AR_SUBLIBS"; |
284 | } | 327 | } |
285 | } | 328 | } |
329 | |||
330 | if(project->isActiveConfig("compile_libtool")) { | ||
331 | const QString libtoolify[] = { "QMAKE_RUN_CC", "QMAKE_RUN_CC_IMP", | ||
332 | "QMAKE_RUN_CXX", "QMAKE_RUN_CXX_IMP", | ||
333 | "QMAKE_LINK_THREAD", "QMAKE_LINK", "QMAKE_AR_CMD", "QMAKE_LINK_SHLIB_CMD", | ||
334 | QString::null }; | ||
335 | for(int i = 0; !libtoolify[i].isNull(); i++) { | ||
336 | QStringList &l = project->variables()[libtoolify[i]]; | ||
337 | if(!l.isEmpty()) { | ||
338 | QString libtool_flags, comp_flags; | ||
339 | if(libtoolify[i].startsWith("QMAKE_LINK") || libtoolify[i] == "QMAKE_AR_CMD") { | ||
340 | libtool_flags += " --mode=link"; | ||
341 | if(project->isActiveConfig("staticlib")) { | ||
342 | libtool_flags += " -static"; | ||
343 | } else { | ||
344 | if(!project->isEmpty("QMAKE_LIB_FLAG")) { | ||
345 | int maj = project->first("VER_MAJ").toInt(); | ||
346 | int min = project->first("VER_MIN").toInt(); | ||
347 | int pat = project->first("VER_PAT").toInt(); | ||
348 | comp_flags += " -version-info " + QString::number(10*maj + min) + | ||
349 | ":" + QString::number(pat) + ":0"; | ||
350 | if(libtoolify[i] != "QMAKE_AR_CMD") { | ||
351 | QString rpath = Option::output_dir; | ||
352 | if(!project->isEmpty("DESTDIR")) { | ||
353 | rpath = project->first("DESTDIR"); | ||
354 | if(QDir::isRelativePath(rpath)) | ||
355 | rpath.prepend(Option::output_dir + Option::dir_sep); | ||
356 | } | ||
357 | comp_flags += " -rpath " + Option::fixPathToTargetOS(rpath, FALSE); | ||
358 | } | ||
359 | } | ||
360 | } | ||
361 | if(project->isActiveConfig("plugin")) | ||
362 | libtool_flags += " -module"; | ||
363 | } else { | ||
364 | libtool_flags += " --mode=compile"; | ||
365 | } | ||
366 | l.first().prepend("$(LIBTOOL)" + libtool_flags + " "); | ||
367 | if(!comp_flags.isEmpty()) | ||
368 | l.first() += comp_flags; | ||
369 | } | ||
370 | } | ||
371 | } | ||
286 | } | 372 | } |
287 | 373 | ||
288 | QStringList | 374 | QStringList |
289 | UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &list2) | 375 | UnixMakefileGenerator::combineSetLFlags(const QStringList &list1, const QStringList &list2) |
290 | { | 376 | { |
377 | if(project->isActiveConfig("no_smart_library_merge")) | ||
378 | return list1 + list2; | ||
379 | |||
291 | QStringList ret; | 380 | QStringList ret; |
292 | for(QStringList::ConstIterator it = list1.begin(); it != list1.end(); ++it) { | 381 | for(int i = 0; i < 2; i++) { |
293 | bool unique = TRUE; | 382 | const QStringList *lst = i ? &list2 : &list1; |
294 | if((*it).startsWith("-")) { | 383 | for(QStringList::ConstIterator it = lst->begin(); it != lst->end(); ++it) { |
295 | if((*it).startsWith("-l") || (*it).startsWith("-L")) { | 384 | if((*it).startsWith("-")) { |
296 | unique = list2.findIndex((*it)) == -1; | 385 | if((*it).startsWith("-L")) { |
297 | } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) { | 386 | if(ret.findIndex((*it)) == -1) |
298 | int as_one = TRUE; | 387 | ret.append((*it)); |
299 | QString framework_in; | 388 | } else if((*it).startsWith("-l")) { |
300 | if((*it).length() > 11) { | 389 | while(1) { |
301 | framework_in = (*it).mid(11); | 390 | QStringList::Iterator idx = ret.find((*it)); |
302 | } else { | 391 | if(idx == ret.end()) |
303 | if(it != list1.end()) { | 392 | break; |
304 | ++it; | 393 | ret.remove(idx); |
305 | as_one = FALSE; | ||
306 | framework_in = (*it); | ||
307 | } | 394 | } |
308 | } | 395 | ret.append((*it)); |
309 | if(!framework_in.isEmpty()) { | 396 | } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) { |
310 | for(QStringList::ConstIterator outit = list2.begin(); outit != list2.end(); ++outit) { | 397 | int as_one = TRUE; |
311 | if((*outit).startsWith("-framework")) { | 398 | QString framework_in; |
312 | QString framework_out; | 399 | if((*it).length() > 11) { |
313 | if((*outit).length() > 11) { | 400 | framework_in = (*it).mid(11); |
314 | framework_out = (*outit).mid(11); | 401 | } else { |
315 | } else { | 402 | if(it != lst->end()) { |
316 | if(it != list2.end()) { | 403 | ++it; |
317 | ++outit; | 404 | as_one = FALSE; |
318 | framework_out = (*outit); | 405 | framework_in = (*it); |
406 | } | ||
407 | } | ||
408 | if(!framework_in.isEmpty()) { | ||
409 | for(QStringList::Iterator outit = ret.begin(); outit != ret.end(); ++outit) { | ||
410 | if((*outit).startsWith("-framework")) { | ||
411 | int found = 0; | ||
412 | if((*outit).length() > 11) { | ||
413 | if(framework_in == (*outit).mid(11)) | ||
414 | found = 1; | ||
415 | } else { | ||
416 | if(it != lst->end()) { | ||
417 | ++outit; | ||
418 | if(framework_in == (*outit)) { | ||
419 | --outit; | ||
420 | found = 2; | ||
421 | } | ||
422 | } | ||
319 | } | 423 | } |
320 | } | 424 | for(int i = 0; i < found; i++) |
321 | if(framework_out == framework_in) { | 425 | outit = ret.remove(outit); |
322 | unique = FALSE; | ||
323 | break; | ||
324 | } | 426 | } |
325 | } | 427 | } |
326 | } | ||
327 | if(unique) { | ||
328 | unique = FALSE; //because I'm about to just insert it myself | ||
329 | if(as_one) { | 428 | if(as_one) { |
330 | ret.append("-framework " + framework_in); | 429 | ret.append("-framework " + framework_in); |
331 | } else { | 430 | } else { |
332 | ret.append("-framework"); | 431 | ret.append("-framework"); |
333 | ret.append(framework_in); | 432 | ret.append(framework_in); |
334 | } | 433 | } |
335 | } | 434 | } |
435 | } else { | ||
436 | #if 1 | ||
437 | while(1) { | ||
438 | QStringList::Iterator idx = ret.find((*it)); | ||
439 | if(idx == ret.end()) | ||
440 | break; | ||
441 | ret.remove(idx); | ||
442 | } | ||
443 | #endif | ||
444 | ret.append((*it)); | ||
336 | } | 445 | } |
337 | } else { | 446 | } else /*if(QFile::exists((*it)))*/ { |
338 | unique = (list2.findIndex((*it)) == -1); | 447 | while(1) { |
448 | QStringList::Iterator idx = ret.find((*it)); | ||
449 | if(idx == ret.end()) | ||
450 | break; | ||
451 | ret.remove(idx); | ||
452 | } | ||
453 | ret.append((*it)); | ||
339 | } | 454 | } |
340 | } else if(QFile::exists((*it))) { | ||
341 | unique = (list2.findIndex((*it)) == -1); | ||
342 | } | 455 | } |
343 | if(unique) | ||
344 | ret.append((*it)); | ||
345 | } | 456 | } |
346 | return ret; | 457 | return ret; |
347 | } | 458 | } |
348 | 459 | ||
349 | |||
350 | void | 460 | void |
351 | UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 461 | UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
352 | { | 462 | { |
353 | if(var == "QMAKE_PRL_LIBS") | 463 | if(var == "QMAKE_PRL_LIBS") |
354 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]); | 464 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] = combineSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"] + |
465 | project->variables()["QMAKE_LIBS"], l); | ||
355 | else | 466 | else |
356 | MakefileGenerator::processPrlVariable(var, l); | 467 | MakefileGenerator::processPrlVariable(var, l); |
357 | } | 468 | } |
358 | 469 | ||
470 | QString | ||
471 | UnixMakefileGenerator::findDependency(const QString &dep) | ||
472 | { | ||
473 | QStringList::Iterator it; | ||
474 | { | ||
475 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | ||
476 | for(it = qut.begin(); it != qut.end(); ++it) { | ||
477 | QString targ = var((*it) + ".target"); | ||
478 | if(targ.isEmpty()) | ||
479 | targ = (*it); | ||
480 | if(targ.endsWith(dep)) | ||
481 | return targ; | ||
482 | } | ||
483 | } | ||
484 | { | ||
485 | QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
486 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
487 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
488 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
489 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
490 | continue; | ||
491 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
492 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
493 | QStringList &inputs = project->variables()[(*it2)]; | ||
494 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
495 | QString out = tmp_out; | ||
496 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
497 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
498 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
499 | if(out.endsWith(dep)) | ||
500 | return out; | ||
501 | } | ||
502 | } | ||
503 | } | ||
504 | } | ||
505 | return MakefileGenerator::findDependency(dep); | ||
506 | } | ||
507 | |||
508 | QStringList | ||
509 | &UnixMakefileGenerator::findDependencies(const QString &file) | ||
510 | { | ||
511 | QStringList &ret = MakefileGenerator::findDependencies(file); | ||
512 | // Note: The QMAKE_IMAGE_COLLECTION file have all images | ||
513 | // as dependency, so don't add precompiled header then | ||
514 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER") | ||
515 | && file != project->first("QMAKE_IMAGE_COLLECTION")) { | ||
516 | QString header_prefix = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep; | ||
517 | header_prefix += project->first("QMAKE_PRECOMP_PREFIX"); | ||
518 | if(file.endsWith(".c")) { | ||
519 | QString precomp_h = header_prefix + "c"; | ||
520 | if(!ret.contains(precomp_h)) | ||
521 | ret += precomp_h; | ||
522 | } else { | ||
523 | for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) { | ||
524 | if(file.endsWith(*it)) { | ||
525 | QString precomp_h = header_prefix + "c++"; | ||
526 | if(!ret.contains(precomp_h)) | ||
527 | ret += precomp_h; | ||
528 | break; | ||
529 | } | ||
530 | } | ||
531 | } | ||
532 | } | ||
533 | return ret; | ||
534 | } | ||
535 | |||
359 | bool | 536 | bool |
360 | UnixMakefileGenerator::findLibraries() | 537 | UnixMakefileGenerator::findLibraries() |
361 | { | 538 | { |
362 | QPtrList<MakefileDependDir> libdirs; | 539 | QPtrList<MakefileDependDir> libdirs; |
363 | libdirs.setAutoDelete(TRUE); | 540 | libdirs.setAutoDelete(TRUE); |
364 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | 541 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; |
365 | for(int i = 0; !lflags[i].isNull(); i++) { | 542 | for(int i = 0; !lflags[i].isNull(); i++) { |
366 | QStringList &l = project->variables()[lflags[i]]; | 543 | QStringList &l = project->variables()[lflags[i]]; |
367 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 544 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
368 | QString stub, dir, extn, opt = (*it).stripWhiteSpace(); | 545 | QString stub, dir, extn, opt = (*it).stripWhiteSpace(); |
369 | if(opt.startsWith("-")) { | 546 | if(opt.startsWith("-")) { |
370 | if(opt.startsWith("-L")) { | 547 | if(opt.startsWith("-L")) { |
371 | QString r = opt.right(opt.length() - 2), l = r; | 548 | QString r = opt.right(opt.length() - 2), l = r; |
372 | fixEnvVariables(l); | 549 | fixEnvVariables(l); |
373 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 550 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
374 | l.replace("\"",""))); | 551 | l.replace("\"",""))); |
375 | } else if(opt.startsWith("-l")) { | 552 | } else if(opt.startsWith("-l")) { |
376 | stub = opt.mid(2); | 553 | stub = opt.mid(2); |
377 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | 554 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { |
378 | if(opt.length() > 11) { | 555 | if(opt.length() > 11) { |
379 | opt = opt.mid(11); | 556 | opt = opt.mid(11); |
380 | } else { | 557 | } else { |
381 | ++it; | 558 | ++it; |
382 | opt = (*it); | 559 | opt = (*it); |
383 | } | 560 | } |
384 | extn = ""; | 561 | extn = ""; |
385 | dir = "/System/Library/Frameworks/" + opt + ".framework/"; | 562 | dir = "/System/Library/Frameworks/" + opt + ".framework/"; |
386 | stub = opt; | 563 | stub = opt; |
387 | } | 564 | } |
388 | } else { | 565 | } else { |
389 | extn = dir = ""; | 566 | extn = dir = ""; |
390 | stub = opt; | 567 | stub = opt; |
391 | int slsh = opt.findRev(Option::dir_sep); | 568 | int slsh = opt.findRev(Option::dir_sep); |
392 | if(slsh != -1) { | 569 | if(slsh != -1) { |
393 | dir = opt.left(slsh); | 570 | dir = opt.left(slsh); |
394 | stub = opt.mid(slsh+1); | 571 | stub = opt.mid(slsh+1); |
395 | } | 572 | } |
396 | QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$"); | 573 | QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$"); |
397 | if(stub_reg.exactMatch(stub)) { | 574 | if(stub_reg.exactMatch(stub)) { |
398 | stub = stub_reg.cap(1); | 575 | stub = stub_reg.cap(1); |
399 | extn = stub_reg.cap(2); | 576 | extn = stub_reg.cap(2); |
400 | } | 577 | } |
401 | } | 578 | } |
402 | if(!stub.isEmpty()) { | 579 | if(!stub.isEmpty()) { |
403 | const QString modifs[] = { "-mt", QString::null }; | 580 | const QString modifs[] = { "", "-mt", QString::null }; |
404 | for(int modif = 0; !modifs[modif].isNull(); modif++) { | 581 | for(int modif = 0; !modifs[modif].isNull(); modif++) { |
405 | bool found = FALSE; | 582 | bool found = FALSE; |
406 | QStringList extens; | 583 | QStringList extens; |
407 | if(!extn.isNull()) | 584 | if(!extn.isNull()) |
408 | extens << extn; | 585 | extens << extn; |
409 | else | 586 | else |
410 | extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a"; | 587 | extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a"; |
411 | for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) { | 588 | for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) { |
412 | if(dir.isNull()) { | 589 | if(dir.isNull()) { |
413 | QString lib_stub; | 590 | QString lib_stub; |
414 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 591 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
415 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + | 592 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + |
416 | modifs[modif] + "." + (*extit))) { | 593 | modifs[modif] + "." + (*extit))) { |
417 | lib_stub = stub + modifs[modif]; | 594 | lib_stub = stub + modifs[modif]; |
418 | break; | 595 | break; |
419 | } | 596 | } |
420 | } | 597 | } |
421 | if(!lib_stub.isNull()) { | 598 | if(!lib_stub.isNull()) { |
422 | (*it) = "-l" + lib_stub; | 599 | (*it) = "-l" + lib_stub; |
423 | found = TRUE; | 600 | found = TRUE; |
424 | break; | 601 | break; |
425 | } | 602 | } |
426 | } else { | 603 | } else { |
427 | if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) { | 604 | if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) { |
428 | (*it) = "lib" + stub + modifs[modif] + "." + (*extit); | 605 | (*it) = "lib" + stub + modifs[modif] + "." + (*extit); |
429 | found = TRUE; | 606 | found = TRUE; |
430 | break; | 607 | break; |
431 | } | 608 | } |
432 | } | 609 | } |
433 | } | 610 | } |
611 | if(!found && project->isActiveConfig("compile_libtool")) { | ||
612 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | ||
613 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + modifs[modif] + Option::libtool_ext)) { | ||
614 | (*it) = mdd->real_dir + Option::dir_sep + "lib" + stub + modifs[modif] + Option::libtool_ext; | ||
615 | found = TRUE; | ||
616 | break; | ||
617 | } | ||
618 | } | ||
619 | } | ||
434 | if(found) | 620 | if(found) |
435 | break; | 621 | break; |
622 | |||
436 | } | 623 | } |
437 | } | 624 | } |
438 | } | 625 | } |
439 | } | 626 | } |
440 | return FALSE; | 627 | return FALSE; |
441 | } | 628 | } |
442 | 629 | ||
630 | QString linkLib(const QString &file, const QString &libName) { | ||
631 | QString ret; | ||
632 | QRegExp reg("^.*lib(" + libName + "[^./=]*).*$"); | ||
633 | if(reg.exactMatch(file)) | ||
634 | ret = "-l" + reg.cap(1); | ||
635 | return ret; | ||
636 | } | ||
637 | |||
443 | void | 638 | void |
444 | UnixMakefileGenerator::processPrlFiles() | 639 | UnixMakefileGenerator::processPrlFiles() |
445 | { | 640 | { |
446 | QDict<void> processed; | 641 | QDict<void> processed; |
447 | QPtrList<MakefileDependDir> libdirs; | 642 | QPtrList<MakefileDependDir> libdirs; |
448 | libdirs.setAutoDelete(TRUE); | 643 | libdirs.setAutoDelete(TRUE); |
449 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | 644 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; |
450 | for(int i = 0; !lflags[i].isNull(); i++) { | 645 | for(int i = 0; !lflags[i].isNull(); i++) { |
451 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 646 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
452 | QStringList l_out; | 647 | QStringList l_out; |
453 | QStringList &l = project->variables()[lflags[i]]; | 648 | QStringList &l = project->variables()[lflags[i]]; |
454 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 649 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
455 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); | 650 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); |
456 | QString opt = (*it).stripWhiteSpace();; | 651 | QString opt = (*it).stripWhiteSpace(); |
457 | if(opt.startsWith("-")) { | 652 | if(opt.startsWith("-")) { |
458 | if(opt.startsWith("-L")) { | 653 | if(opt.startsWith("-L")) { |
459 | QString r = opt.right(opt.length() - 2), l = r; | 654 | QString r = opt.right(opt.length() - 2), l = r; |
460 | fixEnvVariables(l); | 655 | fixEnvVariables(l); |
461 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 656 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
462 | l.replace("\"",""))); | 657 | l.replace("\"",""))); |
463 | } else if(opt.startsWith("-l") && !processed[opt]) { | 658 | } else if(opt.startsWith("-l") && !processed[opt]) { |
464 | QString lib = opt.right(opt.length() - 2), prl; | 659 | QString lib = opt.right(opt.length() - 2); |
465 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 660 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
466 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext; | 661 | if(!project->isActiveConfig("compile_libtool")) { //give them the .libs.. |
662 | QString la = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::libtool_ext; | ||
663 | if(QFile::exists(la) && QFile::exists(mdd->local_dir + Option::dir_sep + ".libs")) { | ||
664 | l_out.append("-L" + mdd->real_dir + Option::dir_sep + ".libs"); | ||
665 | libdirs.append(new MakefileDependDir(mdd->real_dir + Option::dir_sep + ".libs", | ||
666 | mdd->local_dir + Option::dir_sep + ".libs")); | ||
667 | } | ||
668 | } | ||
669 | |||
670 | QString prl = mdd->local_dir + Option::dir_sep + "lib" + lib; | ||
467 | if(processPrlFile(prl)) { | 671 | if(processPrlFile(prl)) { |
468 | if(prl.startsWith(mdd->local_dir)) | 672 | if(prl.startsWith(mdd->local_dir)) |
469 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); | 673 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); |
470 | QRegExp reg("^.*lib(" + lib + "[^./=]*)\\..*$"); | 674 | opt = linkLib(prl, lib); |
471 | if(reg.exactMatch(prl)) | ||
472 | prl = "-l" + reg.cap(1); | ||
473 | opt = prl; | ||
474 | processed.insert(opt, (void*)1); | 675 | processed.insert(opt, (void*)1); |
475 | ret = TRUE; | 676 | ret = TRUE; |
476 | break; | 677 | break; |
477 | } | 678 | } |
478 | } | 679 | } |
479 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | 680 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { |
480 | if(opt.length() > 11) { | 681 | if(opt.length() > 11) { |
481 | opt = opt.mid(11); | 682 | opt = opt.mid(11); |
482 | } else { | 683 | } else { |
483 | ++it; | 684 | ++it; |
484 | opt = (*it); | 685 | opt = (*it); |
485 | } | 686 | } |
486 | QString prl = "/System/Library/Frameworks/" + opt + | 687 | QString prl = "/System/Library/Frameworks/" + opt + |
487 | ".framework/" + opt + Option::prl_ext; | 688 | ".framework/" + opt; |
488 | if(processPrlFile(prl)) | 689 | if(processPrlFile(prl)) |
489 | ret = TRUE; | 690 | ret = TRUE; |
490 | l_out.append("-framework"); | 691 | l_out.append("-framework"); |
491 | } | 692 | } |
492 | if(!opt.isEmpty()) | 693 | if(!opt.isEmpty()) |
493 | l_out.append(opt); | 694 | l_out.append(opt); |
494 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 695 | l_out = combineSetLFlags(l_out, project->variables()["QMAKE_CURRENT_PRL_LIBS"]); |
495 | } else { | 696 | } else { |
496 | if(!processed[opt] && processPrlFile(opt)) { | 697 | QString lib = opt; |
497 | processed.insert(opt, (void*)1); | 698 | if(!processed[lib] && processPrlFile(lib)) { |
498 | ret = TRUE; | 699 | processed.insert(lib, (void*)1); |
700 | ret = TRUE; | ||
499 | } | 701 | } |
702 | #if 0 | ||
703 | if(ret) | ||
704 | opt = linkLib(lib, ""); | ||
705 | #endif | ||
500 | if(!opt.isEmpty()) | 706 | if(!opt.isEmpty()) |
501 | l_out.append(opt); | 707 | l_out.append(opt); |
502 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 708 | l_out = combineSetLFlags(l_out, project->variables()["QMAKE_CURRENT_PRL_LIBS"]); |
503 | } | 709 | } |
504 | } | 710 | } |
505 | if(ret && l != l_out) | 711 | if(ret && l != l_out) |
506 | l = l_out; | 712 | l = l_out; |
507 | else | 713 | else |
508 | break; | 714 | break; |
509 | } | 715 | } |
510 | } | 716 | } |
511 | } | 717 | } |
512 | 718 | ||
513 | QString | 719 | QString |
514 | UnixMakefileGenerator::defaultInstall(const QString &t) | 720 | UnixMakefileGenerator::defaultInstall(const QString &t) |
515 | { | 721 | { |
516 | if(t != "target" || project->first("TEMPLATE") == "subdirs") | 722 | if(t != "target" || project->first("TEMPLATE") == "subdirs") |
517 | return QString(); | 723 | return QString(); |
518 | 724 | ||
519 | bool resource = FALSE; | 725 | bool resource = FALSE; |
520 | const QString root = "$(INSTALL_ROOT)"; | 726 | const QString root = "$(INSTALL_ROOT)"; |
521 | QStringList &uninst = project->variables()[t + ".uninstall"]; | 727 | QStringList &uninst = project->variables()[t + ".uninstall"]; |
522 | QString ret, destdir=project->first("DESTDIR"); | 728 | QString ret, destdir=project->first("DESTDIR"); |
523 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); | 729 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); |
524 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 730 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
525 | destdir += Option::dir_sep; | 731 | destdir += Option::dir_sep; |
526 | targetdir = fileFixify(targetdir); | 732 | targetdir = fileFixify(targetdir); |
527 | if(targetdir.right(1) != Option::dir_sep) | 733 | if(targetdir.right(1) != Option::dir_sep) |
528 | targetdir += Option::dir_sep; | 734 | targetdir += Option::dir_sep; |
529 | 735 | ||
530 | QStringList links; | 736 | QStringList links; |
531 | QString target="$(TARGET)"; | 737 | QString target="$(TARGET)"; |
532 | if(project->first("TEMPLATE") == "app") { | 738 | if(project->first("TEMPLATE") == "app") { |
533 | target = "$(QMAKE_TARGET)"; | 739 | target = "$(QMAKE_TARGET)"; |
534 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 740 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
535 | destdir += "../../../"; | 741 | destdir += "../../../"; |
536 | target += ".app"; | 742 | target += ".app"; |
537 | resource = TRUE; | 743 | resource = TRUE; |
538 | } | 744 | } |
539 | } else if(project->first("TEMPLATE") == "lib") { | 745 | } else if(project->first("TEMPLATE") == "lib") { |
540 | if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | 746 | if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") && |
747 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | ||
541 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); | 748 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); |
542 | int slsh = dst_prl.findRev('/'); | 749 | int slsh = dst_prl.findRev('/'); |
543 | if(slsh != -1) | 750 | if(slsh != -1) |
544 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); | 751 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); |
545 | dst_prl = root + targetdir + dst_prl; | 752 | dst_prl = root + targetdir + dst_prl; |
546 | ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; | 753 | ret += "-$(INSTALL_FILE) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; |
547 | if(!uninst.isEmpty()) | 754 | if(!uninst.isEmpty()) |
548 | uninst.append("\n\t"); | 755 | uninst.append("\n\t"); |
549 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); | 756 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); |
550 | } | 757 | } |
758 | if(project->isActiveConfig("create_libtool") && !project->isActiveConfig("compile_libtool")) { | ||
759 | QString src_lt = var("QMAKE_ORIG_TARGET"); | ||
760 | int slsh = src_lt.findRev(Option::dir_sep); | ||
761 | if(slsh != -1) | ||
762 | src_lt = src_lt.right(src_lt.length() - slsh); | ||
763 | int dot = src_lt.find('.'); | ||
764 | if(dot != -1) | ||
765 | src_lt = src_lt.left(dot); | ||
766 | src_lt += Option::libtool_ext; | ||
767 | src_lt.prepend("lib"); | ||
768 | QString dst_lt = root + targetdir + src_lt; | ||
769 | if(!project->isEmpty("DESTDIR")) { | ||
770 | src_lt.prepend(var("DESTDIR")); | ||
771 | src_lt = Option::fixPathToLocalOS(fileFixify(src_lt, | ||
772 | QDir::currentDirPath(), Option::output_dir)); | ||
773 | } | ||
774 | if(!ret.isEmpty()) | ||
775 | ret += "\n\t"; | ||
776 | ret += "-$(INSTALL_FILE) \"" + src_lt + "\" \"" + dst_lt + "\""; | ||
777 | if(!uninst.isEmpty()) | ||
778 | uninst.append("\n\t"); | ||
779 | uninst.append("-$(DEL_FILE) \"" + dst_lt + "\""); | ||
780 | } | ||
781 | if(project->isActiveConfig("create_pc")) { | ||
782 | QString src_pc = var("QMAKE_ORIG_TARGET"); | ||
783 | int slsh = src_pc.findRev(Option::dir_sep); | ||
784 | if(slsh != -1) | ||
785 | src_pc = src_pc.right(src_pc.length() - slsh); | ||
786 | int dot = src_pc.find('.'); | ||
787 | if(dot != -1) | ||
788 | src_pc = src_pc.left(dot); | ||
789 | src_pc += ".pc"; | ||
790 | QString d = root + targetdir + "pkgconfig" + Option::dir_sep; | ||
791 | QString dst_pc = d + src_pc; | ||
792 | if(!project->isEmpty("DESTDIR")) { | ||
793 | src_pc.prepend(var("DESTDIR")); | ||
794 | src_pc = Option::fixPathToLocalOS(fileFixify(src_pc, | ||
795 | QDir::currentDirPath(), Option::output_dir)); | ||
796 | } | ||
797 | if(!ret.isEmpty()) | ||
798 | ret += "\n\t"; | ||
799 | ret += mkdir_p_asstring(d) + "\n\t"; | ||
800 | ret += "-$(INSTALL_FILE) \"" + src_pc + "\" \"" + dst_pc + "\""; | ||
801 | if(!uninst.isEmpty()) | ||
802 | uninst.append("\n\t"); | ||
803 | uninst.append("-$(DEL_FILE) \"" + dst_pc + "\""); | ||
804 | } | ||
551 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { | 805 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
552 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { | 806 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { |
553 | if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) { | 807 | if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
554 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; | 808 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; |
555 | } else { | 809 | } else { |
556 | links << "$(TARGET0)"; | 810 | links << "$(TARGET0)"; |
557 | } | 811 | } |
558 | } | 812 | } |
559 | } | 813 | } |
560 | } | 814 | } |
561 | QString src_targ = target; | 815 | |
562 | if(!destdir.isEmpty()) | 816 | if(!resource && project->isActiveConfig("compile_libtool")) { |
563 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | 817 | QString src_targ = target; |
564 | QString dst_targ = root + fileFixify(targetdir + target); | 818 | if(src_targ == "$(TARGET)") |
565 | if(!ret.isEmpty()) | 819 | src_targ = "$(TARGETL)"; |
566 | ret += "\n\t"; | 820 | QString dst_dir = fileFixify(targetdir); |
567 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + | 821 | if(QDir::isRelativePath(dst_dir)) |
568 | src_targ + "\" \"" + dst_targ + "\""; | 822 | dst_dir = Option::fixPathToTargetOS(Option::output_dir + Option::dir_sep + dst_dir); |
569 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) { | 823 | ret = "-$(LIBTOOL) --mode=install cp \"" + src_targ + "\" \"" + root + dst_dir + "\""; |
570 | ret += "\n\t-" + var("QMAKE_STRIP"); | 824 | uninst.append("-$(LIBTOOL) --mode=uninstall \"" + src_targ + "\""); |
571 | if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib") | 825 | } else { |
572 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | 826 | QString src_targ = target; |
827 | if(!destdir.isEmpty()) | ||
828 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | ||
829 | QString dst_targ = root + fileFixify(targetdir + target, | ||
830 | QDir::currentDirPath(), Option::output_dir); | ||
831 | if(!ret.isEmpty()) | ||
832 | ret += "\n\t"; | ||
573 | if(resource) | 833 | if(resource) |
574 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; | 834 | ret += "$(DEL_FILE) -r \"" + dst_targ + "\"" + "\n\t"; |
835 | if(!ret.isEmpty()) | ||
836 | ret += "\n\t"; | ||
837 | ret += QString(resource ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + | ||
838 | src_targ + "\" \"" + dst_targ + "\""; | ||
839 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP") && | ||
840 | (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("staticlib"))) { | ||
841 | ret += "\n\t-" + var("QMAKE_STRIP"); | ||
842 | if(project->first("TEMPLATE") == "lib" && !project->isEmpty("QMAKE_STRIPFLAGS_LIB")) | ||
843 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | ||
844 | else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP")) | ||
845 | ret += " " + var("QMAKE_STRIPFLAGS_APP"); | ||
846 | if(resource) | ||
847 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; | ||
848 | else | ||
849 | ret += " \"" + dst_targ + "\""; | ||
850 | } | ||
851 | if(!uninst.isEmpty()) | ||
852 | uninst.append("\n\t"); | ||
853 | if(resource) | ||
854 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); | ||
575 | else | 855 | else |
576 | ret += " \"" + dst_targ + "\""; | 856 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); |
577 | } | 857 | if(!links.isEmpty()) { |
578 | if(!uninst.isEmpty()) | 858 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { |
579 | uninst.append("\n\t"); | 859 | if(Option::target_mode == Option::TARG_WIN_MODE || |
580 | if(resource) | 860 | Option::target_mode == Option::TARG_MAC9_MODE) { |
581 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); | 861 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || |
582 | else | 862 | Option::target_mode == Option::TARG_MACX_MODE) { |
583 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); | 863 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); |
584 | if(!links.isEmpty()) { | 864 | int lslash = link.findRev(Option::dir_sep); |
585 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { | 865 | if(lslash != -1) |
586 | if(Option::target_mode == Option::TARG_WIN_MODE || | 866 | link = link.right(link.length() - (lslash + 1)); |
587 | Option::target_mode == Option::TARG_MAC9_MODE) { | 867 | QString dst_link = root + targetdir + link; |
588 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || | 868 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; |
589 | Option::target_mode == Option::TARG_MACX_MODE) { | 869 | if(!uninst.isEmpty()) |
590 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); | 870 | uninst.append("\n\t"); |
591 | int lslash = link.findRev(Option::dir_sep); | 871 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); |
592 | if(lslash != -1) | 872 | } |
593 | link = link.right(link.length() - (lslash + 1)); | ||
594 | QString dst_link = root + fileFixify(targetdir + link); | ||
595 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; | ||
596 | if(!uninst.isEmpty()) | ||
597 | uninst.append("\n\t"); | ||
598 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); | ||
599 | } | 873 | } |
600 | } | 874 | } |
601 | } | 875 | } |
602 | return ret; | 876 | return ret; |
603 | } | 877 | } |
604 | |||
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index 3d00214..91ec3b1 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h | |||
@@ -1,72 +1,82 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of UnixMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __UNIXMAKE_H__ | 36 | #ifndef __UNIXMAKE_H__ |
38 | #define __UNIXMAKE_H__ | 37 | #define __UNIXMAKE_H__ |
39 | 38 | ||
40 | #include "makefile.h" | 39 | #include "makefile.h" |
41 | 40 | ||
42 | class UnixMakefileGenerator : public MakefileGenerator | 41 | class UnixMakefileGenerator : public MakefileGenerator |
43 | { | 42 | { |
44 | bool init_flag, include_deps; | 43 | bool init_flag, include_deps; |
45 | bool writeMakefile(QTextStream &); | 44 | bool writeMakefile(QTextStream &); |
46 | QStringList uniqueSetLFlags(const QStringList &list1, QStringList &list2); | 45 | void writeExtraVariables(QTextStream &); |
46 | QString libtoolFileName(); | ||
47 | void writeLibtoolFile(); // for libtool | ||
48 | QString pkgConfigPrefix() const; | ||
49 | QString pkgConfigFileName(); | ||
50 | QString pkgConfigFixPath(QString) const; | ||
51 | void writePkgConfigFile(); // for pkg-config | ||
52 | QStringList combineSetLFlags(const QStringList &list1, const QStringList &list2); | ||
53 | void writePrlFile(QTextStream &); | ||
47 | 54 | ||
48 | public: | 55 | public: |
49 | UnixMakefileGenerator(QMakeProject *p); | 56 | UnixMakefileGenerator(QMakeProject *p); |
50 | ~UnixMakefileGenerator(); | 57 | ~UnixMakefileGenerator(); |
51 | 58 | ||
52 | protected: | 59 | protected: |
60 | virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); } | ||
53 | virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); } | 61 | virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); } |
54 | virtual QString defaultInstall(const QString &); | 62 | virtual QString defaultInstall(const QString &); |
55 | virtual void processPrlVariable(const QString &, const QStringList &); | 63 | virtual void processPrlVariable(const QString &, const QStringList &); |
56 | virtual void processPrlFiles(); | 64 | virtual void processPrlFiles(); |
57 | 65 | ||
58 | virtual bool findLibraries(); | 66 | virtual bool findLibraries(); |
67 | virtual QString findDependency(const QString &); | ||
68 | virtual QStringList &findDependencies(const QString &); | ||
59 | virtual void init(); | 69 | virtual void init(); |
60 | 70 | ||
61 | void writeMakeParts(QTextStream &); | 71 | void writeMakeParts(QTextStream &); |
62 | void writeSubdirs(QTextStream &, bool=TRUE); | 72 | void writeSubdirs(QTextStream &, bool=TRUE); |
63 | 73 | ||
64 | private: | 74 | private: |
65 | void init2(); | 75 | void init2(); |
66 | }; | 76 | }; |
67 | 77 | ||
68 | inline UnixMakefileGenerator::~UnixMakefileGenerator() | 78 | inline UnixMakefileGenerator::~UnixMakefileGenerator() |
69 | { } | 79 | { } |
70 | 80 | ||
71 | 81 | ||
72 | #endif /* __UNIXMAKE_H__ */ | 82 | #endif /* __UNIXMAKE_H__ */ |
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index d8a4a0d..21348a6 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp | |||
@@ -1,1110 +1,1588 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | ||
3 | ** | 2 | ** |
4 | ** Definition of ________ class. | ||
5 | ** | 3 | ** |
6 | ** Created : 970521 | 4 | ** Implementation of UnixMakefileGenerator class. |
7 | ** | 5 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 7 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "unixmake.h" | 36 | #include "unixmake.h" |
39 | #include "option.h" | 37 | #include "option.h" |
38 | #include "meta.h" | ||
40 | #include <qregexp.h> | 39 | #include <qregexp.h> |
41 | #include <qfile.h> | 40 | #include <qfile.h> |
42 | #include <qdir.h> | 41 | #include <qdir.h> |
43 | #include <time.h> | 42 | #include <time.h> |
44 | 43 | ||
44 | QString mkdir_p_asstring(const QString &dir); | ||
45 | 45 | ||
46 | UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE) | 46 | UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE) |
47 | { | 47 | { |
48 | 48 | ||
49 | } | 49 | } |
50 | 50 | ||
51 | void | ||
52 | UnixMakefileGenerator::writePrlFile(QTextStream &t) | ||
53 | { | ||
54 | MakefileGenerator::writePrlFile(t); | ||
55 | // libtool support | ||
56 | if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib") { //write .la | ||
57 | if(project->isActiveConfig("compile_libtool")) | ||
58 | warn_msg(WarnLogic, "create_libtool specified with compile_libtool can lead to conflicting .la\n" | ||
59 | "formats, create_libtool has been disabled\n"); | ||
60 | else | ||
61 | writeLibtoolFile(); | ||
62 | } | ||
63 | // pkg-config support | ||
64 | if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") | ||
65 | writePkgConfigFile(); | ||
66 | } | ||
67 | |||
51 | bool | 68 | bool |
52 | UnixMakefileGenerator::writeMakefile(QTextStream &t) | 69 | UnixMakefileGenerator::writeMakefile(QTextStream &t) |
53 | { | 70 | { |
71 | |||
54 | writeHeader(t); | 72 | writeHeader(t); |
55 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 73 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
56 | t << "all clean:" << "\n\t" | 74 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
75 | { //write the extra unix targets.. | ||
76 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | ||
77 | for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) | ||
78 | t << *it << " "; | ||
79 | } | ||
80 | t << "all clean install distclean mocables uninstall uicables:" << "\n\t" | ||
57 | << "@echo \"Some of the required modules (" | 81 | << "@echo \"Some of the required modules (" |
58 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | 82 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" |
59 | << "@echo \"Skipped.\"" << endl << endl; | 83 | << "@echo \"Skipped.\"" << endl << endl; |
60 | writeMakeQmake(t); | 84 | writeMakeQmake(t); |
61 | return TRUE; | 85 | return TRUE; |
62 | } | 86 | } |
63 | 87 | ||
64 | if (project->variables()["TEMPLATE"].first() == "app" || | 88 | if (project->variables()["TEMPLATE"].first() == "app" || |
65 | project->variables()["TEMPLATE"].first() == "lib") { | 89 | project->variables()["TEMPLATE"].first() == "lib") { |
66 | writeMakeParts(t); | 90 | writeMakeParts(t); |
67 | return MakefileGenerator::writeMakefile(t); | 91 | return MakefileGenerator::writeMakefile(t); |
68 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { | 92 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { |
69 | writeSubdirs(t); | 93 | writeSubdirs(t); |
70 | return TRUE; | 94 | return TRUE; |
71 | } | 95 | } |
72 | return FALSE; | 96 | return FALSE; |
73 | } | 97 | } |
74 | 98 | ||
75 | void | 99 | void |
100 | UnixMakefileGenerator::writeExtraVariables(QTextStream &t) | ||
101 | { | ||
102 | bool first = TRUE; | ||
103 | QMap<QString, QStringList> &vars = project->variables(); | ||
104 | QStringList &exports = project->variables()["QMAKE_EXTRA_UNIX_VARIABLES"]; | ||
105 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) { | ||
106 | for(QStringList::Iterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) { | ||
107 | QRegExp rx((*exp_it), FALSE, TRUE); | ||
108 | if(rx.exactMatch(it.key())) { | ||
109 | if(first) { | ||
110 | t << "\n####### Custom Variables" << endl; | ||
111 | first = FALSE; | ||
112 | } | ||
113 | t << "EXPORT_" << it.key() << " = " << it.data().join(" ") << endl; | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | if(!first) | ||
118 | t << endl; | ||
119 | } | ||
120 | |||
121 | void | ||
76 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) | 122 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) |
77 | { | 123 | { |
78 | QString deps = fileFixify(Option::output.name()), prl; | 124 | QString deps = fileFixify(Option::output.name()), target_deps, prl; |
79 | bool do_incremental = (project->isActiveConfig("incremental") && | 125 | bool do_incremental = (project->isActiveConfig("incremental") && |
80 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && | 126 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && |
81 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || | 127 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || |
82 | !project->isActiveConfig("staticlib"))), | 128 | !project->isActiveConfig("staticlib"))), |
83 | src_incremental=FALSE, moc_incremental=FALSE; | 129 | src_incremental=FALSE, moc_incremental=FALSE; |
84 | 130 | ||
85 | t << "####### Compiler, tools and options" << endl << endl; | 131 | t << "####### Compiler, tools and options" << endl << endl; |
86 | t << "CC = "; | 132 | t << "CC = "; |
87 | if (project->isActiveConfig("thread") && | 133 | if (project->isActiveConfig("thread") && |
88 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) | 134 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) |
89 | t << var("QMAKE_CC_THREAD") << endl; | 135 | t << var("QMAKE_CC_THREAD") << endl; |
90 | else | 136 | else |
91 | t << var("QMAKE_CC") << endl; | 137 | t << var("QMAKE_CC") << endl; |
92 | 138 | ||
93 | t << "CXX = "; | 139 | t << "CXX = "; |
94 | if (project->isActiveConfig("thread") && | 140 | if (project->isActiveConfig("thread") && |
95 | ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) | 141 | ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) |
96 | t << var("QMAKE_CXX_THREAD") << endl; | 142 | t << var("QMAKE_CXX_THREAD") << endl; |
97 | else | 143 | else |
98 | t << var("QMAKE_CXX") << endl; | 144 | t << var("QMAKE_CXX") << endl; |
99 | 145 | ||
100 | t << "LEX = " << var("QMAKE_LEX") << endl; | 146 | t << "LEX = " << var("QMAKE_LEX") << endl; |
101 | t << "YACC = " << var("QMAKE_YACC") << endl; | 147 | t << "YACC = " << var("QMAKE_YACC") << endl; |
102 | t << "CFLAGS = " << var("QMAKE_CFLAGS") << " " | 148 | t << "CFLAGS = " << var("QMAKE_CFLAGS") << " " |
103 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 149 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
104 | << varGlue("DEFINES","-D"," -D","") << endl; | 150 | << varGlue("DEFINES","-D"," -D","") << endl; |
105 | t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " " | 151 | t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " " |
106 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 152 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
107 | << varGlue("DEFINES","-D"," -D","") << endl; | 153 | << varGlue("DEFINES","-D"," -D","") << endl; |
108 | t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; | 154 | t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; |
109 | t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; | 155 | t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; |
110 | t << "INCPATH = " << "-I" << specdir(); | 156 | t << "INCPATH = " << "-I" << specdir(); |
111 | if(!project->isActiveConfig("no_include_pwd")) { | 157 | if(!project->isActiveConfig("no_include_pwd")) { |
112 | QString pwd = fileFixify(QDir::currentDirPath()); | 158 | QString pwd = fileFixify(QDir::currentDirPath()); |
113 | if(pwd.isEmpty()) | 159 | if(pwd.isEmpty()) |
114 | pwd = "."; | 160 | pwd = "."; |
115 | t << " -I" << pwd; | 161 | t << " -I" << pwd; |
116 | } | 162 | } |
117 | t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl; | 163 | t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl; |
118 | 164 | ||
119 | if(!project->isActiveConfig("staticlib")) { | 165 | if(!project->isActiveConfig("staticlib")) { |
120 | t << "LINK = "; | 166 | t << "LINK = "; |
121 | if (project->isActiveConfig("thread") && | 167 | if (project->isActiveConfig("thread") && |
122 | ! project->variables()["QMAKE_LINK_THREAD"].isEmpty()) | 168 | ! project->variables()["QMAKE_LINK_THREAD"].isEmpty()) |
123 | t << var("QMAKE_LINK_THREAD") << endl; | 169 | t << var("QMAKE_LINK_THREAD") << endl; |
124 | else | 170 | else |
125 | t << var("QMAKE_LINK") << endl; | 171 | t << var("QMAKE_LINK") << endl; |
126 | 172 | ||
127 | t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; | 173 | t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; |
128 | t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; | 174 | t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; |
129 | } | 175 | } |
130 | 176 | ||
131 | t << "AR = " << var("QMAKE_AR") << endl; | 177 | t << "AR = " << var("QMAKE_AR") << endl; |
132 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; | 178 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; |
133 | t << "MOC = " << var("QMAKE_MOC") << endl; | 179 | t << "MOC = " << var("QMAKE_MOC") << endl; |
134 | t << "UIC = "<< var("QMAKE_UIC") << endl; | 180 | t << "UIC = "<< var("QMAKE_UIC") << endl; |
135 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; | 181 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
136 | t << "TAR = "<< var("QMAKE_TAR") << endl; | 182 | t << "TAR = "<< var("QMAKE_TAR") << endl; |
137 | t << "GZIP = " << var("QMAKE_GZIP") << endl; | 183 | t << "GZIP = " << var("QMAKE_GZIP") << endl; |
184 | if(project->isActiveConfig("compile_libtool")) | ||
185 | t << "LIBTOOL= " << var("QMAKE_LIBTOOL") << endl; | ||
138 | t << "COPY = " << var("QMAKE_COPY") << endl; | 186 | t << "COPY = " << var("QMAKE_COPY") << endl; |
139 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; | 187 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; |
140 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; | 188 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; |
189 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
190 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
191 | |||
141 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 192 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
142 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; | 193 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; |
143 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; | 194 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
144 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 195 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
145 | t << "PRO = " << fileFixify(project->projectFile() )<< endl; | 196 | t << "PRO = " << fileFixify(project->projectFile() )<< endl; |
146 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; | 197 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
147 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; | 198 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; |
148 | t << endl; | 199 | t << endl; |
149 | 200 | ||
150 | t << "####### Output directory" << endl << endl; | 201 | t << "####### Output directory" << endl << endl; |
151 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) | 202 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) |
152 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; | 203 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; |
153 | else | 204 | else |
154 | t << "OBJECTS_DIR = ./" << endl; | 205 | t << "OBJECTS_DIR = ./" << endl; |
155 | t << endl; | 206 | t << endl; |
156 | 207 | ||
157 | /* files */ | 208 | /* files */ |
158 | t << "####### Files" << endl << endl; | 209 | t << "####### Files" << endl << endl; |
159 | t << "HEADERS = " << varList("HEADERS") << endl; | 210 | t << "HEADERS = " << varList("HEADERS") << endl; |
160 | t << "SOURCES = " << varList("SOURCES") << endl; | 211 | t << "SOURCES = " << varList("SOURCES") << endl; |
161 | if(do_incremental) { | 212 | if(do_incremental) { |
162 | QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; | 213 | QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; |
163 | t << "OBJECTS = "; | 214 | t << "OBJECTS = "; |
164 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { | 215 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { |
165 | bool increment = FALSE; | 216 | bool increment = FALSE; |
166 | for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { | 217 | for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { |
167 | if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { | 218 | if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { |
168 | increment = TRUE; | 219 | increment = TRUE; |
169 | incrs_out.append((*objit)); | 220 | incrs_out.append((*objit)); |
170 | break; | 221 | break; |
171 | } | 222 | } |
172 | } | 223 | } |
173 | if(!increment) | 224 | if(!increment) |
174 | t << "\\\n\t\t" << (*objit); | 225 | t << "\\\n\t\t" << (*objit); |
175 | } | 226 | } |
176 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! | 227 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! |
177 | t << incrs_out.join(" \\\n\t\t") << endl; | 228 | t << incrs_out.join(" \\\n\t\t") << endl; |
178 | } else if(!incrs_out.count()) { | 229 | } else if(!incrs_out.count()) { |
179 | t << endl; | 230 | t << endl; |
180 | } else { | 231 | } else { |
181 | src_incremental = TRUE; | 232 | src_incremental = TRUE; |
182 | t << endl; | 233 | t << endl; |
183 | t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl; | 234 | t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl; |
184 | } | 235 | } |
185 | } else { | 236 | } else { |
186 | t << "OBJECTS = " << varList("OBJECTS") << endl; | 237 | t << "OBJECTS = " << varList("OBJECTS") << endl; |
187 | } | 238 | } |
188 | t << "FORMS = " << varList("FORMS") << endl; | 239 | t << "FORMS = " << varList("FORMS") << endl; |
189 | t << "UICDECLS = " << varList("UICDECLS") << endl; | 240 | t << "UICDECLS = " << varList("UICDECLS") << endl; |
190 | t << "UICIMPLS = " << varList("UICIMPLS") << endl; | 241 | t << "UICIMPLS = " << varList("UICIMPLS") << endl; |
191 | QString srcMoc = varList("SRCMOC"), objMoc = varList("OBJMOC"); | 242 | QString srcMoc = varList("SRCMOC"), objMoc = varList("OBJMOC"); |
192 | t << "SRCMOC = " << srcMoc << endl; | 243 | t << "SRCMOC = " << srcMoc << endl; |
193 | if(do_incremental) { | 244 | if(do_incremental) { |
194 | QStringList &objs = project->variables()["OBJMOC"], | 245 | QStringList &objs = project->variables()["OBJMOC"], |
195 | &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; | 246 | &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; |
196 | t << "OBJMOC = "; | 247 | t << "OBJMOC = "; |
197 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { | 248 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { |
198 | bool increment = FALSE; | 249 | bool increment = FALSE; |
199 | for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { | 250 | for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { |
200 | if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { | 251 | if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { |
201 | increment = TRUE; | 252 | increment = TRUE; |
202 | incrs_out.append((*objit)); | 253 | incrs_out.append((*objit)); |
203 | break; | 254 | break; |
204 | } | 255 | } |
205 | } | 256 | } |
206 | if(!increment) | 257 | if(!increment) |
207 | t << "\\\n\t\t" << (*objit); | 258 | t << "\\\n\t\t" << (*objit); |
208 | } | 259 | } |
209 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! | 260 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! |
210 | t << incrs_out.join(" \\\n\t\t") << endl; | 261 | t << incrs_out.join(" \\\n\t\t") << endl; |
211 | } else if(!incrs_out.count()) { | 262 | } else if(!incrs_out.count()) { |
212 | t << endl; | 263 | t << endl; |
213 | } else { | 264 | } else { |
214 | moc_incremental = TRUE; | 265 | moc_incremental = TRUE; |
215 | t << endl; | 266 | t << endl; |
216 | t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; | 267 | t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; |
217 | } | 268 | } |
218 | } else { | 269 | } else { |
219 | t << "OBJMOC = " << objMoc << endl; | 270 | t << "OBJMOC = " << objMoc << endl; |
220 | } | 271 | } |
221 | if(do_incremental && !moc_incremental && !src_incremental) | 272 | if(do_incremental && !moc_incremental && !src_incremental) |
222 | do_incremental = FALSE; | 273 | do_incremental = FALSE; |
274 | if(!project->isEmpty("QMAKE_EXTRA_UNIX_COMPILERS")) { | ||
275 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | ||
276 | target_deps += " $(OBJCOMP)"; | ||
277 | |||
278 | QStringList &comps = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
279 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { | ||
280 | QStringList &vars = project->variables()[(*compit) + ".variables"]; | ||
281 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { | ||
282 | QStringList vals = project->variables()[(*varit)]; | ||
283 | if(!vals.isEmpty()) | ||
284 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; | ||
285 | } | ||
286 | } | ||
287 | } | ||
223 | t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl; | 288 | t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl; |
224 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; | 289 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; |
225 | t << "DESTDIR = " << var("DESTDIR") << endl; | 290 | t << "DESTDIR = " << var("DESTDIR") << endl; |
291 | if(project->isActiveConfig("compile_libtool")) | ||
292 | t << "TARGETL= " << var("TARGET_la") << endl; | ||
226 | t << "TARGET = " << var("TARGET") << endl; | 293 | t << "TARGET = " << var("TARGET") << endl; |
227 | if(project->isActiveConfig("plugin") ) { | 294 | if(project->isActiveConfig("plugin") ) { |
228 | t << "TARGETD = " << var("TARGET") << endl; | 295 | t << "TARGETD = " << var("TARGET") << endl; |
229 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 296 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
230 | t << "TARGETA= " << var("TARGETA") << endl; | 297 | t << "TARGETA= " << var("TARGETA") << endl; |
231 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) { | 298 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) { |
232 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; | 299 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; |
233 | t << "TARGET0= " << var("TARGET_") << endl; | 300 | t << "TARGET0= " << var("TARGET_") << endl; |
234 | t << "TARGET1= " << var("TARGET_x") << endl; | 301 | t << "TARGET1= " << var("TARGET_x") << endl; |
235 | t << "TARGET2= " << var("TARGET_x.y") << endl; | 302 | t << "TARGET2= " << var("TARGET_x.y") << endl; |
236 | } else { | 303 | } else { |
237 | t << "TARGETD= " << var("TARGET_x") << endl; | 304 | t << "TARGETD= " << var("TARGET_x") << endl; |
238 | t << "TARGET0= " << var("TARGET_") << endl; | 305 | t << "TARGET0= " << var("TARGET_") << endl; |
239 | } | 306 | } |
240 | } | 307 | } |
308 | writeExtraVariables(t); | ||
241 | t << endl; | 309 | t << endl; |
242 | 310 | ||
243 | // blasted incldues | 311 | // blasted includes |
244 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; | 312 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; |
245 | QStringList::Iterator it; | 313 | QStringList::Iterator it; |
246 | for( it = qeui.begin(); it != qeui.end(); ++it) | 314 | for( it = qeui.begin(); it != qeui.end(); ++it) |
247 | t << "include " << (*it) << endl; | 315 | t << "include " << (*it) << endl; |
248 | 316 | ||
249 | /* rules */ | 317 | /* rules */ |
250 | t << "first: all" << endl; | 318 | t << "first: all" << endl; |
251 | t << "####### Implicit rules" << endl << endl; | 319 | t << "####### Implicit rules" << endl << endl; |
252 | t << ".SUFFIXES: .c"; | 320 | t << ".SUFFIXES: .c " << Option::obj_ext; |
253 | QStringList::Iterator cppit; | 321 | QStringList::Iterator cppit; |
254 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 322 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
255 | t << " " << (*cppit); | 323 | t << " " << (*cppit); |
256 | t << endl << endl; | 324 | t << endl << endl; |
257 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 325 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
258 | t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 326 | t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
259 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | 327 | t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
260 | 328 | ||
261 | if(include_deps) { | 329 | if(include_deps) { |
262 | QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; | 330 | QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; |
263 | cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); | 331 | cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); |
264 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 332 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
265 | cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; | 333 | cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; |
266 | cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); | 334 | cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); |
267 | QString odir; | 335 | QString odir; |
268 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) | 336 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) |
269 | odir = project->first("OBJECTS_DIR"); | 337 | odir = project->first("OBJECTS_DIR"); |
270 | t << "###### Dependencies" << endl << endl; | 338 | t << "###### Dependencies" << endl << endl; |
271 | t << odir << ".deps/%.d: %.cpp\n\t" | 339 | t << odir << ".deps/%.d: %.cpp\n\t" |
272 | << "@echo Creating depend for $<" << "\n\t" | 340 | << "@echo Creating depend for $<" << "\n\t" |
273 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" | 341 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" |
274 | << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; | 342 | << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; |
275 | 343 | ||
276 | t << odir << ".deps/%.d: %.c\n\t" | 344 | t << odir << ".deps/%.d: %.c\n\t" |
277 | << "@echo Creating depend for $<" << "\n\t" | 345 | << "@echo Creating depend for $<" << "\n\t" |
278 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" | 346 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" |
279 | << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; | 347 | << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; |
280 | 348 | ||
281 | |||
282 | QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; | 349 | QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; |
283 | for(int x = 0; !src[x].isNull(); x++) { | 350 | for(int x = 0; !src[x].isNull(); x++) { |
284 | QStringList &l = project->variables()[src[x]]; | 351 | QStringList &l = project->variables()[src[x]]; |
285 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 352 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
286 | if(!(*it).isEmpty()) { | 353 | if(!(*it).isEmpty()) { |
287 | QString d_file; | 354 | QString d_file; |
288 | if((*it).endsWith(".c")) { | 355 | if((*it).endsWith(".c")) { |
289 | d_file = (*it).left((*it).length() - 2); | 356 | d_file = (*it).left((*it).length() - 2); |
290 | } else { | 357 | } else { |
291 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 358 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
292 | cppit != Option::cpp_ext.end(); ++cppit) { | 359 | cppit != Option::cpp_ext.end(); ++cppit) { |
293 | if((*it).endsWith((*cppit))) { | 360 | if((*it).endsWith((*cppit))) { |
294 | d_file = (*it).left((*it).length() - (*cppit).length()); | 361 | d_file = (*it).left((*it).length() - (*cppit).length()); |
295 | break; | 362 | break; |
296 | } | 363 | } |
297 | } | 364 | } |
298 | } | 365 | } |
299 | if(!d_file.isEmpty()) { | 366 | if(!d_file.isEmpty()) { |
300 | d_file = odir + ".deps/" + d_file + ".d"; | 367 | d_file = odir + ".deps/" + d_file + ".d"; |
301 | QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$")); | 368 | QStringList deps = findDependencies((*it)).grep(QRegExp(Option::cpp_moc_ext + "$")); |
302 | if(!deps.isEmpty()) | 369 | if(!deps.isEmpty()) |
303 | t << d_file << ": " << deps.join(" ") << endl; | 370 | t << d_file << ": " << deps.join(" ") << endl; |
304 | t << "-include " << d_file << endl; | 371 | t << var("QMAKE_CFLAGS_USE_PRECOMPILE") << " " << d_file << endl; |
305 | } | 372 | } |
306 | } | 373 | } |
307 | } | 374 | } |
308 | } | 375 | } |
309 | } | 376 | } |
310 | 377 | ||
311 | t << "####### Build rules" << endl << endl; | 378 | t << "####### Build rules" << endl << endl; |
312 | if(!project->variables()["SUBLIBS"].isEmpty()) { | 379 | if(!project->variables()["SUBLIBS"].isEmpty()) { |
313 | QString libdir = "tmp/"; | 380 | QString libdir = "tmp/"; |
314 | if(!project->isEmpty("SUBLIBS_DIR")) | 381 | if(!project->isEmpty("SUBLIBS_DIR")) |
315 | libdir = project->first("SUBLIBS_DIR"); | 382 | libdir = project->first("SUBLIBS_DIR"); |
316 | t << "SUBLIBS= "; | 383 | t << "SUBLIBS= "; |
317 | QStringList &l = project->variables()["SUBLIBS"]; | 384 | QStringList &l = project->variables()["SUBLIBS"]; |
318 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) | 385 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) |
319 | t << libdir << "lib" << (*it) << ".a "; | 386 | t << libdir << "lib" << (*it) << ".a "; |
320 | t << endl << endl; | 387 | t << endl << endl; |
321 | } | 388 | } |
322 | if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { | 389 | if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { |
323 | QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; | 390 | QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; |
324 | QStringList::Iterator it; | 391 | QStringList::Iterator it; |
325 | for(it = l.begin(); it != l.end(); ++it) { | 392 | for(it = l.begin(); it != l.end(); ++it) { |
326 | QMakeProject proj; | 393 | QMakeMetaInfo libinfo; |
327 | if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) { | 394 | if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) { |
328 | QString dir; | 395 | QString dir; |
329 | int slsh = (*it).findRev(Option::dir_sep); | 396 | int slsh = (*it).findRev(Option::dir_sep); |
330 | if(slsh != -1) | 397 | if(slsh != -1) |
331 | dir = (*it).left(slsh + 1); | 398 | dir = (*it).left(slsh + 1); |
332 | QString targ = dir + proj.first("QMAKE_PRL_TARGET"); | 399 | QString targ = dir + libinfo.first("QMAKE_PRL_TARGET"); |
333 | deps += " " + targ; | 400 | deps += " " + targ; |
334 | t << targ << ":" << "\n\t" | 401 | t << targ << ":" << "\n\t" |
335 | << "@echo \"Creating '" << targ << "'\"" << "\n\t" | 402 | << "@echo \"Creating '" << targ << "'\"" << "\n\t" |
336 | << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";" | 403 | << "(cd " << libinfo.first("QMAKE_PRL_BUILD_DIR") << ";" |
337 | << "$(MAKE) )" << endl; | 404 | << "$(MAKE) )" << endl; |
338 | } | 405 | } |
339 | } | 406 | } |
340 | } | 407 | } |
341 | if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 408 | if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
342 | QString destdir = project->first("DESTDIR"); | 409 | QString destdir = project->first("DESTDIR"); |
343 | if(do_incremental) { | 410 | if(do_incremental) { |
344 | //incremental target | 411 | //incremental target |
345 | QString incr_target = var("TARGET") + "_incremental"; | 412 | QString incr_target = var("TARGET") + "_incremental"; |
346 | if(incr_target.find(Option::dir_sep) != -1) | 413 | if(incr_target.find(Option::dir_sep) != -1) |
347 | incr_target = incr_target.right(incr_target.length() - | 414 | incr_target = incr_target.right(incr_target.length() - |
348 | (incr_target.findRev(Option::dir_sep) + 1)); | 415 | (incr_target.findRev(Option::dir_sep) + 1)); |
349 | QString incr_deps, incr_objs; | 416 | QString incr_deps, incr_objs; |
350 | if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { | 417 | if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { |
351 | QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; | 418 | QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; |
352 | //actual target | 419 | //actual target |
353 | t << incr_target_dir << ": $(OBJECTS)" << "\n\t" | 420 | t << incr_target_dir << ": $(OBJECTS)" << "\n\t" |
354 | << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl; | 421 | << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl; |
355 | //communicated below | 422 | //communicated below |
356 | deps.prepend(incr_target_dir + " "); | 423 | deps.prepend(incr_target_dir + " "); |
357 | incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)"; | 424 | incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)"; |
358 | if(!incr_objs.isEmpty()) | 425 | if(!incr_objs.isEmpty()) |
359 | incr_objs += " "; | 426 | incr_objs += " "; |
360 | incr_objs += incr_target_dir; | 427 | incr_objs += incr_target_dir; |
361 | } else { | 428 | } else { |
362 | //actual target | 429 | //actual target |
363 | QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + | 430 | QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + |
364 | project->variables()["QMAKE_EXTENSION_SHLIB"].first(); | 431 | project->variables()["QMAKE_EXTENSION_SHLIB"].first(); |
365 | QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; | 432 | QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; |
366 | if(project->isActiveConfig("debug")) | 433 | if(project->isActiveConfig("debug")) |
367 | incr_lflags += var("QMAKE_LFLAGS_DEBUG"); | 434 | incr_lflags += var("QMAKE_LFLAGS_DEBUG"); |
368 | else | 435 | else |
369 | incr_lflags += var("QMAKE_LFLAGS_RELEASE"); | 436 | incr_lflags += var("QMAKE_LFLAGS_RELEASE"); |
370 | t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; | 437 | t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; |
371 | if(!destdir.isEmpty()) | 438 | if(!destdir.isEmpty()) |
372 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 439 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
373 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << | 440 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << |
374 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; | 441 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; |
375 | //communicated below | 442 | //communicated below |
376 | if(!destdir.isEmpty()) { | 443 | if(!destdir.isEmpty()) { |
377 | if(!incr_objs.isEmpty()) | 444 | if(!incr_objs.isEmpty()) |
378 | incr_objs += " "; | 445 | incr_objs += " "; |
379 | incr_objs += "-L" + destdir; | 446 | incr_objs += "-L" + destdir; |
380 | } else { | 447 | } else { |
381 | if(!incr_objs.isEmpty()) | 448 | if(!incr_objs.isEmpty()) |
382 | incr_objs += " "; | 449 | incr_objs += " "; |
383 | incr_objs += "-L" + QDir::currentDirPath(); | 450 | incr_objs += "-L" + QDir::currentDirPath(); |
384 | } | 451 | } |
385 | if(!incr_objs.isEmpty()) | 452 | if(!incr_objs.isEmpty()) |
386 | incr_objs += " "; | 453 | incr_objs += " "; |
387 | incr_objs += " -l" + incr_target; | 454 | incr_objs += " -l" + incr_target; |
388 | deps.prepend(incr_target_dir + " "); | 455 | deps.prepend(incr_target_dir + " "); |
389 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 456 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
390 | } | 457 | } |
391 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" | 458 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" |
392 | << endl << endl; | 459 | << endl << endl; |
393 | 460 | ||
394 | //real target | 461 | //real target |
395 | t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps | 462 | t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps << " " << target_deps |
396 | << " " << var("POST_TARGETDEPS") << "\n\t"; | 463 | << " " << var("POST_TARGETDEPS") << "\n\t"; |
397 | if(!destdir.isEmpty()) | 464 | if(!destdir.isEmpty()) |
398 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 465 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
399 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 466 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
400 | t << var("QMAKE_PRE_LINK") << "\n\t"; | 467 | t << var("QMAKE_PRE_LINK") << "\n\t"; |
401 | t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; | 468 | t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; |
402 | if(!project->isEmpty("QMAKE_POST_LINK")) | 469 | if(!project->isEmpty("QMAKE_POST_LINK")) |
403 | t << "\n\t" << var("QMAKE_POST_LINK"); | 470 | t << "\n\t" << var("QMAKE_POST_LINK"); |
404 | t << endl << endl; | 471 | t << endl << endl; |
405 | } else { | 472 | } else { |
406 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" | 473 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" |
407 | << endl << endl; | 474 | << endl << endl; |
408 | 475 | ||
409 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 476 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
410 | << var("POST_TARGETDEPS") << "\n\t"; | 477 | << target_deps << " " << var("POST_TARGETDEPS") << "\n\t"; |
411 | if(!destdir.isEmpty()) | 478 | if(!destdir.isEmpty()) |
412 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 479 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
413 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 480 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
414 | t << var("QMAKE_PRE_LINK") << "\n\t"; | 481 | t << var("QMAKE_PRE_LINK") << "\n\t"; |
415 | t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; | 482 | t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)"; |
416 | if(!project->isEmpty("QMAKE_POST_LINK")) | 483 | if(!project->isEmpty("QMAKE_POST_LINK")) |
417 | t << "\n\t" << var("QMAKE_POST_LINK"); | 484 | t << "\n\t" << var("QMAKE_POST_LINK"); |
418 | t << endl << endl; | 485 | t << endl << endl; |
419 | } | 486 | } |
420 | } else if(!project->isActiveConfig("staticlib")) { | 487 | } else if(!project->isActiveConfig("staticlib")) { |
421 | QString destdir = project->first("DESTDIR"), incr_deps; | 488 | QString destdir = project->first("DESTDIR"), incr_deps; |
422 | if(do_incremental) { | 489 | if(do_incremental) { |
423 | QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); | 490 | QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); |
424 | QString incr_target = var("QMAKE_ORIG_TARGET").replace( | 491 | QString incr_target = var("QMAKE_ORIG_TARGET").replace( |
425 | QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; | 492 | QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; |
426 | if(incr_target.find(Option::dir_sep) != -1) | 493 | if(incr_target.find(Option::dir_sep) != -1) |
427 | incr_target = incr_target.right(incr_target.length() - | 494 | incr_target = incr_target.right(incr_target.length() - |
428 | (incr_target.findRev(Option::dir_sep) + 1)); | 495 | (incr_target.findRev(Option::dir_sep) + 1)); |
429 | 496 | ||
430 | if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { | 497 | if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { |
431 | QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; | 498 | QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; |
432 | //actual target | 499 | //actual target |
433 | const QString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 500 | const QString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
434 | t << incr_target_dir << ": " << link_deps << "\n\t" | 501 | t << incr_target_dir << ": " << link_deps << "\n\t" |
435 | << "ld -r -o " << incr_target_dir << " " << link_deps << endl; | 502 | << "ld -r -o " << incr_target_dir << " " << link_deps << endl; |
436 | //communicated below | 503 | //communicated below |
437 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; | 504 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; |
438 | cmd.first().replace("$(OBJECTS) $(OBJMOC)", | 505 | cmd.first().replace("$(OBJECTS) $(OBJMOC)", |
439 | "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick | 506 | "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick |
440 | cmd.append(incr_target_dir); | 507 | cmd.append(incr_target_dir); |
441 | deps.prepend(incr_target_dir + " "); | 508 | deps.prepend(incr_target_dir + " "); |
442 | incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 509 | incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
443 | } else { | 510 | } else { |
444 | //actual target | 511 | //actual target |
445 | QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext; | 512 | QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext; |
446 | QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; | 513 | QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; |
447 | if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL")) | 514 | if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL")) |
448 | incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " "; | 515 | incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " "; |
449 | if(project->isActiveConfig("debug")) | 516 | if(project->isActiveConfig("debug")) |
450 | incr_lflags += var("QMAKE_LFLAGS_DEBUG"); | 517 | incr_lflags += var("QMAKE_LFLAGS_DEBUG"); |
451 | else | 518 | else |
452 | incr_lflags += var("QMAKE_LFLAGS_RELEASE"); | 519 | incr_lflags += var("QMAKE_LFLAGS_RELEASE"); |
453 | t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; | 520 | t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; |
454 | if(!destdir.isEmpty()) | 521 | if(!destdir.isEmpty()) |
455 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 522 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
456 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << | 523 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << |
457 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; | 524 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; |
458 | //communicated below | 525 | //communicated below |
459 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; | 526 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; |
460 | if(!destdir.isEmpty()) | 527 | if(!destdir.isEmpty()) |
461 | cmd.append(" -L" + destdir); | 528 | cmd.append(" -L" + destdir); |
462 | cmd.append(" -l" + incr_target); | 529 | cmd.append(" -l" + incr_target); |
463 | deps.prepend(incr_target_dir + " "); | 530 | deps.prepend(incr_target_dir + " "); |
464 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 531 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
465 | } | 532 | } |
466 | 533 | ||
467 | t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") | 534 | t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") |
468 | << " " << var("DESTDIR_TARGET") << endl << endl; | 535 | << " " << var("DESTDIR_TARGET") << endl << endl; |
469 | 536 | ||
470 | //real target | 537 | //real target |
471 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " | 538 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " |
472 | << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS"); | 539 | << incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS"); |
473 | } else { | 540 | } else { |
474 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << | 541 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << |
475 | var("DESTDIR_TARGET") << endl << endl; | 542 | var("DESTDIR_TARGET") << endl << endl; |
476 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") | 543 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") |
477 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS"); | 544 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) " << target_deps |
545 | << " " << var("POST_TARGETDEPS"); | ||
478 | } | 546 | } |
479 | if(!destdir.isEmpty()) | 547 | if(!destdir.isEmpty()) |
480 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; | 548 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; |
481 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 549 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
482 | t << "\n\t" << var("QMAKE_PRE_LINK"); | 550 | t << "\n\t" << var("QMAKE_PRE_LINK"); |
483 | 551 | ||
484 | if(project->isActiveConfig("plugin")) { | 552 | if(project->isActiveConfig("compile_libtool")) { |
553 | t << "\n\t" | ||
554 | << var("QMAKE_LINK_SHLIB_CMD"); | ||
555 | } else if(project->isActiveConfig("plugin")) { | ||
485 | t << "\n\t" | 556 | t << "\n\t" |
486 | << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 557 | << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
487 | << var("QMAKE_LINK_SHLIB_CMD"); | 558 | << var("QMAKE_LINK_SHLIB_CMD"); |
488 | if(!destdir.isEmpty()) | 559 | if(!destdir.isEmpty()) |
489 | t << "\n\t" | 560 | t << "\n\t" |
490 | << "-$(MOVE) $(TARGET) " << var("DESTDIR"); | 561 | << "-$(MOVE) $(TARGET) " << var("DESTDIR"); |
491 | if(!project->isEmpty("QMAKE_POST_LINK")) | 562 | if(!project->isEmpty("QMAKE_POST_LINK")) |
492 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; | 563 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; |
493 | t << endl << endl; | 564 | t << endl << endl; |
494 | } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { | 565 | } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { |
495 | t << "\n\t" | 566 | t << "\n\t" |
496 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" | 567 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" |
497 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | 568 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; |
498 | t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" | 569 | t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" |
499 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" | 570 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" |
500 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); | 571 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); |
501 | if(!destdir.isEmpty()) | 572 | if(!destdir.isEmpty()) |
502 | t << "\n\t" | 573 | t << "\n\t" |
503 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | 574 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" |
504 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | 575 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" |
505 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" | 576 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" |
506 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" | 577 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" |
507 | << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); | 578 | << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); |
508 | if(!project->isEmpty("QMAKE_POST_LINK")) | 579 | if(!project->isEmpty("QMAKE_POST_LINK")) |
509 | t << "\n\t" << var("QMAKE_POST_LINK"); | 580 | t << "\n\t" << var("QMAKE_POST_LINK"); |
510 | t << endl << endl; | 581 | t << endl << endl; |
511 | } else { | 582 | } else { |
512 | t << "\n\t" | 583 | t << "\n\t" |
513 | << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" | 584 | << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" |
514 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | 585 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; |
515 | t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); | 586 | t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); |
516 | if(!destdir.isEmpty()) | 587 | if(!destdir.isEmpty()) |
517 | t << "\n\t" | 588 | t << "\n\t" |
518 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | 589 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" |
519 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | 590 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" |
520 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); | 591 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); |
521 | if(!project->isEmpty("QMAKE_POST_LINK")) | 592 | if(!project->isEmpty("QMAKE_POST_LINK")) |
522 | t << "\n\t" << var("QMAKE_POST_LINK"); | 593 | t << "\n\t" << var("QMAKE_POST_LINK"); |
523 | t << endl << endl; | 594 | t << endl << endl; |
524 | } | 595 | } |
525 | t << endl << endl; | 596 | t << endl << endl; |
526 | 597 | ||
527 | if (! project->isActiveConfig("plugin")) { | 598 | if (! project->isActiveConfig("plugin")) { |
528 | t << "staticlib: $(TARGETA)" << endl << endl; | 599 | t << "staticlib: $(TARGETA)" << endl << endl; |
529 | t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 600 | t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)"; |
530 | if(do_incremental) | 601 | if(do_incremental) |
531 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 602 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
532 | t << var("POST_TARGETDEPS") << "\n\t" | 603 | t << var("POST_TARGETDEPS") << "\n\t" |
533 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" | 604 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" |
534 | << var("QMAKE_AR_CMD"); | 605 | << var("QMAKE_AR_CMD"); |
535 | if(do_incremental) | 606 | if(do_incremental) |
536 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 607 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
537 | if(!project->isEmpty("QMAKE_RANLIB")) | 608 | if(!project->isEmpty("QMAKE_RANLIB")) |
538 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; | 609 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; |
539 | t << endl << endl; | 610 | t << endl << endl; |
540 | } | 611 | } |
541 | } else { | 612 | } else { |
542 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " | 613 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " |
543 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" | 614 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" |
544 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; | 615 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; |
545 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { | 616 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { |
546 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") | 617 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
547 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t"; | 618 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) " << var("POST_TARGETDEPS") << "\n\t"; |
548 | if(!project->isEmpty("DESTDIR")) { | 619 | if(!project->isEmpty("DESTDIR")) { |
549 | QString destdir = project->first("DESTDIR"); | 620 | QString destdir = project->first("DESTDIR"); |
550 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 621 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
551 | } | 622 | } |
552 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 623 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
553 | << var("QMAKE_AR_CMD") << "\n"; | 624 | << var("QMAKE_AR_CMD") << "\n"; |
554 | if(!project->isEmpty("QMAKE_POST_LINK")) | 625 | if(!project->isEmpty("QMAKE_POST_LINK")) |
555 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 626 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
556 | if(!project->isEmpty("QMAKE_RANLIB")) | 627 | if(!project->isEmpty("QMAKE_RANLIB")) |
557 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; | 628 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; |
558 | if(!project->isEmpty("DESTDIR")) | 629 | if(!project->isEmpty("DESTDIR")) |
559 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" | 630 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" |
560 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; | 631 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; |
561 | } else { | 632 | } else { |
562 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); | 633 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); |
563 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], | 634 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"] + |
635 | project->variables()["OBJCOMP"], | ||
564 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; | 636 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; |
565 | libs.prepend("$(TARGET)"); | 637 | libs.prepend("$(TARGET)"); |
566 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); | 638 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); |
567 | libit != libs.end(); ++libit) { | 639 | libit != libs.end(); ++libit) { |
568 | QStringList build; | 640 | QStringList build; |
569 | for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) | 641 | for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) |
570 | build << (*objit); | 642 | build << (*objit); |
571 | QString ar; | 643 | QString ar; |
572 | if((*libit) == "$(TARGET)") { | 644 | if((*libit) == "$(TARGET)") { |
573 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") | 645 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
574 | << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; | 646 | << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; |
575 | ar = project->variables()["QMAKE_AR_CMD"].first(); | 647 | ar = project->variables()["QMAKE_AR_CMD"].first(); |
576 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", | 648 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", |
577 | build.join(" ")); | 649 | build.join(" ")); |
578 | } else { | 650 | } else { |
579 | t << (*libit) << ": " << valList(build) << "\n\t"; | 651 | t << (*libit) << ": " << valList(build) << "\n\t"; |
580 | ar = "$(AR) " + (*libit) + " " + build.join(" "); | 652 | ar = "$(AR) " + (*libit) + " " + build.join(" "); |
581 | } | 653 | } |
582 | if(!project->isEmpty("DESTDIR")) { | 654 | if(!project->isEmpty("DESTDIR")) { |
583 | QString destdir = project->first("DESTDIR"); | 655 | QString destdir = project->first("DESTDIR"); |
584 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 656 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
585 | } | 657 | } |
586 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" | 658 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" |
587 | << ar << "\n"; | 659 | << ar << "\n"; |
588 | if(!project->isEmpty("QMAKE_POST_LINK")) | 660 | if(!project->isEmpty("QMAKE_POST_LINK")) |
589 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 661 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
590 | if(!project->isEmpty("QMAKE_RANLIB")) | 662 | if(!project->isEmpty("QMAKE_RANLIB")) |
591 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; | 663 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; |
592 | if(!project->isEmpty("DESTDIR")) | 664 | if(!project->isEmpty("DESTDIR")) |
593 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" | 665 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" |
594 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; | 666 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; |
595 | } | 667 | } |
596 | } | 668 | } |
597 | t << endl << endl; | 669 | t << endl << endl; |
598 | } | 670 | } |
599 | 671 | ||
600 | t << "mocables: $(SRCMOC)" << endl << endl; | 672 | t << "mocables: $(SRCMOC)" << endl |
673 | << "uicables: $(UICDECLS) $(UICIMPLS)" << endl << endl; | ||
601 | 674 | ||
602 | if(!project->isActiveConfig("no_mocdepend")) { | 675 | if(!project->isActiveConfig("no_mocdepend")) { |
603 | //this is an implicity depend on moc, so it will be built if necesary, however | 676 | //this is an implicity depend on moc, so it will be built if necesary, however |
604 | //moc itself shouldn't have this dependency - this is a little kludgy but it is | 677 | //moc itself shouldn't have this dependency - this is a little kludgy but it is |
605 | //better than the alternative for now. | 678 | //better than the alternative for now. |
606 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); | 679 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"), |
680 | moc_dir = "$(QTDIR)/src/moc"; | ||
681 | if(!project->isEmpty("QMAKE_MOC_SRC")) | ||
682 | moc_dir = project->first("QMAKE_MOC_SRC"); | ||
607 | fixEnvVariables(target); | 683 | fixEnvVariables(target); |
608 | fixEnvVariables(moc); | 684 | fixEnvVariables(moc); |
609 | if(target != moc) | 685 | if(target != moc) |
610 | t << "$(MOC): \n\t" | 686 | t << "$(MOC): \n\t" |
611 | << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; | 687 | << "( cd " << moc_dir << " && $(MAKE) )" << endl << endl; |
612 | } | 688 | } |
613 | 689 | ||
614 | writeMakeQmake(t); | 690 | writeMakeQmake(t); |
691 | if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake")) { | ||
692 | QString meta_files; | ||
693 | if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib" && | ||
694 | !project->isActiveConfig("compile_libtool")) { //libtool | ||
695 | if(!meta_files.isEmpty()) | ||
696 | meta_files += " "; | ||
697 | meta_files += libtoolFileName(); | ||
698 | } | ||
699 | if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") { //pkg-config | ||
700 | if(!meta_files.isEmpty()) | ||
701 | meta_files += " "; | ||
702 | meta_files += pkgConfigFileName(); | ||
703 | } | ||
704 | if(!meta_files.isEmpty()) { | ||
705 | QStringList files = fileFixify(Option::mkfile::project_files); | ||
706 | t << meta_files << ": " << "\n\t" | ||
707 | << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl; | ||
708 | } | ||
709 | } | ||
615 | 710 | ||
616 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { | 711 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { |
617 | QString pkginfo = project->first("QMAKE_PKGINFO"); | 712 | QString pkginfo = project->first("QMAKE_PKGINFO"); |
618 | QString destdir = project->first("DESTDIR"); | 713 | QString destdir = project->first("DESTDIR"); |
619 | t << pkginfo << ": " << "\n\t"; | 714 | t << pkginfo << ": " << "\n\t"; |
620 | if(!destdir.isEmpty()) | 715 | if(!destdir.isEmpty()) |
621 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 716 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
622 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" | 717 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" |
623 | << "@echo \"APPL????\" >" << pkginfo << endl; | 718 | << "@echo \"APPL????\" >" << pkginfo << endl; |
624 | } | 719 | } |
625 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { | 720 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { |
626 | QString info_plist = project->first("QMAKE_INFO_PLIST"), | 721 | QString info_plist = project->first("QMAKE_INFO_PLIST"), |
627 | info_plist_out = project->first("QMAKE_INFO_PLIST_OUT"); | 722 | info_plist_out = project->first("QMAKE_INFO_PLIST_OUT"); |
628 | QString destdir = project->first("DESTDIR"); | 723 | QString destdir = project->first("DESTDIR"); |
629 | t << info_plist_out << ": " << "\n\t"; | 724 | t << info_plist_out << ": " << "\n\t"; |
630 | if(!destdir.isEmpty()) | 725 | if(!destdir.isEmpty()) |
631 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 726 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
632 | t << "@$(DEL_FILE) " << info_plist_out << "\n\t" | 727 | t << "@$(DEL_FILE) " << info_plist_out << "\n\t" |
633 | << "@cp \"" << info_plist << "\" \"" << info_plist_out << "\"" << endl; | 728 | << "@sed -e \"s,@ICON@,application.icns,g\" -e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") |
729 | << ",g\" \"" << info_plist << "\" >\"" << info_plist_out << "\"" << endl; | ||
634 | if(!project->first("RC_FILE").isEmpty()) { | 730 | if(!project->first("RC_FILE").isEmpty()) { |
635 | QString dir = destdir + "../Resources/"; | 731 | QString dir = destdir + "../Resources/"; |
636 | t << dir << "application.icns:" << "\n\t" | 732 | t << dir << "application.icns: " << var("RC_FILE") << "\n\t" |
637 | << "@test -d " << dir << " || mkdir -p " << dir << "\n\t" | 733 | << "@test -d " << dir << " || mkdir -p " << dir << "\n\t" |
638 | << "@cp " << var("RC_FILE") << " " << dir << "application.icns" << endl; | 734 | << "@$(DEL_FILE) " << dir << "application.icns" << "\n\t" |
735 | << "@$(COPY_FILE) " << var("RC_FILE") << " " << dir << "application.icns" << endl; | ||
639 | } | 736 | } |
640 | } | 737 | } |
641 | 738 | ||
642 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : | 739 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : |
643 | project->first("QMAKE_DISTDIR"); | 740 | project->first("QMAKE_DISTDIR"); |
644 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : | 741 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : |
645 | project->first("OBJECTS_DIR")) + ddir); | 742 | project->first("OBJECTS_DIR")) + ddir); |
646 | t << "dist: " << "\n\t" | 743 | t << "dist: " << "\n\t" |
647 | << "@mkdir -p " << ddir_c << " && " | 744 | << "@mkdir -p " << ddir_c << " && " |
648 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; | 745 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; |
649 | if(!project->isEmpty("TRANSLATIONS")) | 746 | if(!project->isEmpty("TRANSLATIONS")) |
650 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; | 747 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; |
748 | if(!project->isEmpty("IMAGES")) | ||
749 | t << "$(COPY_FILE) --parents " << var("IMAGES") << " " << ddir_c << Option::dir_sep << " && "; | ||
651 | if(!project->isEmpty("FORMS")) { | 750 | if(!project->isEmpty("FORMS")) { |
652 | QStringList &forms = project->variables()["FORMS"], ui_headers; | 751 | QStringList &forms = project->variables()["FORMS"], ui_headers; |
653 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | 752 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { |
654 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | 753 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); |
655 | if(QFile::exists(ui_h) ) | 754 | if(QFile::exists(ui_h) ) |
656 | ui_headers << ui_h; | 755 | ui_headers << ui_h; |
657 | } | 756 | } |
658 | if(!ui_headers.isEmpty()) | 757 | if(!ui_headers.isEmpty()) |
659 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; | 758 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; |
660 | } | 759 | } |
661 | t << "( cd `dirname " << ddir_c << "` && " | 760 | t << "( cd `dirname " << ddir_c << "` && " |
662 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " | 761 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " |
663 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " | 762 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " |
664 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " | 763 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " |
665 | << "$(DEL_FILE) -r " << ddir_c | 764 | << "$(DEL_FILE) -r " << ddir_c |
666 | << endl << endl; | 765 | << endl << endl; |
667 | 766 | ||
668 | QString clean_targets; | 767 | QString clean_targets; |
768 | t << "mocclean:" << "\n"; | ||
669 | if(mocAware()) { | 769 | if(mocAware()) { |
670 | t << "mocclean:" << "\n"; | ||
671 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { | 770 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { |
672 | if(!objMoc.isEmpty()) | 771 | if(!objMoc.isEmpty()) |
673 | t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; | 772 | t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; |
674 | if(!srcMoc.isEmpty()) | 773 | if(!srcMoc.isEmpty()) |
675 | t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; | 774 | t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; |
676 | if(moc_incremental) | 775 | if(moc_incremental) |
677 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; | 776 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; |
678 | clean_targets += " mocclean"; | 777 | clean_targets += " mocclean"; |
679 | } | 778 | } |
680 | t << endl; | 779 | t << endl; |
681 | } | 780 | } |
682 | t << "uiclean:" << "\n"; | 781 | t << "uiclean:" << "\n"; |
683 | if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) { | 782 | if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) { |
684 | t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n"; | 783 | t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n"; |
685 | clean_targets += " uiclean"; | 784 | clean_targets += " uiclean"; |
686 | } | 785 | } |
687 | t << endl; | 786 | t << endl; |
688 | 787 | ||
689 | t << "yaccclean:" << "\n"; | 788 | t << "yaccclean:" << "\n"; |
690 | if(!var("YACCSOURCES").isEmpty()) { | 789 | if(!var("YACCSOURCES").isEmpty()) { |
691 | QStringList clean, &l = project->variables()["YACCSOURCES"]; | 790 | QStringList clean, &l = project->variables()["YACCSOURCES"]; |
692 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 791 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
693 | QFileInfo fi((*it)); | 792 | QFileInfo fi((*it)); |
694 | QString dir; | 793 | QString dir; |
695 | if(fi.dirPath() != ".") | 794 | if(fi.dirPath() != ".") |
696 | dir = fi.dirPath() + Option::dir_sep; | 795 | dir = fi.dirPath() + Option::dir_sep; |
697 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 796 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
698 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 797 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
699 | dir += Option::dir_sep; | 798 | dir += Option::dir_sep; |
700 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | 799 | clean << ( dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first() ); |
701 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | 800 | clean << ( dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first() ); |
702 | } | 801 | } |
703 | if(!clean.isEmpty()) { | 802 | if(!clean.isEmpty()) { |
704 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | 803 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; |
705 | clean_targets += " yaccclean"; | 804 | clean_targets += " yaccclean"; |
706 | } | 805 | } |
707 | } | 806 | } |
708 | 807 | ||
709 | t << "lexclean:" << "\n"; | 808 | t << "lexclean:" << "\n"; |
710 | if(!var("LEXSOURCES").isEmpty()) { | 809 | if(!var("LEXSOURCES").isEmpty()) { |
711 | QStringList clean, &l = project->variables()["LEXSOURCES"]; | 810 | QStringList clean, &l = project->variables()["LEXSOURCES"]; |
712 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 811 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
713 | QFileInfo fi((*it)); | 812 | QFileInfo fi((*it)); |
714 | QString dir; | 813 | QString dir; |
715 | if(fi.dirPath() != ".") | 814 | if(fi.dirPath() != ".") |
716 | dir = fi.dirPath() + Option::dir_sep; | 815 | dir = fi.dirPath() + Option::dir_sep; |
717 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 816 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
718 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 817 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
719 | dir += Option::dir_sep; | 818 | dir += Option::dir_sep; |
720 | clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | 819 | clean << ( dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first() ); |
721 | } | 820 | } |
722 | if(!clean.isEmpty()) { | 821 | if(!clean.isEmpty()) { |
723 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | 822 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; |
724 | clean_targets += " lexclean"; | 823 | clean_targets += " lexclean"; |
725 | } | 824 | } |
726 | } | 825 | } |
727 | 826 | ||
728 | if(do_incremental) { | 827 | if(do_incremental) { |
729 | t << "incrclean:" << "\n"; | 828 | t << "incrclean:" << "\n"; |
730 | if(src_incremental) | 829 | if(src_incremental) |
731 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; | 830 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; |
732 | if(moc_incremental) | 831 | if(moc_incremental) |
733 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; | 832 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; |
734 | t << endl; | 833 | t << endl; |
735 | } | 834 | } |
736 | 835 | ||
737 | t << "clean:" << clean_targets << "\n\t"; | 836 | t << "clean:" << clean_targets << "\n\t"; |
738 | if(!project->isEmpty("OBJECTS")) | 837 | if(!project->isEmpty("OBJECTS")) { |
739 | t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t"; | 838 | if(project->isActiveConfig("compile_libtool")) |
839 | t << "-$(LIBTOOL) --mode=clean $(DEL_FILE) $(OBJECTS)" << "\n\t"; | ||
840 | else | ||
841 | t << "-$(DEL_FILE) $(OBJECTS)" << "\n\t"; | ||
842 | } | ||
843 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) { | ||
844 | QString header_prefix = project->first("QMAKE_PRECOMP_PREFIX"); | ||
845 | QString precomph_out_dir = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep; | ||
846 | t << "-$(DEL_FILE) " << precomph_out_dir << header_prefix + "c " | ||
847 | << precomph_out_dir << header_prefix << "c++" << "\n\t"; | ||
848 | } | ||
740 | if(!project->isEmpty("IMAGES")) | 849 | if(!project->isEmpty("IMAGES")) |
741 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; | 850 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; |
742 | if(src_incremental) | 851 | if(src_incremental) |
743 | t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; | 852 | t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; |
744 | t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") | 853 | t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") |
745 | << "-$(DEL_FILE) *~ core *.core" << "\n" | 854 | << "-$(DEL_FILE) *~ core *.core" << "\n" |
746 | << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; | 855 | << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; |
747 | t << "####### Sub-libraries" << endl << endl; | 856 | t << "####### Sub-libraries" << endl << endl; |
748 | if ( !project->variables()["SUBLIBS"].isEmpty() ) { | 857 | if ( !project->variables()["SUBLIBS"].isEmpty() ) { |
749 | QString libdir = "tmp/"; | 858 | QString libdir = "tmp/"; |
750 | if(!project->isEmpty("SUBLIBS_DIR")) | 859 | if(!project->isEmpty("SUBLIBS_DIR")) |
751 | libdir = project->first("SUBLIBS_DIR"); | 860 | libdir = project->first("SUBLIBS_DIR"); |
752 | QStringList &l = project->variables()["SUBLIBS"]; | 861 | QStringList &l = project->variables()["SUBLIBS"]; |
753 | for(it = l.begin(); it != l.end(); ++it) | 862 | for(it = l.begin(); it != l.end(); ++it) |
754 | t << libdir << "lib" << (*it) << ".a" << ":\n\t" | 863 | t << libdir << "lib" << (*it) << ".a" << ":\n\t" |
755 | << var(QString("MAKELIB") + (*it)) << endl << endl; | 864 | << var(QString("MAKELIB") + (*it)) << endl << endl; |
756 | } | 865 | } |
757 | 866 | ||
758 | QString destdir = project->first("DESTDIR"); | 867 | QString destdir = project->first("DESTDIR"); |
759 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 868 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
760 | destdir += Option::dir_sep; | 869 | destdir += Option::dir_sep; |
761 | t << "distclean: " << "clean\n"; | 870 | t << "distclean: " << "clean\n"; |
762 | if(project->first("TEMPLATE") == "app" && | 871 | if(project->first("TEMPLATE") == "app" && |
763 | project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | 872 | project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) |
764 | t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n"; | 873 | t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n"; |
874 | else if(project->isActiveConfig("compile_libtool")) | ||
875 | t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) " << "$(TARGET)" << "\n"; | ||
765 | else | 876 | else |
766 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; | 877 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; |
767 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && | 878 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && |
768 | !project->isActiveConfig("plugin")) | 879 | !project->isActiveConfig("plugin") && !project->isActiveConfig("compile_libtool")) |
769 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " | 880 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " |
770 | << destdir << "$(TARGET2) $(TARGETA)" << "\n"; | 881 | << destdir << "$(TARGET2) $(TARGETA)" << "\n"; |
771 | t << endl << endl; | 882 | t << endl << endl; |
772 | 883 | ||
773 | if ( !project->isEmpty("PRECOMPH") ) { | 884 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER") ) { |
885 | QString precomph = fileFixify(project->first("PRECOMPILED_HEADER")); | ||
886 | t << "###### Prefix headers" << endl; | ||
887 | QString comps[] = { "C", "CXX", QString::null }; | ||
888 | for(int i = 0; !comps[i].isNull(); i++) { | ||
889 | QString flags = var("QMAKE_" + comps[i] + "FLAGS_PRECOMPILE"); | ||
890 | flags += " $(" + comps[i] + "FLAGS)"; | ||
891 | |||
892 | QString header_prefix = project->first("QMAKE_PRECOMP_PREFIX"); | ||
893 | QString outdir = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep, outfile = outdir; | ||
894 | QString compiler; | ||
895 | if(comps[i] == "C") { | ||
896 | outfile += header_prefix + "c"; | ||
897 | compiler = "$(CC) "; | ||
898 | } else { | ||
899 | outfile += header_prefix + "c++"; | ||
900 | compiler = "$(CXX) "; | ||
901 | } | ||
902 | t << outfile << ": " << precomph << " " << findDependencies(precomph).join(" \\\n\t\t") | ||
903 | << "\n\t" << "test -d " << outdir << " || mkdir -p " << outdir | ||
904 | << "\n\t" << compiler << flags << " $(INCPATH) " << precomph << " -o " << outfile << endl << endl; | ||
905 | } | ||
906 | } | ||
907 | if(!project->isEmpty("ALLMOC_HEADER")) { | ||
774 | QString outdir = project->first("MOC_DIR"); | 908 | QString outdir = project->first("MOC_DIR"); |
775 | QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH")); | 909 | QString precomph = fileFixify(project->first("ALLMOC_HEADER")); |
776 | t << "###### Combined headers" << endl << endl; | 910 | t << "###### Combined headers" << endl << endl |
777 | //XXX | 911 | << outdir << "allmoc.cpp: " << precomph << " " |
778 | t << outdir << "allmoc.cpp: " << qt_dot_h << " " | ||
779 | << varList("HEADERS_ORIG") << "\n\t" | 912 | << varList("HEADERS_ORIG") << "\n\t" |
780 | << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t" | 913 | << "echo '#include \"" << precomph << "\"' >" << outdir << "allmoc.cpp" << "\n\t" |
781 | << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " | 914 | << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " |
782 | << outdir << "allmoc.cpp" << "\n\t" | 915 | << outdir << "allmoc.cpp" << "\n\t" |
783 | << "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t" | 916 | << "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t" |
784 | << "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \"" | 917 | << "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \"" |
785 | << qt_dot_h << "\"}' " << outdir << "allmoc.cpp" << "\n\t" | 918 | << precomph << "\"}' " << outdir << "allmoc.cpp" << "\n\t" |
786 | << "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl; | 919 | << "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl; |
787 | } | 920 | } |
788 | 921 | ||
789 | // blasted user defined targets | 922 | // user defined targets |
790 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | 923 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; |
791 | for(it = qut.begin(); it != qut.end(); ++it) { | 924 | for(it = qut.begin(); it != qut.end(); ++it) { |
792 | QString targ = var((*it) + ".target"), | 925 | QString targ = var((*it) + ".target"), |
793 | cmd = var((*it) + ".commands"), deps; | 926 | cmd = var((*it) + ".commands"), deps; |
794 | if(targ.isEmpty()) | 927 | if(targ.isEmpty()) |
795 | targ = (*it); | 928 | targ = (*it); |
796 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 929 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
797 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 930 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
798 | QString dep = var((*dep_it) + ".target"); | 931 | QString dep = var((*dep_it) + ".target"); |
799 | if(dep.isEmpty()) | 932 | if(dep.isEmpty()) |
800 | dep = (*dep_it); | 933 | dep = (*dep_it); |
801 | deps += " " + dep; | 934 | deps += " " + dep; |
802 | } | 935 | } |
936 | if(project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1) | ||
937 | deps += QString(" ") + "FORCE"; | ||
803 | t << targ << ":" << deps << "\n\t" | 938 | t << targ << ":" << deps << "\n\t" |
804 | << cmd << endl << endl; | 939 | << cmd << endl << endl; |
805 | } | 940 | } |
941 | // user defined compilers | ||
942 | QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
943 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
944 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
945 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
946 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); | ||
947 | QStringList &vars = project->variables()[(*it) + ".variables"]; | ||
948 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
949 | continue; | ||
950 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
951 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
952 | QStringList &inputs = project->variables()[(*it2)]; | ||
953 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
954 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
955 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
956 | out = tmp_out, cmd = tmp_cmd, deps; | ||
957 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
958 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
959 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
960 | cmd.replace("${QMAKE_FILE_OUT}", out); | ||
961 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
962 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) | ||
963 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); | ||
964 | if(!tmp_dep.isEmpty()) { | ||
965 | char buff[256]; | ||
966 | QString dep_cmd = tmp_dep; | ||
967 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
968 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { | ||
969 | while(!feof(proc)) { | ||
970 | int read_in = int(fread(buff, 1, 255, proc)); | ||
971 | if(!read_in) | ||
972 | break; | ||
973 | int l = 0; | ||
974 | for(int i = 0; i < read_in; i++) { | ||
975 | if(buff[i] == '\n' || buff[i] == ' ') { | ||
976 | deps += " " + QCString(buff+l, (i - l) + 1); | ||
977 | l = i; | ||
978 | } | ||
979 | } | ||
980 | } | ||
981 | fclose(proc); | ||
982 | } | ||
983 | } | ||
984 | t << out << ": " << in << deps << "\n\t" | ||
985 | << cmd << endl << endl; | ||
986 | } | ||
987 | } | ||
988 | } | ||
806 | t <<"FORCE:" << endl << endl; | 989 | t <<"FORCE:" << endl << endl; |
807 | } | 990 | } |
808 | 991 | ||
809 | struct SubDir | 992 | struct SubDir |
810 | { | 993 | { |
811 | QString directory, profile, target, makefile; | 994 | QString directory, profile, target, makefile; |
812 | }; | 995 | }; |
813 | 996 | ||
814 | void | 997 | void |
815 | UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | 998 | UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) |
816 | { | 999 | { |
1000 | // blasted includes | ||
1001 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; | ||
1002 | for(QStringList::Iterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it) | ||
1003 | t << "include " << (*qeui_it) << endl; | ||
1004 | writeExtraVariables(t); | ||
1005 | |||
817 | QPtrList<SubDir> subdirs; | 1006 | QPtrList<SubDir> subdirs; |
818 | { | 1007 | { |
819 | QStringList subdirs_in = project->variables()["SUBDIRS"]; | 1008 | QStringList subdirs_in = project->variables()["SUBDIRS"]; |
820 | for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { | 1009 | for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { |
821 | QString file = (*it); | 1010 | QString file = (*it); |
822 | fileFixify(file); | 1011 | fileFixify(file); |
823 | SubDir *sd = new SubDir; | 1012 | SubDir *sd = new SubDir; |
824 | subdirs.append(sd); | 1013 | subdirs.append(sd); |
825 | sd->makefile = "$(MAKEFILE)"; | 1014 | sd->makefile = "$(MAKEFILE)"; |
826 | if((*it).right(4) == ".pro") { | 1015 | if((*it).right(4) == ".pro") { |
827 | int slsh = file.findRev(Option::dir_sep); | 1016 | int slsh = file.findRev(Option::dir_sep); |
828 | if(slsh != -1) { | 1017 | if(slsh != -1) { |
829 | sd->directory = file.left(slsh+1); | 1018 | sd->directory = file.left(slsh+1); |
830 | sd->profile = file.mid(slsh+1); | 1019 | sd->profile = file.mid(slsh+1); |
831 | } else { | 1020 | } else { |
832 | sd->profile = file; | 1021 | sd->profile = file; |
833 | } | 1022 | } |
834 | } else { | 1023 | } else { |
1024 | if(!file.isEmpty()) | ||
1025 | sd->profile = file.section(Option::dir_sep, -1) + ".pro"; | ||
835 | sd->directory = file; | 1026 | sd->directory = file; |
836 | } | 1027 | } |
837 | while(sd->directory.right(1) == Option::dir_sep) | 1028 | while(sd->directory.right(1) == Option::dir_sep) |
838 | sd->directory = sd->directory.left(sd->directory.length() - 1); | 1029 | sd->directory = sd->directory.left(sd->directory.length() - 1); |
839 | if(!sd->profile.isEmpty()) { | 1030 | if(!sd->profile.isEmpty()) { |
840 | QString basename = sd->directory; | 1031 | QString basename = sd->directory; |
841 | int new_slsh = basename.findRev(Option::dir_sep); | 1032 | int new_slsh = basename.findRev(Option::dir_sep); |
842 | if(new_slsh != -1) | 1033 | if(new_slsh != -1) |
843 | basename = basename.mid(new_slsh+1); | 1034 | basename = basename.mid(new_slsh+1); |
844 | if(sd->profile != basename + ".pro") | 1035 | if(sd->profile != basename + ".pro") |
845 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro | 1036 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro |
846 | } | 1037 | } |
847 | sd->target = "sub-" + (*it); | 1038 | sd->target = "sub-" + (*it); |
848 | sd->target.replace('/', '-'); | 1039 | sd->target.replace('/', '-'); |
849 | sd->target.replace('.', '_'); | 1040 | sd->target.replace('.', '_'); |
850 | } | 1041 | } |
851 | } | 1042 | } |
852 | QPtrListIterator<SubDir> it(subdirs); | 1043 | QPtrListIterator<SubDir> it(subdirs); |
853 | 1044 | ||
854 | QString ofile = Option::output.name(); | 1045 | QString ofile = Option::output.name(); |
855 | if(ofile.findRev(Option::dir_sep) != -1) | 1046 | if(ofile.findRev(Option::dir_sep) != -1) |
856 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); | 1047 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); |
857 | t << "MAKEFILE =" << var("MAKEFILE") << endl; | 1048 | t << "MAKEFILE =" << var("MAKEFILE") << endl; |
858 | t << "QMAKE =" << var("QMAKE") << endl; | 1049 | t << "QMAKE =" << var("QMAKE") << endl; |
859 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 1050 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
1051 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; | ||
1052 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; | ||
1053 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
1054 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
860 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory | 1055 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory |
861 | for( it.toFirst(); it.current(); ++it) | 1056 | for( it.toFirst(); it.current(); ++it) |
862 | t << " \\\n\t\t" << it.current()->target; | 1057 | t << " \\\n\t\t" << it.current()->target; |
863 | t << endl << endl; | 1058 | t << endl << endl; |
864 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; | 1059 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; |
865 | 1060 | ||
866 | // generate target rules | 1061 | // generate target rules |
867 | for( it.toFirst(); it.current(); ++it) { | 1062 | for( it.toFirst(); it.current(); ++it) { |
868 | bool have_dir = !(*it)->directory.isEmpty(); | 1063 | bool have_dir = !(*it)->directory.isEmpty(); |
869 | QString mkfile = (*it)->makefile, out; | 1064 | QString mkfile = (*it)->makefile, out; |
870 | if(have_dir) | 1065 | if(have_dir) |
871 | mkfile.prepend((*it)->directory + Option::dir_sep); | 1066 | mkfile.prepend((*it)->directory + Option::dir_sep); |
872 | if(direct || (*it)->makefile != "$(MAKEFILE)") | 1067 | if(direct || (*it)->makefile != "$(MAKEFILE)") |
873 | out = " -o " + (*it)->makefile; | 1068 | out = " -o " + (*it)->makefile; |
874 | //qmake it | 1069 | //qmake it |
875 | t << mkfile << ": " << "\n\t"; | 1070 | t << mkfile << ": " << "\n\t"; |
876 | if(have_dir) | 1071 | if(have_dir) |
877 | t << "cd " << (*it)->directory << " && "; | 1072 | t << mkdir_p_asstring((*it)->directory) << "\n\t" |
878 | t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; | 1073 | << "cd " << (*it)->directory << " && "; |
1074 | QString profile = fileFixify((*it)->profile, (*it)->directory, (*it)->directory); | ||
1075 | t << "$(QMAKE) " << profile << buildArgs() << out << endl; | ||
879 | //actually compile | 1076 | //actually compile |
880 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; | 1077 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; |
881 | if(have_dir) | 1078 | if(have_dir) |
882 | t << "cd " << (*it)->directory << " && "; | 1079 | t << "cd " << (*it)->directory << " && "; |
883 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; | 1080 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; |
884 | } | 1081 | } |
885 | 1082 | ||
886 | if (project->isActiveConfig("ordered")) { // generate dependencies | 1083 | if (project->isActiveConfig("ordered")) { // generate dependencies |
887 | for( it.toFirst(); it.current(); ) { | 1084 | for( it.toFirst(); it.current(); ) { |
888 | QString tar = it.current()->target; | 1085 | QString tar = it.current()->target; |
889 | ++it; | 1086 | ++it; |
890 | if (it.current()) | 1087 | if (it.current()) |
891 | t << it.current()->target << ": " << tar << endl; | 1088 | t << it.current()->target << ": " << tar << endl; |
892 | } | 1089 | } |
893 | t << endl; | 1090 | t << endl; |
894 | } | 1091 | } |
895 | 1092 | ||
896 | writeMakeQmake(t); | 1093 | writeMakeQmake(t); |
897 | 1094 | ||
898 | if(project->isEmpty("SUBDIRS")) { | 1095 | if(project->isEmpty("SUBDIRS")) { |
899 | t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl; | 1096 | t << "all qmake_all distclean uicables mocables install_subdirs uninstall_subdirs" |
1097 | << " uiclean mocclean lexclean yaccclean clean " << var("SUBDIR_TARGETS") << ": FORCE" << endl; | ||
900 | } else { | 1098 | } else { |
901 | t << "all: $(SUBTARGETS)" << endl; | 1099 | t << "all: $(SUBTARGETS)" << endl; |
902 | t << "qmake_all:"; | 1100 | t << "qmake_all:"; |
903 | for( it.toFirst(); it.current(); ++it) { | 1101 | for( it.toFirst(); it.current(); ++it) { |
904 | t << " "; | 1102 | t << " "; |
905 | if(!(*it)->directory.isEmpty()) | 1103 | if(!(*it)->directory.isEmpty()) |
906 | t << (*it)->directory << Option::dir_sep; | 1104 | t << (*it)->directory << Option::dir_sep; |
907 | t << (*it)->makefile; | 1105 | t << (*it)->makefile; |
908 | } | 1106 | } |
909 | for( it.toFirst(); it.current(); ++it) { | 1107 | for( it.toFirst(); it.current(); ++it) { |
910 | t << "\n\t ( "; | 1108 | t << "\n\t ( "; |
911 | if(!(*it)->directory.isEmpty()) | 1109 | if(!(*it)->directory.isEmpty()) |
912 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 1110 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
913 | t << "grep \"^qmake_all:\" " << (*it)->makefile | 1111 | t << "grep \"^qmake_all:\" " << (*it)->makefile |
914 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; | 1112 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; |
915 | } | 1113 | } |
916 | t << endl; | 1114 | t << endl; |
917 | t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE"; | 1115 | t << "clean uicables mocables uiclean mocclean lexclean yaccclean " |
1116 | << var("SUBDIR_TARGETS") << ": qmake_all FORCE"; | ||
918 | for( it.toFirst(); it.current(); ++it) { | 1117 | for( it.toFirst(); it.current(); ++it) { |
919 | t << "\n\t ( "; | 1118 | t << "\n\t ( "; |
920 | if(!(*it)->directory.isEmpty()) | 1119 | if(!(*it)->directory.isEmpty()) |
921 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 1120 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
922 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; | 1121 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; |
923 | } | 1122 | } |
924 | t << endl; | 1123 | t << endl; |
1124 | t << "uninstall_subdirs: qmake_all FORCE"; | ||
1125 | for( it.toFirst(); it.current(); ++it) { | ||
1126 | t << "\n\t ( "; | ||
1127 | if(!(*it)->directory.isEmpty()) | ||
1128 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | ||
1129 | t << "$(MAKE) -f " << (*it)->makefile << " uninstall" << "; ) || true"; | ||
1130 | } | ||
1131 | t << endl; | ||
1132 | t << "install_subdirs: qmake_all FORCE"; | ||
1133 | for( it.toFirst(); it.current(); ++it) { | ||
1134 | t << "\n\t ( "; | ||
1135 | if(!(*it)->directory.isEmpty()) | ||
1136 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | ||
1137 | t << "$(MAKE) -f " << (*it)->makefile << " install" << "; ) || true"; | ||
1138 | } | ||
1139 | t << endl; | ||
925 | t << "distclean: qmake_all FORCE"; | 1140 | t << "distclean: qmake_all FORCE"; |
926 | for( it.toFirst(); it.current(); ++it) { | 1141 | for( it.toFirst(); it.current(); ++it) { |
927 | t << "\n\t ( "; | 1142 | t << "\n\t ( "; |
928 | if(!(*it)->directory.isEmpty()) | 1143 | if(!(*it)->directory.isEmpty()) |
929 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 1144 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
930 | t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; | 1145 | t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; |
931 | } | 1146 | } |
932 | t << endl << endl; | 1147 | t << endl << endl; |
933 | } | 1148 | } |
1149 | |||
1150 | //installations | ||
1151 | project->variables()["INSTALLDEPS"] += "install_subdirs"; | ||
1152 | project->variables()["UNINSTALLDEPS"] += "uninstall_subdirs"; | ||
1153 | writeInstalls(t, "INSTALLS"); | ||
1154 | |||
1155 | // user defined targets | ||
1156 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | ||
1157 | for(QStringList::Iterator qut_it = qut.begin(); qut_it != qut.end(); ++qut_it) { | ||
1158 | QString targ = var((*qut_it) + ".target"), | ||
1159 | cmd = var((*qut_it) + ".commands"), deps; | ||
1160 | if(targ.isEmpty()) | ||
1161 | targ = (*qut_it); | ||
1162 | QStringList &deplist = project->variables()[(*qut_it) + ".depends"]; | ||
1163 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | ||
1164 | QString dep = var((*dep_it) + ".target"); | ||
1165 | if(dep.isEmpty()) | ||
1166 | dep = (*dep_it); | ||
1167 | deps += " " + dep; | ||
1168 | } | ||
1169 | if(project->variables()[(*qut_it) + ".CONFIG"].findIndex("phony") != -1) | ||
1170 | deps += QString(" ") + "FORCE"; | ||
1171 | t << targ << ":" << deps << "\n\t" | ||
1172 | << cmd << endl << endl; | ||
1173 | } | ||
934 | t <<"FORCE:" << endl << endl; | 1174 | t <<"FORCE:" << endl << endl; |
935 | } | 1175 | } |
936 | 1176 | ||
937 | void UnixMakefileGenerator::init2() | 1177 | void UnixMakefileGenerator::init2() |
938 | { | 1178 | { |
939 | //version handling | 1179 | //version handling |
940 | if(project->variables()["VERSION"].isEmpty()) | 1180 | if(project->variables()["VERSION"].isEmpty()) |
941 | project->variables()["VERSION"].append("1.0." + | 1181 | project->variables()["VERSION"].append("1.0." + |
942 | (project->isEmpty("VER_PAT") ? QString("0") : | 1182 | (project->isEmpty("VER_PAT") ? QString("0") : |
943 | project->first("VER_PAT")) ); | 1183 | project->first("VER_PAT")) ); |
944 | QStringList l = QStringList::split('.', project->first("VERSION")); | 1184 | QStringList l = QStringList::split('.', project->first("VERSION")); |
945 | l << "0" << "0"; //make sure there are three | 1185 | l << "0" << "0"; //make sure there are three |
946 | project->variables()["VER_MAJ"].append(l[0]); | 1186 | project->variables()["VER_MAJ"].append(l[0]); |
947 | project->variables()["VER_MIN"].append(l[1]); | 1187 | project->variables()["VER_MIN"].append(l[1]); |
948 | project->variables()["VER_PAT"].append(l[2]); | 1188 | project->variables()["VER_PAT"].append(l[2]); |
949 | 1189 | ||
950 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 1190 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
951 | #if 0 | 1191 | #if 0 |
952 | if ( project->isActiveConfig("dll") ) { | 1192 | if ( project->isActiveConfig("dll") ) { |
953 | project->variables()["TARGET"] += project->variables()["TARGET.so"]; | 1193 | project->variables()["TARGET"] += project->variables()["TARGET.so"]; |
954 | if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty()) | 1194 | if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty()) |
955 | project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; | 1195 | project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; |
956 | if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) | 1196 | if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) |
957 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); | 1197 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); |
958 | } | 1198 | } |
959 | #endif | 1199 | #endif |
960 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 1200 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); |
961 | if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() ) | 1201 | if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() ) |
962 | project->variables()["TARGET_EXT"].append(".exe"); | 1202 | project->variables()["TARGET_EXT"].append(".exe"); |
963 | } else if ( project->isActiveConfig("staticlib") ) { | 1203 | } else if ( project->isActiveConfig("staticlib") ) { |
964 | project->variables()["TARGET"].first().prepend("lib"); | 1204 | project->variables()["TARGET"].first().prepend("lib"); |
965 | project->variables()["TARGET"].first() += ".a"; | 1205 | project->variables()["TARGET"].first() += ".a"; |
966 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) | 1206 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) |
967 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); | 1207 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); |
968 | } else { | 1208 | } else { |
969 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); | 1209 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); |
1210 | if( project->isActiveConfig("compile_libtool") ) | ||
1211 | project->variables()["TARGET_la"] = project->first("DESTDIR") + "lib" + project->first("TARGET") + Option::libtool_ext; | ||
1212 | |||
970 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) | 1213 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) |
971 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); | 1214 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); |
972 | else | 1215 | else |
973 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); | 1216 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); |
974 | if( project->isActiveConfig("plugin") ) { | 1217 | if( project->isActiveConfig("compile_libtool") ) { |
1218 | project->variables()["TARGET"] = project->variables()["TARGET_la"]; | ||
1219 | } else if( project->isActiveConfig("plugin") ) { | ||
975 | project->variables()["TARGET_x.y.z"].append("lib" + | 1220 | project->variables()["TARGET_x.y.z"].append("lib" + |
976 | project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); | 1221 | project->first("TARGET") + "." + |
1222 | project->first("QMAKE_EXTENSION_PLUGIN")); | ||
977 | if(project->isActiveConfig("lib_version_first")) | 1223 | if(project->isActiveConfig("lib_version_first")) |
978 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1224 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
979 | project->first("VER_MAJ") + "." + | 1225 | project->first("VER_MAJ") + "." + |
980 | project->first("QMAKE_EXTENSION_SHLIB")); | 1226 | project->first("QMAKE_EXTENSION_PLUGIN")); |
981 | else | 1227 | else |
982 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1228 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
983 | project->first("QMAKE_EXTENSION_SHLIB") + | 1229 | project->first("QMAKE_EXTENSION_PLUGIN") + |
984 | "." + project->first("VER_MAJ")); | 1230 | "." + project->first("VER_MAJ")); |
985 | 1231 | ||
986 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 1232 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
987 | if(project->isActiveConfig("qt")) | 1233 | if(project->isActiveConfig("qt")) |
988 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 1234 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
989 | } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) { | 1235 | } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
990 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); | 1236 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); |
991 | if(project->isActiveConfig("lib_version_first")) | 1237 | if(project->isActiveConfig("lib_version_first")) |
992 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + | 1238 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + |
993 | project->first("TARGET")); | 1239 | project->first("TARGET")); |
994 | else | 1240 | else |
995 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1241 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
996 | project->first("VER_MAJ")); | 1242 | project->first("VER_MAJ")); |
997 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; | 1243 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; |
998 | } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) { | 1244 | } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) { |
999 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); | 1245 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); |
1000 | if(project->isActiveConfig("lib_version_first")) { | 1246 | if(project->isActiveConfig("lib_version_first")) { |
1001 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1247 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1002 | project->first("VER_MAJ") + "." + | 1248 | project->first("VER_MAJ") + "." + |
1003 | project->first("QMAKE_EXTENSION_SHLIB")); | 1249 | project->first("QMAKE_EXTENSION_SHLIB")); |
1004 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1250 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1005 | project->first("VER_MAJ") + | 1251 | project->first("VER_MAJ") + |
1006 | "." + project->first("VER_MIN") + "." + | 1252 | "." + project->first("VER_MIN") + "." + |
1007 | project->first("QMAKE_EXTENSION_SHLIB")); | 1253 | project->first("QMAKE_EXTENSION_SHLIB")); |
1008 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + | 1254 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + |
1009 | project->first("VER_MAJ") + "." + | 1255 | project->first("VER_MAJ") + "." + |
1010 | project->first("VER_MIN") + "." + | 1256 | project->first("VER_MIN") + "." + |
1011 | project->first("VER_PAT") + "." + | 1257 | project->first("VER_PAT") + "." + |
1012 | project->first("QMAKE_EXTENSION_SHLIB")); | 1258 | project->first("QMAKE_EXTENSION_SHLIB")); |
1013 | } else { | 1259 | } else { |
1014 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1260 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1015 | project->first("QMAKE_EXTENSION_SHLIB") + | 1261 | project->first("QMAKE_EXTENSION_SHLIB") + |
1016 | "." + project->first("VER_MAJ")); | 1262 | "." + project->first("VER_MAJ")); |
1017 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1263 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1018 | project->first("QMAKE_EXTENSION_SHLIB") + | 1264 | project->first("QMAKE_EXTENSION_SHLIB") + |
1019 | "." + project->first("VER_MAJ") + | 1265 | "." + project->first("VER_MAJ") + |
1020 | "." + project->first("VER_MIN")); | 1266 | "." + project->first("VER_MIN")); |
1021 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + | 1267 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + |
1022 | project->first("QMAKE_EXTENSION_SHLIB") + "." + | 1268 | project->first("QMAKE_EXTENSION_SHLIB") + "." + |
1023 | project->first("VER_MAJ") + "." + | 1269 | project->first("VER_MAJ") + "." + |
1024 | project->first("VER_MIN") + "." + | 1270 | project->first("VER_MIN") + "." + |
1025 | project->first("VER_PAT")); | 1271 | project->first("VER_PAT")); |
1026 | } | 1272 | } |
1027 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 1273 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
1028 | } else { | 1274 | } else { |
1029 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + "." + | 1275 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + "." + |
1030 | project->first("QMAKE_EXTENSION_SHLIB")); | 1276 | project->first("QMAKE_EXTENSION_SHLIB")); |
1031 | if(project->isActiveConfig("lib_version_first")) { | 1277 | if(project->isActiveConfig("lib_version_first")) { |
1032 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1278 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1033 | project->first("VER_MAJ") + "." + | 1279 | project->first("VER_MAJ") + "." + |
1034 | project->first("QMAKE_EXTENSION_SHLIB")); | 1280 | project->first("QMAKE_EXTENSION_SHLIB")); |
1035 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1281 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1036 | project->first("VER_MAJ") + | 1282 | project->first("VER_MAJ") + |
1037 | "." + project->first("VER_MIN") + "." + | 1283 | "." + project->first("VER_MIN") + "." + |
1038 | project->first("QMAKE_EXTENSION_SHLIB")); | 1284 | project->first("QMAKE_EXTENSION_SHLIB")); |
1039 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + | 1285 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + |
1040 | project->first("VER_MAJ") + "." + | 1286 | project->first("VER_MAJ") + "." + |
1041 | project->first("VER_MIN") + "." + | 1287 | project->first("VER_MIN") + "." + |
1042 | project->first("VER_PAT") + "." + | 1288 | project->first("VER_PAT") + "." + |
1043 | project->variables()["QMAKE_EXTENSION_SHLIB"].first()); | 1289 | project->variables()["QMAKE_EXTENSION_SHLIB"].first()); |
1044 | } else { | 1290 | } else { |
1045 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1291 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1046 | project->first("QMAKE_EXTENSION_SHLIB") + | 1292 | project->first("QMAKE_EXTENSION_SHLIB") + |
1047 | "." + project->first("VER_MAJ")); | 1293 | "." + project->first("VER_MAJ")); |
1048 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1294 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1049 | project->first("QMAKE_EXTENSION_SHLIB") | 1295 | project->first("QMAKE_EXTENSION_SHLIB") |
1050 | + "." + project->first("VER_MAJ") + | 1296 | + "." + project->first("VER_MAJ") + |
1051 | "." + project->first("VER_MIN")); | 1297 | "." + project->first("VER_MIN")); |
1052 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + | 1298 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + |
1053 | "." + | 1299 | "." + |
1054 | project->variables()[ | 1300 | project->variables()[ |
1055 | "QMAKE_EXTENSION_SHLIB"].first() + "." + | 1301 | "QMAKE_EXTENSION_SHLIB"].first() + "." + |
1056 | project->first("VER_MAJ") + "." + | 1302 | project->first("VER_MAJ") + "." + |
1057 | project->first("VER_MIN") + "." + | 1303 | project->first("VER_MIN") + "." + |
1058 | project->first("VER_PAT")); | 1304 | project->first("VER_PAT")); |
1059 | } | 1305 | } |
1060 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 1306 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
1061 | } | 1307 | } |
1062 | if(project->isEmpty("QMAKE_LN_SHLIB")) | 1308 | if(project->isEmpty("QMAKE_LN_SHLIB")) |
1063 | project->variables()["QMAKE_LN_SHLIB"].append("ln -s"); | 1309 | project->variables()["QMAKE_LN_SHLIB"].append("ln -s"); |
1064 | project->variables()["DESTDIR_TARGET"].append("$(TARGET)"); | 1310 | project->variables()["DESTDIR_TARGET"].append("$(TARGET)"); |
1065 | if ( !project->variables()["DESTDIR"].isEmpty() ) | 1311 | if ( !project->variables()["DESTDIR"].isEmpty() ) |
1066 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); | 1312 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); |
1067 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) { | 1313 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) { |
1068 | if(project->isActiveConfig("plugin")) { | 1314 | if(project->isActiveConfig("plugin")) { |
1069 | if(!project->variables()["TARGET"].isEmpty() ) | 1315 | if(!project->variables()["TARGET"].isEmpty() ) |
1070 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); | 1316 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); |
1071 | } else { | 1317 | } else { |
1072 | if(!project->variables()["TARGET_x"].isEmpty() ) | 1318 | if(!project->variables()["TARGET_x"].isEmpty() ) |
1073 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); | 1319 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); |
1074 | } | 1320 | } |
1075 | } | 1321 | } |
1076 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) | 1322 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) |
1077 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( | 1323 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( |
1078 | "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"); | 1324 | "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)"); |
1079 | } | 1325 | } |
1080 | if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) | 1326 | if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) |
1081 | project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); | 1327 | project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); |
1082 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 1328 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
1083 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"]; | 1329 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_APP"]; |
1330 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_APP"]; | ||
1331 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_APP"]; | ||
1084 | } else if ( project->isActiveConfig("dll") ) { | 1332 | } else if ( project->isActiveConfig("dll") ) { |
1085 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; | 1333 | if( !project->isActiveConfig("plugin") || !project->isActiveConfig("plugin_no_share_shlib_cflags")) { |
1086 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; | 1334 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; |
1335 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; | ||
1336 | } | ||
1087 | if ( project->isActiveConfig("plugin") ) { | 1337 | if ( project->isActiveConfig("plugin") ) { |
1338 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_PLUGIN"]; | ||
1339 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_PLUGIN"]; | ||
1088 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; | 1340 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; |
1089 | if( !project->isActiveConfig("plugin_no_soname") ) | 1341 | if( project->isActiveConfig("plugin_with_soname") && !project->isActiveConfig("compile_libtool")) |
1090 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | 1342 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; |
1091 | } else { | 1343 | } else { |
1092 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; | 1344 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; |
1093 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | 1345 | if(!project->isEmpty("QMAKE_LFLAGS_COMPAT_VERSION")) { |
1346 | if(project->isEmpty("COMPAT_VERSION")) | ||
1347 | project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_COMPAT_VERSION") + | ||
1348 | project->first("VER_MAJ") + "." + | ||
1349 | project->first("VER_MIN")); | ||
1350 | else | ||
1351 | project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_COMPAT_VERSION") + | ||
1352 | project->first("COMPATIBILITY_VERSION")); | ||
1353 | } | ||
1354 | if(!project->isEmpty("QMAKE_LFLAGS_VERSION")) { | ||
1355 | project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_VERSION") + | ||
1356 | project->first("VER_MAJ") + "." + | ||
1357 | project->first("VER_MIN") + "." + | ||
1358 | project->first("VER_PAT")); | ||
1359 | } | ||
1360 | if(!project->isActiveConfig("compile_libtool")) | ||
1361 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | ||
1094 | } | 1362 | } |
1095 | QString destdir = project->first("DESTDIR"); | 1363 | QString destdir = project->first("DESTDIR"); |
1096 | if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) { | 1364 | if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) { |
1097 | QString rpath_destdir = destdir; | 1365 | QString rpath_destdir = destdir; |
1098 | if(QDir::isRelativePath(rpath_destdir)) { | 1366 | if(QDir::isRelativePath(rpath_destdir)) { |
1099 | QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir)); | 1367 | QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir)); |
1100 | if(fi.convertToAbs()) //strange, shouldn't really happen | 1368 | if(fi.convertToAbs()) //strange, shouldn't really happen |
1101 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); | 1369 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); |
1102 | else | 1370 | else |
1103 | rpath_destdir = fi.filePath(); | 1371 | rpath_destdir = fi.filePath(); |
1104 | } else { | 1372 | } else { |
1105 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); | 1373 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); |
1106 | } | 1374 | } |
1107 | project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir; | 1375 | project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir; |
1108 | } | 1376 | } |
1109 | } | 1377 | } |
1378 | QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
1379 | for(QStringList::Iterator it = quc.begin(); it != quc.end(); ++it) { | ||
1380 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
1381 | if(tmp_out.isEmpty()) | ||
1382 | continue; | ||
1383 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
1384 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
1385 | QStringList &inputs = project->variables()[(*it2)]; | ||
1386 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
1387 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
1388 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
1389 | out = tmp_out; | ||
1390 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
1391 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
1392 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
1393 | project->variables()["OBJCOMP"] += out; | ||
1394 | } | ||
1395 | } | ||
1396 | } | ||
1397 | } | ||
1398 | |||
1399 | QString | ||
1400 | UnixMakefileGenerator::libtoolFileName() | ||
1401 | { | ||
1402 | QString ret = var("TARGET"); | ||
1403 | int slsh = ret.findRev(Option::dir_sep); | ||
1404 | if(slsh != -1) | ||
1405 | ret = ret.right(ret.length() - slsh); | ||
1406 | int dot = ret.find('.'); | ||
1407 | if(dot != -1) | ||
1408 | ret = ret.left(dot); | ||
1409 | ret += Option::libtool_ext; | ||
1410 | if(!project->isEmpty("DESTDIR")) | ||
1411 | ret.prepend(var("DESTDIR")); | ||
1412 | return ret; | ||
1413 | } | ||
1414 | |||
1415 | void | ||
1416 | UnixMakefileGenerator::writeLibtoolFile() | ||
1417 | { | ||
1418 | QString fname = libtoolFileName(), lname = fname; | ||
1419 | int slsh = lname.findRev(Option::dir_sep); | ||
1420 | if(slsh != -1) | ||
1421 | lname = lname.right(lname.length() - slsh - 1); | ||
1422 | QFile ft(fname); | ||
1423 | if(!ft.open(IO_WriteOnly)) | ||
1424 | return; | ||
1425 | project->variables()["ALL_DEPS"].append(fname); | ||
1426 | |||
1427 | QTextStream t(&ft); | ||
1428 | t << "# " << lname << " - a libtool library file\n"; | ||
1429 | time_t now = time(NULL); | ||
1430 | t << "# Generated by qmake/libtool (" << qmake_version() << ") (Qt " | ||
1431 | << QT_VERSION_STR << ") on: " << ctime(&now) << "\n"; | ||
1432 | |||
1433 | t << "# The name that we can dlopen(3).\n" | ||
1434 | << "dlname='" << var(project->isActiveConfig("plugin") ? "TARGET" : "TARGET_x") | ||
1435 | << "'\n\n"; | ||
1436 | |||
1437 | t << "# Names of this library.\n"; | ||
1438 | t << "library_names='"; | ||
1439 | if(project->isActiveConfig("plugin")) { | ||
1440 | t << var("TARGET"); | ||
1441 | } else { | ||
1442 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) | ||
1443 | t << var("TARGET_x.y.z") << " "; | ||
1444 | t << var("TARGET_x") << " " << var("TARGET_"); | ||
1445 | } | ||
1446 | t << "'\n\n"; | ||
1447 | |||
1448 | t << "# The name of the static archive.\n" | ||
1449 | << "old_library='" << lname.left(lname.length()-Option::libtool_ext.length()) << ".a'\n\n"; | ||
1450 | |||
1451 | t << "# Libraries that this one depends upon.\n"; | ||
1452 | QStringList libs; | ||
1453 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | ||
1454 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; | ||
1455 | else | ||
1456 | libs << "QMAKE_LIBS"; //obvious one | ||
1457 | t << "dependency_libs='"; | ||
1458 | for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) | ||
1459 | t << project->variables()[(*it)].join(" ") << " "; | ||
1460 | t << "'\n\n"; | ||
1461 | |||
1462 | t << "# Version information for " << lname << "\n"; | ||
1463 | int maj = project->first("VER_MAJ").toInt(); | ||
1464 | int min = project->first("VER_MIN").toInt(); | ||
1465 | int pat = project->first("VER_PAT").toInt(); | ||
1466 | t << "current=" << (10*maj + min) << "\n" // best I can think of | ||
1467 | << "age=0\n" | ||
1468 | << "revision=" << pat << "\n\n"; | ||
1469 | |||
1470 | t << "# Is this an already installed library.\n" | ||
1471 | "installed=yes\n\n"; // ### | ||
1472 | |||
1473 | t << "# Files to dlopen/dlpreopen.\n" | ||
1474 | "dlopen=''\n" | ||
1475 | "dlpreopen=''\n\n"; | ||
1476 | |||
1477 | QString install_dir = project->first("target.path"); | ||
1478 | if(install_dir.isEmpty()) | ||
1479 | install_dir = project->first("DESTDIR"); | ||
1480 | t << "# Directory that this library needs to be installed in:\n" | ||
1481 | "libdir='" << Option::fixPathToTargetOS(install_dir, FALSE) << "'\n"; | ||
1482 | } | ||
1483 | |||
1484 | QString | ||
1485 | UnixMakefileGenerator::pkgConfigFileName() | ||
1486 | { | ||
1487 | QString ret = var("TARGET"); | ||
1488 | int slsh = ret.findRev(Option::dir_sep); | ||
1489 | if(slsh != -1) | ||
1490 | ret = ret.right(ret.length() - slsh); | ||
1491 | if(ret.startsWith("lib")) | ||
1492 | ret = ret.mid(3); | ||
1493 | int dot = ret.find('.'); | ||
1494 | if(dot != -1) | ||
1495 | ret = ret.left(dot); | ||
1496 | ret += Option::pkgcfg_ext; | ||
1497 | if(!project->isEmpty("DESTDIR")) { | ||
1498 | ret.prepend(var("DESTDIR")); | ||
1499 | ret = Option::fixPathToLocalOS(fileFixify(ret,QDir::currentDirPath(), Option::output_dir)); | ||
1500 | } | ||
1501 | return ret; | ||
1502 | } | ||
1503 | |||
1504 | QString | ||
1505 | UnixMakefileGenerator::pkgConfigPrefix() const | ||
1506 | { | ||
1507 | if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX")) | ||
1508 | return project->first("QMAKE_PKGCONFIG_PREFIX"); | ||
1509 | return qInstallPath(); | ||
1510 | } | ||
1511 | |||
1512 | QString | ||
1513 | UnixMakefileGenerator::pkgConfigFixPath(QString path) const | ||
1514 | { | ||
1515 | QString prefix = pkgConfigPrefix(); | ||
1516 | if(path.startsWith(prefix)) | ||
1517 | path = path.replace(prefix, "${prefix}"); | ||
1518 | return path; | ||
1519 | } | ||
1520 | |||
1521 | void | ||
1522 | UnixMakefileGenerator::writePkgConfigFile() // ### does make sense only for libqt so far | ||
1523 | { | ||
1524 | QString fname = pkgConfigFileName(), lname = fname; | ||
1525 | int slsh = lname.findRev(Option::dir_sep); | ||
1526 | if(slsh != -1) | ||
1527 | lname = lname.right(lname.length() - slsh - 1); | ||
1528 | QFile ft(fname); | ||
1529 | if(!ft.open(IO_WriteOnly)) | ||
1530 | return; | ||
1531 | project->variables()["ALL_DEPS"].append(fname); | ||
1532 | QTextStream t(&ft); | ||
1533 | |||
1534 | QString prefix = pkgConfigPrefix(); | ||
1535 | QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR"); | ||
1536 | if(libDir.isEmpty()) | ||
1537 | libDir = prefix + "/lib"; | ||
1538 | QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR"); | ||
1539 | if(includeDir.isEmpty()) | ||
1540 | includeDir = prefix + "/include"; | ||
1541 | |||
1542 | t << "prefix=" << prefix << endl; | ||
1543 | t << "exec_prefix=${prefix}\n" | ||
1544 | << "libdir=" << pkgConfigFixPath(libDir) << "\n" | ||
1545 | << "includedir=" << pkgConfigFixPath(includeDir) << endl; | ||
1546 | // non-standard entry. Provides useful info normally only | ||
1547 | // contained in the internal .qmake.cache file | ||
1548 | t << varGlue("CONFIG", "qt_config=", " ", "") << endl << endl; | ||
1549 | |||
1550 | t << "Name: Qt" << endl; | ||
1551 | QString desc = project->first("QMAKE_PKGCONFIG_DESCRIPTION"); | ||
1552 | if(desc.isEmpty()) { | ||
1553 | desc = project->first("TARGET").lower(); | ||
1554 | desc.replace(0, 1, desc[0].upper()); | ||
1555 | if(project->first("TEMPLATE") == "lib") { | ||
1556 | if(project->isActiveConfig("plugin")) | ||
1557 | desc += " Plugin"; | ||
1558 | else | ||
1559 | desc += " Library"; | ||
1560 | } else if(project->first("TEMPLATE") == "app") { | ||
1561 | desc += " Application"; | ||
1562 | } | ||
1563 | } | ||
1564 | t << "Description: " << desc << endl; | ||
1565 | t << "Version: " << project->first("VERSION") << endl; | ||
1566 | |||
1567 | // libs | ||
1568 | QStringList libs; | ||
1569 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | ||
1570 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; | ||
1571 | else | ||
1572 | libs << "QMAKE_LIBS"; //obvious one | ||
1573 | if(project->isActiveConfig("thread")) | ||
1574 | libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? | ||
1575 | t << "Libs: -L${libdir} -l" << lname.left(lname.length()-Option::libtool_ext.length()) << " "; | ||
1576 | for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) | ||
1577 | t << project->variables()[(*it)].join(" ") << " "; | ||
1578 | t << endl; | ||
1579 | |||
1580 | // flags | ||
1581 | // ### too many | ||
1582 | t << "Cflags: " | ||
1583 | // << var("QMAKE_CXXFLAGS") << " " | ||
1584 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") | ||
1585 | << project->variables()["PRL_EXPORT_CXXFLAGS"].join(" ") | ||
1586 | // << varGlue("DEFINES","-D"," -D"," ") | ||
1587 | << " -I${includedir}"; | ||
1110 | } | 1588 | } |
diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp index 26eea88..12607cf 100644 --- a/qmake/generators/win32/borland_bmake.cpp +++ b/qmake/generators/win32/borland_bmake.cpp | |||
@@ -1,509 +1,661 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** NmakeMakefileGenerator of BorlandMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "borland_bmake.h" | 36 | #include "borland_bmake.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qdir.h> | 38 | #include <qdir.h> |
41 | #include <qregexp.h> | 39 | #include <qregexp.h> |
42 | #include <time.h> | 40 | #include <time.h> |
43 | #include <stdlib.h> | 41 | #include <stdlib.h> |
44 | 42 | ||
45 | 43 | ||
46 | BorlandMakefileGenerator::BorlandMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 44 | BorlandMakefileGenerator::BorlandMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
47 | { | 45 | { |
48 | 46 | ||
49 | } | 47 | } |
50 | 48 | ||
51 | bool | 49 | bool |
52 | BorlandMakefileGenerator::writeMakefile(QTextStream &t) | 50 | BorlandMakefileGenerator::writeMakefile(QTextStream &t) |
53 | { | 51 | { |
54 | writeHeader(t); | 52 | writeHeader(t); |
55 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
56 | t << "all clean:" << "\n\t" | 54 | t << "all clean:" << "\n\t" |
57 | << "@echo \"Some of the required modules (" | 55 | << "@echo \"Some of the required modules (" |
58 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | 56 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" |
59 | << "@echo \"Skipped.\"" << endl << endl; | 57 | << "@echo \"Skipped.\"" << endl << endl; |
60 | return TRUE; | 58 | return TRUE; |
61 | } | 59 | } |
62 | 60 | ||
63 | if(project->first("TEMPLATE") == "app" || | 61 | if(project->first("TEMPLATE") == "app" || |
64 | project->first("TEMPLATE") == "lib") { | 62 | project->first("TEMPLATE") == "lib") { |
65 | writeBorlandParts(t); | 63 | writeBorlandParts(t); |
66 | return MakefileGenerator::writeMakefile(t); | 64 | return MakefileGenerator::writeMakefile(t); |
67 | } | 65 | } |
68 | else if(project->first("TEMPLATE") == "subdirs") { | 66 | else if(project->first("TEMPLATE") == "subdirs") { |
69 | writeSubDirs(t); | 67 | writeSubDirs(t); |
70 | return TRUE; | 68 | return TRUE; |
71 | } | 69 | } |
72 | return FALSE; | 70 | return FALSE; |
73 | } | 71 | } |
74 | 72 | ||
75 | void | 73 | void |
76 | BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) | 74 | BorlandMakefileGenerator::writeBorlandParts(QTextStream &t) |
77 | { | 75 | { |
78 | t << "!if !$d(BCB)" << endl; | 76 | t << "!if !$d(BCB)" << endl; |
79 | t << "BCB = $(MAKEDIR)\\.." << endl; | 77 | t << "BCB = $(MAKEDIR)\\.." << endl; |
80 | t << "!endif" << endl << endl; | 78 | t << "!endif" << endl << endl; |
81 | t << "####### Compiler, tools and options" << endl << endl; | 79 | t << "####### Compiler, tools and options" << endl << endl; |
82 | t << "CC =" << var("QMAKE_CC") << endl; | 80 | t << "CC =" << var("QMAKE_CC") << endl; |
83 | t << "CXX =" << var("QMAKE_CXX") << endl; | 81 | t << "CXX =" << var("QMAKE_CXX") << endl; |
84 | t << "LEX = " << var("QMAKE_LEX") << endl; | 82 | t << "LEX = " << var("QMAKE_LEX") << endl; |
85 | t << "YACC = " << var("QMAKE_YACC") << endl; | 83 | t << "YACC = " << var("QMAKE_YACC") << endl; |
86 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " | 84 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " |
87 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 85 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
88 | << varGlue("DEFINES","-D"," -D","") << endl; | 86 | << varGlue("DEFINES","-D"," -D","") << endl; |
89 | t << "CXXFLAGS=" << var("QMAKE_CXXFLAGS") << " " | 87 | t << "CXXFLAGS=" << var("QMAKE_CXXFLAGS") << " " |
90 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 88 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
91 | << varGlue("DEFINES","-D"," -D","") << endl; | 89 | << varGlue("DEFINES","-D"," -D","") << endl; |
92 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; | 90 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; |
93 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; | 91 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; |
94 | 92 | ||
95 | t << "INCPATH ="; | 93 | t << "INCPATH ="; |
96 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 94 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
97 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 95 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
98 | QString inc = (*incit); | 96 | QString inc = (*incit); |
99 | inc.replace(QRegExp("\\\\*$"), ""); | 97 | inc.replace(QRegExp("\\\\*$"), ""); |
100 | inc.replace("\"", ""); | 98 | inc.replace("\"", ""); |
101 | t << " -I\"" << inc << "\""; | 99 | t << " -I\"" << inc << "\""; |
102 | } | 100 | } |
103 | t << " -I\"" << specdir() << "\"" | 101 | t << " -I\"" << specdir() << "\"" |
104 | << endl; | 102 | << endl; |
105 | 103 | ||
106 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 104 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
107 | t << "LINK =" << var("QMAKE_LINK") << endl; | 105 | t << "LINK =" << var("QMAKE_LINK") << endl; |
108 | t << "LFLAGS ="; | 106 | t << "LFLAGS ="; |
109 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 107 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
110 | t << varGlue("QMAKE_LIBDIR","-L",";","") << " "; | 108 | t << varGlue("QMAKE_LIBDIR","-L",";","") << " "; |
111 | t << var("QMAKE_LFLAGS") << endl; | 109 | t << var("QMAKE_LFLAGS") << endl; |
112 | t << "LIBS =" << var("QMAKE_LIBS") << endl; | 110 | t << "LIBS =" << var("QMAKE_LIBS") << endl; |
113 | } | 111 | } |
114 | else { | 112 | else { |
115 | t << "LIB =" << var("QMAKE_LIB") << endl; | 113 | t << "LIB =" << var("QMAKE_LIB") << endl; |
116 | } | 114 | } |
117 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | 115 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : |
118 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; | 116 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; |
119 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | 117 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : |
120 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | 118 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; |
121 | t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | 119 | t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : |
122 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | 120 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; |
123 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : | 121 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : |
124 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; | 122 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; |
125 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : | 123 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : |
126 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; | 124 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; |
127 | t << "ZIP =" << var("QMAKE_ZIP") << endl; | 125 | t << "ZIP =" << var("QMAKE_ZIP") << endl; |
128 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; | 126 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; |
129 | t << "RES_FILE =" << varList("RES_FILE") << endl; | 127 | t << "RES_FILE =" << varList("RES_FILE") << endl; |
130 | t << "COPY_FILE = " << var("QMAKE_COPY") << endl; | 128 | t << "COPY_FILE = " << var("QMAKE_COPY") << endl; |
131 | t << "COPY_DIR = " << var("QMAKE_COPY") << endl; | 129 | t << "COPY_DIR = " << var("QMAKE_COPY") << endl; |
132 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 130 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
133 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; | 131 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
134 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 132 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
135 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; | 133 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; |
136 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | 134 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; |
135 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
136 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
137 | t << endl; | 137 | t << endl; |
138 | 138 | ||
139 | t << "####### Files" << endl << endl; | 139 | t << "####### Files" << endl << endl; |
140 | t << "HEADERS =" << varList("HEADERS") << endl; | 140 | t << "HEADERS =" << varList("HEADERS") << endl; |
141 | t << "SOURCES =" << varList("SOURCES") << endl; | 141 | t << "SOURCES =" << varList("SOURCES") << endl; |
142 | t << "OBJECTS =" << varList("OBJECTS") << endl; | 142 | t << "OBJECTS =" << varList("OBJECTS") << endl; |
143 | t << "FORMS =" << varList("FORMS") << endl; | 143 | t << "FORMS =" << varList("FORMS") << endl; |
144 | t << "UICDECLS =" << varList("UICDECLS") << endl; | 144 | t << "UICDECLS =" << varList("UICDECLS") << endl; |
145 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; | 145 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; |
146 | t << "SRCMOC =" << varList("SRCMOC") << endl; | 146 | t << "SRCMOC =" << varList("SRCMOC") << endl; |
147 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 147 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
148 | |||
149 | QString extraCompilerDeps; | ||
150 | if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) { | ||
151 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | ||
152 | extraCompilerDeps += " $(OBJCOMP) "; | ||
153 | |||
154 | QStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
155 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { | ||
156 | QStringList &vars = project->variables()[(*compit) + ".variables"]; | ||
157 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { | ||
158 | QStringList vals = project->variables()[(*varit)]; | ||
159 | if(!vals.isEmpty()) | ||
160 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; | ||
161 | } | ||
162 | } | ||
163 | } | ||
164 | |||
148 | t << "DIST =" << varList("DISTFILES") << endl; | 165 | t << "DIST =" << varList("DISTFILES") << endl; |
149 | t << "TARGET =" | 166 | t << "TARGET =" |
150 | << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")) | 167 | << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")) |
151 | << endl; | 168 | << endl; |
152 | t << endl; | 169 | t << endl; |
153 | 170 | ||
154 | t << "####### Implicit rules" << endl << endl; | 171 | t << "####### Implicit rules" << endl << endl; |
155 | t << ".SUFFIXES: .c"; | 172 | t << ".SUFFIXES: .c"; |
156 | QStringList::Iterator cppit; | 173 | QStringList::Iterator cppit; |
157 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 174 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
158 | t << " " << (*cppit); | 175 | t << " " << (*cppit); |
159 | t << endl << endl; | 176 | t << endl << endl; |
160 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 177 | 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; | 178 | 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; | 179 | t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
163 | 180 | ||
164 | t << "####### Build rules" << endl << endl; | 181 | t << "####### Build rules" << endl << endl; |
165 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << " $(TARGET)" << endl << endl; | 182 | t << "all: " << fileFixify(Option::output.name()) << " " << varGlue("ALL_DEPS"," "," "," ") << " $(TARGET)" << endl << endl; |
166 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 183 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
167 | << var("POST_TARGETDEPS"); | 184 | << extraCompilerDeps << var("POST_TARGETDEPS"); |
168 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 185 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
169 | t << "\n\t" << "$(LINK) @&&|" << "\n\t" | 186 | t << "\n\t" << "$(LINK) @&&|" << "\n\t" |
170 | << "$(LFLAGS) $(OBJECTS) $(OBJMOC),$(TARGET),,$(LIBS),$(DEF_FILE),$(RES_FILE)"; | 187 | << "$(LFLAGS) $(OBJECTS) $(OBJMOC),$(TARGET),,$(LIBS),$(DEF_FILE),$(RES_FILE)"; |
171 | } else { | 188 | } else { |
172 | t << "\n\t-del $(TARGET)" | 189 | t << "\n\t-$(DEL_FILE) $(TARGET)" |
173 | << "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+" | 190 | << "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+" |
174 | << project->variables()["OBJECTS"].join(" \\\n+") << " \\\n+" | 191 | << project->variables()["OBJECTS"].join(" \\\n+") << " \\\n+" |
175 | << project->variables()["OBJMOC"].join(" \\\n+"); | 192 | << project->variables()["OBJMOC"].join(" \\\n+"); |
176 | } | 193 | } |
194 | t << extraCompilerDeps; | ||
177 | t << endl << "|" << endl; | 195 | t << endl << "|" << endl; |
178 | 196 | ||
179 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) | 197 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) |
180 | t << "\t" <<var("QMAKE_POST_LINK") << endl; | 198 | t << "\t" <<var("QMAKE_POST_LINK") << endl; |
181 | 199 | ||
182 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { | 200 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { |
183 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 201 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
184 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 202 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
185 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; | 203 | t << "\n\t" << "-$(COPY_FILE) \"$(TARGET)\" " << *dlldir; |
186 | } | 204 | } |
187 | } | 205 | } |
188 | QString targetfilename = project->variables()["TARGET"].first(); | 206 | QString targetfilename = project->variables()["TARGET"].first(); |
189 | if(project->isActiveConfig("activeqt")) { | 207 | if(project->isActiveConfig("activeqt")) { |
190 | QString version = project->variables()["VERSION"].first(); | 208 | QString version = project->variables()["VERSION"].first(); |
191 | if ( version.isEmpty() ) | 209 | if ( version.isEmpty() ) |
192 | version = "1.0"; | 210 | version = "1.0"; |
193 | 211 | ||
194 | if ( project->isActiveConfig("dll")) { | 212 | if ( project->isActiveConfig("dll")) { |
195 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 213 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + 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"); | 214 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
197 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 215 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
198 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | 216 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); |
199 | } else { | 217 | } else { |
200 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | 218 | t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + 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"); | 219 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
202 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 220 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
203 | t << "\n\t" << ("-$(TARGET) -regserver"); | 221 | t << "\n\t" << ("-$(TARGET) -regserver"); |
204 | } | 222 | } |
205 | } | 223 | } |
206 | t << endl << endl; | 224 | t << endl << endl; |
207 | 225 | ||
208 | if(!project->variables()["RC_FILE"].isEmpty()) { | 226 | if(!project->variables()["RC_FILE"].isEmpty()) { |
209 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" | 227 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" |
210 | << var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl; | 228 | << var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl; |
211 | } | 229 | } |
212 | t << "mocables: $(SRCMOC)" << endl << endl; | 230 | t << "mocables: $(SRCMOC)" << endl |
231 | << "uicables: $(UICIMPLS) $(UICDECLS)" << endl << endl; | ||
213 | 232 | ||
214 | writeMakeQmake(t); | 233 | writeMakeQmake(t); |
215 | 234 | ||
235 | QStringList dist_files = Option::mkfile::project_files; | ||
236 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) | ||
237 | dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; | ||
238 | if(!project->isEmpty("TRANSLATIONS")) | ||
239 | dist_files << var("TRANSLATIONS"); | ||
240 | if(!project->isEmpty("FORMS")) { | ||
241 | QStringList &forms = project->variables()["FORMS"]; | ||
242 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | ||
243 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | ||
244 | if(QFile::exists(ui_h) ) | ||
245 | dist_files << ui_h; | ||
246 | } | ||
247 | } | ||
216 | t << "dist:" << "\n\t" | 248 | t << "dist:" << "\n\t" |
217 | << "$(ZIP) " << var("PROJECT") << ".zip " << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" | 249 | << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(HEADERS) $(DIST) $(FORMS) " |
218 | << endl << endl; | 250 | << dist_files.join(" ") << " " << var("TRANSLATIONS") << " " << var("IMAGES") << endl << endl; |
251 | |||
252 | t << "uiclean:"; | ||
253 | QString uiclean = varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") + varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ",""); | ||
254 | if ( uiclean.isEmpty() ) { | ||
255 | // Borland make does not like an empty command section | ||
256 | uiclean = "\n\t@cd ."; | ||
257 | } | ||
258 | t << uiclean << endl; | ||
259 | |||
260 | t << "mocclean:"; | ||
261 | QString mocclean = varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") + varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ",""); | ||
262 | if ( mocclean.isEmpty() ) { | ||
263 | // Borland make does not like an empty command section | ||
264 | mocclean = "\n\t@cd ."; | ||
265 | } | ||
266 | t << mocclean << endl; | ||
219 | 267 | ||
220 | t << "clean:\n" | 268 | t << "clean: uiclean mocclean" |
221 | << varGlue("OBJECTS","\t-del ","\n\t-del ","") | 269 | << varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
222 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 270 | << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
223 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") | 271 | << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ",""); |
224 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | ||
225 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | ||
226 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | ||
227 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | ||
228 | if ( project->isActiveConfig("activeqt")) { | 272 | if ( project->isActiveConfig("activeqt")) { |
229 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 273 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl"); |
230 | t << "\n\t-del tmp\\dump.*"; | 274 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
231 | } | 275 | } |
232 | if(!project->isEmpty("IMAGES")) | 276 | if(!project->isEmpty("IMAGES")) |
233 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 277 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", ""); |
278 | t << endl; | ||
234 | 279 | ||
235 | // blasted user defined targets | 280 | // user defined targets |
281 | QStringList::Iterator it; | ||
236 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 282 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
237 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 283 | for(it = qut.begin(); it != qut.end(); ++it) { |
238 | QString targ = var((*it) + ".target"), | 284 | QString targ = var((*it) + ".target"), |
239 | cmd = var((*it) + ".commands"), deps; | 285 | cmd = var((*it) + ".commands"), deps; |
240 | if(targ.isEmpty()) | 286 | if(targ.isEmpty()) |
241 | targ = (*it); | 287 | targ = (*it); |
242 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 288 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
243 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 289 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
244 | QString dep = var((*dep_it) + ".target"); | 290 | QString dep = var((*dep_it) + ".target"); |
245 | if(dep.isEmpty()) | 291 | if(dep.isEmpty()) |
246 | dep = (*dep_it); | 292 | dep = (*dep_it); |
247 | deps += " " + dep; | 293 | deps += " " + dep; |
248 | } | 294 | } |
295 | if(!project->variables()["QMAKE_NOFORCE"].isEmpty() && | ||
296 | project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1) | ||
297 | deps += QString(" ") + "FORCE"; | ||
249 | t << "\n\n" << targ << ":" << deps << "\n\t" | 298 | t << "\n\n" << targ << ":" << deps << "\n\t" |
250 | << cmd; | 299 | << cmd; |
251 | } | 300 | } |
252 | 301 | ||
253 | t << endl << endl; | 302 | t << endl << endl; |
254 | 303 | ||
304 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
305 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
306 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
307 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
308 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); | ||
309 | QStringList &vars = project->variables()[(*it) + ".variables"]; | ||
310 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
311 | continue; | ||
312 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
313 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
314 | QStringList &inputs = project->variables()[(*it2)]; | ||
315 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
316 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
317 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
318 | out = tmp_out, cmd = tmp_cmd, deps; | ||
319 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
320 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
321 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
322 | cmd.replace("${QMAKE_FILE_OUT}", out); | ||
323 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
324 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) | ||
325 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); | ||
326 | if(!tmp_dep.isEmpty()) { | ||
327 | char buff[256]; | ||
328 | QString dep_cmd = tmp_dep; | ||
329 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
330 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { | ||
331 | while(!feof(proc)) { | ||
332 | int read_in = int(fread(buff, 1, 255, proc)); | ||
333 | if(!read_in) | ||
334 | break; | ||
335 | int l = 0; | ||
336 | for(int i = 0; i < read_in; i++) { | ||
337 | if(buff[i] == '\n' || buff[i] == ' ') { | ||
338 | deps += " " + QCString(buff+l, (i - l) + 1); | ||
339 | l = i; | ||
340 | } | ||
341 | } | ||
342 | } | ||
343 | fclose(proc); | ||
344 | } | ||
345 | } | ||
346 | t << out << ": " << in << deps << "\n\t" | ||
347 | << cmd << endl << endl; | ||
348 | } | ||
349 | } | ||
350 | } | ||
351 | t << endl; | ||
352 | |||
255 | t << "distclean: clean" | 353 | t << "distclean: clean" |
256 | << "\n\t-del $(TARGET)" | 354 | << "\n\t-$(DEL_FILE) $(TARGET)" |
257 | << endl << endl; | 355 | << endl << endl; |
258 | } | 356 | } |
259 | 357 | ||
260 | void | 358 | void |
261 | BorlandMakefileGenerator::init() | 359 | BorlandMakefileGenerator::init() |
262 | { | 360 | { |
263 | if(init_flag) | 361 | if(init_flag) |
264 | return; | 362 | return; |
265 | init_flag = TRUE; | 363 | init_flag = TRUE; |
266 | 364 | ||
267 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 365 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
268 | 366 | ||
269 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 367 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
270 | if(project->first("TEMPLATE") == "app") | 368 | if(project->first("TEMPLATE") == "app") |
271 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 369 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
272 | else if(project->first("TEMPLATE") == "lib") | 370 | else if(project->first("TEMPLATE") == "lib") |
273 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 371 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
274 | else if(project->first("TEMPLATE") == "subdirs") { | 372 | else if(project->first("TEMPLATE") == "subdirs") { |
275 | MakefileGenerator::init(); | 373 | MakefileGenerator::init(); |
276 | if(project->variables()["MAKEFILE"].isEmpty()) | 374 | if(project->variables()["MAKEFILE"].isEmpty()) |
277 | project->variables()["MAKEFILE"].append("Makefile"); | 375 | project->variables()["MAKEFILE"].append("Makefile"); |
278 | if(project->variables()["QMAKE"].isEmpty()) | 376 | if(project->variables()["QMAKE"].isEmpty()) |
279 | project->variables()["QMAKE"].append("qmake"); | 377 | project->variables()["QMAKE"].append("qmake"); |
280 | return; | 378 | return; |
281 | } | 379 | } |
282 | 380 | ||
381 | if(project->isEmpty("QMAKE_INSTALL_FILE")) | ||
382 | project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)"); | ||
383 | if(project->isEmpty("QMAKE_INSTALL_DIR")) | ||
384 | project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)"); | ||
385 | |||
283 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qtmt"QTDLL_POSTFIX); | 386 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qtmt"QTDLL_POSTFIX); |
284 | QStringList &configs = project->variables()["CONFIG"]; | 387 | QStringList &configs = project->variables()["CONFIG"]; |
285 | if (project->isActiveConfig("shared")) | 388 | if (project->isActiveConfig("shared")) |
286 | project->variables()["DEFINES"].append("QT_DLL"); | 389 | project->variables()["DEFINES"].append("QT_DLL"); |
287 | if (project->isActiveConfig("qt_dll")) | 390 | if (project->isActiveConfig("qt_dll")) |
288 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 391 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
392 | if ( project->isActiveConfig("qtopia") ) { | ||
393 | if(configs.findIndex("qtopialib") == -1) | ||
394 | configs.append("qtopialib"); | ||
395 | if(configs.findIndex("qtopiainc") == -1) | ||
396 | configs.append("qtopiainc"); | ||
397 | } | ||
289 | if ( project->isActiveConfig("qt") ) { | 398 | if ( project->isActiveConfig("qt") ) { |
290 | if ( project->isActiveConfig("plugin") ) { | 399 | if ( project->isActiveConfig("plugin") ) { |
291 | project->variables()["CONFIG"].append("dll"); | 400 | project->variables()["CONFIG"].append("dll"); |
292 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 401 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
293 | } | 402 | } |
294 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && | 403 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && |
295 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || | 404 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || |
296 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || | 405 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || |
297 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { | 406 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { |
298 | project->variables()["QMAKE_QT_DLL"].append("1"); | 407 | project->variables()["QMAKE_QT_DLL"].append("1"); |
299 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | 408 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) |
300 | project->variables()["CONFIG"].append("dll"); | 409 | project->variables()["CONFIG"].append("dll"); |
301 | } | 410 | } |
302 | } | 411 | } |
303 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 412 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
304 | project->variables()["CONFIG"].remove("staticlib"); | 413 | project->variables()["CONFIG"].remove("staticlib"); |
305 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); | 414 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); |
306 | } else { | 415 | } else { |
307 | project->variables()["CONFIG"].append("staticlib"); | 416 | project->variables()["CONFIG"].append("staticlib"); |
308 | } | 417 | } |
309 | if ( project->isActiveConfig("warn_off") ) { | 418 | if ( project->isActiveConfig("warn_off") ) { |
310 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | 419 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; |
311 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | 420 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; |
312 | } else if ( project->isActiveConfig("warn_on") ) { | 421 | } else if ( project->isActiveConfig("warn_on") ) { |
313 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | 422 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; |
314 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | 423 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; |
315 | } | 424 | } |
316 | if(project->isActiveConfig("qt")) { | 425 | if(project->isActiveConfig("qt")) { |
317 | if ( project->isActiveConfig("thread") ) | 426 | if ( project->isActiveConfig("thread") ) |
318 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | 427 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); |
319 | if ( project->isActiveConfig("accessibility" ) ) | 428 | if ( project->isActiveConfig("accessibility" ) ) |
320 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 429 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
321 | if ( project->isActiveConfig("tablet") ) | 430 | if ( project->isActiveConfig("tablet") ) |
322 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 431 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
323 | } | 432 | } |
324 | 433 | ||
325 | if ( project->isActiveConfig("debug") ) { | 434 | if ( project->isActiveConfig("debug") ) { |
326 | if ( project->isActiveConfig("thread") ) { | 435 | if ( project->isActiveConfig("thread") ) { |
327 | if ( project->isActiveConfig("dll") ) { | 436 | if ( project->isActiveConfig("dll") ) { |
328 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; | 437 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; |
329 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 438 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; |
330 | } else { | 439 | } else { |
331 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; | 440 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; |
332 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | 441 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; |
333 | } | 442 | } |
334 | } | 443 | } |
335 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | 444 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; |
336 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | 445 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; |
337 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | 446 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; |
338 | } else { | 447 | } else { |
339 | if ( project->isActiveConfig("thread") ) { | 448 | if ( project->isActiveConfig("thread") ) { |
340 | if ( project->isActiveConfig("dll") ) { | 449 | if ( project->isActiveConfig("dll") ) { |
341 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; | 450 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; |
342 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | 451 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; |
343 | } else { | 452 | } else { |
344 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; | 453 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; |
345 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | 454 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; |
346 | } | 455 | } |
347 | } | 456 | } |
348 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | 457 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; |
349 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | 458 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; |
350 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | 459 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; |
351 | } | 460 | } |
352 | 461 | ||
353 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) { | 462 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) { |
354 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | 463 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; |
355 | } | 464 | } |
356 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) { | 465 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) { |
357 | project->variables()["CONFIG"].append("windows"); | 466 | project->variables()["CONFIG"].append("windows"); |
358 | } | 467 | } |
468 | if ( project->isActiveConfig("qtopiainc") ) | ||
469 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
470 | if ( project->isActiveConfig("qtopialib") ) { | ||
471 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
472 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
473 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
474 | } | ||
359 | if ( project->isActiveConfig("qt") ) { | 475 | if ( project->isActiveConfig("qt") ) { |
360 | project->variables()["CONFIG"].append("moc"); | 476 | project->variables()["CONFIG"].append("moc"); |
361 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 477 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
362 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 478 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
363 | if ( !project->isActiveConfig("debug") ) | 479 | if ( !project->isActiveConfig("debug") ) |
364 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 480 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
365 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 481 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
366 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { | 482 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { |
367 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 483 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
368 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; | 484 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; |
369 | } | 485 | } |
370 | } else { | 486 | } else { |
371 | if(project->isActiveConfig("thread")) | 487 | if(project->isActiveConfig("thread")) |
372 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 488 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
373 | else | 489 | else |
374 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 490 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
375 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 491 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
376 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 492 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
377 | if ( hver == -1 ) | 493 | if ( hver == -1 ) |
378 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qtmt"); | 494 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qtmt"); |
379 | if(hver != -1) { | 495 | if(hver != -1) { |
380 | QString ver; | 496 | QString ver; |
381 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "mt" : ""), hver); | 497 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "mt" : ""), hver); |
382 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 498 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
383 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 499 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
384 | (*libit).replace(QRegExp("qt(mt)?\\.lib"), ver); | 500 | (*libit).replace(QRegExp("qt(mt)?\\.lib"), ver); |
385 | } | 501 | } |
386 | } | 502 | } |
387 | if ( project->isActiveConfig( "activeqt" ) ) { | 503 | if ( project->isActiveConfig( "activeqt" ) ) { |
388 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 504 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
389 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 505 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
390 | if ( project->isActiveConfig( "dll" ) ) | 506 | if ( project->isActiveConfig( "dll" ) ) |
391 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 507 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
392 | } | 508 | } |
393 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 509 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
394 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 510 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
395 | } | 511 | } |
396 | } | 512 | } |
397 | } | 513 | } |
398 | if ( project->isActiveConfig("opengl") ) { | 514 | if ( project->isActiveConfig("opengl") ) { |
399 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 515 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
400 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 516 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
401 | } | 517 | } |
402 | if ( project->isActiveConfig("dll") ) { | 518 | if ( project->isActiveConfig("dll") ) { |
403 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | 519 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; |
404 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | 520 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; |
405 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | 521 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; |
406 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | 522 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; |
407 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { | 523 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { |
408 | project->variables()["TARGET_EXT"].append( | 524 | project->variables()["TARGET_EXT"].append( |
409 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); | 525 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); |
410 | } else { | 526 | } else { |
411 | project->variables()["TARGET_EXT"].append(".dll"); | 527 | project->variables()["TARGET_EXT"].append(".dll"); |
412 | } | 528 | } |
413 | } else { | 529 | } else { |
414 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | 530 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; |
415 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | 531 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; |
416 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | 532 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; |
417 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | 533 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; |
418 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 534 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
419 | project->variables()["TARGET_EXT"].append(".exe"); | 535 | project->variables()["TARGET_EXT"].append(".exe"); |
420 | } else { | 536 | } else { |
421 | project->variables()["TARGET_EXT"].append(".lib"); | 537 | project->variables()["TARGET_EXT"].append(".lib"); |
422 | } | 538 | } |
423 | } | 539 | } |
424 | if ( project->isActiveConfig("windows") ) { | 540 | if ( project->isActiveConfig("windows") ) { |
425 | if ( project->isActiveConfig("console") ) { | 541 | if ( project->isActiveConfig("console") ) { |
426 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 542 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; |
427 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 543 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; |
428 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 544 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; |
429 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 545 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; |
430 | } else { | 546 | } else { |
431 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | 547 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; |
432 | } | 548 | } |
433 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 549 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
434 | } else { | 550 | } else { |
435 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 551 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; |
436 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 552 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; |
437 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 553 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; |
438 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 554 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; |
439 | } | 555 | } |
440 | if ( project->isActiveConfig("stl") ) { | 556 | if ( project->isActiveConfig("stl") ) { |
441 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | 557 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; |
442 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | 558 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; |
443 | } else { | 559 | } else { |
444 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | 560 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; |
445 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | 561 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; |
446 | } | 562 | } |
447 | if ( project->isActiveConfig("exceptions") ) { | 563 | if ( project->isActiveConfig("exceptions") ) { |
448 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | 564 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; |
449 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | 565 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; |
450 | } else { | 566 | } else { |
451 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | 567 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; |
452 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | 568 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; |
453 | } | 569 | } |
454 | if ( project->isActiveConfig("rtti") ) { | 570 | if ( project->isActiveConfig("rtti") ) { |
455 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | 571 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; |
456 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | 572 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; |
457 | } else { | 573 | } else { |
458 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | 574 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; |
459 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | 575 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; |
460 | } | 576 | } |
461 | 577 | ||
462 | if ( project->isActiveConfig("thread") ) { | 578 | if ( project->isActiveConfig("thread") ) { |
463 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RTMT"]; | 579 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RTMT"]; |
464 | } else { | 580 | } else { |
465 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RT"]; | 581 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RT"]; |
466 | } | 582 | } |
467 | if ( project->isActiveConfig("moc") ) { | 583 | if ( project->isActiveConfig("moc") ) { |
468 | setMocAware(TRUE); | 584 | setMocAware(TRUE); |
469 | } | 585 | } |
470 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 586 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
587 | // Update -lname to name.lib, and -Ldir to | ||
588 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | ||
589 | for( QStringList::Iterator stIt = libList.begin(); stIt != libList.end(); ) { | ||
590 | QString s = *stIt; | ||
591 | if( s.startsWith( "-l" ) ) { | ||
592 | stIt = libList.remove( stIt ); | ||
593 | stIt = libList.insert( stIt, s.mid( 2 ) + ".lib" ); | ||
594 | } else if( s.startsWith( "-L" ) ) { | ||
595 | stIt = libList.remove( stIt ); | ||
596 | project->variables()["QMAKE_LIBDIR"].append(QDir::convertSeparators(s.mid( 2 ))); | ||
597 | } else { | ||
598 | stIt++; | ||
599 | } | ||
600 | } | ||
471 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 601 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
472 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 602 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
473 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 603 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
474 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 604 | QStringList::Iterator it; |
605 | for(it = l.begin(); it != l.end(); ++it) { | ||
475 | QStringList &gdmf = project->variables()[(*it)]; | 606 | QStringList &gdmf = project->variables()[(*it)]; |
476 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 607 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
477 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 608 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
478 | } | 609 | } |
479 | 610 | ||
480 | if ( !project->variables()["RC_FILE"].isEmpty()) { | 611 | if ( !project->variables()["RC_FILE"].isEmpty()) { |
481 | if ( !project->variables()["RES_FILE"].isEmpty()) { | 612 | if ( !project->variables()["RES_FILE"].isEmpty()) { |
482 | fprintf(stderr, "Both .rc and .res file specified.\n"); | 613 | fprintf(stderr, "Both .rc and .res file specified.\n"); |
483 | fprintf(stderr, "Please specify one of them, not both."); | 614 | fprintf(stderr, "Please specify one of them, not both."); |
484 | exit(666); | 615 | exit(666); |
485 | } | 616 | } |
486 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | 617 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; |
487 | project->variables()["RES_FILE"].first().replace(".rc",".res"); | 618 | project->variables()["RES_FILE"].first().replace(".rc",".res"); |
488 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | 619 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; |
620 | project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"]; | ||
489 | } | 621 | } |
490 | MakefileGenerator::init(); | 622 | MakefileGenerator::init(); |
491 | if ( !project->variables()["VERSION"].isEmpty()) { | 623 | if ( !project->variables()["VERSION"].isEmpty()) { |
492 | QStringList l = QStringList::split('.', project->first("VERSION")); | 624 | QStringList l = QStringList::split('.', project->first("VERSION")); |
493 | project->variables()["VER_MAJ"].append(l[0]); | 625 | project->variables()["VER_MAJ"].append(l[0]); |
494 | project->variables()["VER_MIN"].append(l[1]); | 626 | project->variables()["VER_MIN"].append(l[1]); |
495 | } | 627 | } |
496 | 628 | ||
497 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 629 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
498 | // bcc does not generate a .tds file for static libs | 630 | // bcc does not generate a .tds file for static libs |
499 | QString tdsPostfix; | 631 | QString tdsPostfix; |
500 | if ( !project->variables()["VERSION"].isEmpty() ) { | 632 | if ( !project->variables()["VERSION"].isEmpty() ) { |
501 | tdsPostfix = QStringList::split( '.', project->first("VERSION") ).join("") | 633 | tdsPostfix = QStringList::split( '.', project->first("VERSION") ).join("") |
502 | + ".tds"; | 634 | + ".tds"; |
503 | } else { | 635 | } else { |
504 | tdsPostfix = ".tds"; | 636 | tdsPostfix = ".tds"; |
505 | } | 637 | } |
506 | project->variables()["QMAKE_CLEAN"].append( | 638 | project->variables()["QMAKE_CLEAN"].append( |
507 | project->first("DESTDIR") + project->first("TARGET") + tdsPostfix ); | 639 | project->first("DESTDIR") + project->first("TARGET") + tdsPostfix ); |
508 | } | 640 | } |
641 | |||
642 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
643 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
644 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
645 | if(tmp_out.isEmpty()) | ||
646 | continue; | ||
647 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
648 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
649 | QStringList &inputs = project->variables()[(*it2)]; | ||
650 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
651 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
652 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
653 | out = tmp_out; | ||
654 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
655 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
656 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
657 | project->variables()["OBJCOMP"] += out; | ||
658 | } | ||
659 | } | ||
660 | } | ||
509 | } | 661 | } |
diff --git a/qmake/generators/win32/borland_bmake.h b/qmake/generators/win32/borland_bmake.h index 5ffed58..700e7f7 100644 --- a/qmake/generators/win32/borland_bmake.h +++ b/qmake/generators/win32/borland_bmake.h | |||
@@ -1,58 +1,57 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of BorlandMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __BORLAND_BMAKE_H__ | 36 | #ifndef __BORLAND_BMAKE_H__ |
38 | #define __BORLAND_BMAKE_H__ | 37 | #define __BORLAND_BMAKE_H__ |
39 | 38 | ||
40 | #include "winmakefile.h" | 39 | #include "winmakefile.h" |
41 | 40 | ||
42 | class BorlandMakefileGenerator : public Win32MakefileGenerator | 41 | class BorlandMakefileGenerator : public Win32MakefileGenerator |
43 | { | 42 | { |
44 | bool init_flag; | 43 | bool init_flag; |
45 | void writeBorlandParts(QTextStream &); | 44 | void writeBorlandParts(QTextStream &); |
46 | 45 | ||
47 | bool writeMakefile(QTextStream &); | 46 | bool writeMakefile(QTextStream &); |
48 | void init(); | 47 | void init(); |
49 | 48 | ||
50 | public: | 49 | public: |
51 | BorlandMakefileGenerator(QMakeProject *p); | 50 | BorlandMakefileGenerator(QMakeProject *p); |
52 | ~BorlandMakefileGenerator(); | 51 | ~BorlandMakefileGenerator(); |
53 | }; | 52 | }; |
54 | 53 | ||
55 | inline BorlandMakefileGenerator::~BorlandMakefileGenerator() | 54 | inline BorlandMakefileGenerator::~BorlandMakefileGenerator() |
56 | { } | 55 | { } |
57 | 56 | ||
58 | #endif /* __BORLAND_BMAKE_H__ */ | 57 | #endif /* __BORLAND_BMAKE_H__ */ |
diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 7f58a55..c693d6a 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp | |||
@@ -1,524 +1,708 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of MingwMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
15 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
20 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
21 | ** with the Software. | 21 | ** with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #include "mingw_make.h" | 36 | #include "mingw_make.h" |
37 | #include "option.h" | 37 | #include "option.h" |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | #include <time.h> | 41 | #include <time.h> |
42 | 42 | ||
43 | 43 | ||
44 | MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 44 | MingwMakefileGenerator::MingwMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
45 | { | 45 | { |
46 | Option::obj_ext = ".o"; | 46 | Option::obj_ext = ".o"; |
47 | } | 47 | } |
48 | 48 | ||
49 | bool | 49 | bool |
50 | MingwMakefileGenerator::writeMakefile(QTextStream &t) | 50 | MingwMakefileGenerator::findLibraries() // todo - pascal |
51 | { | 51 | { |
52 | writeHeader(t); | 52 | return TRUE; |
53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 53 | } |
54 | t << "all clean:" << "\n\t" | 54 | |
55 | << "@echo \"Some of the required modules (" | 55 | bool |
56 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | 56 | MingwMakefileGenerator::writeMakefile(QTextStream &t) |
57 | << "@echo \"Skipped.\"" << endl << endl; | 57 | { |
58 | writeMakeQmake(t); | 58 | writeHeader(t); |
59 | return TRUE; | 59 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
60 | } | 60 | t << "all clean:" << "\n\t" |
61 | 61 | << "@echo \"Some of the required modules (" | |
62 | if(project->first("TEMPLATE") == "app" || | 62 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" |
63 | project->first("TEMPLATE") == "lib") { | 63 | << "@echo \"Skipped.\"" << endl << endl; |
64 | writeMingwParts(t); | 64 | writeMakeQmake(t); |
65 | return MakefileGenerator::writeMakefile(t); | 65 | return TRUE; |
66 | } | 66 | } |
67 | else if(project->first("TEMPLATE") == "subdirs") { | 67 | |
68 | writeSubDirs(t); | 68 | if(project->first("TEMPLATE") == "app" || |
69 | return TRUE; | 69 | project->first("TEMPLATE") == "lib") { |
70 | } | 70 | writeMingwParts(t); |
71 | return FALSE; | 71 | return MakefileGenerator::writeMakefile(t); |
72 | } | 72 | } |
73 | 73 | else if(project->first("TEMPLATE") == "subdirs") { | |
74 | void | 74 | writeSubDirs(t); |
75 | MingwMakefileGenerator::writeMingwParts(QTextStream &t) | 75 | return TRUE; |
76 | { | 76 | } |
77 | t << "####### Compiler, tools and options" << endl << endl; | 77 | return FALSE; |
78 | t << "CC =" << var("QMAKE_CC") << endl; | 78 | } |
79 | t << "CXX =" << var("QMAKE_CXX") << endl; | 79 | |
80 | t << "LEX = " << var("QMAKE_LEX") << endl; | 80 | void createLdObjectScriptFile(const QString & fileName, QStringList & objList) |
81 | t << "YACC = " << var("QMAKE_YACC") << endl; | 81 | { |
82 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " | 82 | QString filePath = Option::output_dir + QDir::separator() + fileName; |
83 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 83 | QFile file(filePath); |
84 | << varGlue("DEFINES","-D"," -D","") << endl; | 84 | if (file.open(IO_WriteOnly | IO_Translate )) { |
85 | t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " " | 85 | QTextStream t(&file); |
86 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 86 | t << "INPUT(" << endl; |
87 | << varGlue("DEFINES","-D"," -D","") << endl; | 87 | for (QStringList::Iterator it = objList.begin(); it != objList.end(); ++it ) { |
88 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; | 88 | t << *it << endl; |
89 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; | 89 | } |
90 | 90 | t << ");" << endl; | |
91 | t << "INCPATH ="; | 91 | file.close(); |
92 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 92 | } |
93 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 93 | } |
94 | QString inc = (*incit); | 94 | |
95 | inc.replace(QRegExp("\\\\$"), "\\\\"); | 95 | void |
96 | inc.replace(QRegExp("\""), ""); | 96 | MingwMakefileGenerator::writeMingwParts(QTextStream &t) |
97 | t << " -I" << inc ; | 97 | { |
98 | } | 98 | t << "####### Compiler, tools and options" << endl << endl; |
99 | t << " -I" << specdir() | 99 | t << "CC =" << var("QMAKE_CC") << endl; |
100 | << endl; | 100 | t << "CXX =" << var("QMAKE_CXX") << endl; |
101 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 101 | t << "LEX = " << var("QMAKE_LEX") << endl; |
102 | t << "LINK =" << var("QMAKE_LINK") << endl; | 102 | t << "YACC = " << var("QMAKE_YACC") << endl; |
103 | t << "LFLAGS ="; | 103 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " |
104 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 104 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
105 | t << varGlue("QMAKE_LIBDIR","-L",";","") << " "; | 105 | << varGlue("DEFINES","-D"," -D","") << endl; |
106 | t << var("QMAKE_LFLAGS") << endl; | 106 | t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " " |
107 | t << "LIBS =" << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl; | 107 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
108 | } | 108 | << varGlue("DEFINES","-D"," -D","") << endl; |
109 | else { | 109 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; |
110 | t << "LIB =" << var("QMAKE_LIB") << endl; | 110 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; |
111 | } | 111 | |
112 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | 112 | t << "INCPATH ="; |
113 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; | 113 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
114 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | 114 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
115 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | 115 | QString inc = (*incit); |
116 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | 116 | inc.replace(QRegExp("\\\\$"), "\\\\"); |
117 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | 117 | inc.replace(QRegExp("\""), ""); |
118 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : | 118 | t << " -I" << "\"" << inc << "\""; |
119 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; | 119 | } |
120 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : | 120 | t << " -I" << "\"" << specdir() << "\"" << endl; |
121 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; | 121 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
122 | t << "ZIP =" << var("QMAKE_ZIP") << endl; | 122 | t << "LINK =" << var("QMAKE_LINK") << endl; |
123 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; | 123 | t << "LFLAGS =" << var("QMAKE_LFLAGS") << endl; |
124 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; | 124 | t << "LIBS ="; |
125 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; | 125 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
126 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; | 126 | t << varGlue("QMAKE_LIBDIR","-L\"","\" -L\"","\"") << " "; |
127 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; | 127 | t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl; |
128 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 128 | } |
129 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; | 129 | else { |
130 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | 130 | t << "LIB =" << var("QMAKE_LIB") << endl; |
131 | t << endl; | 131 | } |
132 | 132 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | |
133 | t << "####### Output directory" << endl << endl; | 133 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; |
134 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) | 134 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : |
135 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl; | 135 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; |
136 | else | 136 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : |
137 | t << "OBJECTS_DIR = . " << endl; | 137 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; |
138 | if (! project->variables()["MOC_DIR"].isEmpty()) | 138 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : |
139 | t << "MOC_DIR = " << var("MOC_DIR").replace(QRegExp("\\\\$"),"") << endl; | 139 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; |
140 | else | 140 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : |
141 | t << "MOC_DIR = . " << endl; | 141 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; |
142 | t << endl; | 142 | t << "ZIP =" << var("QMAKE_ZIP") << endl; |
143 | 143 | t << "DEF_FILE =" << varList("DEF_FILE") << endl; | |
144 | t << "####### Files" << endl << endl; | 144 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; |
145 | t << "HEADERS =" << varList("HEADERS") << endl; | 145 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; |
146 | t << "SOURCES =" << varList("SOURCES") << endl; | 146 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; |
147 | // t << "OBJECTS =" << varList("OBJECTS").replace(QRegExp("\\.obj"),".o") << endl; | 147 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; |
148 | t << "OBJECTS =" << varList("OBJECTS") << endl; | 148 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
149 | t << "FORMS =" << varList("FORMS") << endl; | 149 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; |
150 | t << "UICDECLS =" << varList("UICDECLS") << endl; | 150 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; |
151 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; | 151 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; |
152 | t << "SRCMOC =" << varList("SRCMOC") << endl; | 152 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; |
153 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 153 | t << endl; |
154 | // t << "OBJMOC =" << varList("OBJMOC").replace(QRegExp("\\.obj"),".o") << endl; | 154 | |
155 | t << "DIST =" << varList("DISTFILES") << endl; | 155 | t << "####### Output directory" << endl << endl; |
156 | t << "TARGET ="; | 156 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) |
157 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) | 157 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl; |
158 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); | 158 | else |
159 | else | 159 | t << "OBJECTS_DIR = . " << endl; |
160 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | 160 | if (! project->variables()["MOC_DIR"].isEmpty()) |
161 | t << endl; | 161 | t << "MOC_DIR = " << var("MOC_DIR").replace(QRegExp("\\\\$"),"") << endl; |
162 | t << endl; | 162 | else |
163 | 163 | t << "MOC_DIR = . " << endl; | |
164 | t << "####### Implicit rules" << endl << endl; | 164 | t << endl; |
165 | t << ".SUFFIXES: .cpp .cxx .cc .C .c" << endl << endl; | 165 | |
166 | t << ".cpp.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 166 | t << "####### Files" << endl << endl; |
167 | t << ".cxx.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 167 | t << "HEADERS =" << varList("HEADERS") << endl; |
168 | t << ".cc.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 168 | t << "SOURCES =" << varList("SOURCES") << endl; |
169 | t << ".C.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 169 | QString objectsLinkLine; |
170 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | 170 | if (!project->variables()["QMAKE_APP_OR_DLL"].isEmpty() && |
171 | 171 | project->variables()["OBJECTS"].count() > var("QMAKE_LINK_OBJECT_MAX").toUInt()) { | |
172 | t << "####### Build rules" << endl << endl; | 172 | createLdObjectScriptFile(var("QMAKE_LINK_OBJECT_SCRIPT"), project->variables()["OBJECTS"]); |
173 | t << "all: " << "$(OBJECTS_DIR) " << "$(MOC_DIR) " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; | 173 | objectsLinkLine = var("QMAKE_LINK_OBJECT_SCRIPT"); |
174 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 174 | } else { |
175 | << var("POST_TARGETDEPS"); | 175 | objectsLinkLine = "$(OBJECTS)"; |
176 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 176 | } |
177 | t << "\n\t" << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; | 177 | t << "OBJECTS =" << varList("OBJECTS") << endl; |
178 | } else { | 178 | t << "FORMS =" << varList("FORMS") << endl; |
179 | t << "\n\t" << "$(LIB) $(TARGET) $(OBJECTS) $(OBJMOC)"; | 179 | t << "UICDECLS =" << varList("UICDECLS") << endl; |
180 | } | 180 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; |
181 | 181 | t << "SRCMOC =" << varList("SRCMOC") << endl; | |
182 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { | 182 | QString objmocLinkLine; |
183 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 183 | if (!project->variables()["QMAKE_APP_OR_DLL"].isEmpty() && |
184 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 184 | project->variables()["OBJMOC"].count() > var("QMAKE_LINK_OBJECT_MAX").toUInt()) { |
185 | t << "\n\t" << "copy $(TARGET) " << *dlldir; | 185 | createLdObjectScriptFile(var("QMAKE_LINK_OBJMOC_SCRIPT"), project->variables()["OBJMOC"]); |
186 | } | 186 | objmocLinkLine = var("QMAKE_LINK_OBJMOC_SCRIPT"); |
187 | } | 187 | } else { |
188 | QString targetfilename = project->variables()["TARGET"].first(); | 188 | objmocLinkLine = "$(OBJMOC)"; |
189 | if(project->isActiveConfig("activeqt")) { | 189 | } |
190 | QString version = project->variables()["VERSION"].first(); | 190 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
191 | if ( version.isEmpty() ) | 191 | QString extraCompilerDeps; |
192 | version = "1.0"; | 192 | if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) { |
193 | 193 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | |
194 | if ( project->isActiveConfig("dll")) { | 194 | extraCompilerDeps += " $(OBJCOMP) "; |
195 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 195 | |
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"); | 196 | QStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; |
197 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 197 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { |
198 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | 198 | QStringList &vars = project->variables()[(*compit) + ".variables"]; |
199 | } else { | 199 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { |
200 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | 200 | QStringList vals = project->variables()[(*varit)]; |
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"); | 201 | if(!vals.isEmpty()) |
202 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 202 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; |
203 | t << "\n\t" << "-$(TARGET) -regserver"; | 203 | } |
204 | } | 204 | } |
205 | } | 205 | } |
206 | t << endl << endl; | 206 | |
207 | 207 | t << "DIST =" << varList("DISTFILES") << endl; | |
208 | if(!project->variables()["RC_FILE"].isEmpty()) { | 208 | t << "TARGET ="; |
209 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" | 209 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) |
210 | << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),".o") << endl << endl; | 210 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); |
211 | } | 211 | else |
212 | project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),".o"); | 212 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); |
213 | 213 | t << endl; | |
214 | t << "mocables: $(SRCMOC)" << endl << endl; | 214 | t << endl; |
215 | 215 | ||
216 | t << "$(OBJECTS_DIR):" << "\n\t" | 216 | t << "####### Implicit rules" << endl << endl; |
217 | << "@if not exist $(OBJECTS_DIR) mkdir $(OBJECTS_DIR)" << endl << endl; | 217 | t << ".SUFFIXES: .cpp .cxx .cc .C .c" << endl << endl; |
218 | 218 | t << ".cpp.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | |
219 | t << "$(MOC_DIR):" << "\n\t" | 219 | t << ".cxx.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
220 | << "@if not exist $(MOC_DIR) mkdir $(MOC_DIR)" << endl << endl; | 220 | t << ".cc.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
221 | 221 | t << ".C.o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | |
222 | writeMakeQmake(t); | 222 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
223 | 223 | ||
224 | t << "dist:" << "\n\t" | 224 | t << "####### Build rules" << endl << endl; |
225 | << "$(ZIP) " << var("PROJECT") << ".zip " | 225 | t << "all: " << "$(OBJECTS_DIR) " << "$(MOC_DIR) " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; |
226 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; | 226 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
227 | 227 | << extraCompilerDeps << var("POST_TARGETDEPS"); | |
228 | t << "clean:" | 228 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
229 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o") | 229 | t << "\n\t" << "$(LINK) $(LFLAGS) -o $(TARGET) " << objectsLinkLine << " " << objmocLinkLine << " $(LIBS)"; |
230 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 230 | } else { |
231 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","").replace(QRegExp("\\.obj"),".o") | 231 | t << "\n\t" << "$(LIB) $(TARGET) " << objectsLinkLine << " " << objmocLinkLine; |
232 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | 232 | } |
233 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | 233 | t << extraCompilerDeps; |
234 | << "\n\t-del $(TARGET)" | 234 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { |
235 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | 235 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
236 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | 236 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
237 | if ( project->isActiveConfig("activeqt")) { | 237 | t << "\n\t" << "$(COPY_FILE) \"$(TARGET)\" " << *dlldir; |
238 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 238 | } |
239 | t << "\n\t-del tmp\\dump.*"; | 239 | } |
240 | } | 240 | QString targetfilename = project->variables()["TARGET"].first(); |
241 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) | 241 | if(project->isActiveConfig("activeqt")) { |
242 | t << "\n\t-del " << var("DLLDESTDIR") << "\\" << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | 242 | QString version = project->variables()["VERSION"].first(); |
243 | if(!project->isEmpty("IMAGES")) | 243 | if ( version.isEmpty() ) |
244 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 244 | version = "1.0"; |
245 | 245 | ||
246 | // blasted user defined targets | 246 | if ( project->isActiveConfig("dll")) { |
247 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 247 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
248 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 248 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
249 | QString targ = var((*it) + ".target"), | 249 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
250 | cmd = var((*it) + ".commands"), deps; | 250 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); |
251 | if(targ.isEmpty()) | 251 | } else { |
252 | targ = (*it); | 252 | t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
253 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 253 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
254 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 254 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
255 | QString dep = var((*dep_it) + ".target"); | 255 | t << "\n\t" << "-$(TARGET) -regserver"; |
256 | if(dep.isEmpty()) | 256 | } |
257 | dep = (*dep_it); | 257 | } |
258 | deps += " " + dep; | 258 | t << endl << endl; |
259 | } | 259 | |
260 | t << "\n\n" << targ << ":" << deps << "\n\t" | 260 | if(!project->variables()["RC_FILE"].isEmpty()) { |
261 | << cmd; | 261 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" |
262 | } | 262 | << var("QMAKE_RC") << " -i " << var("RC_FILE") << " -o " << var("RC_FILE").replace(QRegExp("\\.rc"),".o") << " --include-dir=" << QFileInfo(var("RC_FILE")).dirPath() << endl << endl; |
263 | 263 | } | |
264 | t << endl << endl; | 264 | project->variables()["RES_FILE"].first().replace(QRegExp("\\.rc"),".o"); |
265 | } | 265 | |
266 | 266 | t << "mocables: $(SRCMOC)" << endl << endl; | |
267 | 267 | ||
268 | void | 268 | t << "$(OBJECTS_DIR):" << "\n\t" |
269 | MingwMakefileGenerator::init() | 269 | << "@if not exist $(OBJECTS_DIR) $(MKDIR) $(OBJECTS_DIR)" << endl << endl; |
270 | { | 270 | |
271 | if(init_flag) | 271 | t << "$(MOC_DIR):" << "\n\t" |
272 | return; | 272 | << "@if not exist $(MOC_DIR) $(MKDIR) $(MOC_DIR)" << endl << endl; |
273 | init_flag = TRUE; | 273 | |
274 | 274 | writeMakeQmake(t); | |
275 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 275 | |
276 | if(project->first("TEMPLATE") == "app") | 276 | t << "dist:" << "\n\t" |
277 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 277 | << "$(ZIP) " << var("PROJECT") << ".zip " |
278 | else if(project->first("TEMPLATE") == "lib") | 278 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; |
279 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 279 | |
280 | else if(project->first("TEMPLATE") == "subdirs") { | 280 | t << "clean:" |
281 | MakefileGenerator::init(); | 281 | << varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","").replace(QRegExp("\\.obj"),".o") |
282 | if(project->variables()["MAKEFILE"].isEmpty()) | 282 | << varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
283 | project->variables()["MAKEFILE"].append("Makefile"); | 283 | << varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","").replace(QRegExp("\\.obj"),".o") |
284 | if(project->variables()["QMAKE"].isEmpty()) | 284 | << varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
285 | project->variables()["QMAKE"].append("qmake"); | 285 | << varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
286 | return; | 286 | << "\n\t-$(DEL_FILE) $(TARGET)" |
287 | } | 287 | << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
288 | 288 | << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ",""); | |
289 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 289 | if ( project->isActiveConfig("activeqt")) { |
290 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 290 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl"); |
291 | 291 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb"); | |
292 | // LIBS defined in Profile comes first for gcc | 292 | } |
293 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 293 | if(!project->isEmpty("IMAGES")) |
294 | 294 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", ""); | |
295 | QString targetfilename = project->variables()["TARGET"].first(); | 295 | |
296 | QStringList &configs = project->variables()["CONFIG"]; | 296 | // user defined targets |
297 | if (project->isActiveConfig("qt") && project->isActiveConfig("shared")) | 297 | QStringList::Iterator it; |
298 | project->variables()["DEFINES"].append("QT_DLL"); | 298 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
299 | if (project->isActiveConfig("qt_dll")) | 299 | |
300 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 300 | for(it = qut.begin(); it != qut.end(); ++it) { |
301 | if ( project->isActiveConfig("qt") ) { | 301 | QString targ = var((*it) + ".target"), |
302 | if ( project->isActiveConfig( "plugin" ) ) { | 302 | cmd = var((*it) + ".commands"), deps; |
303 | project->variables()["CONFIG"].append("dll"); | 303 | if(targ.isEmpty()) |
304 | if(project->isActiveConfig("qt")) | 304 | targ = (*it); |
305 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 305 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
306 | } | 306 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
307 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && | 307 | QString dep = var((*dep_it) + ".target"); |
308 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || | 308 | if(dep.isEmpty()) |
309 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || | 309 | dep = (*dep_it); |
310 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { | 310 | deps += " " + dep; |
311 | project->variables()["QMAKE_QT_DLL"].append("1"); | 311 | } |
312 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | 312 | t << "\n\n" << targ << ":" << deps << "\n\t" |
313 | project->variables()["CONFIG"].append("dll"); | 313 | << cmd; |
314 | } | 314 | } |
315 | if ( project->isActiveConfig("thread") ) | 315 | |
316 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | 316 | t << endl << endl; |
317 | if ( project->isActiveConfig("accessibility" ) ) | 317 | |
318 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 318 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; |
319 | if ( project->isActiveConfig("tablet") ) | 319 | for(it = quc.begin(); it != quc.end(); ++it) { |
320 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 320 | QString tmp_out = project->variables()[(*it) + ".output"].first(); |
321 | } | 321 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); |
322 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 322 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); |
323 | project->variables()["CONFIG"].remove("staticlib"); | 323 | QStringList &vars = project->variables()[(*it) + ".variables"]; |
324 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); | 324 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) |
325 | } else { | 325 | continue; |
326 | project->variables()["CONFIG"].append("staticlib"); | 326 | QStringList &tmp = project->variables()[(*it) + ".input"]; |
327 | } | 327 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { |
328 | if ( project->isActiveConfig("warn_off") ) { | 328 | QStringList &inputs = project->variables()[(*it2)]; |
329 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | 329 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { |
330 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | 330 | QFileInfo fi(Option::fixPathToLocalOS((*input))); |
331 | } else if ( project->isActiveConfig("warn_on") ) { | 331 | QString in = Option::fixPathToTargetOS((*input), FALSE), |
332 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | 332 | out = tmp_out, cmd = tmp_cmd, deps; |
333 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | 333 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); |
334 | } | 334 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); |
335 | if ( project->isActiveConfig("debug") ) { | 335 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); |
336 | if ( project->isActiveConfig("thread") ) { | 336 | cmd.replace("${QMAKE_FILE_OUT}", out); |
337 | // use the DLL RT even here | 337 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); |
338 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | 338 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) |
339 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; | 339 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); |
340 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 340 | if(!tmp_dep.isEmpty()) { |
341 | } else { | 341 | char buff[256]; |
342 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; | 342 | QString dep_cmd = tmp_dep; |
343 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | 343 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); |
344 | } | 344 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { |
345 | } | 345 | while(!feof(proc)) { |
346 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | 346 | int read_in = int(fread(buff, 1, 255, proc)); |
347 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | 347 | if(!read_in) |
348 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | 348 | break; |
349 | } else { | 349 | int l = 0; |
350 | if ( project->isActiveConfig("thread") ) { | 350 | for(int i = 0; i < read_in; i++) { |
351 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | 351 | if(buff[i] == '\n' || buff[i] == ' ') { |
352 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; | 352 | deps += " " + QCString(buff+l, (i - l) + 1); |
353 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | 353 | l = i; |
354 | } else { | 354 | } |
355 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; | 355 | } |
356 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | 356 | } |
357 | } | 357 | fclose(proc); |
358 | } | 358 | } |
359 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | 359 | } |
360 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | 360 | t << out << ": " << in << deps << "\n\t" |
361 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | 361 | << cmd << endl << endl; |
362 | } | 362 | } |
363 | 363 | } | |
364 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) | 364 | } |
365 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | 365 | t << endl; |
366 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) | 366 | } |
367 | project->variables()["CONFIG"].append("windows"); | 367 | |
368 | if ( project->isActiveConfig("qt") ) { | 368 | |
369 | project->variables()["CONFIG"].append("moc"); | 369 | void |
370 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 370 | MingwMakefileGenerator::init() |
371 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 371 | { |
372 | if ( !project->isActiveConfig("debug") ) | 372 | if(init_flag) |
373 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 373 | return; |
374 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 374 | init_flag = TRUE; |
375 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { | 375 | |
376 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 376 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
377 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; | 377 | if(project->first("TEMPLATE") == "app") |
378 | } | 378 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
379 | } else { | 379 | else if(project->first("TEMPLATE") == "lib") |
380 | if(project->isActiveConfig("thread")) | 380 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
381 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 381 | else if(project->first("TEMPLATE") == "subdirs") { |
382 | else | 382 | MakefileGenerator::init(); |
383 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 383 | if(project->variables()["MAKEFILE"].isEmpty()) |
384 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 384 | project->variables()["MAKEFILE"].append("Makefile"); |
385 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 385 | if(project->variables()["QMAKE"].isEmpty()) |
386 | if ( hver == -1 ) | 386 | project->variables()["QMAKE"].append("qmake"); |
387 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | 387 | return; |
388 | if(hver != -1) { | 388 | } |
389 | QString ver; | 389 | |
390 | ver.sprintf("libqt-%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | 390 | if(project->isEmpty("QMAKE_INSTALL_FILE")) |
391 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 391 | project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)"); |
392 | // @@@HGTODO maybe we must change the replace regexp if we understand what's going on | 392 | if(project->isEmpty("QMAKE_INSTALL_DIR")) |
393 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 393 | project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)"); |
394 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | 394 | |
395 | } | 395 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
396 | } | 396 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
397 | if ( project->isActiveConfig( "activeqt" ) ) { | 397 | |
398 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 398 | // LIBS defined in Profile comes first for gcc |
399 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 399 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
400 | if ( project->isActiveConfig( "dll" ) ) | 400 | |
401 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 401 | QString targetfilename = project->variables()["TARGET"].first(); |
402 | } | 402 | QStringList &configs = project->variables()["CONFIG"]; |
403 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 403 | |
404 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 404 | if (project->isActiveConfig("qt") && project->isActiveConfig("shared")) |
405 | } | 405 | project->variables()["DEFINES"].append("QT_DLL"); |
406 | } | 406 | |
407 | } | 407 | if (project->isActiveConfig("qt_dll")) |
408 | if ( project->isActiveConfig("opengl") ) { | 408 | if (configs.findIndex("qt") == -1) |
409 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 409 | configs.append("qt"); |
410 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 410 | |
411 | } | 411 | if ( project->isActiveConfig("qt") ) { |
412 | if ( project->isActiveConfig("dll") ) { | 412 | if ( project->isActiveConfig( "plugin" ) ) { |
413 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | 413 | project->variables()["CONFIG"].append("dll"); |
414 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | 414 | if(project->isActiveConfig("qt")) |
415 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | 415 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
416 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | 416 | } |
417 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { | 417 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && |
418 | project->variables()["TARGET_EXT"].append( | 418 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || |
419 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); | 419 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || |
420 | } else { | 420 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { |
421 | project->variables()["TARGET_EXT"].append(".dll"); | 421 | project->variables()["QMAKE_QT_DLL"].append("1"); |
422 | } | 422 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) |
423 | } else { | 423 | project->variables()["CONFIG"].append("dll"); |
424 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | 424 | } |
425 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | 425 | if ( project->isActiveConfig("thread") ) |
426 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | 426 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); |
427 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | 427 | if ( project->isActiveConfig("accessibility" ) ) |
428 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 428 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
429 | project->variables()["TARGET_EXT"].append(".exe"); | 429 | if ( project->isActiveConfig("tablet") ) |
430 | } else { | 430 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
431 | project->variables()["TARGET_EXT"].append(".a"); | 431 | } |
432 | project->variables()["QMAKE_LFLAGS"].append("-static"); | 432 | |
433 | if(project->variables()["TARGET"].first().left(3) != "lib") | 433 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
434 | project->variables()["TARGET"].first().prepend("lib"); | 434 | project->variables()["CONFIG"].remove("staticlib"); |
435 | } | 435 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); |
436 | } | 436 | } else { |
437 | if ( project->isActiveConfig("windows") ) { | 437 | project->variables()["CONFIG"].append("staticlib"); |
438 | if ( project->isActiveConfig("console") ) { | 438 | } |
439 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 439 | |
440 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 440 | if ( project->isActiveConfig("warn_off") ) { |
441 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 441 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; |
442 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 442 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; |
443 | } else { | 443 | } else if ( project->isActiveConfig("warn_on") ) { |
444 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | 444 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; |
445 | } | 445 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; |
446 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 446 | } |
447 | } else { | 447 | |
448 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 448 | if ( project->isActiveConfig("debug") ) { |
449 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 449 | if ( project->isActiveConfig("thread") ) { |
450 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 450 | // use the DLL RT even here |
451 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 451 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { |
452 | } | 452 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; |
453 | 453 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | |
454 | if ( project->isActiveConfig("moc") ) | 454 | } else { |
455 | setMocAware(TRUE); | 455 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; |
456 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 456 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; |
457 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 457 | } |
458 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 458 | } |
459 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 459 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; |
460 | QStringList &gdmf = project->variables()[(*it)]; | 460 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; |
461 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 461 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; |
462 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 462 | } else { |
463 | } | 463 | if ( project->isActiveConfig("thread") ) { |
464 | 464 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | |
465 | if ( project->isActiveConfig("dll") ) | 465 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; |
466 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") + project->first("DESTDIR") + "\\lib"+ project->first("TARGET") + ".a"); | 466 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; |
467 | 467 | } else { | |
468 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | 468 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; |
469 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--output-def,") + project->first("DEF_FILE")); | 469 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; |
470 | // if(!project->isActiveConfig("incremental")) | 470 | } |
471 | //project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | 471 | } |
472 | 472 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | |
473 | #if 0 | 473 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; |
474 | if ( !project->variables()["VERSION"].isEmpty() ) { | 474 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; |
475 | QString version = project->variables()["VERSION"][0]; | 475 | } |
476 | int firstDot = version.find( "." ); | 476 | |
477 | QString major = version.left( firstDot ); | 477 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) |
478 | QString minor = version.right( version.length() - firstDot - 1 ); | 478 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; |
479 | minor.replace( ".", "" ); | 479 | |
480 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | 480 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) |
481 | } | 481 | project->variables()["CONFIG"].append("windows"); |
482 | #endif | 482 | |
483 | if ( !project->variables()["RC_FILE"].isEmpty()) { | 483 | if ( project->isActiveConfig("qt") ) { |
484 | if ( !project->variables()["RES_FILE"].isEmpty()) { | 484 | project->variables()["CONFIG"].append("moc"); |
485 | fprintf(stderr, "Both .rc and .res file specified.\n"); | 485 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
486 | fprintf(stderr, "Please specify one of them, not both."); | 486 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
487 | exit(666); | 487 | if ( !project->isActiveConfig("debug") ) |
488 | } | 488 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
489 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | 489 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
490 | project->variables()["RES_FILE"].first().replace(".rc",".o"); | 490 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { |
491 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | 491 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
492 | } | 492 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; |
493 | if ( !project->variables()["RES_FILE"].isEmpty()) | 493 | } |
494 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | 494 | } else { |
495 | 495 | ||
496 | MakefileGenerator::init(); | 496 | if(project->isActiveConfig("thread")) |
497 | if ( !project->variables()["VERSION"].isEmpty()) { | 497 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
498 | QStringList l = QStringList::split('.', project->first("VERSION")); | 498 | else |
499 | project->variables()["VER_MAJ"].append(l[0]); | 499 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
500 | project->variables()["VER_MIN"].append(l[1]); | 500 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
501 | } | 501 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
502 | if(project->isActiveConfig("dll")) { | 502 | if ( hver == -1 ) |
503 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a"); | 503 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); |
504 | } | 504 | if(hver != -1) { |
505 | } | 505 | QString ver; |
506 | 506 | ver.sprintf("libqt-%s" QTDLL_POSTFIX "%d.a", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | |
507 | void | 507 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
508 | MingwMakefileGenerator::writeSubDirs(QTextStream &t) | 508 | // @@@HGTODO maybe we must change the replace regexp if we understand what's going on |
509 | { | 509 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
510 | QString qs ; | 510 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); |
511 | QTextStream ts (&qs, IO_WriteOnly) ; | 511 | } |
512 | Win32MakefileGenerator::writeSubDirs( ts ) ; | 512 | } |
513 | QRegExp rx("(\\n\\tcd [^\\n\\t]+)(\\n\\t.+)\\n\\t@cd ..") ; | 513 | if ( project->isActiveConfig( "activeqt" ) ) { |
514 | rx.setMinimal(true); | 514 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
515 | int pos = 0 ; | 515 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "-lqaxserver"; |
516 | while ( -1 != (pos = rx.search( qs, pos))) | 516 | if ( project->isActiveConfig( "dll" ) ) { |
517 | { | 517 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
518 | QString qsMatch = rx.cap(2); | 518 | } |
519 | qsMatch.replace("\n\t"," && \\\n\t"); | 519 | } |
520 | qs.replace(pos+rx.cap(1).length(), rx.cap(2).length(), qsMatch ); | 520 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
521 | pos += (rx.cap(1).length()+qsMatch.length()); | 521 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
522 | } | 522 | } |
523 | t << qs ; | 523 | |
524 | } | 524 | // QMAKE_LIBS_QT_ENTRY should be first on the link line as it needs qt |
525 | project->variables()["QMAKE_LIBS"].remove(project->variables()["QMAKE_LIBS_QT_ENTRY"].first()); | ||
526 | project->variables()["QMAKE_LIBS"].prepend(project->variables()["QMAKE_LIBS_QT_ENTRY"].first()); | ||
527 | |||
528 | } | ||
529 | } | ||
530 | |||
531 | if ( project->isActiveConfig("opengl") ) { | ||
532 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | ||
533 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | ||
534 | } | ||
535 | |||
536 | if ( project->isActiveConfig("dll") ) { | ||
537 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | ||
538 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | ||
539 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | ||
540 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | ||
541 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { | ||
542 | project->variables()["TARGET_EXT"].append( | ||
543 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); | ||
544 | } else { | ||
545 | project->variables()["TARGET_EXT"].append(".dll"); | ||
546 | } | ||
547 | } else { | ||
548 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | ||
549 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | ||
550 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | ||
551 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | ||
552 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | ||
553 | project->variables()["TARGET_EXT"].append(".exe"); | ||
554 | } else { | ||
555 | project->variables()["TARGET_EXT"].append(".a"); | ||
556 | project->variables()["QMAKE_LFLAGS"].append("-static"); | ||
557 | if(project->variables()["TARGET"].first().left(3) != "lib") | ||
558 | project->variables()["TARGET"].first().prepend("lib"); | ||
559 | } | ||
560 | } | ||
561 | |||
562 | if ( project->isActiveConfig("windows") ) { | ||
563 | if ( project->isActiveConfig("console") ) { | ||
564 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
565 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
566 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
567 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
568 | } else { | ||
569 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | ||
570 | } | ||
571 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | ||
572 | } else { | ||
573 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
574 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
575 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
576 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
577 | } | ||
578 | |||
579 | if ( project->isActiveConfig("exceptions") ) { | ||
580 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | ||
581 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | ||
582 | } else { | ||
583 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | ||
584 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | ||
585 | } | ||
586 | |||
587 | if ( project->isActiveConfig("rtti") ) { | ||
588 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | ||
589 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | ||
590 | } else { | ||
591 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | ||
592 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | ||
593 | } | ||
594 | |||
595 | if ( project->isActiveConfig("moc") ) | ||
596 | setMocAware(TRUE); | ||
597 | |||
598 | // add -L libs to libdir | ||
599 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | ||
600 | for ( QStringList::Iterator libit = libs.begin(); libit != libs.end(); ) { | ||
601 | if ( (*libit).startsWith( "-L" ) ) { | ||
602 | project->variables()["QMAKE_LIBDIR"] += (*libit).mid(2); | ||
603 | libit = libs.remove( libit ); | ||
604 | } else { | ||
605 | ++libit; | ||
606 | } | ||
607 | } | ||
608 | |||
609 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | ||
610 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | ||
611 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | ||
612 | QStringList::Iterator it; | ||
613 | for(it = l.begin(); it != l.end(); ++it) { | ||
614 | QStringList &gdmf = project->variables()[(*it)]; | ||
615 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | ||
616 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | ||
617 | } | ||
618 | |||
619 | if ( project->isActiveConfig("dll") ) { | ||
620 | QString destDir = ""; | ||
621 | if (!project->first("DESTDIR").isEmpty()) | ||
622 | destDir = project->first("DESTDIR") + Option::dir_sep; | ||
623 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,--out-implib,") + | ||
624 | destDir + "lib" + project->first("TARGET") + ".a"); | ||
625 | } | ||
626 | |||
627 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | ||
628 | project->variables()["QMAKE_LFLAGS"].append(QString("-Wl,") + project->first("DEF_FILE")); | ||
629 | // if(!project->isActiveConfig("incremental")) | ||
630 | //project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | ||
631 | |||
632 | #if 0 | ||
633 | if ( !project->variables()["VERSION"].isEmpty() ) { | ||
634 | QString version = project->variables()["VERSION"][0]; | ||
635 | int firstDot = version.find( "." ); | ||
636 | QString major = version.left( firstDot ); | ||
637 | QString minor = version.right( version.length() - firstDot - 1 ); | ||
638 | minor.replace( ".", "" ); | ||
639 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | ||
640 | } | ||
641 | #endif | ||
642 | |||
643 | if ( !project->variables()["RC_FILE"].isEmpty()) { | ||
644 | if ( !project->variables()["RES_FILE"].isEmpty()) { | ||
645 | fprintf(stderr, "Both .rc and .res file specified.\n"); | ||
646 | fprintf(stderr, "Please specify one of them, not both."); | ||
647 | exit(666); | ||
648 | } | ||
649 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | ||
650 | project->variables()["RES_FILE"].first().replace(".rc",".o"); | ||
651 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | ||
652 | project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"]; | ||
653 | } | ||
654 | |||
655 | if ( !project->variables()["RES_FILE"].isEmpty()) | ||
656 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | ||
657 | |||
658 | MakefileGenerator::init(); | ||
659 | |||
660 | if ( !project->variables()["VERSION"].isEmpty()) { | ||
661 | QStringList l = QStringList::split('.', project->first("VERSION")); | ||
662 | project->variables()["VER_MAJ"].append(l[0]); | ||
663 | project->variables()["VER_MIN"].append(l[1]); | ||
664 | } | ||
665 | |||
666 | if(project->isActiveConfig("dll")) { | ||
667 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") +"lib" + project->first("TARGET") + ".a"); | ||
668 | } | ||
669 | |||
670 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
671 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
672 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
673 | if(tmp_out.isEmpty()) | ||
674 | continue; | ||
675 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
676 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
677 | QStringList &inputs = project->variables()[(*it2)]; | ||
678 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
679 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
680 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
681 | out = tmp_out; | ||
682 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
683 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
684 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
685 | project->variables()["OBJCOMP"] += out; | ||
686 | } | ||
687 | } | ||
688 | } | ||
689 | } | ||
690 | |||
691 | void | ||
692 | MingwMakefileGenerator::writeSubDirs(QTextStream &t) | ||
693 | { | ||
694 | QString qs ; | ||
695 | QTextStream ts (&qs, IO_WriteOnly) ; | ||
696 | Win32MakefileGenerator::writeSubDirs( ts ) ; | ||
697 | QRegExp rx("(\\n\\tcd [^\\n\\t]+)(\\n\\t.+)\\n\\t@cd ..") ; | ||
698 | rx.setMinimal(TRUE); | ||
699 | int pos = 0 ; | ||
700 | while ( -1 != (pos = rx.search( qs, pos))) | ||
701 | { | ||
702 | QString qsMatch = rx.cap(2); | ||
703 | qsMatch.replace("\n\t"," && \\\n\t"); | ||
704 | qs.replace(pos+rx.cap(1).length(), rx.cap(2).length(), qsMatch ); | ||
705 | pos += (rx.cap(1).length()+qsMatch.length()); | ||
706 | } | ||
707 | t << qs ; | ||
708 | } | ||
diff --git a/qmake/generators/win32/mingw_make.h b/qmake/generators/win32/mingw_make.h index c00bf1b..d971e3a 100644 --- a/qmake/generators/win32/mingw_make.h +++ b/qmake/generators/win32/mingw_make.h | |||
@@ -1,58 +1,61 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of MingwMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
15 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
20 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
21 | ** with the Software. | 21 | ** with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | #ifndef __MINGW_MAKE_H__ | 35 | |
36 | #define __MINGW_MAKE_H__ | 36 | #ifndef __MINGW_MAKE_H__ |
37 | 37 | #define __MINGW_MAKE_H__ | |
38 | #include "winmakefile.h" | 38 | |
39 | 39 | #include "winmakefile.h" | |
40 | class MingwMakefileGenerator : public Win32MakefileGenerator | 40 | |
41 | { | 41 | class MingwMakefileGenerator : public Win32MakefileGenerator |
42 | bool init_flag; | 42 | { |
43 | void writeMingwParts(QTextStream &); | 43 | bool init_flag; |
44 | void writeSubDirs(QTextStream &t) ; | 44 | void writeMingwParts(QTextStream &); |
45 | 45 | void writeSubDirs(QTextStream &t) ; | |
46 | bool writeMakefile(QTextStream &); | 46 | |
47 | void init(); | 47 | bool writeMakefile(QTextStream &); |
48 | 48 | void init(); | |
49 | public: | 49 | |
50 | MingwMakefileGenerator(QMakeProject *p); | 50 | virtual bool findLibraries(); |
51 | ~MingwMakefileGenerator(); | 51 | |
52 | 52 | public: | |
53 | }; | 53 | MingwMakefileGenerator(QMakeProject *p); |
54 | 54 | ~MingwMakefileGenerator(); | |
55 | inline MingwMakefileGenerator::~MingwMakefileGenerator() | 55 | |
56 | { } | 56 | }; |
57 | 57 | ||
58 | #endif /* __MINGW_MAKE_H__ */ | 58 | inline MingwMakefileGenerator::~MingwMakefileGenerator() |
59 | { } | ||
60 | |||
61 | #endif /* __MINGW_MAKE_H__ */ | ||
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 3fa0496..d2abac6 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp | |||
@@ -1,998 +1,1136 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of DspMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "msvc_dsp.h" | 36 | #include "msvc_dsp.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qdir.h> | 38 | #include <qdir.h> |
41 | #include <qregexp.h> | 39 | #include <qregexp.h> |
42 | #include <stdlib.h> | 40 | #include <stdlib.h> |
43 | #include <time.h> | 41 | #include <time.h> |
44 | 42 | ||
45 | DspMakefileGenerator::DspMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 43 | DspMakefileGenerator::DspMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
46 | { | 44 | { |
47 | 45 | ||
48 | } | 46 | } |
49 | 47 | ||
50 | bool | 48 | bool |
51 | DspMakefileGenerator::writeMakefile(QTextStream &t) | 49 | DspMakefileGenerator::writeMakefile(QTextStream &t) |
52 | { | 50 | { |
53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 51 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
54 | /* for now just dump, I need to generated an empty dsp or something.. */ | 52 | /* for now just dump, I need to generated an empty dsp or something.. */ |
55 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 53 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
56 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 54 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
57 | return TRUE; | 55 | return TRUE; |
58 | } | 56 | } |
59 | 57 | ||
60 | if(project->first("TEMPLATE") == "vcapp" || | 58 | if(project->first("TEMPLATE") == "vcapp" || |
61 | project->first("TEMPLATE") == "vclib") { | 59 | project->first("TEMPLATE") == "vclib") { |
62 | return writeDspParts(t); | 60 | return writeDspParts(t); |
63 | } | 61 | } |
64 | else if(project->first("TEMPLATE") == "subdirs") { | 62 | else if(project->first("TEMPLATE") == "subdirs") { |
65 | writeHeader(t); | 63 | writeHeader(t); |
66 | writeSubDirs(t); | 64 | writeSubDirs(t); |
67 | return TRUE; | 65 | return TRUE; |
68 | } | 66 | } |
69 | return FALSE; | 67 | return FALSE; |
70 | } | 68 | } |
71 | 69 | ||
72 | bool | 70 | bool |
73 | DspMakefileGenerator::writeDspParts(QTextStream &t) | 71 | DspMakefileGenerator::writeDspParts(QTextStream &t) |
74 | { | 72 | { |
75 | QString dspfile; | 73 | QString dspfile; |
76 | if ( !project->variables()["DSP_TEMPLATE"].isEmpty() ) { | 74 | if ( !project->variables()["DSP_TEMPLATE"].isEmpty() ) { |
77 | dspfile = project->first("DSP_TEMPLATE"); | 75 | dspfile = project->first("DSP_TEMPLATE"); |
78 | } else { | 76 | } else { |
79 | dspfile = project->first("MSVCDSP_TEMPLATE"); | 77 | dspfile = project->first("MSVCDSP_TEMPLATE"); |
80 | } | 78 | } |
79 | if (dspfile.startsWith("\"") && dspfile.endsWith("\"")) | ||
80 | dspfile = dspfile.mid(1, dspfile.length() - 2); | ||
81 | QString dspfile_loc = findTemplate(dspfile); | 81 | QString dspfile_loc = findTemplate(dspfile); |
82 | 82 | ||
83 | QFile file(dspfile_loc); | 83 | QFile file(dspfile_loc); |
84 | if(!file.open(IO_ReadOnly)) { | 84 | if(!file.open(IO_ReadOnly)) { |
85 | fprintf(stderr, "Cannot open dsp file: %s\n", dspfile.latin1()); | 85 | fprintf(stderr, "Cannot open dsp file: %s\n", dspfile.latin1()); |
86 | return FALSE; | 86 | return FALSE; |
87 | } | 87 | } |
88 | QTextStream dsp(&file); | 88 | QTextStream dsp(&file); |
89 | 89 | ||
90 | QString platform = "Win32"; | ||
91 | if ( !project->variables()["QMAKE_PLATFORM"].isEmpty() ) | ||
92 | platform = varGlue("QMAKE_PLATFORM", "", " ", ""); | ||
93 | |||
94 | // Setup PCH variables | ||
95 | precompH = project->first("PRECOMPILED_HEADER"); | ||
96 | QString namePCH = QFileInfo(precompH).fileName(); | ||
97 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
98 | if (usePCH) { | ||
99 | // Created files | ||
100 | QString origTarget = project->first("QMAKE_ORIG_TARGET"); | ||
101 | origTarget.replace(QRegExp("-"), "_"); | ||
102 | precompObj = "\"$(IntDir)\\" + origTarget + Option::obj_ext + "\""; | ||
103 | precompPch = "\"$(IntDir)\\" + origTarget + ".pch\""; | ||
104 | // Add PRECOMPILED_HEADER to HEADERS | ||
105 | if (!project->variables()["HEADERS"].contains(precompH)) | ||
106 | project->variables()["HEADERS"] += precompH; | ||
107 | // Add precompile compiler options | ||
108 | project->variables()["PRECOMPILED_FLAGS_REL"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" "; | ||
109 | project->variables()["PRECOMPILED_FLAGS_DEB"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" "; | ||
110 | // Return to variable pool | ||
111 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
112 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
113 | } | ||
90 | int rep; | 114 | int rep; |
91 | QString line; | 115 | QString line; |
92 | while ( !dsp.eof() ) { | 116 | while ( !dsp.eof() ) { |
93 | line = dsp.readLine(); | 117 | line = dsp.readLine(); |
94 | while((rep = line.find(QRegExp("\\$\\$[a-zA-Z0-9_-]*"))) != -1) { | 118 | while((rep = line.find(QRegExp("\\$\\$[a-zA-Z0-9_-]*"))) != -1) { |
95 | QString torep = line.mid(rep, line.find(QRegExp("[^\\$a-zA-Z0-9_-]"), rep) - rep); | 119 | QString torep = line.mid(rep, line.find(QRegExp("[^\\$a-zA-Z0-9_-]"), rep) - rep); |
96 | QString variable = torep.right(torep.length()-2); | 120 | QString variable = torep.right(torep.length()-2); |
97 | 121 | ||
98 | t << line.left(rep); //output the left side | 122 | t << line.left(rep); //output the left side |
99 | line = line.right(line.length() - (rep + torep.length())); //now past the variable | 123 | line = line.right(line.length() - (rep + torep.length())); //now past the variable |
100 | if(variable == "MSVCDSP_SOURCES") { | 124 | if(variable == "MSVCDSP_SOURCES") { |
101 | if(project->variables()["SOURCES"].isEmpty()) | 125 | if(project->variables()["SOURCES"].isEmpty()) |
102 | continue; | 126 | continue; |
103 | 127 | ||
104 | QString mocpath = var( "QMAKE_MOC" ); | 128 | QString mocpath = var( "QMAKE_MOC" ); |
105 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 129 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
106 | 130 | ||
107 | QStringList list = project->variables()["SOURCES"] + project->variables()["DEF_FILE"]; | 131 | QStringList list = project->variables()["SOURCES"] + project->variables()["DEF_FILE"]; |
108 | if(!project->isActiveConfig("flat")) | 132 | if(!project->isActiveConfig("flat")) |
109 | list.sort(); | 133 | list.sort(); |
110 | QStringList::Iterator it; | 134 | QStringList::Iterator it; |
111 | for( it = list.begin(); it != list.end(); ++it) { | 135 | for( it = list.begin(); it != list.end(); ++it) { |
112 | beginGroupForFile((*it), t); | 136 | beginGroupForFile((*it), t); |
113 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 137 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
114 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::moc_ext)) { | 138 | if (usePCH && (*it).endsWith(".c")) |
139 | t << "# SUBTRACT CPP /FI\"" << namePCH << "\" /Yu\"" << namePCH << "\" /Fp" << endl; | ||
140 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { | ||
115 | QString base = (*it); | 141 | QString base = (*it); |
116 | base.replace(QRegExp("\\..*$"), "").upper(); | 142 | base.replace(QRegExp("\\..*$"), "").upper(); |
117 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 143 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
118 | 144 | ||
119 | QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + | 145 | QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + |
120 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" | 146 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" |
121 | " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 147 | " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" |
122 | "\t" + mocpath + findMocSource((*it)) + " -o " + | 148 | "\t" + mocpath + findMocSource((*it)) + " -o " + |
123 | (*it) + "\n\n" "# End Custom Build\n\n"; | 149 | (*it) + "\n\n" "# End Custom Build\n\n"; |
124 | 150 | ||
125 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 151 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; |
126 | 152 | ||
127 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 153 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
128 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 154 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" |
129 | << build << "!ENDIF " << endl << endl; | 155 | << build << "!ENDIF " << endl << endl; |
130 | } | 156 | } |
131 | t << "# End Source File" << endl; | 157 | t << "# End Source File" << endl; |
132 | } | 158 | } |
133 | endGroups(t); | 159 | endGroups(t); |
134 | } else if(variable == "MSVCDSP_IMAGES") { | 160 | } else if(variable == "MSVCDSP_IMAGES") { |
135 | if(project->variables()["IMAGES"].isEmpty()) | 161 | if(project->variables()["IMAGES"].isEmpty()) |
136 | continue; | 162 | continue; |
137 | t << "# Begin Source File\n\nSOURCE=" << project->first("QMAKE_IMAGE_COLLECTION") << endl; | 163 | t << "# Begin Source File\n\nSOURCE=" << project->first("QMAKE_IMAGE_COLLECTION") << endl; |
138 | t << "# End Source File" << endl; | 164 | t << "# End Source File" << endl; |
139 | } else if(variable == "MSVCDSP_HEADERS") { | 165 | } else if(variable == "MSVCDSP_HEADERS") { |
140 | if(project->variables()["HEADERS"].isEmpty()) | 166 | if(project->variables()["HEADERS"].isEmpty()) |
141 | continue; | 167 | continue; |
142 | 168 | ||
143 | QStringList list = project->variables()["HEADERS"]; | 169 | QStringList list = project->variables()["HEADERS"]; |
144 | if(!project->isActiveConfig("flat")) | 170 | if(!project->isActiveConfig("flat")) |
145 | list.sort(); | 171 | list.sort(); |
146 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 172 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
147 | // beginGroupForFile((*it), t); | 173 | // beginGroupForFile((*it), t); |
148 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl << endl; | 174 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl << endl; |
149 | if ( project->isActiveConfig("moc") && !findMocDestination((*it)).isEmpty()) { | 175 | QString compilePCH; |
150 | QString base = (*it); | 176 | QStringList customDependencies; |
177 | QString createMOC; | ||
178 | QString buildCmdsR, buildCmdsD; | ||
179 | QString buildCmds = "\nBuildCmds= \\\n"; | ||
180 | // Create unique baseID | ||
181 | QString base = (*it); | ||
182 | { | ||
151 | base.replace(QRegExp("\\..*$"), "").upper(); | 183 | base.replace(QRegExp("\\..*$"), "").upper(); |
152 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 184 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
185 | } | ||
186 | if (usePCH && precompH.endsWith(*it)) { | ||
187 | QString basicBuildCmd = QString("\tcl.exe /TP /W3 /FD /c /D \"WIN32\" /Yc /Fp\"%1\" /Fo\"%2\" %3 %4 %5 %6 %7 %8 %9 /D \"") | ||
188 | .arg(precompPch) | ||
189 | .arg(precompObj) | ||
190 | .arg(var("MSVCDSP_INCPATH")) | ||
191 | .arg(var("MSVCDSP_DEFINES")) | ||
192 | .arg(var("MSVCDSP_CXXFLAGS")); | ||
193 | buildCmdsR = basicBuildCmd | ||
194 | .arg("/D \"NDEBUG\"") | ||
195 | .arg(var("QMAKE_CXXFLAGS_RELEASE")) | ||
196 | .arg(var("MSVCDSP_MTDEF")) | ||
197 | .arg(var("MSVCDSP_RELDEFS")); | ||
198 | buildCmdsD = basicBuildCmd | ||
199 | .arg("/D \"_DEBUG\" /Od") | ||
200 | .arg(var("QMAKE_CXXFLAGS_DEBUG")) | ||
201 | .arg(var("MSVCDSP_MTDEFD")) | ||
202 | .arg(var("MSVCDSP_DEBUG_OPT")); | ||
203 | if (project->first("TEMPLATE") == "vcapp") {// App | ||
204 | buildCmdsR += var("MSVCDSP_WINCONDEF"); | ||
205 | buildCmdsD += var("MSVCDSP_WINCONDEF"); | ||
206 | } else if (project->isActiveConfig("dll")) {// Dll | ||
207 | buildCmdsR += "_WINDOWS\" /D \"_USRDLL"; | ||
208 | buildCmdsD += "_WINDOWS\" /D \"_USRDLL"; | ||
209 | } else { // Lib | ||
210 | buildCmdsR += "_LIB"; | ||
211 | buildCmdsD += "_LIB"; | ||
212 | } | ||
213 | buildCmdsR += "\" /Fd\"$(IntDir)\\\\\" " + (*it) + " \\\n"; | ||
214 | buildCmdsD += "\" /Fd\"$(IntDir)\\\\\" " + (*it) + " \\\n"; | ||
215 | |||
216 | compilePCH = precompPch + " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; | ||
153 | 217 | ||
218 | QStringList &tmp = findDependencies(precompH); | ||
219 | if(!tmp.isEmpty()) // Got Deps for PCH | ||
220 | customDependencies += tmp; | ||
221 | } | ||
222 | if (project->isActiveConfig("moc") && !findMocDestination((*it)).isEmpty()) { | ||
154 | QString mocpath = var( "QMAKE_MOC" ); | 223 | QString mocpath = var( "QMAKE_MOC" ); |
155 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 224 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
156 | 225 | buildCmds += "\t" + mocpath + (*it) + " -o " + findMocDestination((*it)) + " \\\n"; | |
157 | QString build = "\n\n# Begin Custom Build - Moc'ing " + (*it) + | 226 | createMOC = "\"" + findMocDestination((*it)) +"\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n $(BuildCmds)\n\n"; |
158 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + findMocDestination((*it)) + | 227 | customDependencies += "\"$(QTDIR)\\bin\\moc.exe\""; |
159 | "\"" " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 228 | } |
160 | "\t" + mocpath + (*it) + " -o " + | 229 | if (!createMOC.isEmpty() || !compilePCH.isEmpty()) { |
161 | findMocDestination((*it)) + "\n\n" "# End Custom Build\n\n"; | 230 | bool doMOC = !createMOC.isEmpty(); |
162 | 231 | bool doPCH = !compilePCH.isEmpty(); | |
163 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 232 | QString build = "\n\n# Begin Custom Build - "+ |
164 | 233 | QString(doMOC?"Moc'ing ":"") + | |
165 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 234 | QString((doMOC&&doPCH)?" and ":"") + |
166 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 235 | QString(doPCH?"Creating PCH cpp from ":"") + |
167 | << build << "!ENDIF " << endl << endl; | 236 | (*it) + "...\nInputPath=.\\" + (*it) + "\n\n" + |
237 | buildCmds + "%1\n" + | ||
238 | createMOC + | ||
239 | compilePCH + | ||
240 | "# End Custom Build\n\n"; | ||
241 | |||
242 | t << "USERDEP_" << base << "=" << valGlue(customDependencies, "\"", "\" \"", "\"") << endl << endl; | ||
243 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build.arg(buildCmdsR) | ||
244 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build.arg(buildCmdsD) | ||
245 | << "!ENDIF " << endl << endl; | ||
168 | } | 246 | } |
169 | t << "# End Source File" << endl; | 247 | t << "# End Source File" << endl; |
170 | } | 248 | } |
171 | // endGroups(t); | 249 | // endGroups(t); |
172 | } else if(variable == "MSVCDSP_FORMSOURCES" || variable == "MSVCDSP_FORMHEADERS") { | 250 | } else if(variable == "MSVCDSP_FORMSOURCES" || variable == "MSVCDSP_FORMHEADERS") { |
173 | if(project->variables()["FORMS"].isEmpty()) | 251 | if(project->variables()["FORMS"].isEmpty()) |
174 | continue; | 252 | continue; |
175 | 253 | ||
176 | QString uiSourcesDir; | 254 | QString uiSourcesDir; |
177 | QString uiHeadersDir; | 255 | QString uiHeadersDir; |
178 | if(!project->variables()["UI_DIR"].isEmpty()) { | 256 | if(!project->variables()["UI_DIR"].isEmpty()) { |
179 | uiSourcesDir = project->first("UI_DIR"); | 257 | uiSourcesDir = project->first("UI_DIR"); |
180 | uiHeadersDir = project->first("UI_DIR"); | 258 | uiHeadersDir = project->first("UI_DIR"); |
181 | } else { | 259 | } else { |
182 | if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) | 260 | if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) |
183 | uiSourcesDir = project->first("UI_SOURCES_DIR"); | 261 | uiSourcesDir = project->first("UI_SOURCES_DIR"); |
184 | else | 262 | else |
185 | uiSourcesDir = ""; | 263 | uiSourcesDir = ""; |
186 | if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) | 264 | if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) |
187 | uiHeadersDir = project->first("UI_HEADERS_DIR"); | 265 | uiHeadersDir = project->first("UI_HEADERS_DIR"); |
188 | else | 266 | else |
189 | uiHeadersDir = ""; | 267 | uiHeadersDir = ""; |
190 | } | 268 | } |
191 | 269 | ||
192 | QStringList list = project->variables()["FORMS"]; | 270 | QStringList list = project->variables()["FORMS"]; |
193 | if(!project->isActiveConfig("flat")) | 271 | if(!project->isActiveConfig("flat")) |
194 | list.sort(); | 272 | list.sort(); |
195 | QString ext = variable == "MSVCDSP_FORMSOURCES" ? ".cpp" : ".h"; | 273 | QString ext = variable == "MSVCDSP_FORMSOURCES" ? ".cpp" : ".h"; |
196 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 274 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
197 | QString base = (*it); | 275 | QString base = (*it); |
198 | int dot = base.findRev("."); | 276 | int dot = base.findRev("."); |
199 | base.replace( dot, base.length() - dot, ext ); | 277 | base.replace( dot, base.length() - dot, ext ); |
200 | QString fname = base; | 278 | QString fname = base; |
201 | 279 | ||
202 | int lbs = fname.findRev( "\\" ); | 280 | int lbs = fname.findRev( "\\" ); |
203 | QString fpath; | 281 | QString fpath; |
204 | if ( lbs != -1 ) | 282 | if ( lbs != -1 ) |
205 | fpath = fname.left( lbs + 1 ); | 283 | fpath = fname.left( lbs + 1 ); |
206 | fname = fname.right( fname.length() - lbs - 1 ); | 284 | fname = fname.right( fname.length() - lbs - 1 ); |
207 | 285 | ||
208 | if ( ext == ".cpp" && !uiSourcesDir.isEmpty() ) | 286 | if ( ext == ".cpp" && !uiSourcesDir.isEmpty() ) |
209 | fname.prepend(uiSourcesDir); | 287 | fname.prepend(uiSourcesDir); |
210 | else if ( ext == ".h" && !uiHeadersDir.isEmpty() ) | 288 | else if ( ext == ".h" && !uiHeadersDir.isEmpty() ) |
211 | fname.prepend(uiHeadersDir); | 289 | fname.prepend(uiHeadersDir); |
212 | else | 290 | else |
213 | fname = base; | 291 | fname = base; |
214 | // beginGroupForFile(fname, t); | 292 | // beginGroupForFile(fname, t); |
215 | t << "# Begin Source File\n\nSOURCE=" << fname | 293 | t << "# Begin Source File\n\nSOURCE=" << fname |
216 | << "\n# End Source File" << endl; | 294 | << "\n# End Source File" << endl; |
217 | } | 295 | } |
218 | // endGroups(t); | 296 | // endGroups(t); |
219 | } else if(variable == "MSVCDSP_TRANSLATIONS" ) { | 297 | } else if(variable == "MSVCDSP_TRANSLATIONS" ) { |
220 | if(project->variables()["TRANSLATIONS"].isEmpty()) | 298 | if(project->variables()["TRANSLATIONS"].isEmpty()) |
221 | continue; | 299 | continue; |
222 | 300 | ||
223 | t << "# Begin Group \"Translations\"\n"; | 301 | t << "# Begin Group \"Translations\"\n"; |
224 | t << "# Prop Default_Filter \"ts\"\n"; | 302 | t << "# Prop Default_Filter \"ts\"\n"; |
225 | 303 | ||
226 | QStringList list = project->variables()["TRANSLATIONS"]; | 304 | QStringList list = project->variables()["TRANSLATIONS"]; |
227 | if(!project->isActiveConfig("flat")) | 305 | if(!project->isActiveConfig("flat")) |
228 | list.sort(); | 306 | list.sort(); |
229 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 307 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
230 | QString sify = *it; | 308 | QString sify = *it; |
231 | sify.replace('/', '\\' ); | 309 | sify.replace('/', '\\' ); |
232 | QString base = (*it); | 310 | QString base = (*it); |
233 | base.replace(QRegExp("\\..*$"), "").upper(); | 311 | base.replace(QRegExp("\\..*$"), "").upper(); |
234 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 312 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
235 | 313 | ||
236 | // beginGroupForFile(sify, t); | 314 | // beginGroupForFile(sify, t); |
237 | t << "# Begin Source File\n\nSOURCE=" << sify << endl; | 315 | t << "# Begin Source File\n\nSOURCE=" << sify << endl; |
238 | t << "\n# End Source File" << endl; | 316 | t << "\n# End Source File" << endl; |
239 | } | 317 | } |
240 | // endGroups(t); | 318 | // endGroups(t); |
241 | t << "\n# End Group\n"; | 319 | t << "\n# End Group\n"; |
242 | } else if (variable == "MSVCDSP_MOCSOURCES" && project->isActiveConfig("moc")) { | 320 | } else if (variable == "MSVCDSP_MOCSOURCES" && project->isActiveConfig("moc")) { |
243 | if ( project->variables()["SRCMOC"].isEmpty()) | 321 | if ( project->variables()["SRCMOC"].isEmpty()) |
244 | continue; | 322 | continue; |
245 | 323 | ||
246 | QString mocpath = var( "QMAKE_MOC" ); | 324 | QString mocpath = var( "QMAKE_MOC" ); |
247 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 325 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
248 | 326 | ||
249 | QStringList list = project->variables()["SRCMOC"]; | 327 | QStringList list = project->variables()["SRCMOC"]; |
250 | if(!project->isActiveConfig("flat")) | 328 | if(!project->isActiveConfig("flat")) |
251 | list.sort(); | 329 | list.sort(); |
252 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 330 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
253 | // beginGroupForFile((*it), t); | 331 | // beginGroupForFile((*it), t); |
254 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 332 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
255 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::moc_ext)) { | 333 | if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { |
256 | QString base = (*it); | 334 | QString base = (*it); |
257 | base.replace(QRegExp("\\..*$"), "").upper(); | 335 | base.replace(QRegExp("\\..*$"), "").upper(); |
258 | base.replace(QRegExp("[^a-zA-Z]"), "_"); | 336 | base.replace(QRegExp("[^a-zA-Z]"), "_"); |
259 | 337 | ||
260 | QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + | 338 | QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + |
261 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" | 339 | "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" |
262 | " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" | 340 | " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" |
263 | "\t" + mocpath + findMocSource((*it)) + " -o " + | 341 | "\t" + mocpath + findMocSource((*it)) + " -o " + |
264 | (*it) + "\n\n" "# End Custom Build\n\n"; | 342 | (*it) + "\n\n" "# End Custom Build\n\n"; |
265 | 343 | ||
266 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; | 344 | t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; |
267 | 345 | ||
268 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 346 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
269 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" | 347 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" |
270 | << build << "!ENDIF " << endl << endl; | 348 | << build << "!ENDIF " << endl << endl; |
271 | } | 349 | } |
272 | t << "# End Source File" << endl; | 350 | t << "# End Source File" << endl; |
273 | } | 351 | } |
274 | // endGroups(t); | 352 | // endGroups(t); |
275 | } else if(variable == "MSVCDSP_PICTURES") { | 353 | } else if(variable == "MSVCDSP_PICTURES") { |
276 | if(project->variables()["IMAGES"].isEmpty()) | 354 | if(project->variables()["IMAGES"].isEmpty()) |
277 | continue; | 355 | continue; |
278 | 356 | ||
279 | t << "# Begin Group \"Images\"\n" | 357 | t << "# Begin Group \"Images\"\n" |
280 | << "# Prop Default_Filter \"png jpeg bmp xpm\"\n"; | 358 | << "# Prop Default_Filter \"png jpeg bmp xpm\"\n"; |
281 | 359 | ||
282 | QStringList list = project->variables()["IMAGES"]; | 360 | QStringList list = project->variables()["IMAGES"]; |
283 | if(!project->isActiveConfig("flat")) | 361 | if(!project->isActiveConfig("flat")) |
284 | list.sort(); | 362 | list.sort(); |
285 | QStringList::Iterator it; | 363 | QStringList::Iterator it; |
286 | 364 | ||
287 | // dump the image list to a file UIC can read. | 365 | // dump the image list to a file UIC can read. |
288 | QFile f( "images.tmp" ); | 366 | QFile f( "images.tmp" ); |
289 | f.open( IO_WriteOnly ); | 367 | f.open( IO_WriteOnly ); |
290 | QTextStream ts( &f ); | 368 | QTextStream ts( &f ); |
291 | for( it = list.begin(); it != list.end(); ++it ) | 369 | for( it = list.begin(); it != list.end(); ++it ) |
292 | ts << " " << *it; | 370 | ts << " " << *it; |
293 | f.close(); | 371 | f.close(); |
294 | 372 | ||
295 | // create an output step for images not more than once | 373 | // create an output step for images not more than once |
296 | bool imagesBuildDone = FALSE; | 374 | bool imagesBuildDone = FALSE; |
297 | for( it = list.begin(); it != list.end(); ++it ) { | 375 | for( it = list.begin(); it != list.end(); ++it ) { |
298 | // beginGroupForFile((*it), t); | 376 | // beginGroupForFile((*it), t); |
299 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; | 377 | t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; |
300 | 378 | ||
301 | QString base = (*it); | 379 | QString base = (*it); |
302 | QString uicpath = var("QMAKE_UIC"); | 380 | QString uicpath = var("QMAKE_UIC"); |
303 | uicpath = uicpath.replace(QRegExp("\\..*$"), "") + " "; | 381 | uicpath = uicpath.replace(QRegExp("\\..*$"), "") + " "; |
304 | 382 | ||
305 | if ( !imagesBuildDone ) { | 383 | if ( !imagesBuildDone ) { |
306 | imagesBuildDone = TRUE; | 384 | imagesBuildDone = TRUE; |
307 | QString build = "\n\n# Begin Custom Build - Creating image collection...\n" | 385 | QString build = "\n\n# Begin Custom Build - Creating image collection...\n" |
308 | "InputPath=.\\" + base + "\n\n"; | 386 | "InputPath=.\\" + base + "\n\n"; |
309 | 387 | ||
310 | build += "\"" + project->first("QMAKE_IMAGE_COLLECTION") + "\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n"; | 388 | build += "\"" + project->first("QMAKE_IMAGE_COLLECTION") + "\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n"; |
311 | build += "\t" + uicpath + "-embed " + project->first("QMAKE_ORIG_TARGET") + " -f images.tmp -o " | 389 | build += "\t" + uicpath + "-embed " + project->first("QMAKE_ORIG_TARGET") + " -f images.tmp -o " |
312 | + project->first("QMAKE_IMAGE_COLLECTION") + "\n\n"; | 390 | + project->first("QMAKE_IMAGE_COLLECTION") + "\n\n"; |
313 | build.append("# End Custom Build\n\n"); | 391 | build.append("# End Custom Build\n\n"); |
314 | 392 | ||
315 | t << "USERDEP_" << base << "="; | 393 | t << "USERDEP_" << base << "="; |
316 | QStringList::Iterator it2 = list.begin(); | 394 | QStringList::Iterator it2 = list.begin(); |
317 | while ( it2 != list.end() ) { | 395 | while ( it2 != list.end() ) { |
318 | t << "\"" << (*it2) << "\""; | 396 | t << "\"" << (*it2) << "\""; |
319 | it2++; | 397 | it2++; |
320 | if ( it2 != list.end() ) | 398 | if ( it2 != list.end() ) |
321 | t << "\\\n"; | 399 | t << "\\\n"; |
322 | } | 400 | } |
323 | t << endl << endl; | 401 | t << endl << endl; |
324 | 402 | ||
325 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 403 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build |
326 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 404 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build |
327 | << "!ENDIF \n\n" << endl; | 405 | << "!ENDIF \n\n" << endl; |
328 | } | 406 | } |
329 | 407 | ||
330 | t << "# End Source File" << endl; | 408 | t << "# End Source File" << endl; |
331 | } | 409 | } |
332 | // endGroups(t); | 410 | // endGroups(t); |
333 | t << "\n# End Group\n"; | 411 | t << "\n# End Group\n"; |
334 | } else if(variable == "MSVCDSP_FORMS") { | 412 | } else if(variable == "MSVCDSP_FORMS") { |
335 | if(project->variables()["FORMS"].isEmpty()) | 413 | if(project->variables()["FORMS"].isEmpty()) |
336 | continue; | 414 | continue; |
337 | 415 | ||
338 | t << "# Begin Group \"Forms\"\n" | 416 | t << "# Begin Group \"Forms\"\n" |
339 | << "# Prop Default_Filter \"ui\"\n"; | 417 | << "# Prop Default_Filter \"ui\"\n"; |
340 | 418 | ||
341 | QString uicpath = var("QMAKE_UIC"); | 419 | QString uicpath = var("QMAKE_UIC"); |
342 | uicpath = uicpath.replace(QRegExp("\\..*$"), "") + " "; | 420 | uicpath = uicpath.replace(QRegExp("\\..*$"), "") + " "; |
343 | QString mocpath = var( "QMAKE_MOC" ); | 421 | QString mocpath = var( "QMAKE_MOC" ); |
344 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; | 422 | mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; |
345 | 423 | ||
346 | QStringList list = project->variables()["FORMS"]; | 424 | QStringList list = project->variables()["FORMS"]; |
347 | if(!project->isActiveConfig("flat")) | 425 | if(!project->isActiveConfig("flat")) |
348 | list.sort(); | 426 | list.sort(); |
349 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 427 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
350 | QString base = (*it); | 428 | QString base = (*it); |
351 | // beginGroupForFile(base, t); | 429 | // beginGroupForFile(base, t); |
352 | t << "# Begin Source File\n\nSOURCE=" << base << endl; | 430 | t << "# Begin Source File\n\nSOURCE=" << base << endl; |
353 | 431 | ||
354 | QString fname = base; | 432 | QString fname = base; |
355 | fname.replace(".ui", ""); | 433 | fname.replace(".ui", ""); |
356 | int lbs = fname.findRev( "\\" ); | 434 | int lbs = fname.findRev( "\\" ); |
357 | QString fpath; | 435 | QString fpath; |
358 | if ( lbs != -1 ) | 436 | if ( lbs != -1 ) |
359 | fpath = fname.left( lbs + 1 ); | 437 | fpath = fname.left( lbs + 1 ); |
360 | fname = fname.right( fname.length() - lbs - 1 ); | 438 | fname = fname.right( fname.length() - lbs - 1 ); |
361 | 439 | ||
362 | QString mocFile; | 440 | QString mocFile; |
363 | if(!project->variables()["MOC_DIR"].isEmpty()) | 441 | if(!project->variables()["MOC_DIR"].isEmpty()) |
364 | mocFile = project->first("MOC_DIR"); | 442 | mocFile = project->first("MOC_DIR"); |
365 | else | 443 | else |
366 | mocFile = fpath; | 444 | mocFile = fpath; |
367 | 445 | ||
368 | QString uiSourcesDir; | 446 | QString uiSourcesDir; |
369 | QString uiHeadersDir; | 447 | QString uiHeadersDir; |
370 | if(!project->variables()["UI_DIR"].isEmpty()) { | 448 | if(!project->variables()["UI_DIR"].isEmpty()) { |
371 | uiSourcesDir = project->first("UI_DIR"); | 449 | uiSourcesDir = project->first("UI_DIR"); |
372 | uiHeadersDir = project->first("UI_DIR"); | 450 | uiHeadersDir = project->first("UI_DIR"); |
373 | } else { | 451 | } else { |
374 | if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) | 452 | if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) |
375 | uiSourcesDir = project->first("UI_SOURCES_DIR"); | 453 | uiSourcesDir = project->first("UI_SOURCES_DIR"); |
376 | else | 454 | else |
377 | uiSourcesDir = fpath; | 455 | uiSourcesDir = fpath; |
378 | if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) | 456 | if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) |
379 | uiHeadersDir = project->first("UI_HEADERS_DIR"); | 457 | uiHeadersDir = project->first("UI_HEADERS_DIR"); |
380 | else | 458 | else |
381 | uiHeadersDir = fpath; | 459 | uiHeadersDir = fpath; |
382 | } | 460 | } |
383 | 461 | ||
384 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\" \"$(QTDIR)\\bin\\uic.exe\"" << endl << endl; | 462 | t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\" \"$(QTDIR)\\bin\\uic.exe\"" << endl << endl; |
385 | 463 | ||
386 | QString build = "\n\n# Begin Custom Build - Uic'ing " + base + "...\n" | 464 | QString build = "\n\n# Begin Custom Build - Uic'ing " + base + "...\n" |
387 | "InputPath=.\\" + base + "\n\n" "BuildCmds= \\\n\t" + uicpath + base + | 465 | "InputPath=.\\" + base + "\n\n" "BuildCmds= \\\n\t" + uicpath + base + |
388 | " -o " + uiHeadersDir + fname + ".h \\\n" "\t" + uicpath + base + | 466 | " -o " + uiHeadersDir + fname + ".h \\\n" "\t" + uicpath + base + |
389 | " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" | 467 | " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" |
390 | "\t" + mocpath + uiHeadersDir + fname + ".h -o " + mocFile + "moc_" + fname + ".cpp \\\n"; | 468 | "\t" + mocpath + " " + uiHeadersDir + |
469 | fname + ".h -o " + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + " \\\n"; | ||
391 | 470 | ||
392 | build.append("\n\"" + uiHeadersDir + fname + ".h\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 471 | build.append("\n\"" + uiHeadersDir + fname + ".h\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
393 | "\t$(BuildCmds)\n\n" | 472 | "\t$(BuildCmds)\n\n" |
394 | "\"" + uiSourcesDir + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 473 | "\"" + uiSourcesDir + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
395 | "\t$(BuildCmds)\n\n" | 474 | "\t$(BuildCmds)\n\n" |
396 | "\"" + mocFile + "moc_" + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 475 | "\"" + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
397 | "\t$(BuildCmds)\n\n"); | 476 | "\t$(BuildCmds)\n\n"); |
398 | 477 | ||
399 | build.append("# End Custom Build\n\n"); | 478 | build.append("# End Custom Build\n\n"); |
400 | 479 | ||
401 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 480 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
402 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 481 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
403 | << "!ENDIF \n\n" << "# End Source File" << endl; | 482 | << "!ENDIF \n\n" << "# End Source File" << endl; |
404 | } | 483 | } |
405 | // endGroups(t); | 484 | // endGroups(t); |
406 | t << "\n# End Group\n"; | 485 | t << "\n# End Group\n"; |
407 | } else if(variable == "MSVCDSP_LEXSOURCES") { | 486 | } else if(variable == "MSVCDSP_LEXSOURCES") { |
408 | if(project->variables()["LEXSOURCES"].isEmpty()) | 487 | if(project->variables()["LEXSOURCES"].isEmpty()) |
409 | continue; | 488 | continue; |
410 | 489 | ||
411 | t << "# Begin Group \"Lexables\"\n" | 490 | t << "# Begin Group \"Lexables\"\n" |
412 | << "# Prop Default_Filter \"l\"\n"; | 491 | << "# Prop Default_Filter \"l\"\n"; |
413 | 492 | ||
414 | QString lexpath = var("QMAKE_LEX") + varGlue("QMAKE_LEXFLAGS", " ", " ", "") + " "; | 493 | QString lexpath = var("QMAKE_LEX") + varGlue("QMAKE_LEXFLAGS", " ", " ", "") + " "; |
415 | 494 | ||
416 | QStringList list = project->variables()["LEXSOURCES"]; | 495 | QStringList list = project->variables()["LEXSOURCES"]; |
417 | if(!project->isActiveConfig("flat")) | 496 | if(!project->isActiveConfig("flat")) |
418 | list.sort(); | 497 | list.sort(); |
419 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 498 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
420 | QString fname = (*it); | 499 | QString fname = (*it); |
421 | // beginGroupForFile(fname, t); | 500 | // beginGroupForFile(fname, t); |
422 | t << "# Begin Source File\n\nSOURCE=" << fname << endl; | 501 | t << "# Begin Source File\n\nSOURCE=" << fname << endl; |
423 | fname.replace(".l", Option::lex_mod + Option::cpp_ext.first()); | 502 | fname.replace(".l", Option::lex_mod + Option::cpp_ext.first()); |
424 | 503 | ||
425 | QString build = "\n\n# Begin Custom Build - Lex'ing " + (*it) + "...\n" | 504 | QString build = "\n\n# Begin Custom Build - Lex'ing " + (*it) + "...\n" |
426 | "InputPath=.\\" + (*it) + "\n\n" | 505 | "InputPath=.\\" + (*it) + "\n\n" |
427 | "\"" + fname + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 506 | "\"" + fname + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
428 | "\t" + lexpath + (*it) + "\\\n" | 507 | "\t" + lexpath + (*it) + "\\\n" |
429 | "\tdel " + fname + "\\\n" | 508 | "\tdel " + fname + "\\\n" |
430 | "\tcopy lex.yy.c " + fname + "\n\n" + | 509 | "\tcopy lex.yy.c " + fname + "\n\n" + |
431 | "# End Custom Build\n\n"; | 510 | "# End Custom Build\n\n"; |
432 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 511 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
433 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 512 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
434 | << "!ENDIF \n\n" << build | 513 | << "!ENDIF \n\n" << build |
435 | 514 | ||
436 | << "# End Source File" << endl; | 515 | << "# End Source File" << endl; |
437 | } | 516 | } |
438 | // endGroups(t); | 517 | // endGroups(t); |
439 | t << "\n# End Group\n"; | 518 | t << "\n# End Group\n"; |
440 | } else if(variable == "MSVCDSP_YACCSOURCES") { | 519 | } else if(variable == "MSVCDSP_YACCSOURCES") { |
441 | if(project->variables()["YACCSOURCES"].isEmpty()) | 520 | if(project->variables()["YACCSOURCES"].isEmpty()) |
442 | continue; | 521 | continue; |
443 | 522 | ||
444 | t << "# Begin Group \"Yaccables\"\n" | 523 | t << "# Begin Group \"Yaccables\"\n" |
445 | << "# Prop Default_Filter \"y\"\n"; | 524 | << "# Prop Default_Filter \"y\"\n"; |
446 | 525 | ||
447 | QString yaccpath = var("QMAKE_YACC") + varGlue("QMAKE_YACCFLAGS", " ", " ", "") + " "; | 526 | QString yaccpath = var("QMAKE_YACC") + varGlue("QMAKE_YACCFLAGS", " ", " ", "") + " "; |
448 | 527 | ||
449 | QStringList list = project->variables()["YACCSOURCES"]; | 528 | QStringList list = project->variables()["YACCSOURCES"]; |
450 | if(!project->isActiveConfig("flat")) | 529 | if(!project->isActiveConfig("flat")) |
451 | list.sort(); | 530 | list.sort(); |
452 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 531 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
453 | QString fname = (*it); | 532 | QString fname = (*it); |
454 | // beginGroupForFile(fname, t); | 533 | // beginGroupForFile(fname, t); |
455 | t << "# Begin Source File\n\nSOURCE=" << fname << endl; | 534 | t << "# Begin Source File\n\nSOURCE=" << fname << endl; |
456 | fname.replace(".y", Option::yacc_mod); | 535 | fname.replace(".y", Option::yacc_mod); |
457 | 536 | ||
458 | QString build = "\n\n# Begin Custom Build - Yacc'ing " + (*it) + "...\n" | 537 | QString build = "\n\n# Begin Custom Build - Yacc'ing " + (*it) + "...\n" |
459 | "InputPath=.\\" + (*it) + "\n\n" | 538 | "InputPath=.\\" + (*it) + "\n\n" |
460 | "\"" + fname + Option::cpp_ext.first() + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" | 539 | "\"" + fname + Option::cpp_ext.first() + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" |
461 | "\t" + yaccpath + (*it) + "\\\n" | 540 | "\t" + yaccpath + (*it) + "\\\n" |
462 | "\tdel " + fname + Option::h_ext.first() + "\\\n" | 541 | "\tdel " + fname + Option::h_ext.first() + "\\\n" |
463 | "\tmove y.tab.h " + fname + Option::h_ext.first() + "\n\n" + | 542 | "\tmove y.tab.h " + fname + Option::h_ext.first() + "\n\n" + |
464 | "\tdel " + fname + Option::cpp_ext.first() + "\\\n" | 543 | "\tdel " + fname + Option::cpp_ext.first() + "\\\n" |
465 | "\tmove y.tab.c " + fname + Option::cpp_ext.first() + "\n\n" + | 544 | "\tmove y.tab.c " + fname + Option::cpp_ext.first() + "\n\n" + |
466 | "# End Custom Build\n\n"; | 545 | "# End Custom Build\n\n"; |
467 | 546 | ||
468 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build | 547 | t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build |
469 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build | 548 | << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build |
470 | << "!ENDIF \n\n" | 549 | << "!ENDIF \n\n" |
471 | << "# End Source File" << endl; | 550 | << "# End Source File" << endl; |
472 | } | 551 | } |
473 | // endGroups(t); | 552 | // endGroups(t); |
474 | t << "\n# End Group\n"; | 553 | t << "\n# End Group\n"; |
475 | } else if( variable == "MSVCDSP_CONFIGMODE" ) { | 554 | } else if( variable == "MSVCDSP_CONFIGMODE" ) { |
476 | if( project->isActiveConfig( "debug" ) ) | 555 | if( project->isActiveConfig( "debug" ) ) |
477 | t << "Debug"; | 556 | t << "Debug"; |
478 | else | 557 | else |
479 | t << "Release"; | 558 | t << "Release"; |
480 | } else if( variable == "MSVCDSP_IDLSOURCES" ) { | 559 | } else if( variable == "MSVCDSP_IDLSOURCES" ) { |
481 | QStringList list = project->variables()["MSVCDSP_IDLSOURCES"]; | 560 | QStringList list = project->variables()["MSVCDSP_IDLSOURCES"]; |
482 | if(!project->isActiveConfig("flat")) | 561 | if(!project->isActiveConfig("flat")) |
483 | list.sort(); | 562 | list.sort(); |
484 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { | 563 | for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { |
485 | t << "# Begin Source File" << endl << endl; | 564 | t << "# Begin Source File" << endl << endl; |
486 | t << "SOURCE=" << (*it) << endl; | 565 | t << "SOURCE=" << (*it) << endl; |
487 | t << "# PROP Exclude_From_Build 1" << endl; | 566 | t << "# PROP Exclude_From_Build 1" << endl; |
488 | t << "# End Source File" << endl << endl; | 567 | t << "# End Source File" << endl << endl; |
489 | } | 568 | } |
490 | } | 569 | } |
491 | else | 570 | else |
492 | t << var(variable); | 571 | t << var(variable); |
493 | } | 572 | } |
494 | t << line << endl; | 573 | t << line << endl; |
495 | } | 574 | } |
496 | t << endl; | 575 | t << endl; |
497 | file.close(); | 576 | file.close(); |
498 | return TRUE; | 577 | return TRUE; |
499 | } | 578 | } |
500 | 579 | ||
501 | 580 | ||
502 | 581 | ||
503 | void | 582 | void |
504 | DspMakefileGenerator::init() | 583 | DspMakefileGenerator::init() |
505 | { | 584 | { |
506 | if(init_flag) | 585 | if(init_flag) |
507 | return; | 586 | return; |
508 | QStringList::Iterator it; | 587 | QStringList::Iterator it; |
509 | init_flag = TRUE; | 588 | init_flag = TRUE; |
510 | 589 | ||
511 | const bool thread = project->isActiveConfig("thread"); | 590 | const bool thread = project->isActiveConfig("thread"); |
512 | 591 | ||
513 | if ( project->isActiveConfig("stl") ) { | 592 | if ( project->isActiveConfig("stl") ) { |
514 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | 593 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; |
515 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | 594 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; |
516 | } else { | 595 | } else { |
517 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | 596 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; |
518 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | 597 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; |
519 | } | 598 | } |
520 | if ( project->isActiveConfig("exceptions") ) { | 599 | if ( project->isActiveConfig("exceptions") ) { |
521 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | 600 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; |
522 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | 601 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; |
523 | } else { | 602 | } else { |
524 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | 603 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; |
525 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | 604 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; |
526 | } | 605 | } |
527 | if ( project->isActiveConfig("rtti") ) { | 606 | if ( project->isActiveConfig("rtti") ) { |
528 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | 607 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; |
529 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | 608 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; |
530 | } else { | 609 | } else { |
531 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | 610 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; |
532 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | 611 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; |
533 | } | 612 | } |
534 | 613 | ||
614 | |||
535 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 615 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
536 | if(project->first("TEMPLATE") == "vcapp" ) | 616 | if(project->first("TEMPLATE") == "vcapp" ) |
537 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 617 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
538 | else if(project->first("TEMPLATE") == "vclib") | 618 | else if(project->first("TEMPLATE") == "vclib") |
539 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 619 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
540 | if ( project->variables()["QMAKESPEC"].isEmpty() ) | 620 | if ( project->variables()["QMAKESPEC"].isEmpty() ) |
541 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); | 621 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); |
542 | 622 | ||
543 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 623 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
544 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 624 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
545 | 625 | ||
546 | QStringList &configs = project->variables()["CONFIG"]; | 626 | QStringList &configs = project->variables()["CONFIG"]; |
547 | if (project->isActiveConfig("shared")) | 627 | if (project->isActiveConfig("shared")) |
548 | project->variables()["DEFINES"].append("QT_DLL"); | 628 | project->variables()["DEFINES"].append("QT_DLL"); |
549 | if (project->isActiveConfig("qt_dll")) | 629 | if (project->isActiveConfig("qt_dll")) |
550 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 630 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
631 | if ( project->isActiveConfig("qtopia") ) { | ||
632 | if(configs.findIndex("qtopialib") == -1) | ||
633 | configs.append("qtopialib"); | ||
634 | if(configs.findIndex("qtopiainc") == -1) | ||
635 | configs.append("qtopiainc"); | ||
636 | } | ||
551 | if ( project->isActiveConfig("qt") ) { | 637 | if ( project->isActiveConfig("qt") ) { |
552 | if ( project->isActiveConfig( "plugin" ) ) { | 638 | if ( project->isActiveConfig( "plugin" ) ) { |
553 | project->variables()["CONFIG"].append("dll"); | 639 | project->variables()["CONFIG"].append("dll"); |
554 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 640 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
555 | } | 641 | } |
556 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && | 642 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && |
557 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || | 643 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || |
558 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || | 644 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || |
559 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { | 645 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { |
560 | project->variables()["QMAKE_QT_DLL"].append("1"); | 646 | project->variables()["QMAKE_QT_DLL"].append("1"); |
561 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | 647 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) |
562 | project->variables()["CONFIG"].append("dll"); | 648 | project->variables()["CONFIG"].append("dll"); |
563 | } | 649 | } |
564 | } | 650 | } |
565 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 651 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
566 | project->variables()["CONFIG"].remove("staticlib"); | 652 | project->variables()["CONFIG"].remove("staticlib"); |
567 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); | 653 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); |
568 | } else { | 654 | } else { |
569 | project->variables()["CONFIG"].append("staticlib"); | 655 | project->variables()["CONFIG"].append("staticlib"); |
570 | } | 656 | } |
571 | 657 | ||
572 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) { | 658 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) { |
573 | project->variables()["CONFIG"].append("windows"); | 659 | project->variables()["CONFIG"].append("windows"); |
574 | } | 660 | } |
575 | if ( !project->variables()["VERSION"].isEmpty() ) { | 661 | if ( !project->variables()["VERSION"].isEmpty() ) { |
576 | QString version = project->variables()["VERSION"][0]; | 662 | QString version = project->variables()["VERSION"][0]; |
577 | int firstDot = version.find( "." ); | 663 | int firstDot = version.find( "." ); |
578 | QString major = version.left( firstDot ); | 664 | QString major = version.left( firstDot ); |
579 | QString minor = version.right( version.length() - firstDot - 1 ); | 665 | QString minor = version.right( version.length() - firstDot - 1 ); |
580 | minor.replace( ".", "" ); | 666 | minor.replace( ".", "" ); |
581 | project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); | 667 | project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); |
582 | } | 668 | } |
583 | 669 | ||
670 | if ( project->isActiveConfig("qtopiainc") ) | ||
671 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
672 | if ( project->isActiveConfig("qtopialib") ) { | ||
673 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
674 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
675 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
676 | } | ||
677 | |||
584 | if ( project->isActiveConfig("qt") ) { | 678 | if ( project->isActiveConfig("qt") ) { |
585 | project->variables()["CONFIG"].append("moc"); | 679 | project->variables()["CONFIG"].append("moc"); |
586 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 680 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
587 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 681 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
588 | 682 | ||
589 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 683 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
590 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 684 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
591 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 685 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
592 | project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); | 686 | project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); |
593 | } | 687 | } |
594 | } else { | 688 | } else { |
595 | if( thread ) | 689 | if( thread ) |
596 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 690 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
597 | else | 691 | else |
598 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 692 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
599 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 693 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
600 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 694 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
601 | if ( hver == -1 ) | 695 | if ( hver == -1 ) |
602 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | 696 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); |
603 | if(hver != -1) { | 697 | if(hver != -1) { |
604 | QString ver; | 698 | QString ver; |
605 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver); | 699 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver); |
606 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 700 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
607 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 701 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
608 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | 702 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); |
609 | } | 703 | } |
610 | } | 704 | } |
611 | if ( project->isActiveConfig( "activeqt" ) ) { | 705 | if ( project->isActiveConfig( "activeqt" ) ) { |
612 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 706 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
613 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 707 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
614 | if ( project->isActiveConfig( "dll" ) ) | 708 | if ( project->isActiveConfig( "dll" ) ) |
615 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 709 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
616 | } | 710 | } |
617 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 711 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
618 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 712 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
619 | } | 713 | } |
620 | } | 714 | } |
621 | } | 715 | } |
622 | 716 | ||
623 | if ( project->isActiveConfig("debug") ) { | 717 | if ( project->isActiveConfig("debug") ) { |
624 | if ( !project->first("OBJECTS_DIR").isEmpty() ) | 718 | if ( !project->first("OBJECTS_DIR").isEmpty() ) |
625 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = project->first("OBJECTS_DIR"); | 719 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = project->first("OBJECTS_DIR"); |
626 | else | 720 | else |
627 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; | 721 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; |
628 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; | 722 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; |
629 | if ( !project->first("DESTDIR").isEmpty() ) | 723 | if ( !project->first("DESTDIR").isEmpty() ) |
630 | project->variables()["MSVCDSP_TARGETDIRDEB"] = project->first("DESTDIR"); | 724 | project->variables()["MSVCDSP_TARGETDIRDEB"] = project->first("DESTDIR"); |
631 | else | 725 | else |
632 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; | 726 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; |
633 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; | 727 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; |
634 | } else { | 728 | } else { |
635 | if ( !project->first("OBJECTS_DIR").isEmpty() ) | 729 | if ( !project->first("OBJECTS_DIR").isEmpty() ) |
636 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); | 730 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); |
731 | else | ||
732 | project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; | ||
637 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; | 733 | project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; |
638 | if ( !project->first("DESTDIR").isEmpty() ) | 734 | if ( !project->first("DESTDIR").isEmpty() ) |
639 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); | 735 | project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); |
640 | else | 736 | else |
641 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; | 737 | project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; |
642 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; | 738 | project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; |
643 | } | 739 | } |
644 | 740 | ||
645 | if ( project->isActiveConfig("opengl") ) { | 741 | if ( project->isActiveConfig("opengl") ) { |
646 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 742 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
647 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 743 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
648 | } | 744 | } |
649 | if ( thread ) { | 745 | if ( thread ) { |
650 | if(project->isActiveConfig("qt")) | 746 | if(project->isActiveConfig("qt")) |
651 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); | 747 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); |
652 | if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" | 748 | if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" |
653 | || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 749 | || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
654 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 750 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; |
655 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | 751 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; |
656 | } else { | 752 | } else { |
657 | // YES we want to use the DLL even in a static build | 753 | // YES we want to use the DLL even in a static build |
658 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | 754 | project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; |
659 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | 755 | project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; |
660 | } | 756 | } |
661 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt | 757 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt |
662 | && project->first("TARGET") != "qtmain" ) | 758 | && project->first("TARGET") != "qtmain" ) |
663 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); | 759 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); |
664 | } | 760 | } |
665 | 761 | ||
666 | if(project->isActiveConfig("qt")) { | 762 | if(project->isActiveConfig("qt")) { |
667 | if ( project->isActiveConfig("accessibility" ) ) | 763 | if ( project->isActiveConfig("accessibility" ) ) |
668 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 764 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
669 | if ( project->isActiveConfig("tablet") ) | 765 | if ( project->isActiveConfig("tablet") ) |
670 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 766 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
671 | } | 767 | } |
672 | if ( project->isActiveConfig("dll") ) { | 768 | if ( project->isActiveConfig("dll") ) { |
769 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | ||
770 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | ||
771 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | ||
772 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | ||
673 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 773 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
674 | QString ver_xyz(project->first("VERSION")); | 774 | QString ver_xyz(project->first("VERSION")); |
675 | ver_xyz.replace(".", ""); | 775 | ver_xyz.replace(".", ""); |
676 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); | 776 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); |
677 | } else { | 777 | } else { |
678 | project->variables()["TARGET_EXT"].append(".dll"); | 778 | project->variables()["TARGET_EXT"].append(".dll"); |
679 | } | 779 | } |
680 | } else { | 780 | } else { |
781 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | ||
782 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | ||
783 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | ||
784 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | ||
681 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) | 785 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) |
682 | project->variables()["TARGET_EXT"].append(".exe"); | 786 | project->variables()["TARGET_EXT"].append(".exe"); |
683 | else | 787 | else |
684 | project->variables()["TARGET_EXT"].append(".lib"); | 788 | project->variables()["TARGET_EXT"].append(".lib"); |
685 | } | 789 | } |
686 | 790 | ||
791 | if ( project->isActiveConfig("windows") ) { | ||
792 | if ( project->isActiveConfig("console") ) { | ||
793 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
794 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
795 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
796 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
797 | } else { | ||
798 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | ||
799 | } | ||
800 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | ||
801 | } else { | ||
802 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | ||
803 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | ||
804 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | ||
805 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | ||
806 | } | ||
807 | |||
687 | project->variables()["MSVCDSP_VER"] = "6.00"; | 808 | project->variables()["MSVCDSP_VER"] = "6.00"; |
688 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /ZI"; | 809 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /ZI"; |
689 | 810 | ||
690 | if(!project->isActiveConfig("incremental")) { | 811 | if(!project->isActiveConfig("incremental")) { |
691 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | 812 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); |
692 | if ( is_qt ) | 813 | if ( is_qt ) |
693 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /Zi"; | 814 | project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /Zi"; |
694 | } | 815 | } |
695 | 816 | ||
696 | QString msvcdsp_project; | 817 | QString msvcdsp_project; |
697 | if ( project->variables()["TARGET"].count() ) | 818 | if ( project->variables()["TARGET"].count() ) |
698 | msvcdsp_project = project->variables()["TARGET"].first(); | 819 | msvcdsp_project = project->variables()["TARGET"].first(); |
699 | 820 | ||
700 | QString targetfilename = project->variables()["TARGET"].first(); | 821 | QString targetfilename = project->variables()["TARGET"].first(); |
701 | project->variables()["TARGET"].first() += project->first("TARGET_EXT"); | 822 | project->variables()["TARGET"].first() += project->first("TARGET_EXT"); |
702 | if ( project->isActiveConfig("moc") ) | 823 | if ( project->isActiveConfig("moc") ) |
703 | setMocAware(TRUE); | 824 | setMocAware(TRUE); |
704 | 825 | ||
705 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 826 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
706 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 827 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
707 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 828 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
708 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 829 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
709 | for(it = l.begin(); it != l.end(); ++it) { | 830 | for(it = l.begin(); it != l.end(); ++it) { |
710 | QStringList &gdmf = project->variables()[(*it)]; | 831 | QStringList &gdmf = project->variables()[(*it)]; |
711 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 832 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
712 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 833 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
713 | } | 834 | } |
714 | 835 | ||
715 | MakefileGenerator::init(); | 836 | MakefileGenerator::init(); |
716 | if ( msvcdsp_project.isEmpty() ) | 837 | if ( msvcdsp_project.isEmpty() ) |
717 | msvcdsp_project = Option::output.name(); | 838 | msvcdsp_project = Option::output.name(); |
718 | 839 | ||
719 | msvcdsp_project = msvcdsp_project.right( msvcdsp_project.length() - msvcdsp_project.findRev( "\\" ) - 1 ); | 840 | msvcdsp_project = msvcdsp_project.right( msvcdsp_project.length() - msvcdsp_project.findRev( "\\" ) - 1 ); |
720 | msvcdsp_project = msvcdsp_project.left( msvcdsp_project.findRev( "." ) ); | 841 | msvcdsp_project = msvcdsp_project.left( msvcdsp_project.findRev( "." ) ); |
721 | msvcdsp_project.replace("-", ""); | 842 | msvcdsp_project.replace("-", ""); |
722 | 843 | ||
723 | project->variables()["MSVCDSP_PROJECT"].append(msvcdsp_project); | 844 | project->variables()["MSVCDSP_PROJECT"].append(msvcdsp_project); |
724 | QStringList &proj = project->variables()["MSVCDSP_PROJECT"]; | 845 | QStringList &proj = project->variables()["MSVCDSP_PROJECT"]; |
725 | 846 | ||
726 | for(it = proj.begin(); it != proj.end(); ++it) | 847 | for(it = proj.begin(); it != proj.end(); ++it) |
727 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); | 848 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); |
728 | 849 | ||
729 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 850 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
730 | project->variables()["MSVCDSP_TEMPLATE"].append("win32app" + project->first( "DSP_EXTENSION" ) ); | 851 | project->variables()["MSVCDSP_TEMPLATE"].append("win32app" + project->first( "DSP_EXTENSION" ) ); |
731 | if ( project->isActiveConfig("console") ) { | 852 | if ( project->isActiveConfig("console") ) { |
732 | project->variables()["MSVCDSP_CONSOLE"].append("Console"); | 853 | project->variables()["MSVCDSP_CONSOLE"].append("Console"); |
733 | project->variables()["MSVCDSP_WINCONDEF"].append("_CONSOLE"); | 854 | project->variables()["MSVCDSP_WINCONDEF"].append("_CONSOLE"); |
734 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); | 855 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); |
735 | project->variables()["MSVCDSP_SUBSYSTEM"].append("console"); | ||
736 | } else { | 856 | } else { |
737 | project->variables()["MSVCDSP_CONSOLE"].clear(); | 857 | project->variables()["MSVCDSP_CONSOLE"].clear(); |
738 | project->variables()["MSVCDSP_WINCONDEF"].append("_WINDOWS"); | 858 | project->variables()["MSVCDSP_WINCONDEF"].append("_WINDOWS"); |
739 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); | 859 | project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); |
740 | project->variables()["MSVCDSP_SUBSYSTEM"].append("windows"); | ||
741 | } | 860 | } |
742 | } else { | 861 | } else { |
743 | if ( project->isActiveConfig("dll") ) { | 862 | if ( project->isActiveConfig("dll") ) { |
744 | project->variables()["MSVCDSP_TEMPLATE"].append("win32dll" + project->first( "DSP_EXTENSION" ) ); | 863 | project->variables()["MSVCDSP_TEMPLATE"].append("win32dll" + project->first( "DSP_EXTENSION" ) ); |
745 | } else { | 864 | } else { |
746 | project->variables()["MSVCDSP_TEMPLATE"].append("win32lib" + project->first( "DSP_EXTENSION" ) ); | 865 | project->variables()["MSVCDSP_TEMPLATE"].append("win32lib" + project->first( "DSP_EXTENSION" ) ); |
747 | } | 866 | } |
748 | } | 867 | } |
749 | 868 | ||
750 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 869 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
870 | |||
871 | processPrlFiles(); | ||
751 | 872 | ||
873 | // Update -lname to name.lib, | ||
874 | QStringList &libs2 = project->variables()["QMAKE_LIBS"]; | ||
875 | for ( QStringList::Iterator libit2 = libs2.begin(); libit2 != libs2.end(); ++libit2 ) { | ||
876 | if ( (*libit2).startsWith( "-l" ) ) { | ||
877 | (*libit2) = (*libit2).mid( 2 ) + ".lib"; | ||
878 | } else if ( (*libit2).startsWith( "-L" ) ) { | ||
879 | project->variables()["QMAKE_LIBDIR"] += (*libit2).mid(2); | ||
880 | libit2 = libs2.remove( libit2 ); | ||
881 | } | ||
882 | } | ||
883 | |||
752 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 884 | project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
753 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 885 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
754 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); | 886 | project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); |
755 | project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; | 887 | project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; |
756 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); | 888 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); |
757 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); | 889 | project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); |
758 | 890 | ||
759 | processPrlFiles(); | 891 | if (!project->variables()["RES_FILE"].isEmpty()) |
892 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | ||
893 | |||
760 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 894 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
761 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { | 895 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { |
762 | QString lib = (*libit); | 896 | QString lib = (*libit); |
763 | lib.replace(QRegExp("\""), ""); | 897 | lib.replace(QRegExp("\""), ""); |
764 | project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); | 898 | project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); |
765 | } | 899 | } |
766 | 900 | ||
767 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 901 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
768 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 902 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
769 | QString inc = (*incit); | 903 | QString inc = (*incit); |
770 | inc.replace("\"", ""); | 904 | inc.replace("\"", ""); |
905 | if(inc.endsWith("\\")) // Remove trailing \'s from paths | ||
906 | inc.truncate(inc.length()-1); | ||
771 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); | 907 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); |
772 | } | 908 | } |
773 | 909 | ||
774 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); | 910 | project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); |
775 | if ( project->isActiveConfig("qt") ) { | 911 | if ( project->isActiveConfig("qt") ) { |
776 | project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); | 912 | project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); |
777 | } else { | 913 | } else { |
778 | project->variables()["MSVCDSP_RELDEFS"].clear(); | 914 | project->variables()["MSVCDSP_RELDEFS"].clear(); |
779 | } | 915 | } |
780 | 916 | ||
781 | QString dest; | 917 | QString dest; |
782 | QString postLinkStep; | 918 | QString postLinkStep; |
783 | QString copyDllStep; | 919 | QString copyDllStep; |
784 | QString activeQtStepPreCopyDll; | 920 | QString activeQtStepPreCopyDll; |
785 | QString activeQtStepPostCopyDll; | 921 | QString activeQtStepPostCopyDll; |
786 | QString activeQtStepPreCopyDllDebug; | 922 | QString activeQtStepPreCopyDllDebug; |
787 | QString activeQtStepPostCopyDllDebug; | 923 | QString activeQtStepPostCopyDllDebug; |
788 | QString activeQtStepPreCopyDllRelease; | 924 | QString activeQtStepPreCopyDllRelease; |
789 | QString activeQtStepPostCopyDllRelease; | 925 | QString activeQtStepPostCopyDllRelease; |
790 | 926 | ||
791 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) | 927 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) |
792 | postLinkStep += var("QMAKE_POST_LINK"); | 928 | postLinkStep += var("QMAKE_POST_LINK"); |
793 | 929 | ||
794 | if ( !project->variables()["DESTDIR"].isEmpty() ) { | 930 | if ( !project->variables()["DESTDIR"].isEmpty() ) { |
795 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 931 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); |
796 | Option::fixPathToTargetOS(project->first("TARGET")); | 932 | Option::fixPathToTargetOS(project->first("TARGET")); |
797 | dest = project->first("TARGET"); | 933 | dest = project->first("TARGET"); |
798 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) | 934 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) |
799 | dest.replace( "$(QTDIR)", getenv("QTDIR") ); | 935 | dest.replace( "$(QTDIR)", getenv("QTDIR") ); |
800 | project->variables()["MSVCDSP_TARGET"].append( | 936 | project->variables()["MSVCDSP_TARGET"].append( |
801 | QString("/out:\"") + dest + "\""); | 937 | QString("/out:\"") + dest + "\""); |
802 | if ( project->isActiveConfig("dll") ) { | 938 | if ( project->isActiveConfig("dll") ) { |
803 | QString imp = dest; | 939 | QString imp = dest; |
804 | imp.replace(".dll", ".lib"); | 940 | imp.replace(".dll", ".lib"); |
805 | project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); | 941 | project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); |
806 | } | 942 | } |
807 | } | 943 | } |
808 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { | 944 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { |
809 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 945 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
810 | if ( dlldirs.count() ) | 946 | if ( dlldirs.count() ) |
811 | copyDllStep += "\t"; | 947 | copyDllStep += "\t"; |
812 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 948 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
813 | copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t"; | 949 | copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t"; |
814 | } | 950 | } |
815 | } | 951 | } |
816 | 952 | ||
817 | if ( project->isActiveConfig("activeqt") ) { | 953 | if ( project->isActiveConfig("activeqt") ) { |
818 | QString idl = project->variables()["QMAKE_IDL"].first(); | 954 | QString idl = project->variables()["QMAKE_IDL"].first(); |
819 | QString idc = project->variables()["QMAKE_IDC"].first(); | 955 | QString idc = project->variables()["QMAKE_IDC"].first(); |
820 | QString version = project->variables()["VERSION"].first(); | 956 | QString version = project->variables()["VERSION"].first(); |
821 | if ( version.isEmpty() ) | 957 | if ( version.isEmpty() ) |
822 | version = "1.0"; | 958 | version = "1.0"; |
823 | 959 | project->variables()["MSVCDSP_IDLSOURCES"].append( var("OBJECTS_DIR") + targetfilename + ".idl" ); | |
824 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | ||
825 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | ||
826 | project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | ||
827 | if ( project->isActiveConfig( "dll" ) ) { | 960 | if ( project->isActiveConfig( "dll" ) ) { |
828 | activeQtStepPreCopyDll += | 961 | activeQtStepPreCopyDll += |
829 | "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | 962 | "\t" + idc + " %1 -idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version + |
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" | 963 | "\t" + idl + " /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb" + |
831 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; | 964 | "\t" + idc + " %2 /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"; |
832 | activeQtStepPostCopyDll += | 965 | activeQtStepPostCopyDll += |
833 | "\t" + idc + " %1 /regserver\n"; | 966 | "\t" + idc + " %1 /regserver\n"; |
834 | 967 | ||
835 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll"; | 968 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll"; |
836 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); | 969 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); |
837 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); | 970 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); |
838 | 971 | ||
839 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll"; | 972 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll"; |
840 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); | 973 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); |
841 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); | 974 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); |
842 | } else { | 975 | } else { |
843 | activeQtStepPreCopyDll += | 976 | activeQtStepPreCopyDll += |
844 | "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | 977 | "\t%1 -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version + |
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" | 978 | "\t" + idl + " /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb" + |
846 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; | 979 | "\t" + idc + " %2 /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"; |
847 | activeQtStepPostCopyDll += | 980 | activeQtStepPostCopyDll += |
848 | "\t%1 -regserver\n"; | 981 | "\t%1 -regserver\n"; |
849 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe"; | 982 | QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe"; |
850 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); | 983 | activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); |
851 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); | 984 | activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); |
852 | 985 | ||
853 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe"; | 986 | executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe"; |
854 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); | 987 | activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); |
855 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); | 988 | activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); |
856 | } | 989 | } |
857 | 990 | ||
858 | } | 991 | } |
859 | 992 | ||
860 | 993 | ||
861 | if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) { | 994 | if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) { |
862 | project->variables()["MSVCDSP_POST_LINK_DBG"].append( | 995 | project->variables()["MSVCDSP_POST_LINK_DBG"].append( |
863 | "# Begin Special Build Tool\n" | 996 | "# Begin Special Build Tool\n" |
864 | "SOURCE=$(InputPath)\n" | 997 | "SOURCE=$(InputPath)\n" |
865 | "PostBuild_Desc=Post Build Step\n" | 998 | "PostBuild_Desc=Post Build Step\n" |
866 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n" | 999 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n" |
867 | "# End Special Build Tool\n" ); | 1000 | "# End Special Build Tool\n" ); |
868 | project->variables()["MSVCDSP_POST_LINK_REL"].append( | 1001 | project->variables()["MSVCDSP_POST_LINK_REL"].append( |
869 | "# Begin Special Build Tool\n" | 1002 | "# Begin Special Build Tool\n" |
870 | "SOURCE=$(InputPath)\n" | 1003 | "SOURCE=$(InputPath)\n" |
871 | "PostBuild_Desc=Post Build Step\n" | 1004 | "PostBuild_Desc=Post Build Step\n" |
872 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n" | 1005 | "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n" |
873 | "# End Special Build Tool\n" ); | 1006 | "# End Special Build Tool\n" ); |
874 | } | 1007 | } |
875 | 1008 | ||
876 | if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { | 1009 | if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { |
877 | project->variables()["SOURCES"] += project->variables()["RC_FILE"]; | 1010 | project->variables()["SOURCES"] += project->variables()["RC_FILE"]; |
878 | } | 1011 | } |
879 | QStringList &list = project->variables()["FORMS"]; | 1012 | QStringList &list = project->variables()["FORMS"]; |
880 | for( it = list.begin(); it != list.end(); ++it ) { | 1013 | for( it = list.begin(); it != list.end(); ++it ) { |
881 | if ( QFile::exists( *it + ".h" ) ) | 1014 | if ( QFile::exists( *it + ".h" ) ) |
882 | project->variables()["SOURCES"].append( *it + ".h" ); | 1015 | project->variables()["SOURCES"].append( *it + ".h" ); |
883 | } | 1016 | } |
884 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; | 1017 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; |
885 | } | 1018 | } |
886 | 1019 | ||
887 | 1020 | ||
888 | QString | 1021 | QString |
889 | DspMakefileGenerator::findTemplate(const QString &file) | 1022 | DspMakefileGenerator::findTemplate(const QString &file) |
890 | { | 1023 | { |
891 | QString ret; | 1024 | QString ret; |
892 | if(!QFile::exists((ret = file)) && | 1025 | if(!QFile::exists((ret = file)) && |
893 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && | 1026 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && |
894 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && | 1027 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && |
895 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 1028 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
896 | return ""; | 1029 | return ""; |
897 | return ret; | 1030 | return ret; |
898 | } | 1031 | } |
899 | 1032 | ||
900 | 1033 | ||
901 | void | 1034 | void |
902 | DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 1035 | DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
903 | { | 1036 | { |
904 | if(var == "QMAKE_PRL_DEFINES") { | 1037 | if(var == "QMAKE_PRL_DEFINES") { |
905 | QStringList &out = project->variables()["MSVCDSP_DEFINES"]; | 1038 | QStringList &out = project->variables()["MSVCDSP_DEFINES"]; |
906 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1039 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
907 | if(out.findIndex((*it)) == -1) | 1040 | if(out.findIndex((*it)) == -1) |
908 | out.append((" /D \"" + *it + "\"")); | 1041 | out.append((" /D \"" + *it + "\"")); |
909 | } | 1042 | } |
910 | } else { | 1043 | } else { |
911 | MakefileGenerator::processPrlVariable(var, l); | 1044 | MakefileGenerator::processPrlVariable(var, l); |
912 | } | 1045 | } |
913 | } | 1046 | } |
914 | 1047 | ||
915 | 1048 | ||
916 | void | 1049 | void |
917 | DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, | 1050 | DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, |
918 | const QString& filter) | 1051 | const QString& filter) |
919 | { | 1052 | { |
920 | if(project->isActiveConfig("flat")) | 1053 | if(project->isActiveConfig("flat")) |
921 | return; | 1054 | return; |
922 | |||
923 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); | 1055 | fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); |
924 | file = file.section(Option::dir_sep, 0, -2); | 1056 | file = file.section(Option::dir_sep, 0, -2); |
925 | if(file.right(Option::dir_sep.length()) != Option::dir_sep) | 1057 | if(file.right(Option::dir_sep.length()) != Option::dir_sep) |
926 | file += Option::dir_sep; | 1058 | file += Option::dir_sep; |
927 | if(file == currentGroup) | 1059 | if(file == currentGroup) |
928 | return; | 1060 | return; |
929 | 1061 | ||
930 | if(file.isEmpty() || !QDir::isRelativePath(file)) { | 1062 | if(file.isEmpty() || !QDir::isRelativePath(file)) { |
931 | endGroups(t); | 1063 | endGroups(t); |
932 | return; | 1064 | return; |
933 | } | 1065 | } |
934 | if(file.startsWith(currentGroup)) | 1066 | |
935 | file = file.mid(currentGroup.length()); | 1067 | QString tempFile = file; |
1068 | if(tempFile.startsWith(currentGroup)) | ||
1069 | tempFile = tempFile.mid(currentGroup.length()); | ||
936 | int dirSep = currentGroup.findRev( Option::dir_sep ); | 1070 | int dirSep = currentGroup.findRev( Option::dir_sep ); |
937 | while( !file.startsWith( currentGroup ) && dirSep != -1 ) { | 1071 | |
1072 | while( !tempFile.startsWith( currentGroup ) && dirSep != -1 ) { | ||
938 | currentGroup.truncate( dirSep ); | 1073 | currentGroup.truncate( dirSep ); |
939 | dirSep = currentGroup.findRev( Option::dir_sep ); | 1074 | dirSep = currentGroup.findRev( Option::dir_sep ); |
940 | if ( !file.startsWith( currentGroup ) && dirSep != -1 ) | 1075 | if ( !tempFile.startsWith( currentGroup ) && dirSep != -1 ) |
941 | t << "\n# End Group\n"; | 1076 | t << "\n# End Group\n"; |
942 | } | 1077 | } |
943 | if ( !file.startsWith( currentGroup ) ) { | 1078 | if ( !file.startsWith( currentGroup ) ) { |
944 | t << "\n# End Group\n"; | 1079 | t << "\n# End Group\n"; |
945 | currentGroup = ""; | 1080 | currentGroup = ""; |
946 | } | 1081 | } |
1082 | |||
947 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); | 1083 | QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); |
948 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { | 1084 | for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { |
949 | t << "# Begin Group \"" << (*dir_it) << "\"\n" | 1085 | t << "# Begin Group \"" << (*dir_it) << "\"\n" |
950 | << "# Prop Default_Filter \"" << filter << "\"\n"; | 1086 | << "# Prop Default_Filter \"" << filter << "\"\n"; |
951 | } | 1087 | } |
952 | currentGroup = file; | 1088 | currentGroup = file; |
953 | } | 1089 | } |
954 | 1090 | ||
955 | 1091 | ||
956 | void | 1092 | void |
957 | DspMakefileGenerator::endGroups(QTextStream &t) | 1093 | DspMakefileGenerator::endGroups(QTextStream &t) |
958 | { | 1094 | { |
959 | if(project->isActiveConfig("flat")) | 1095 | if(project->isActiveConfig("flat")) |
960 | return; | 1096 | return; |
961 | else if(currentGroup.isEmpty()) | 1097 | else if(currentGroup.isEmpty()) |
962 | return; | 1098 | return; |
963 | 1099 | ||
964 | QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); | 1100 | QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); |
965 | for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { | 1101 | for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { |
966 | t << "\n# End Group\n"; | 1102 | t << "\n# End Group\n"; |
967 | } | 1103 | } |
968 | currentGroup = ""; | 1104 | currentGroup = ""; |
969 | } | 1105 | } |
970 | 1106 | ||
971 | bool | 1107 | bool |
972 | DspMakefileGenerator::openOutput(QFile &file) const | 1108 | DspMakefileGenerator::openOutput(QFile &file) const |
973 | { | 1109 | { |
974 | QString outdir; | 1110 | QString outdir; |
975 | if(!file.name().isEmpty()) { | 1111 | if(!file.name().isEmpty()) { |
1112 | if(QDir::isRelativePath(file.name())) | ||
1113 | file.setName(Option::output_dir + file.name()); //pwd when qmake was run | ||
976 | QFileInfo fi(file); | 1114 | QFileInfo fi(file); |
977 | if(fi.isDir()) | 1115 | if(fi.isDir()) |
978 | outdir = file.name() + QDir::separator(); | 1116 | outdir = file.name() + QDir::separator(); |
979 | } | 1117 | } |
980 | if(!outdir.isEmpty() || file.name().isEmpty()) | 1118 | if(!outdir.isEmpty() || file.name().isEmpty()) |
981 | file.setName(outdir + project->first("TARGET") + project->first("DSP_EXTENSION")); | 1119 | file.setName(outdir + project->first("TARGET") + project->first("DSP_EXTENSION")); |
982 | if(QDir::isRelativePath(file.name())) { | 1120 | if(QDir::isRelativePath(file.name())) { |
983 | QString ofile; | 1121 | QString ofile; |
984 | ofile = file.name(); | 1122 | ofile = file.name(); |
985 | int slashfind = ofile.findRev('\\'); | 1123 | int slashfind = ofile.findRev('\\'); |
986 | if (slashfind == -1) { | 1124 | if (slashfind == -1) { |
987 | ofile = ofile.replace(QRegExp("-"), "_"); | 1125 | ofile = ofile.replace(QRegExp("-"), "_"); |
988 | } else { | 1126 | } else { |
989 | int hypenfind = ofile.find('-', slashfind); | 1127 | int hypenfind = ofile.find('-', slashfind); |
990 | while (hypenfind != -1 && slashfind < hypenfind) { | 1128 | while (hypenfind != -1 && slashfind < hypenfind) { |
991 | ofile = ofile.replace(hypenfind, 1, "_"); | 1129 | ofile = ofile.replace(hypenfind, 1, "_"); |
992 | hypenfind = ofile.find('-', hypenfind + 1); | 1130 | hypenfind = ofile.find('-', hypenfind + 1); |
993 | } | 1131 | } |
994 | } | 1132 | } |
995 | file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile)); | 1133 | file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile)); |
996 | } | 1134 | } |
997 | return Win32MakefileGenerator::openOutput(file); | 1135 | return Win32MakefileGenerator::openOutput(file); |
998 | } | 1136 | } |
diff --git a/qmake/generators/win32/msvc_dsp.h b/qmake/generators/win32/msvc_dsp.h index 3a7d18e..0e86539 100644 --- a/qmake/generators/win32/msvc_dsp.h +++ b/qmake/generators/win32/msvc_dsp.h | |||
@@ -1,73 +1,76 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of DspMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __MSVC_DSP_H__ | 36 | #ifndef __MSVC_DSP_H__ |
38 | #define __MSVC_DSP_H__ | 37 | #define __MSVC_DSP_H__ |
39 | 38 | ||
40 | #include "winmakefile.h" | 39 | #include "winmakefile.h" |
41 | #include <qvaluestack.h> | 40 | #include <qvaluestack.h> |
42 | 41 | ||
43 | class DspMakefileGenerator : public Win32MakefileGenerator | 42 | class DspMakefileGenerator : public Win32MakefileGenerator |
44 | { | 43 | { |
45 | QString currentGroup; | 44 | QString currentGroup; |
46 | void beginGroupForFile(QString file, QTextStream &, const QString& filter=""); | 45 | void beginGroupForFile(QString file, QTextStream &, const QString& filter=""); |
47 | void endGroups(QTextStream &); | 46 | void endGroups(QTextStream &); |
48 | 47 | ||
49 | bool init_flag; | 48 | bool init_flag; |
50 | bool writeDspParts(QTextStream &); | 49 | bool writeDspParts(QTextStream &); |
51 | 50 | ||
52 | bool writeMakefile(QTextStream &); | 51 | bool writeMakefile(QTextStream &); |
53 | QString findTemplate(const QString &file); | 52 | QString findTemplate(const QString &file); |
54 | void init(); | 53 | void init(); |
55 | 54 | ||
56 | public: | 55 | public: |
57 | DspMakefileGenerator(QMakeProject *p); | 56 | DspMakefileGenerator(QMakeProject *p); |
58 | ~DspMakefileGenerator(); | 57 | ~DspMakefileGenerator(); |
59 | 58 | ||
60 | bool openOutput(QFile &file) const; | 59 | bool openOutput(QFile &file) const; |
61 | 60 | ||
62 | protected: | 61 | protected: |
63 | virtual void processPrlVariable(const QString &, const QStringList &); | 62 | virtual void processPrlVariable(const QString &, const QStringList &); |
64 | virtual bool findLibraries(); | 63 | virtual bool findLibraries(); |
64 | |||
65 | QString precompH, | ||
66 | precompObj, precompPch; | ||
67 | bool usePCH; | ||
65 | }; | 68 | }; |
66 | 69 | ||
67 | inline DspMakefileGenerator::~DspMakefileGenerator() | 70 | inline DspMakefileGenerator::~DspMakefileGenerator() |
68 | { } | 71 | { } |
69 | 72 | ||
70 | inline bool DspMakefileGenerator::findLibraries() | 73 | inline bool DspMakefileGenerator::findLibraries() |
71 | { return Win32MakefileGenerator::findLibraries("MSVCDSP_LIBS"); } | 74 | { return Win32MakefileGenerator::findLibraries("MSVCDSP_LIBS"); } |
72 | 75 | ||
73 | #endif /* __MSVC_DSP_H__ */ | 76 | #endif /* __MSVC_DSP_H__ */ |
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index ecef34d..528cb19 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp | |||
@@ -1,562 +1,787 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of NmakeMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "msvc_nmake.h" | 36 | #include "msvc_nmake.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qregexp.h> | 38 | #include <qregexp.h> |
41 | #include <qdict.h> | 39 | #include <qdict.h> |
42 | #include <qdir.h> | 40 | #include <qdir.h> |
43 | #include <stdlib.h> | 41 | #include <stdlib.h> |
44 | #include <time.h> | 42 | #include <time.h> |
45 | 43 | ||
46 | |||
47 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 44 | NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
48 | { | 45 | { |
49 | 46 | ||
50 | } | 47 | } |
51 | 48 | ||
52 | bool | 49 | bool |
53 | NmakeMakefileGenerator::writeMakefile(QTextStream &t) | 50 | NmakeMakefileGenerator::writeMakefile(QTextStream &t) |
54 | { | 51 | { |
55 | writeHeader(t); | 52 | writeHeader(t); |
56 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 53 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
54 | { //write the extra unix targets.. | ||
55 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
56 | for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) | ||
57 | t << *it << " "; | ||
58 | } | ||
57 | t << "all clean:" << "\n\t" | 59 | t << "all clean:" << "\n\t" |
58 | << "@echo \"Some of the required modules (" | 60 | << "@echo \"Some of the required modules (" |
59 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | 61 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" |
60 | << "@echo \"Skipped.\"" << endl << endl; | 62 | << "@echo \"Skipped.\"" << endl << endl; |
61 | writeMakeQmake(t); | 63 | writeMakeQmake(t); |
62 | return TRUE; | 64 | return TRUE; |
63 | } | 65 | } |
64 | 66 | ||
65 | if(project->first("TEMPLATE") == "app" || | 67 | if(project->first("TEMPLATE") == "app" || |
66 | project->first("TEMPLATE") == "lib") { | 68 | project->first("TEMPLATE") == "lib") { |
67 | writeNmakeParts(t); | 69 | writeNmakeParts(t); |
68 | return MakefileGenerator::writeMakefile(t); | 70 | return MakefileGenerator::writeMakefile(t); |
69 | } | 71 | } |
70 | else if(project->first("TEMPLATE") == "subdirs") { | 72 | else if(project->first("TEMPLATE") == "subdirs") { |
71 | writeSubDirs(t); | 73 | writeSubDirs(t); |
72 | return TRUE; | 74 | return TRUE; |
73 | } | 75 | } |
74 | return FALSE; | 76 | return FALSE; |
75 | } | 77 | } |
76 | 78 | ||
79 | QStringList | ||
80 | &NmakeMakefileGenerator::findDependencies(const QString &file) | ||
81 | { | ||
82 | QStringList &aList = MakefileGenerator::findDependencies(file); | ||
83 | // Note: The QMAKE_IMAGE_COLLECTION file have all images | ||
84 | // as dependency, so don't add precompiled header then | ||
85 | if (file == project->first("QMAKE_IMAGE_COLLECTION")) | ||
86 | return aList; | ||
87 | for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) { | ||
88 | if(file.endsWith(*it)) { | ||
89 | if(!aList.contains(precompH)) | ||
90 | aList += precompH; | ||
91 | break; | ||
92 | } | ||
93 | } | ||
94 | return aList; | ||
95 | } | ||
96 | |||
77 | void | 97 | void |
78 | NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) | 98 | NmakeMakefileGenerator::writeNmakeParts(QTextStream &t) |
79 | { | 99 | { |
80 | t << "####### Compiler, tools and options" << endl << endl; | 100 | t << "####### Compiler, tools and options" << endl << endl; |
81 | t << "CC =" << var("QMAKE_CC") << endl; | 101 | t << "CC =" << var("QMAKE_CC") << endl; |
82 | t << "CXX =" << var("QMAKE_CXX") << endl; | 102 | t << "CXX =" << var("QMAKE_CXX") << endl; |
83 | t << "LEX = " << var("QMAKE_LEX") << endl; | 103 | t << "LEX = " << var("QMAKE_LEX") << endl; |
84 | t << "YACC = " << var("QMAKE_YACC") << endl; | 104 | t << "YACC = " << var("QMAKE_YACC") << endl; |
85 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " | 105 | t << "CFLAGS =" << var("QMAKE_CFLAGS") << " " |
86 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 106 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
87 | << varGlue("DEFINES","-D"," -D","") << endl; | 107 | << varGlue("DEFINES","-D"," -D","") << endl; |
88 | t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " " | 108 | t << "CXXFLAGS =" << var("QMAKE_CXXFLAGS") << " " |
89 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 109 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
90 | << varGlue("DEFINES","-D"," -D","") << endl; | 110 | << varGlue("DEFINES","-D"," -D","") << endl; |
91 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; | 111 | t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl; |
92 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; | 112 | t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl; |
93 | 113 | ||
94 | t << "INCPATH ="; | 114 | t << "INCPATH ="; |
95 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 115 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
96 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 116 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
97 | QString inc = (*incit); | 117 | QString inc = (*incit); |
98 | inc.replace(QRegExp("\\\\$"), "\\\\"); | 118 | if (inc.endsWith("\\")) |
99 | inc.replace("\"", ""); | 119 | inc.truncate(inc.length()-1); |
100 | t << " -I\"" << inc << "\""; | 120 | t << " -I\"" << inc << "\""; |
101 | } | 121 | } |
102 | t << " -I\"" << specdir() << "\"" | 122 | t << " -I\"" << specdir() << "\"" |
103 | << endl; | 123 | << endl; |
104 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 124 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
105 | t << "LINK =" << var("QMAKE_LINK") << endl; | 125 | t << "LINK =" << var("QMAKE_LINK") << endl; |
106 | t << "LFLAGS =" << var("QMAKE_LFLAGS"); | 126 | t << "LFLAGS =" << var("QMAKE_LFLAGS"); |
107 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) | 127 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) |
108 | t << " " << varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\""); | 128 | t << " " << varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\""); |
109 | t << endl; | 129 | t << endl; |
110 | t << "LIBS ="; | 130 | t << "LIBS ="; |
111 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 131 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
112 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { | 132 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { |
113 | QString lib = (*libit); | 133 | QString lib = (*libit); |
114 | lib.replace(QRegExp("\\\\$"), "\\\\"); | 134 | if (lib.endsWith("\\")) |
115 | lib.replace(QRegExp("\""), ""); | 135 | lib.truncate(lib.length()-1); |
116 | t << " \"" << lib << "\""; | 136 | t << " \"" << lib << "\""; |
117 | } | 137 | } |
118 | t << endl; | 138 | t << endl; |
119 | } | 139 | } |
120 | else { | 140 | else { |
121 | t << "LIB =" << var("QMAKE_LIB") << endl; | 141 | t << "LIB =" << var("QMAKE_LIB") << endl; |
122 | } | 142 | } |
123 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : | 143 | t << "MOC =" << (project->isEmpty("QMAKE_MOC") ? QString("moc") : |
124 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; | 144 | Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl; |
125 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : | 145 | t << "UIC =" << (project->isEmpty("QMAKE_UIC") ? QString("uic") : |
126 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; | 146 | Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl; |
127 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : | 147 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : |
128 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; | 148 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl; |
129 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : | 149 | t << "IDC =" << (project->isEmpty("QMAKE_IDC") ? QString("idc") : |
130 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; | 150 | Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl; |
131 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : | 151 | t << "IDL =" << (project->isEmpty("QMAKE_IDL") ? QString("midl") : |
132 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; | 152 | Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl; |
133 | t << "ZIP =" << var("QMAKE_ZIP") << endl; | 153 | t << "ZIP =" << var("QMAKE_ZIP") << endl; |
134 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; | 154 | t << "COPY_FILE= " << var("QMAKE_COPY") << endl; |
135 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; | 155 | t << "COPY_DIR= " << var("QMAKE_COPY") << endl; |
136 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; | 156 | t << "DEL_FILE= " << var("QMAKE_DEL_FILE") << endl; |
137 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; | 157 | t << "DEL_DIR= " << var("QMAKE_DEL_DIR") << endl; |
138 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 158 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
139 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; | 159 | t << "CHK_DIR_EXISTS =" << var("QMAKE_CHK_DIR_EXISTS") << endl; |
140 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; | 160 | t << "MKDIR =" << var("QMAKE_MKDIR") << endl; |
161 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
162 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
141 | t << endl; | 163 | t << endl; |
142 | 164 | ||
143 | t << "####### Files" << endl << endl; | 165 | t << "####### Files" << endl << endl; |
144 | t << "HEADERS =" << varList("HEADERS") << endl; | 166 | t << "HEADERS =" << varList("HEADERS") << endl; |
145 | t << "SOURCES =" << varList("SOURCES") << endl; | 167 | t << "SOURCES =" << varList("SOURCES") << endl; |
146 | t << "OBJECTS =" << varList("OBJECTS") << endl; | 168 | t << "OBJECTS =" << varList("OBJECTS") << endl; |
147 | t << "FORMS =" << varList("FORMS") << endl; | 169 | t << "FORMS =" << varList("FORMS") << endl; |
148 | t << "UICDECLS =" << varList("UICDECLS") << endl; | 170 | t << "UICDECLS =" << varList("UICDECLS") << endl; |
149 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; | 171 | t << "UICIMPLS =" << varList("UICIMPLS") << endl; |
150 | t << "SRCMOC =" << varList("SRCMOC") << endl; | 172 | t << "SRCMOC =" << varList("SRCMOC") << endl; |
151 | t << "OBJMOC =" << varList("OBJMOC") << endl; | 173 | t << "OBJMOC =" << varList("OBJMOC") << endl; |
174 | |||
175 | QString extraCompilerDeps; | ||
176 | if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) { | ||
177 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | ||
178 | extraCompilerDeps += " $(OBJCOMP) "; | ||
179 | |||
180 | QStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
181 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { | ||
182 | QStringList &vars = project->variables()[(*compit) + ".variables"]; | ||
183 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { | ||
184 | QStringList vals = project->variables()[(*varit)]; | ||
185 | if(!vals.isEmpty()) | ||
186 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
152 | t << "DIST =" << varList("DISTFILES") << endl; | 191 | t << "DIST =" << varList("DISTFILES") << endl; |
153 | t << "TARGET ="; | 192 | t << "TARGET ="; |
154 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) | 193 | if( !project->variables()[ "DESTDIR" ].isEmpty() ) |
155 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); | 194 | t << varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT")); |
156 | else | 195 | else |
157 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); | 196 | t << project->variables()[ "TARGET" ].first() << project->variables()[ "TARGET_EXT" ].first(); |
158 | t << endl; | 197 | t << endl; |
159 | t << endl; | 198 | t << endl; |
160 | 199 | ||
161 | t << "####### Implicit rules" << endl << endl; | 200 | t << "####### Implicit rules" << endl << endl; |
162 | t << ".SUFFIXES: .c"; | 201 | t << ".SUFFIXES: .c"; |
163 | QStringList::Iterator cppit; | 202 | QStringList::Iterator cppit; |
164 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 203 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
165 | t << " " << (*cppit); | 204 | t << " " << (*cppit); |
166 | t << endl << endl; | 205 | t << endl << endl; |
206 | |||
167 | if(!project->isActiveConfig("no_batch")) { | 207 | if(!project->isActiveConfig("no_batch")) { |
168 | // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC | 208 | // Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC |
169 | project->variables().remove("QMAKE_RUN_CXX"); | 209 | project->variables().remove("QMAKE_RUN_CXX"); |
170 | project->variables().remove("QMAKE_RUN_CC"); | 210 | project->variables().remove("QMAKE_RUN_CC"); |
171 | 211 | ||
172 | QDict<void> source_directories; | 212 | QDict<void> source_directories; |
173 | source_directories.insert(".", (void*)1); | 213 | source_directories.insert(".", (void*)1); |
174 | if(!project->isEmpty("MOC_DIR")) | 214 | QString directories[] = { QString("MOC_DIR"), QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString::null }; |
175 | source_directories.insert(project->first("MOC_DIR"), (void*)1); | 215 | for(int y = 0; !directories[y].isNull(); y++) { |
176 | if(!project->isEmpty("UI_SOURCES_DIR")) | 216 | QString dirTemp = project->first(directories[y]); |
177 | source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1); | 217 | if (dirTemp.endsWith("\\")) |
178 | else if(!project->isEmpty("UI_DIR")) | 218 | dirTemp.truncate(dirTemp.length()-1); |
179 | source_directories.insert(project->first("UI_DIR"), (void*)1); | 219 | if(!dirTemp.isEmpty()) |
220 | source_directories.insert(dirTemp, (void*)1); | ||
221 | } | ||
180 | QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null }; | 222 | QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null }; |
181 | for(int x = 0; !srcs[x].isNull(); x++) { | 223 | for(int x = 0; !srcs[x].isNull(); x++) { |
182 | QStringList &l = project->variables()[srcs[x]]; | 224 | QStringList &l = project->variables()[srcs[x]]; |
183 | for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) { | 225 | for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) { |
184 | QString sep = "\\"; | 226 | QString sep = "\\"; |
185 | if((*sit).find(sep) == -1) | 227 | if((*sit).find(sep) == -1) |
186 | sep = "/"; | 228 | sep = "/"; |
187 | QString dir = (*sit).section(sep, 0, -2); | 229 | QString dir = (*sit).section(sep, 0, -2); |
188 | if(!dir.isEmpty() && !source_directories[dir]) | 230 | if(!dir.isEmpty() && !source_directories[dir]) |
189 | source_directories.insert(dir, (void*)1); | 231 | source_directories.insert(dir, (void*)1); |
190 | } | 232 | } |
191 | } | 233 | } |
192 | 234 | ||
193 | for(QDictIterator<void> it(source_directories); it.current(); ++it) { | 235 | for(QDictIterator<void> it(source_directories); it.current(); ++it) { |
194 | if(it.currentKey().isEmpty()) | 236 | if(it.currentKey().isEmpty()) |
195 | continue; | 237 | continue; |
196 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 238 | 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" | 239 | 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; | 240 | << 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" | 241 | 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; | 242 | << var("QMAKE_RUN_CC_IMP_BATCH").replace( QRegExp( "\\$@" ), var("OBJECTS_DIR") ) << endl << "\t$<" << endl << "<<" << endl << endl; |
201 | } | 243 | } |
202 | } else { | 244 | } else { |
203 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 245 | 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; | 246 | 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; | 247 | t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
206 | } | 248 | } |
207 | 249 | ||
208 | t << "####### Build rules" << endl << endl; | 250 | t << "####### Build rules" << endl << endl; |
209 | t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; | 251 | t << "all: " << fileFixify(Option::output.name()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(TARGET)" << endl << endl; |
210 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 252 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
211 | << var("POST_TARGETDEPS"); | 253 | << extraCompilerDeps << var("POST_TARGETDEPS"); |
212 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { | 254 | if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) { |
213 | t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t " | 255 | t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t " |
214 | << "$(OBJECTS) $(OBJMOC) $(LIBS)"; | 256 | << "$(OBJECTS) $(OBJMOC) $(LIBS)"; |
215 | } else { | 257 | } else { |
216 | t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t " | 258 | t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t " |
217 | << "$(OBJECTS) $(OBJMOC)"; | 259 | << "$(OBJECTS) $(OBJMOC)"; |
218 | } | 260 | } |
261 | t << extraCompilerDeps; | ||
219 | t << endl << "<<" << endl; | 262 | t << endl << "<<" << endl; |
220 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) | 263 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) |
221 | t << "\t" << var( "QMAKE_POST_LINK" ) << endl; | 264 | t << "\t" << var( "QMAKE_POST_LINK" ) << endl; |
222 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { | 265 | if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) { |
223 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 266 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
224 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | 267 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
225 | t << "\n\t" << "-copy $(TARGET) " << *dlldir; | 268 | t << "\n\t" << "-$(COPY_FILE) \"$(TARGET)\" " << *dlldir; |
226 | } | 269 | } |
227 | } | 270 | } |
228 | QString targetfilename = project->variables()["TARGET"].first(); | 271 | QString targetfilename = project->variables()["TARGET"].first(); |
229 | if(project->isActiveConfig("activeqt")) { | 272 | if(project->isActiveConfig("activeqt")) { |
230 | QString version = project->variables()["VERSION"].first(); | 273 | QString version = project->variables()["VERSION"].first(); |
231 | if ( version.isEmpty() ) | 274 | if ( version.isEmpty() ) |
232 | version = "1.0"; | 275 | version = "1.0"; |
233 | 276 | ||
234 | if ( project->isActiveConfig("dll")) { | 277 | if ( project->isActiveConfig("dll")) { |
235 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version); | 278 | t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
236 | 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"); | 279 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
237 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 280 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
238 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); | 281 | t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" ); |
239 | } else { | 282 | } else { |
240 | t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version); | 283 | t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version); |
241 | 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"); | 284 | t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
242 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb"); | 285 | t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
243 | t << "\n\t" << "-$(TARGET) -regserver"; | 286 | t << "\n\t" << "-$(TARGET) -regserver"; |
244 | } | 287 | } |
245 | } | 288 | } |
246 | t << endl << endl; | 289 | t << endl << endl; |
247 | 290 | ||
248 | if(!project->variables()["RC_FILE"].isEmpty()) { | 291 | if(!project->variables()["RC_FILE"].isEmpty()) { |
249 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" | 292 | t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t" |
250 | << var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl; | 293 | << var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl; |
251 | } | 294 | } |
252 | 295 | ||
253 | t << "mocables: $(SRCMOC)" << endl << endl; | 296 | t << "mocables: $(SRCMOC)" << endl |
297 | << "uicables: $(UICIMPLS) $(UICDECLS)" << endl << endl; | ||
254 | 298 | ||
255 | writeMakeQmake(t); | 299 | writeMakeQmake(t); |
256 | 300 | ||
301 | QStringList dist_files = Option::mkfile::project_files; | ||
302 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) | ||
303 | dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; | ||
304 | if(!project->isEmpty("TRANSLATIONS")) | ||
305 | dist_files << var("TRANSLATIONS"); | ||
306 | if(!project->isEmpty("FORMS")) { | ||
307 | QStringList &forms = project->variables()["FORMS"]; | ||
308 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | ||
309 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | ||
310 | if(QFile::exists(ui_h) ) | ||
311 | dist_files << ui_h; | ||
312 | } | ||
313 | } | ||
257 | t << "dist:" << "\n\t" | 314 | t << "dist:" << "\n\t" |
258 | << "$(ZIP) " << var("PROJECT") << ".zip " | 315 | << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(HEADERS) $(DIST) $(FORMS) " |
259 | << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl; | 316 | << dist_files.join(" ") << " " << var("TRANSLATIONS") << " " << var("IMAGES") << endl << endl; |
260 | 317 | ||
261 | t << "clean:" | 318 | t << "uiclean:" |
262 | << varGlue("OBJECTS","\n\t-del ","\n\t-del ","") | 319 | << varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
263 | << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","") | 320 | << varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") << endl; |
264 | << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","") | 321 | |
265 | << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","") | 322 | t << "mocclean:" |
266 | << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","") | 323 | << varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") |
267 | << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","") | 324 | << varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") << endl; |
268 | << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ",""); | 325 | |
269 | 326 | t << "clean: uiclean mocclean" | |
327 | << varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") | ||
328 | << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","\n") | ||
329 | << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","\n"); | ||
270 | if ( project->isActiveConfig("activeqt")) { | 330 | if ( project->isActiveConfig("activeqt")) { |
271 | t << ("\n\t-del tmp\\" + targetfilename + ".*"); | 331 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl"); |
272 | t << "\n\t-del tmp\\dump.*"; | 332 | t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb"); |
273 | } | 333 | } |
274 | if(!project->isEmpty("IMAGES")) | 334 | if(!project->isEmpty("IMAGES")) |
275 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", ""); | 335 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", ""); |
336 | t << endl; | ||
337 | |||
338 | // user defined targets | ||
276 | 339 | ||
277 | // blasted user defined targets | 340 | QStringList::Iterator it; |
278 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | 341 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; |
279 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | 342 | for(it = qut.begin(); it != qut.end(); ++it) { |
280 | QString targ = var((*it) + ".target"), | 343 | QString targ = var((*it) + ".target"), |
281 | cmd = var((*it) + ".commands"), deps; | 344 | cmd = var((*it) + ".commands"), deps; |
282 | if(targ.isEmpty()) | 345 | if(targ.isEmpty()) |
283 | targ = (*it); | 346 | targ = (*it); |
284 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 347 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
285 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 348 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
286 | QString dep = var((*dep_it) + ".target"); | 349 | QString dep = var((*dep_it) + ".target"); |
287 | if(dep.isEmpty()) | 350 | if(dep.isEmpty()) |
288 | dep = (*dep_it); | 351 | dep = (*dep_it); |
289 | deps += " " + dep; | 352 | deps += " " + dep; |
290 | } | 353 | } |
354 | if(!project->variables()["QMAKE_NOFORCE"].isEmpty() && | ||
355 | project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1) | ||
356 | deps += QString(" ") + "FORCE"; | ||
291 | t << "\n\n" << targ << ":" << deps << "\n\t" | 357 | t << "\n\n" << targ << ":" << deps << "\n\t" |
292 | << cmd; | 358 | << cmd; |
293 | } | 359 | } |
294 | |||
295 | t << endl << endl; | 360 | t << endl << endl; |
296 | 361 | ||
362 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
363 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
364 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
365 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
366 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); | ||
367 | QStringList &vars = project->variables()[(*it) + ".variables"]; | ||
368 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
369 | continue; | ||
370 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
371 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
372 | QStringList &inputs = project->variables()[(*it2)]; | ||
373 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
374 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
375 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
376 | out = tmp_out, cmd = tmp_cmd, deps; | ||
377 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
378 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
379 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
380 | cmd.replace("${QMAKE_FILE_OUT}", out); | ||
381 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
382 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) | ||
383 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); | ||
384 | if(!tmp_dep.isEmpty()) { | ||
385 | char buff[256]; | ||
386 | QString dep_cmd = tmp_dep; | ||
387 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
388 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { | ||
389 | while(!feof(proc)) { | ||
390 | int read_in = int(fread(buff, 1, 255, proc)); | ||
391 | if(!read_in) | ||
392 | break; | ||
393 | int l = 0; | ||
394 | for(int i = 0; i < read_in; i++) { | ||
395 | if(buff[i] == '\n' || buff[i] == ' ') { | ||
396 | deps += " " + QCString(buff+l, (i - l) + 1); | ||
397 | l = i; | ||
398 | } | ||
399 | } | ||
400 | } | ||
401 | fclose(proc); | ||
402 | } | ||
403 | } | ||
404 | t << out << ": " << in << deps << "\n\t" | ||
405 | << cmd << endl << endl; | ||
406 | } | ||
407 | } | ||
408 | } | ||
409 | t << endl; | ||
410 | |||
411 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | ||
412 | t << "FORCE:" << endl << endl; | ||
413 | |||
297 | t << "distclean: clean" | 414 | t << "distclean: clean" |
298 | << "\n\t-del $(TARGET)" | 415 | << "\n\t-$(DEL_FILE) $(TARGET)" |
299 | << endl << endl; | 416 | << endl << endl; |
417 | |||
418 | // precompiled header | ||
419 | if(usePCH) { | ||
420 | QString precompRule = QString("-c -Yc -Fp%1 -Fo%2").arg(precompPch).arg(precompObj); | ||
421 | t << precompObj << ": " << precompH << " " << findDependencies(precompH).join(" \\\n\t\t") | ||
422 | << "\n\t" << "$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " << precompH << endl << endl; | ||
423 | } | ||
300 | } | 424 | } |
301 | 425 | ||
426 | QString | ||
427 | NmakeMakefileGenerator::var(const QString &value) | ||
428 | { | ||
429 | if (usePCH) { | ||
430 | if ((value == "QMAKE_RUN_CXX_IMP_BATCH" | ||
431 | || value == "QMAKE_RUN_CXX_IMP" | ||
432 | || value == "QMAKE_RUN_CXX")) { | ||
433 | QFileInfo precompHInfo(precompH); | ||
434 | QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3") | ||
435 | .arg(precompHInfo.fileName()) | ||
436 | .arg(precompHInfo.fileName()) | ||
437 | .arg(precompPch); | ||
438 | QString p = MakefileGenerator::var(value); | ||
439 | p.replace("-c", precompRule); | ||
440 | // Cannot use -Gm with -FI & -Yu, as this gives an | ||
441 | // internal compiler error, on the newer compilers | ||
442 | p.remove("-Gm"); | ||
443 | return p; | ||
444 | } else if (value == "QMAKE_CXXFLAGS") { | ||
445 | // Remove internal compiler error option | ||
446 | return MakefileGenerator::var(value).remove("-Gm"); | ||
447 | } | ||
448 | } | ||
449 | |||
450 | // Normal val | ||
451 | return MakefileGenerator::var(value); | ||
452 | } | ||
302 | 453 | ||
303 | void | 454 | void |
304 | NmakeMakefileGenerator::init() | 455 | NmakeMakefileGenerator::init() |
305 | { | 456 | { |
306 | if(init_flag) | 457 | if(init_flag) |
307 | return; | 458 | return; |
308 | init_flag = TRUE; | 459 | init_flag = TRUE; |
309 | 460 | ||
310 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 461 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
311 | if(project->first("TEMPLATE") == "app") | 462 | if(project->first("TEMPLATE") == "app") |
312 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 463 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
313 | else if(project->first("TEMPLATE") == "lib") | 464 | else if(project->first("TEMPLATE") == "lib") |
314 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 465 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
315 | else if(project->first("TEMPLATE") == "subdirs") { | 466 | else if(project->first("TEMPLATE") == "subdirs") { |
316 | MakefileGenerator::init(); | 467 | MakefileGenerator::init(); |
317 | if(project->variables()["MAKEFILE"].isEmpty()) | 468 | if(project->variables()["MAKEFILE"].isEmpty()) |
318 | project->variables()["MAKEFILE"].append("Makefile"); | 469 | project->variables()["MAKEFILE"].append("Makefile"); |
319 | if(project->variables()["QMAKE"].isEmpty()) | 470 | if(project->variables()["QMAKE"].isEmpty()) |
320 | project->variables()["QMAKE"].append("qmake"); | 471 | project->variables()["QMAKE"].append("qmake"); |
321 | return; | 472 | return; |
322 | } | 473 | } |
323 | 474 | ||
475 | if(project->isEmpty("QMAKE_INSTALL_FILE")) | ||
476 | project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)"); | ||
477 | if(project->isEmpty("QMAKE_INSTALL_DIR")) | ||
478 | project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)"); | ||
479 | |||
324 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); | 480 | bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); |
325 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 481 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
326 | 482 | ||
327 | QString targetfilename = project->variables()["TARGET"].first(); | 483 | QString targetfilename = project->variables()["TARGET"].first(); |
328 | QStringList &configs = project->variables()["CONFIG"]; | 484 | QStringList &configs = project->variables()["CONFIG"]; |
329 | if (project->isActiveConfig("qt") && project->isActiveConfig("shared")) | 485 | if (project->isActiveConfig("qt") && project->isActiveConfig("shared")) |
330 | project->variables()["DEFINES"].append("QT_DLL"); | 486 | project->variables()["DEFINES"].append("QT_DLL"); |
331 | if (project->isActiveConfig("qt_dll")) | 487 | if (project->isActiveConfig("qt_dll")) |
332 | if(configs.findIndex("qt") == -1) configs.append("qt"); | 488 | if(configs.findIndex("qt") == -1) configs.append("qt"); |
489 | if ( project->isActiveConfig("qtopia") ) { | ||
490 | if(configs.findIndex("qtopialib") == -1) | ||
491 | configs.append("qtopialib"); | ||
492 | if(configs.findIndex("qtopiainc") == -1) | ||
493 | configs.append("qtopiainc"); | ||
494 | } | ||
333 | if ( project->isActiveConfig("qt") ) { | 495 | if ( project->isActiveConfig("qt") ) { |
334 | if ( project->isActiveConfig( "plugin" ) ) { | 496 | if ( project->isActiveConfig( "plugin" ) ) { |
335 | project->variables()["CONFIG"].append("dll"); | 497 | project->variables()["CONFIG"].append("dll"); |
336 | if(project->isActiveConfig("qt")) | 498 | if(project->isActiveConfig("qt")) |
337 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 499 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
338 | } | 500 | } |
339 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && | 501 | if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && |
340 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || | 502 | ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || |
341 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || | 503 | project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || |
342 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { | 504 | (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { |
343 | project->variables()["QMAKE_QT_DLL"].append("1"); | 505 | project->variables()["QMAKE_QT_DLL"].append("1"); |
344 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | 506 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) |
345 | project->variables()["CONFIG"].append("dll"); | 507 | project->variables()["CONFIG"].append("dll"); |
346 | } | 508 | } |
347 | if ( project->isActiveConfig("thread") ) | 509 | if ( project->isActiveConfig("thread") ) |
348 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | 510 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); |
349 | if ( project->isActiveConfig("accessibility" ) ) | 511 | if ( project->isActiveConfig("accessibility" ) ) |
350 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 512 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
351 | if ( project->isActiveConfig("tablet") ) | 513 | if ( project->isActiveConfig("tablet") ) |
352 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 514 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
353 | } | 515 | } |
354 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 516 | if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
355 | project->variables()["CONFIG"].remove("staticlib"); | 517 | project->variables()["CONFIG"].remove("staticlib"); |
356 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); | 518 | project->variables()["QMAKE_APP_OR_DLL"].append("1"); |
357 | } else { | 519 | } else { |
358 | project->variables()["CONFIG"].append("staticlib"); | 520 | project->variables()["CONFIG"].append("staticlib"); |
359 | } | 521 | } |
360 | if ( project->isActiveConfig("warn_off") ) { | 522 | if ( project->isActiveConfig("warn_off") ) { |
361 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | 523 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; |
362 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | 524 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; |
363 | } else if ( project->isActiveConfig("warn_on") ) { | 525 | } else if ( project->isActiveConfig("warn_on") ) { |
364 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | 526 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; |
365 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | 527 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; |
366 | } | 528 | } |
367 | if ( project->isActiveConfig("debug") ) { | 529 | if ( project->isActiveConfig("debug") ) { |
368 | if ( project->isActiveConfig("thread") ) { | 530 | if ( project->isActiveConfig("thread") ) { |
369 | // use the DLL RT even here | 531 | // use the DLL RT even here |
370 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | 532 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { |
371 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; | 533 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"]; |
372 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; | 534 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; |
373 | } else { | 535 | } else { |
374 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; | 536 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"]; |
375 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; | 537 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; |
376 | } | 538 | } |
377 | } | 539 | } |
378 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | 540 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; |
379 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | 541 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; |
380 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | 542 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; |
381 | } else { | 543 | } else { |
382 | if ( project->isActiveConfig("thread") ) { | 544 | if ( project->isActiveConfig("thread") ) { |
383 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { | 545 | if ( project->variables()["DEFINES"].contains("QT_DLL") ) { |
384 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; | 546 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"]; |
385 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; | 547 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; |
386 | } else { | 548 | } else { |
387 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; | 549 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"]; |
388 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; | 550 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"]; |
389 | } | 551 | } |
390 | } | 552 | } |
391 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | 553 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; |
392 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | 554 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; |
393 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | 555 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; |
394 | } | 556 | } |
395 | if ( project->isActiveConfig("thread") && !project->variables()["DEFINES"].contains("QT_DLL") | 557 | if ( project->isActiveConfig("thread") && !project->variables()["DEFINES"].contains("QT_DLL") |
396 | && !is_qt && project->first("TARGET") != "qtmain") { | 558 | && !is_qt && project->first("TARGET") != "qtmain") { |
397 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); | 559 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); |
398 | } | 560 | } |
399 | 561 | ||
400 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) | 562 | if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) |
401 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | 563 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; |
402 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) | 564 | if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) |
403 | project->variables()["CONFIG"].append("windows"); | 565 | project->variables()["CONFIG"].append("windows"); |
566 | if ( project->isActiveConfig("qtopiainc") ) | ||
567 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; | ||
568 | if ( project->isActiveConfig("qtopialib") ) { | ||
569 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) | ||
570 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"]; | ||
571 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
572 | } | ||
404 | if ( project->isActiveConfig("qt") ) { | 573 | if ( project->isActiveConfig("qt") ) { |
405 | project->variables()["CONFIG"].append("moc"); | 574 | project->variables()["CONFIG"].append("moc"); |
406 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 575 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
407 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 576 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
408 | if ( !project->isActiveConfig("debug") ) | 577 | if ( !project->isActiveConfig("debug") ) |
409 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 578 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
410 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 579 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
411 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { | 580 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) { |
412 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 581 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
413 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; | 582 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"]; |
414 | } | 583 | } |
415 | } else { | 584 | } else { |
416 | if(project->isActiveConfig("thread")) | 585 | if(project->isActiveConfig("thread")) |
417 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 586 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
418 | else | 587 | else |
419 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 588 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
420 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 589 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
421 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 590 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
422 | if ( hver == -1 ) | 591 | if ( hver == -1 ) |
423 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); | 592 | hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); |
424 | if(hver != -1) { | 593 | if(hver != -1) { |
425 | QString ver; | 594 | QString ver; |
426 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | 595 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); |
427 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 596 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
428 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 597 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
429 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | 598 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); |
430 | } | 599 | } |
431 | } | 600 | } |
432 | if ( project->isActiveConfig( "activeqt" ) ) { | 601 | if ( project->isActiveConfig( "activeqt" ) ) { |
433 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 602 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
434 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 603 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
435 | if ( project->isActiveConfig( "dll" ) ) | 604 | if ( project->isActiveConfig( "dll" ) ) |
436 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 605 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
437 | } | 606 | } |
438 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 607 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
439 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 608 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
440 | } | 609 | } |
441 | } | 610 | } |
442 | } | 611 | } |
443 | if ( project->isActiveConfig("opengl") ) { | 612 | if ( project->isActiveConfig("opengl") ) { |
444 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 613 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
445 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 614 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
446 | } | 615 | } |
447 | if ( project->isActiveConfig("dll") ) { | 616 | if ( project->isActiveConfig("dll") ) { |
448 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; | 617 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"]; |
449 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; | 618 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"]; |
450 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; | 619 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"]; |
451 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; | 620 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"]; |
452 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { | 621 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) { |
453 | project->variables()["TARGET_EXT"].append( | 622 | project->variables()["TARGET_EXT"].append( |
454 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); | 623 | QStringList::split('.',project->first("VERSION")).join("") + ".dll"); |
455 | } else { | 624 | } else { |
456 | project->variables()["TARGET_EXT"].append(".dll"); | 625 | project->variables()["TARGET_EXT"].append(".dll"); |
457 | } | 626 | } |
458 | } else { | 627 | } else { |
459 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; | 628 | project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"]; |
460 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; | 629 | project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"]; |
461 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; | 630 | project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"]; |
462 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; | 631 | project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"]; |
463 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 632 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
464 | project->variables()["TARGET_EXT"].append(".exe"); | 633 | project->variables()["TARGET_EXT"].append(".exe"); |
465 | } else { | 634 | } else { |
466 | project->variables()["TARGET_EXT"].append(".lib"); | 635 | project->variables()["TARGET_EXT"].append(".lib"); |
467 | } | 636 | } |
468 | } | 637 | } |
469 | if ( project->isActiveConfig("windows") ) { | 638 | if ( project->isActiveConfig("windows") ) { |
470 | if ( project->isActiveConfig("console") ) { | 639 | if ( project->isActiveConfig("console") ) { |
471 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 640 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; |
472 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 641 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; |
473 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 642 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; |
474 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 643 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; |
475 | } else { | 644 | } else { |
476 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; | 645 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"]; |
477 | } | 646 | } |
478 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 647 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
479 | } else { | 648 | } else { |
480 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; | 649 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"]; |
481 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; | 650 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"]; |
482 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; | 651 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"]; |
483 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; | 652 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"]; |
484 | } | 653 | } |
485 | if ( project->isActiveConfig("stl") ) { | 654 | if ( project->isActiveConfig("stl") ) { |
486 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | 655 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; |
487 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | 656 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; |
488 | } else { | 657 | } else { |
489 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | 658 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; |
490 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | 659 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; |
491 | } | 660 | } |
492 | if ( project->isActiveConfig("exceptions") ) { | 661 | if ( project->isActiveConfig("exceptions") ) { |
493 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | 662 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; |
494 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | 663 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; |
495 | } else { | 664 | } else { |
496 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | 665 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; |
497 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | 666 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; |
498 | } | 667 | } |
499 | if ( project->isActiveConfig("rtti") ) { | 668 | if ( project->isActiveConfig("rtti") ) { |
500 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | 669 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; |
501 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | 670 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; |
502 | } else { | 671 | } else { |
503 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | 672 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; |
504 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | 673 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; |
505 | } | 674 | } |
506 | 675 | ||
507 | 676 | ||
508 | if ( project->isActiveConfig("moc") ) | 677 | if ( project->isActiveConfig("moc") ) |
509 | setMocAware(TRUE); | 678 | setMocAware(TRUE); |
510 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 679 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
680 | |||
681 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | ||
682 | for( QStringList::Iterator stIt = libList.begin(); stIt != libList.end(); ) { | ||
683 | QString s = *stIt; | ||
684 | if( s.startsWith( "-l" ) ) { | ||
685 | stIt = libList.remove( stIt ); | ||
686 | stIt = libList.insert( stIt, s.mid( 2 ) + ".lib" ); | ||
687 | } else if( s.startsWith( "-L" ) ) { | ||
688 | stIt = libList.remove( stIt ); | ||
689 | project->variables()["QMAKE_LIBDIR"].append(QDir::convertSeparators(s.mid( 2 ))); | ||
690 | } else { | ||
691 | stIt++; | ||
692 | } | ||
693 | } | ||
694 | |||
511 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', | 695 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', |
512 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 696 | "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
513 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 697 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
514 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 698 | QStringList::Iterator it; |
699 | for(it = l.begin(); it != l.end(); ++it) { | ||
515 | QStringList &gdmf = project->variables()[(*it)]; | 700 | QStringList &gdmf = project->variables()[(*it)]; |
516 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 701 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
517 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 702 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
518 | } | 703 | } |
519 | 704 | ||
520 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | 705 | if ( !project->variables()["DEF_FILE"].isEmpty() ) |
521 | project->variables()["QMAKE_LFLAGS"].append(QString("/DEF:") + project->first("DEF_FILE")); | 706 | project->variables()["QMAKE_LFLAGS"].append(QString("/DEF:") + project->first("DEF_FILE")); |
522 | if(!project->isActiveConfig("incremental")) | 707 | if(!project->isActiveConfig("incremental")) |
523 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); | 708 | project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); |
524 | 709 | ||
525 | if ( !project->variables()["VERSION"].isEmpty() ) { | 710 | if ( !project->variables()["VERSION"].isEmpty() ) { |
526 | QString version = project->variables()["VERSION"][0]; | 711 | QString version = project->variables()["VERSION"][0]; |
527 | int firstDot = version.find( "." ); | 712 | int firstDot = version.find( "." ); |
528 | QString major = version.left( firstDot ); | 713 | QString major = version.left( firstDot ); |
529 | QString minor = version.right( version.length() - firstDot - 1 ); | 714 | QString minor = version.right( version.length() - firstDot - 1 ); |
530 | minor.replace( ".", "" ); | 715 | minor.replace( ".", "" ); |
531 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | 716 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); |
532 | } | 717 | } |
533 | if ( !project->variables()["RC_FILE"].isEmpty()) { | 718 | if ( !project->variables()["RC_FILE"].isEmpty()) { |
534 | if ( !project->variables()["RES_FILE"].isEmpty()) { | 719 | if ( !project->variables()["RES_FILE"].isEmpty()) { |
535 | fprintf(stderr, "Both .rc and .res file specified.\n"); | 720 | fprintf(stderr, "Both .rc and .res file specified.\n"); |
536 | fprintf(stderr, "Please specify one of them, not both."); | 721 | fprintf(stderr, "Please specify one of them, not both."); |
537 | exit(666); | 722 | exit(666); |
538 | } | 723 | } |
539 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; | 724 | project->variables()["RES_FILE"] = project->variables()["RC_FILE"]; |
540 | project->variables()["RES_FILE"].first().replace(".rc",".res"); | 725 | project->variables()["RES_FILE"].first().replace(".rc",".res"); |
541 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; | 726 | project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"]; |
727 | project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"]; | ||
542 | } | 728 | } |
543 | if ( !project->variables()["RES_FILE"].isEmpty()) | 729 | if ( !project->variables()["RES_FILE"].isEmpty()) |
544 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; | 730 | project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"]; |
545 | 731 | ||
732 | // Base class init! | ||
546 | MakefileGenerator::init(); | 733 | MakefileGenerator::init(); |
734 | |||
735 | // Setup PCH variables | ||
736 | precompH = project->first("PRECOMPILED_HEADER"); | ||
737 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
738 | if (usePCH) { | ||
739 | // Created files | ||
740 | precompObj = var("OBJECTS_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext; | ||
741 | precompPch = var("OBJECTS_DIR") + project->first("TARGET") + "_pch.pch"; | ||
742 | // Add linking of precompObj (required for whole precompiled classes) | ||
743 | project->variables()["OBJECTS"] += precompObj; | ||
744 | // Add pch file to cleanup | ||
745 | project->variables()["QMAKE_CLEAN"] += precompPch; | ||
746 | // Return to variable pool | ||
747 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
748 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
749 | } | ||
750 | |||
547 | if ( !project->variables()["VERSION"].isEmpty()) { | 751 | if ( !project->variables()["VERSION"].isEmpty()) { |
548 | QStringList l = QStringList::split('.', project->first("VERSION")); | 752 | QStringList l = QStringList::split('.', project->first("VERSION")); |
549 | project->variables()["VER_MAJ"].append(l[0]); | 753 | project->variables()["VER_MAJ"].append(l[0]); |
550 | project->variables()["VER_MIN"].append(l[1]); | 754 | project->variables()["VER_MIN"].append(l[1]); |
551 | } | 755 | } |
552 | 756 | ||
553 | QString version = QStringList::split('.', project->first("VERSION")).join(""); | 757 | QString version = QStringList::split('.', project->first("VERSION")).join(""); |
554 | if(project->isActiveConfig("dll")) { | 758 | if(project->isActiveConfig("dll")) { |
555 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp"); | 759 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".exp"); |
556 | } | 760 | } |
557 | if(project->isActiveConfig("debug")) { | 761 | if(project->isActiveConfig("debug")) { |
558 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb"); | 762 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb"); |
559 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk"); | 763 | project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk"); |
560 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); | 764 | project->variables()["QMAKE_CLEAN"].append("vc*.pdb"); |
765 | project->variables()["QMAKE_CLEAN"].append("vc*.idb"); | ||
766 | } | ||
767 | |||
768 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
769 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
770 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
771 | if(tmp_out.isEmpty()) | ||
772 | continue; | ||
773 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
774 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
775 | QStringList &inputs = project->variables()[(*it2)]; | ||
776 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
777 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
778 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
779 | out = tmp_out; | ||
780 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
781 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
782 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
783 | project->variables()["OBJCOMP"] += out; | ||
784 | } | ||
785 | } | ||
561 | } | 786 | } |
562 | } | 787 | } |
diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 579fc35..f2996cd 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h | |||
@@ -1,59 +1,64 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of NmakeMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __MSVC_NMAKE_H__ | 36 | #ifndef __MSVC_NMAKE_H__ |
38 | #define __MSVC_NMAKE_H__ | 37 | #define __MSVC_NMAKE_H__ |
39 | 38 | ||
40 | #include "winmakefile.h" | 39 | #include "winmakefile.h" |
41 | 40 | ||
42 | class NmakeMakefileGenerator : public Win32MakefileGenerator | 41 | class NmakeMakefileGenerator : public Win32MakefileGenerator |
43 | { | 42 | { |
44 | bool init_flag; | 43 | bool init_flag; |
45 | void writeNmakeParts(QTextStream &); | 44 | void writeNmakeParts(QTextStream &); |
46 | 45 | ||
47 | bool writeMakefile(QTextStream &); | 46 | bool writeMakefile(QTextStream &); |
48 | void init(); | 47 | void init(); |
49 | 48 | ||
49 | protected: | ||
50 | QStringList &findDependencies(const QString &file); | ||
51 | QString var(const QString &value); | ||
52 | QString precompH, precompObj, precompPch; | ||
53 | bool usePCH; | ||
54 | |||
50 | public: | 55 | public: |
51 | NmakeMakefileGenerator(QMakeProject *p); | 56 | NmakeMakefileGenerator(QMakeProject *p); |
52 | ~NmakeMakefileGenerator(); | 57 | ~NmakeMakefileGenerator(); |
53 | 58 | ||
54 | }; | 59 | }; |
55 | 60 | ||
56 | inline NmakeMakefileGenerator::~NmakeMakefileGenerator() | 61 | inline NmakeMakefileGenerator::~NmakeMakefileGenerator() |
57 | { } | 62 | { } |
58 | 63 | ||
59 | #endif /* __MSVC_NMAKE_H__ */ | 64 | #endif /* __MSVC_NMAKE_H__ */ |
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 7ffe4f7..a672c2d 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp | |||
@@ -1,150 +1,136 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of VCProject class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 2002-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
15 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
20 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
21 | ** with the Software. | 21 | ** with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | 35 | ||
36 | #include "msvc_objectmodel.h" | 36 | #include "msvc_objectmodel.h" |
37 | #include "msvc_vcproj.h" | 37 | #include "msvc_vcproj.h" |
38 | #include <qtextstream.h> | 38 | #include <qtextstream.h> |
39 | #include <qstringlist.h> | 39 | #include <qstringlist.h> |
40 | #include <quuid.h> | 40 | #include <qfileinfo.h> |
41 | |||
42 | #if defined(Q_OS_WIN32) | ||
43 | #include <objbase.h> | ||
44 | #ifndef GUID_DEFINED | ||
45 | #define GUID_DEFINED | ||
46 | typedef struct _GUID | ||
47 | { | ||
48 | ulong Data1; | ||
49 | ushort Data2; | ||
50 | ushort Data3; | ||
51 | uchar Data4[8]; | ||
52 | } GUID; | ||
53 | #endif | ||
54 | #endif | ||
55 | 41 | ||
56 | // XML Tags --------------------------------------------------------- | 42 | // XML Tags --------------------------------------------------------- |
57 | const char* _xmlInit = "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>"; | 43 | const char* _xmlInit = "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>"; |
58 | const char* _begConfiguration = "\n\t\t<Configuration"; | 44 | const char* _begConfiguration = "\n\t\t<Configuration"; |
59 | const char* _begConfigurations = "\n\t<Configurations>"; | 45 | const char* _begConfigurations = "\n\t<Configurations>"; |
60 | const char* _begFile = "\n\t\t\t<File"; | 46 | const char* _begFile = "\n\t\t\t<File"; |
61 | const char* _begFileConfiguration = "\n\t\t\t\t<FileConfiguration"; | 47 | const char* _begFileConfiguration = "\n\t\t\t\t<FileConfiguration"; |
62 | const char* _begFiles = "\n\t<Files>"; | 48 | const char* _begFiles = "\n\t<Files>"; |
63 | const char* _begFilter = "\n\t\t<Filter"; | 49 | const char* _begFilter = "\n\t\t<Filter"; |
64 | const char* _begGlobals = "\n\t<Globals>"; | 50 | const char* _begGlobals = "\n\t<Globals>"; |
65 | const char* _begPlatform = "\n\t\t<Platform"; | 51 | const char* _begPlatform = "\n\t\t<Platform"; |
66 | const char* _begPlatforms = "\n\t<Platforms>"; | 52 | const char* _begPlatforms = "\n\t<Platforms>"; |
67 | const char* _begTool3 = "\n\t\t\t<Tool"; | 53 | const char* _begTool3 = "\n\t\t\t<Tool"; |
68 | const char* _begTool5 = "\n\t\t\t\t\t<Tool"; | 54 | const char* _begTool5 = "\n\t\t\t\t\t<Tool"; |
69 | const char* _begVisualStudioProject = "\n<VisualStudioProject"; | 55 | const char* _begVisualStudioProject = "\n<VisualStudioProject"; |
70 | const char* _endConfiguration = "\n\t\t</Configuration>"; | 56 | const char* _endConfiguration = "\n\t\t</Configuration>"; |
71 | const char* _endConfigurations = "\n\t</Configurations>"; | 57 | const char* _endConfigurations = "\n\t</Configurations>"; |
72 | const char* _endFile = "\n\t\t\t</File>"; | 58 | const char* _endFile = "\n\t\t\t</File>"; |
73 | const char* _endFileConfiguration = "\n\t\t\t\t</FileConfiguration>"; | 59 | const char* _endFileConfiguration = "\n\t\t\t\t</FileConfiguration>"; |
74 | const char* _endFiles = "\n\t</Files>"; | 60 | const char* _endFiles = "\n\t</Files>"; |
75 | const char* _endFilter = "\n\t\t</Filter>"; | 61 | const char* _endFilter = "\n\t\t</Filter>"; |
76 | const char* _endGlobals = "\n\t</Globals>"; | 62 | const char* _endGlobals = "\n\t</Globals>"; |
77 | const char* _endPlatforms = "\n\t</Platforms>"; | 63 | const char* _endPlatforms = "\n\t</Platforms>"; |
78 | const char* _endVisualStudioProject = "\n</VisualStudioProject>"; | 64 | const char* _endVisualStudioProject = "\n</VisualStudioProject>"; |
79 | 65 | ||
80 | // XML Properties --------------------------------------------------- | 66 | // XML Properties --------------------------------------------------- |
81 | const char* _AddModuleNamesToAssembly = "\n\t\t\t\tAddModuleNamesToAssembly=\""; | 67 | const char* _AddModuleNamesToAssembly = "\n\t\t\t\tAddModuleNamesToAssembly=\""; |
82 | const char* _AdditionalDependencies4 = "\n\t\t\t\tAdditionalDependencies=\""; | 68 | const char* _AdditionalDependencies4 = "\n\t\t\t\tAdditionalDependencies=\""; |
83 | const char* _AdditionalDependencies6 = "\n\t\t\t\t\t\tAdditionalDependencies=\""; | 69 | const char* _AdditionalDependencies6 = "\n\t\t\t\t\t\tAdditionalDependencies=\""; |
84 | const char* _AdditionalIncludeDirectories = "\n\t\t\t\tAdditionalIncludeDirectories=\""; | 70 | const char* _AdditionalIncludeDirectories = "\n\t\t\t\tAdditionalIncludeDirectories=\""; |
85 | const char* _AdditionalLibraryDirectories = "\n\t\t\t\tAdditionalLibraryDirectories=\""; | 71 | const char* _AdditionalLibraryDirectories = "\n\t\t\t\tAdditionalLibraryDirectories=\""; |
86 | const char* _AdditionalOptions = "\n\t\t\t\tAdditionalOptions=\""; | 72 | const char* _AdditionalOptions = "\n\t\t\t\tAdditionalOptions=\""; |
87 | const char* _AdditionalUsingDirectories = "\n\t\t\t\tAdditionalUsingDirectories=\""; | 73 | const char* _AdditionalUsingDirectories = "\n\t\t\t\tAdditionalUsingDirectories=\""; |
88 | const char* _AssemblerListingLocation = "\n\t\t\t\tAssemblerListingLocation=\""; | 74 | const char* _AssemblerListingLocation = "\n\t\t\t\tAssemblerListingLocation=\""; |
89 | const char* _AssemblerOutput = "\n\t\t\t\tAssemblerOutput=\""; | 75 | const char* _AssemblerOutput = "\n\t\t\t\tAssemblerOutput=\""; |
90 | const char* _ATLMinimizesCRunTimeLibraryUsage= "\n\t\t\tATLMinimizesCRunTimeLibraryUsage=\""; | 76 | const char* _ATLMinimizesCRunTimeLibraryUsage= "\n\t\t\tATLMinimizesCRunTimeLibraryUsage=\""; |
91 | const char* _BaseAddress = "\n\t\t\t\tBaseAddress=\""; | 77 | const char* _BaseAddress = "\n\t\t\t\tBaseAddress=\""; |
92 | const char* _BasicRuntimeChecks = "\n\t\t\t\tBasicRuntimeChecks=\""; | 78 | const char* _BasicRuntimeChecks = "\n\t\t\t\tBasicRuntimeChecks=\""; |
93 | const char* _BrowseInformation = "\n\t\t\t\tBrowseInformation=\""; | 79 | const char* _BrowseInformation = "\n\t\t\t\tBrowseInformation=\""; |
94 | const char* _BrowseInformationFile = "\n\t\t\t\tBrowseInformationFile=\""; | 80 | const char* _BrowseInformationFile = "\n\t\t\t\tBrowseInformationFile=\""; |
95 | const char* _BufferSecurityCheck = "\n\t\t\t\tBufferSecurityCheck=\""; | 81 | const char* _BufferSecurityCheck = "\n\t\t\t\tBufferSecurityCheck=\""; |
96 | const char* _BuildBrowserInformation = "\n\t\t\tBuildBrowserInformation=\""; | 82 | const char* _BuildBrowserInformation = "\n\t\t\tBuildBrowserInformation=\""; |
97 | const char* _CPreprocessOptions = "\n\t\t\t\tCPreprocessOptions=\""; | 83 | const char* _CPreprocessOptions = "\n\t\t\t\tCPreprocessOptions=\""; |
98 | const char* _CallingConvention = "\n\t\t\t\tCallingConvention=\""; | 84 | const char* _CallingConvention = "\n\t\t\t\tCallingConvention=\""; |
99 | const char* _CharacterSet = "\n\t\t\tCharacterSet=\""; | 85 | const char* _CharacterSet = "\n\t\t\tCharacterSet=\""; |
100 | const char* _CommandLine4 = "\n\t\t\t\tCommandLine=\""; | 86 | const char* _CommandLine4 = "\n\t\t\t\tCommandLine=\""; |
101 | const char* _CommandLine6 = "\n\t\t\t\t\t\tCommandLine=\""; | 87 | const char* _CommandLine6 = "\n\t\t\t\t\t\tCommandLine=\""; |
102 | const char* _CompileAs = "\n\t\t\t\tCompileAs=\""; | 88 | const char* _CompileAs = "\n\t\t\t\tCompileAs=\""; |
103 | const char* _CompileAsManaged = "\n\t\t\t\tCompileAsManaged=\""; | 89 | const char* _CompileAsManaged = "\n\t\t\t\tCompileAsManaged=\""; |
104 | const char* _CompileOnly = "\n\t\t\t\tCompileOnly=\""; | 90 | const char* _CompileOnly = "\n\t\t\t\tCompileOnly=\""; |
105 | const char* _ConfigurationType = "\n\t\t\tConfigurationType=\""; | 91 | const char* _ConfigurationType = "\n\t\t\tConfigurationType=\""; |
106 | const char* _Culture = "\n\t\t\t\tCulture=\""; | 92 | const char* _Culture = "\n\t\t\t\tCulture=\""; |
107 | const char* _DLLDataFileName = "\n\t\t\t\tDLLDataFileName=\""; | 93 | const char* _DLLDataFileName = "\n\t\t\t\tDLLDataFileName=\""; |
108 | const char* _DebugInformationFormat = "\n\t\t\t\tDebugInformationFormat=\""; | 94 | const char* _DebugInformationFormat = "\n\t\t\t\tDebugInformationFormat=\""; |
109 | const char* _DefaultCharIsUnsigned = "\n\t\t\t\tDefaultCharIsUnsigned=\""; | 95 | const char* _DefaultCharIsUnsigned = "\n\t\t\t\tDefaultCharIsUnsigned=\""; |
110 | const char* _DefaultCharType = "\n\t\t\t\tDefaultCharType=\""; | 96 | const char* _DefaultCharType = "\n\t\t\t\tDefaultCharType=\""; |
111 | const char* _DelayLoadDLLs = "\n\t\t\t\tDelayLoadDLLs=\""; | 97 | const char* _DelayLoadDLLs = "\n\t\t\t\tDelayLoadDLLs=\""; |
112 | const char* _DeleteExtensionsOnClean = "\n\t\t\tDeleteExtensionsOnClean=\""; | 98 | const char* _DeleteExtensionsOnClean = "\n\t\t\tDeleteExtensionsOnClean=\""; |
113 | const char* _Description4 = "\n\t\t\t\tDescription=\""; | 99 | const char* _Description4 = "\n\t\t\t\tDescription=\""; |
114 | const char* _Description6 = "\n\t\t\t\t\t\tDescription=\""; | 100 | const char* _Description6 = "\n\t\t\t\t\t\tDescription=\""; |
115 | const char* _Detect64BitPortabilityProblems = "\n\t\t\t\tDetect64BitPortabilityProblems=\""; | 101 | const char* _Detect64BitPortabilityProblems = "\n\t\t\t\tDetect64BitPortabilityProblems=\""; |
116 | const char* _DisableLanguageExtensions = "\n\t\t\t\tDisableLanguageExtensions=\""; | 102 | const char* _DisableLanguageExtensions = "\n\t\t\t\tDisableLanguageExtensions=\""; |
117 | const char* _DisableSpecificWarnings = "\n\t\t\t\tDisableSpecificWarnings=\""; | 103 | const char* _DisableSpecificWarnings = "\n\t\t\t\tDisableSpecificWarnings=\""; |
118 | const char* _EnableCOMDATFolding = "\n\t\t\t\tEnableCOMDATFolding=\""; | 104 | const char* _EnableCOMDATFolding = "\n\t\t\t\tEnableCOMDATFolding=\""; |
119 | const char* _EnableErrorChecks = "\n\t\t\t\tEnableErrorChecks=\""; | 105 | const char* _EnableErrorChecks = "\n\t\t\t\tEnableErrorChecks=\""; |
120 | const char* _EnableFiberSafeOptimizations = "\n\t\t\t\tEnableFiberSafeOptimizations=\""; | 106 | const char* _EnableFiberSafeOptimizations = "\n\t\t\t\tEnableFiberSafeOptimizations=\""; |
121 | const char* _EnableFunctionLevelLinking = "\n\t\t\t\tEnableFunctionLevelLinking=\""; | 107 | const char* _EnableFunctionLevelLinking = "\n\t\t\t\tEnableFunctionLevelLinking=\""; |
122 | const char* _EnableIntrinsicFunctions = "\n\t\t\t\tEnableIntrinsicFunctions=\""; | 108 | const char* _EnableIntrinsicFunctions = "\n\t\t\t\tEnableIntrinsicFunctions=\""; |
123 | const char* _EntryPointSymbol = "\n\t\t\t\tEntryPointSymbol=\""; | 109 | const char* _EntryPointSymbol = "\n\t\t\t\tEntryPointSymbol=\""; |
124 | const char* _ErrorCheckAllocations = "\n\t\t\t\tErrorCheckAllocations=\""; | 110 | const char* _ErrorCheckAllocations = "\n\t\t\t\tErrorCheckAllocations=\""; |
125 | const char* _ErrorCheckBounds = "\n\t\t\t\tErrorCheckBounds=\""; | 111 | const char* _ErrorCheckBounds = "\n\t\t\t\tErrorCheckBounds=\""; |
126 | const char* _ErrorCheckEnumRange = "\n\t\t\t\tErrorCheckEnumRange=\""; | 112 | const char* _ErrorCheckEnumRange = "\n\t\t\t\tErrorCheckEnumRange=\""; |
127 | const char* _ErrorCheckRefPointers = "\n\t\t\t\tErrorCheckRefPointers=\""; | 113 | const char* _ErrorCheckRefPointers = "\n\t\t\t\tErrorCheckRefPointers=\""; |
128 | const char* _ErrorCheckStubData = "\n\t\t\t\tErrorCheckStubData=\""; | 114 | const char* _ErrorCheckStubData = "\n\t\t\t\tErrorCheckStubData=\""; |
129 | const char* _ExceptionHandling = "\n\t\t\t\tExceptionHandling=\""; | 115 | const char* _ExceptionHandling = "\n\t\t\t\tExceptionHandling=\""; |
130 | const char* _ExcludedFromBuild = "\n\t\t\t\tExcludedFromBuild=\""; | 116 | const char* _ExcludedFromBuild = "\n\t\t\t\tExcludedFromBuild=\""; |
131 | const char* _ExpandAttributedSource = "\n\t\t\t\tExpandAttributedSource=\""; | 117 | const char* _ExpandAttributedSource = "\n\t\t\t\tExpandAttributedSource=\""; |
132 | const char* _ExportNamedFunctions = "\n\t\t\t\tExportNamedFunctions=\""; | 118 | const char* _ExportNamedFunctions = "\n\t\t\t\tExportNamedFunctions=\""; |
133 | const char* _FavorSizeOrSpeed = "\n\t\t\t\tFavorSizeOrSpeed=\""; | 119 | const char* _FavorSizeOrSpeed = "\n\t\t\t\tFavorSizeOrSpeed=\""; |
134 | const char* _Filter = "\n\t\t\tFilter=\""; | 120 | const char* _Filter = "\n\t\t\tFilter=\""; |
135 | const char* _ForceConformanceInForLoopScope = "\n\t\t\t\tForceConformanceInForLoopScope=\""; | 121 | const char* _ForceConformanceInForLoopScope = "\n\t\t\t\tForceConformanceInForLoopScope=\""; |
136 | const char* _ForceSymbolReferences = "\n\t\t\t\tForceSymbolReferences=\""; | 122 | const char* _ForceSymbolReferences = "\n\t\t\t\tForceSymbolReferences=\""; |
137 | const char* _ForcedIncludeFiles = "\n\t\t\t\tForcedIncludeFiles=\""; | 123 | const char* _ForcedIncludeFiles = "\n\t\t\t\tForcedIncludeFiles=\""; |
138 | const char* _ForcedUsingFiles = "\n\t\t\t\tForcedUsingFiles=\""; | 124 | const char* _ForcedUsingFiles = "\n\t\t\t\tForcedUsingFiles=\""; |
139 | const char* _FullIncludePath = "\n\t\t\t\tFullIncludePath=\""; | 125 | const char* _FullIncludePath = "\n\t\t\t\tFullIncludePath=\""; |
140 | const char* _FunctionOrder = "\n\t\t\t\tFunctionOrder=\""; | 126 | const char* _FunctionOrder = "\n\t\t\t\tFunctionOrder=\""; |
141 | const char* _GenerateDebugInformation = "\n\t\t\t\tGenerateDebugInformation=\""; | 127 | const char* _GenerateDebugInformation = "\n\t\t\t\tGenerateDebugInformation=\""; |
142 | const char* _GenerateMapFile = "\n\t\t\t\tGenerateMapFile=\""; | 128 | const char* _GenerateMapFile = "\n\t\t\t\tGenerateMapFile=\""; |
143 | const char* _GeneratePreprocessedFile = "\n\t\t\t\tGeneratePreprocessedFile=\""; | 129 | const char* _GeneratePreprocessedFile = "\n\t\t\t\tGeneratePreprocessedFile=\""; |
144 | const char* _GenerateStublessProxies = "\n\t\t\t\tGenerateStublessProxies=\""; | 130 | const char* _GenerateStublessProxies = "\n\t\t\t\tGenerateStublessProxies=\""; |
145 | const char* _GenerateTypeLibrary = "\n\t\t\t\tGenerateTypeLibrary=\""; | 131 | const char* _GenerateTypeLibrary = "\n\t\t\t\tGenerateTypeLibrary=\""; |
146 | const char* _GlobalOptimizations = "\n\t\t\t\tGlobalOptimizations=\""; | 132 | const char* _GlobalOptimizations = "\n\t\t\t\tGlobalOptimizations=\""; |
147 | const char* _HeaderFileName = "\n\t\t\t\tHeaderFileName=\""; | 133 | const char* _HeaderFileName = "\n\t\t\t\tHeaderFileName=\""; |
148 | const char* _HeapCommitSize = "\n\t\t\t\tHeapCommitSize=\""; | 134 | const char* _HeapCommitSize = "\n\t\t\t\tHeapCommitSize=\""; |
149 | const char* _HeapReserveSize = "\n\t\t\t\tHeapReserveSize=\""; | 135 | const char* _HeapReserveSize = "\n\t\t\t\tHeapReserveSize=\""; |
150 | const char* _IgnoreAllDefaultLibraries = "\n\t\t\t\tIgnoreAllDefaultLibraries=\""; | 136 | const char* _IgnoreAllDefaultLibraries = "\n\t\t\t\tIgnoreAllDefaultLibraries=\""; |
@@ -188,502 +174,512 @@ const char* _OutputDirectory3 = "\n\t\t\tOutputDirectory=\""; | |||
188 | const char* _OutputDirectory4 = "\n\t\t\t\tOutputDirectory=\""; | 174 | const char* _OutputDirectory4 = "\n\t\t\t\tOutputDirectory=\""; |
189 | const char* _OutputFile = "\n\t\t\t\tOutputFile=\""; | 175 | const char* _OutputFile = "\n\t\t\t\tOutputFile=\""; |
190 | const char* _Outputs4 = "\n\t\t\t\tOutputs=\""; | 176 | const char* _Outputs4 = "\n\t\t\t\tOutputs=\""; |
191 | const char* _Outputs6 = "\n\t\t\t\t\t\tOutputs=\""; | 177 | const char* _Outputs6 = "\n\t\t\t\t\t\tOutputs=\""; |
192 | const char* _ParseFiles = "\n\t\t\tParseFiles=\""; | 178 | const char* _ParseFiles = "\n\t\t\tParseFiles=\""; |
193 | const char* _PrecompiledHeaderFile = "\n\t\t\t\tPrecompiledHeaderFile=\""; | 179 | const char* _PrecompiledHeaderFile = "\n\t\t\t\tPrecompiledHeaderFile=\""; |
194 | const char* _PrecompiledHeaderThrough = "\n\t\t\t\tPrecompiledHeaderThrough=\""; | 180 | const char* _PrecompiledHeaderThrough = "\n\t\t\t\tPrecompiledHeaderThrough=\""; |
195 | const char* _PreprocessorDefinitions = "\n\t\t\t\tPreprocessorDefinitions=\""; | 181 | const char* _PreprocessorDefinitions = "\n\t\t\t\tPreprocessorDefinitions=\""; |
196 | const char* _PrimaryOutput = "\n\t\t\tPrimaryOutput=\""; | 182 | const char* _PrimaryOutput = "\n\t\t\tPrimaryOutput=\""; |
197 | const char* _ProjectGUID = "\n\tProjectGUID=\""; | 183 | const char* _ProjectGUID = "\n\tProjectGUID=\""; |
198 | const char* _ProjectType = "\n\tProjectType=\"Visual C++\""; | 184 | const char* _ProjectType = "\n\tProjectType=\"Visual C++\""; |
199 | const char* _ProgramDatabase = "\n\t\t\tProgramDatabase=\""; | 185 | const char* _ProgramDatabase = "\n\t\t\tProgramDatabase=\""; |
200 | const char* _ProgramDataBaseFileName = "\n\t\t\t\tProgramDataBaseFileName=\""; | 186 | const char* _ProgramDataBaseFileName = "\n\t\t\t\tProgramDataBaseFileName=\""; |
201 | const char* _ProgramDatabaseFile = "\n\t\t\t\tProgramDatabaseFile=\""; | 187 | const char* _ProgramDatabaseFile = "\n\t\t\t\tProgramDatabaseFile=\""; |
202 | const char* _ProxyFileName = "\n\t\t\t\tProxyFileName=\""; | 188 | const char* _ProxyFileName = "\n\t\t\t\tProxyFileName=\""; |
203 | const char* _RedirectOutputAndErrors = "\n\t\t\t\tRedirectOutputAndErrors=\""; | 189 | const char* _RedirectOutputAndErrors = "\n\t\t\t\tRedirectOutputAndErrors=\""; |
204 | const char* _RegisterOutput = "\n\t\t\t\tRegisterOutput=\""; | 190 | const char* _RegisterOutput = "\n\t\t\t\tRegisterOutput=\""; |
205 | const char* _RelativePath = "\n\t\t\t\tRelativePath=\""; | 191 | const char* _RelativePath = "\n\t\t\t\tRelativePath=\""; |
206 | const char* _ResourceOnlyDLL = "\n\t\t\t\tResourceOnlyDLL=\""; | 192 | const char* _ResourceOnlyDLL = "\n\t\t\t\tResourceOnlyDLL=\""; |
207 | const char* _ResourceOutputFileName = "\n\t\t\t\tResourceOutputFileName=\""; | 193 | const char* _ResourceOutputFileName = "\n\t\t\t\tResourceOutputFileName=\""; |
208 | const char* _RuntimeLibrary = "\n\t\t\t\tRuntimeLibrary=\""; | 194 | const char* _RuntimeLibrary = "\n\t\t\t\tRuntimeLibrary=\""; |
209 | const char* _RuntimeTypeInfo = "\n\t\t\t\tRuntimeTypeInfo=\""; | 195 | const char* _RuntimeTypeInfo = "\n\t\t\t\tRuntimeTypeInfo=\""; |
210 | const char* _SccProjectName = "\n\tSccProjectName=\""; | 196 | const char* _SccProjectName = "\n\tSccProjectName=\""; |
211 | const char* _SccLocalPath = "\n\tSccLocalPath=\""; | 197 | const char* _SccLocalPath = "\n\tSccLocalPath=\""; |
212 | const char* _SetChecksum = "\n\t\t\t\tSetChecksum=\""; | 198 | const char* _SetChecksum = "\n\t\t\t\tSetChecksum=\""; |
213 | const char* _ShowIncludes = "\n\t\t\t\tShowIncludes=\""; | 199 | const char* _ShowIncludes = "\n\t\t\t\tShowIncludes=\""; |
214 | const char* _ShowProgress = "\n\t\t\t\tShowProgress=\""; | 200 | const char* _ShowProgress = "\n\t\t\t\tShowProgress=\""; |
215 | const char* _SmallerTypeCheck = "\n\t\t\t\tSmallerTypeCheck=\""; | 201 | const char* _SmallerTypeCheck = "\n\t\t\t\tSmallerTypeCheck=\""; |
216 | const char* _StackCommitSize = "\n\t\t\t\tStackCommitSize=\""; | 202 | const char* _StackCommitSize = "\n\t\t\t\tStackCommitSize=\""; |
217 | const char* _StackReserveSize = "\n\t\t\t\tStackReserveSize=\""; | 203 | const char* _StackReserveSize = "\n\t\t\t\tStackReserveSize=\""; |
218 | const char* _StringPooling = "\n\t\t\t\tStringPooling=\""; | 204 | const char* _StringPooling = "\n\t\t\t\tStringPooling=\""; |
219 | const char* _StripPrivateSymbols = "\n\t\t\t\tStripPrivateSymbols=\""; | 205 | const char* _StripPrivateSymbols = "\n\t\t\t\tStripPrivateSymbols=\""; |
220 | const char* _StructMemberAlignment = "\n\t\t\t\tStructMemberAlignment=\""; | 206 | const char* _StructMemberAlignment = "\n\t\t\t\tStructMemberAlignment=\""; |
221 | const char* _SubSystem = "\n\t\t\t\tSubSystem=\""; | 207 | const char* _SubSystem = "\n\t\t\t\tSubSystem=\""; |
222 | const char* _SupportUnloadOfDelayLoadedDLL = "\n\t\t\t\tSupportUnloadOfDelayLoadedDLL=\""; | 208 | const char* _SupportUnloadOfDelayLoadedDLL = "\n\t\t\t\tSupportUnloadOfDelayLoadedDLL=\""; |
223 | const char* _SuppressStartupBanner = "\n\t\t\t\tSuppressStartupBanner=\""; | 209 | const char* _SuppressStartupBanner = "\n\t\t\t\tSuppressStartupBanner=\""; |
224 | const char* _SwapRunFromCD = "\n\t\t\t\tSwapRunFromCD=\""; | 210 | const char* _SwapRunFromCD = "\n\t\t\t\tSwapRunFromCD=\""; |
225 | const char* _SwapRunFromNet = "\n\t\t\t\tSwapRunFromNet=\""; | 211 | const char* _SwapRunFromNet = "\n\t\t\t\tSwapRunFromNet=\""; |
226 | const char* _TargetEnvironment = "\n\t\t\t\tTargetEnvironment=\""; | 212 | const char* _TargetEnvironment = "\n\t\t\t\tTargetEnvironment=\""; |
227 | const char* _TargetMachine = "\n\t\t\t\tTargetMachine=\""; | 213 | const char* _TargetMachine = "\n\t\t\t\tTargetMachine=\""; |
228 | const char* _TerminalServerAware = "\n\t\t\t\tTerminalServerAware=\""; | 214 | const char* _TerminalServerAware = "\n\t\t\t\tTerminalServerAware=\""; |
229 | const char* _ToolName = "\n\t\t\t\tName=\""; | 215 | const char* _ToolName = "\n\t\t\t\tName=\""; |
230 | const char* _ToolPath = "\n\t\t\t\tPath=\""; | 216 | const char* _ToolPath = "\n\t\t\t\tPath=\""; |
231 | const char* _TreatWChar_tAsBuiltInType = "\n\t\t\t\tTreatWChar_tAsBuiltInType=\""; | 217 | const char* _TreatWChar_tAsBuiltInType = "\n\t\t\t\tTreatWChar_tAsBuiltInType=\""; |
232 | const char* _TurnOffAssemblyGeneration = "\n\t\t\t\tTurnOffAssemblyGeneration=\""; | 218 | const char* _TurnOffAssemblyGeneration = "\n\t\t\t\tTurnOffAssemblyGeneration=\""; |
233 | const char* _TypeLibraryFile = "\n\t\t\t\tTypeLibraryFile=\""; | 219 | const char* _TypeLibraryFile = "\n\t\t\t\tTypeLibraryFile=\""; |
234 | const char* _TypeLibraryName = "\n\t\t\t\tTypeLibraryName=\""; | 220 | const char* _TypeLibraryName = "\n\t\t\t\tTypeLibraryName=\""; |
235 | const char* _TypeLibraryResourceID = "\n\t\t\t\tTypeLibraryResourceID=\""; | 221 | const char* _TypeLibraryResourceID = "\n\t\t\t\tTypeLibraryResourceID=\""; |
236 | const char* _UndefineAllPreprocessorDefinitions = "\n\t\t\t\tUndefineAllPreprocessorDefinitions=\""; | 222 | const char* _UndefineAllPreprocessorDefinitions = "\n\t\t\t\tUndefineAllPreprocessorDefinitions=\""; |
237 | const char* _UndefinePreprocessorDefinitions = "\n\t\t\t\tUndefinePreprocessorDefinitions=\""; | 223 | const char* _UndefinePreprocessorDefinitions = "\n\t\t\t\tUndefinePreprocessorDefinitions=\""; |
238 | const char* _UseOfATL = "\n\t\t\tUseOfATL=\""; | 224 | const char* _UseOfATL = "\n\t\t\tUseOfATL=\""; |
239 | const char* _UseOfMfc = "\n\t\t\tUseOfMfc=\""; | 225 | const char* _UseOfMfc = "\n\t\t\tUseOfMfc=\""; |
240 | const char* _UsePrecompiledHeader = "\n\t\t\t\tUsePrecompiledHeader=\""; | 226 | const char* _UsePrecompiledHeader = "\n\t\t\t\tUsePrecompiledHeader=\""; |
241 | const char* _ValidateParameters = "\n\t\t\t\tValidateParameters=\""; | 227 | const char* _ValidateParameters = "\n\t\t\t\tValidateParameters=\""; |
242 | const char* _VCCLCompilerToolName = "\n\t\t\t\tName=\"VCCLCompilerTool\""; | 228 | const char* _VCCLCompilerToolName = "\n\t\t\t\tName=\"VCCLCompilerTool\""; |
243 | const char* _VCCustomBuildTool = "\n\t\t\t\t\t\tName=\"VCCustomBuildTool\""; | 229 | const char* _VCCustomBuildTool = "\n\t\t\t\t\t\tName=\"VCCustomBuildTool\""; |
244 | const char* _VCLinkerToolName = "\n\t\t\t\tName=\"VCLinkerTool\""; | 230 | const char* _VCLinkerToolName = "\n\t\t\t\tName=\"VCLinkerTool\""; |
245 | const char* _VCResourceCompilerToolName = "\n\t\t\t\tName=\"VCResourceCompilerTool\""; | 231 | const char* _VCResourceCompilerToolName = "\n\t\t\t\tName=\"VCResourceCompilerTool\""; |
246 | const char* _VCMIDLToolName = "\n\t\t\t\tName=\"VCMIDLTool\""; | 232 | const char* _VCMIDLToolName = "\n\t\t\t\tName=\"VCMIDLTool\""; |
247 | const char* _Version1 = "\n\tVersion=\""; | 233 | const char* _Version1 = "\n\tVersion=\""; |
248 | const char* _Version4 = "\n\t\t\t\tVersion=\""; | 234 | const char* _Version4 = "\n\t\t\t\tVersion=\""; |
249 | const char* _WarnAsError = "\n\t\t\t\tWarnAsError=\""; | 235 | const char* _WarnAsError = "\n\t\t\t\tWarnAsError=\""; |
250 | const char* _WarnLevel = "\n\t\t\t\tWarnLevel=\""; | 236 | const char* _WarnLevel = "\n\t\t\t\tWarnLevel=\""; |
251 | const char* _WarningLevel = "\n\t\t\t\tWarningLevel=\""; | 237 | const char* _WarningLevel = "\n\t\t\t\tWarningLevel=\""; |
252 | const char* _WholeProgramOptimization = "\n\t\t\t\tWholeProgramOptimization=\""; | 238 | const char* _WholeProgramOptimization = "\n\t\t\t\tWholeProgramOptimization=\""; |
253 | 239 | ||
254 | // Property name and value as Pairs --------------------------------- | 240 | // Property name and value as Pairs --------------------------------- |
255 | struct TPair { | 241 | struct TPair { |
256 | TPair( const char* n, const triState v ) : name(n), value(v) {}; | 242 | TPair( const char* n, const triState v ) : name(n), value(v) {}; |
257 | const char* name; | 243 | const char* name; |
258 | const triState value; | 244 | const triState value; |
259 | }; | 245 | }; |
260 | struct EPair { | 246 | struct EPair { |
261 | EPair( const char* n, const int v ) : name(n), value(v) {}; | 247 | EPair( const char* n, const int v ) : name(n), value(v) {}; |
262 | const char* name; | 248 | const char* name; |
263 | const int value; | 249 | const int value; |
264 | }; | 250 | }; |
265 | struct LPair { | 251 | struct LPair { |
266 | LPair( const char* n, const long v ) : name(n), value(v) {}; | 252 | LPair( const char* n, const long v ) : name(n), value(v) {}; |
267 | const char* name; | 253 | const char* name; |
268 | const long value; | 254 | const long value; |
269 | }; | 255 | }; |
270 | struct SPair { | 256 | struct SPair { |
271 | SPair( const char* n, const QString& v ) : name(n), value(v) {}; | 257 | SPair( const char* n, const QString& v ) : name(n), value(v) {}; |
272 | const char* name; | 258 | const char* name; |
273 | const QString& value; | 259 | const QString& value; |
274 | }; | 260 | }; |
275 | struct XPair { | 261 | struct XPair { |
276 | XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {}; | 262 | XPair( const char* n, const QStringList& v, const char* s = "," ) : name(n), value(v), sep(s) {}; |
277 | const char* name; | 263 | const char* name; |
278 | const QStringList& value; | 264 | const QStringList& value; |
279 | const char* sep; | 265 | const char* sep; |
280 | }; | 266 | }; |
281 | 267 | ||
282 | // void streamSPair( QTextStream &strm, const char *n, const QString &s ) | 268 | // void streamSPair( QTextStream &strm, const char *n, const QString &s ) |
283 | 269 | ||
284 | |||
285 | // Streaming operators for property Pairs --------------------------- | 270 | // Streaming operators for property Pairs --------------------------- |
286 | QTextStream &operator<<( QTextStream &strm, const TPair &prop ) | 271 | QTextStream &operator<<( QTextStream &strm, const TPair &prop ) |
287 | { | 272 | { |
288 | switch( prop.value ) { | 273 | switch( prop.value ) { |
289 | case _False: | 274 | case _False: |
290 | strm << prop.name << "FALSE\""; | 275 | strm << prop.name << "FALSE\""; |
291 | break; | 276 | break; |
292 | case _True: | 277 | case _True: |
293 | strm << prop.name << "TRUE\""; | 278 | strm << prop.name << "TRUE\""; |
294 | break; | 279 | break; |
295 | case unset: | 280 | case unset: |
296 | default: | 281 | default: |
297 | break; | 282 | break; |
298 | } | 283 | } |
299 | return strm; | 284 | return strm; |
300 | } | 285 | } |
301 | 286 | ||
302 | /* Be sure to check that each enum is not set to | 287 | /* Be sure to check that each enum is not set to |
303 | default before streaming it out. Defaults seem | 288 | default before streaming it out. Defaults seem |
304 | to not be in the XML file. | 289 | to not be in the XML file. |
305 | */ | 290 | */ |
306 | QTextStream &operator<<( QTextStream &strm, const EPair &prop ) | 291 | QTextStream &operator<<( QTextStream &strm, const EPair &prop ) |
307 | { | 292 | { |
308 | strm << prop.name << prop.value << "\""; | 293 | strm << prop.name << prop.value << "\""; |
309 | return strm; | 294 | return strm; |
310 | } | 295 | } |
311 | 296 | ||
312 | QTextStream &operator<<( QTextStream &strm, const LPair &prop ) | 297 | QTextStream &operator<<( QTextStream &strm, const LPair &prop ) |
313 | { | 298 | { |
314 | strm << prop.name << prop.value << "\""; | 299 | strm << prop.name << prop.value << "\""; |
315 | return strm; | 300 | return strm; |
316 | } | 301 | } |
317 | 302 | ||
318 | QTextStream &operator<<( QTextStream &strm, const SPair &prop ) | 303 | QTextStream &operator<<( QTextStream &strm, const SPair &prop ) |
319 | { | 304 | { |
320 | if ( !prop.value.isEmpty() ) | 305 | if ( !prop.value.isEmpty() ) |
321 | strm << prop.name << prop.value.latin1() << "\""; | 306 | strm << prop.name << QString(prop.value).remove("\"") << "\""; |
322 | return strm; | 307 | return strm; |
323 | } | 308 | } |
324 | 309 | ||
325 | QTextStream &operator<<( QTextStream &strm, const XPair &prop ) | 310 | QTextStream &operator<<( QTextStream &strm, const XPair &prop ) |
326 | { | 311 | { |
327 | if ( !prop.value.isEmpty() ) | 312 | if ( !prop.value.isEmpty() ) |
328 | strm << prop.name << prop.value.join(prop.sep).latin1() << "\""; | 313 | strm << prop.name << prop.value.join(prop.sep).latin1() << "\""; |
329 | return strm; | 314 | return strm; |
330 | } | 315 | } |
331 | 316 | ||
332 | // VCCLCompilerTool ------------------------------------------------- | 317 | // VCCLCompilerTool ------------------------------------------------- |
333 | VCCLCompilerTool::VCCLCompilerTool() | 318 | VCCLCompilerTool::VCCLCompilerTool() |
334 | :AssemblerOutput( asmListingNone ), | 319 | :AssemblerOutput( asmListingNone ), |
335 | BasicRuntimeChecks( runtimeBasicCheckNone ), | 320 | BasicRuntimeChecks( runtimeBasicCheckNone ), |
336 | BrowseInformation( brInfoNone ), | 321 | BrowseInformation( brInfoNone ), |
337 | BufferSecurityCheck( unset ), | 322 | BufferSecurityCheck( _False ), |
338 | CallingConvention( callConventionDefault ), | 323 | CallingConvention( callConventionDefault ), |
339 | CompileAs( compileAsDefault ), | 324 | CompileAs( compileAsDefault ), |
340 | CompileAsManaged( managedDefault ), | 325 | CompileAsManaged( managedDefault ), |
341 | CompileOnly( unset ), | 326 | CompileOnly( unset ), |
342 | DebugInformationFormat( debugDisabled ), | 327 | DebugInformationFormat( debugDisabled ), |
343 | DefaultCharIsUnsigned( unset ), | 328 | DefaultCharIsUnsigned( unset ), |
344 | Detect64BitPortabilityProblems( unset ), | 329 | Detect64BitPortabilityProblems( unset ), |
345 | DisableLanguageExtensions( unset ), | 330 | DisableLanguageExtensions( unset ), |
346 | EnableFiberSafeOptimizations( unset ), | 331 | EnableFiberSafeOptimizations( unset ), |
347 | EnableFunctionLevelLinking( unset ), | 332 | EnableFunctionLevelLinking( unset ), |
348 | EnableIntrinsicFunctions( unset ), | 333 | EnableIntrinsicFunctions( unset ), |
349 | ExceptionHandling( unset ), | 334 | ExceptionHandling( _False ), |
350 | ExpandAttributedSource( unset ), | 335 | ExpandAttributedSource( unset ), |
351 | FavorSizeOrSpeed( favorNone ), | 336 | FavorSizeOrSpeed( favorNone ), |
352 | ForceConformanceInForLoopScope( unset ), | 337 | ForceConformanceInForLoopScope( unset ), |
353 | GeneratePreprocessedFile( preprocessNo ), | 338 | GeneratePreprocessedFile( preprocessNo ), |
354 | GlobalOptimizations( unset ), | 339 | GlobalOptimizations( unset ), |
355 | IgnoreStandardIncludePath( unset ), | 340 | IgnoreStandardIncludePath( unset ), |
356 | ImproveFloatingPointConsistency( unset ), | 341 | ImproveFloatingPointConsistency( unset ), |
357 | InlineFunctionExpansion( expandOnlyInline ), | 342 | InlineFunctionExpansion( expandDefault ), |
358 | KeepComments( unset ), | 343 | KeepComments( unset ), |
359 | MinimalRebuild( unset ), | 344 | MinimalRebuild( unset ), |
360 | OmitFramePointers( unset ), | 345 | OmitFramePointers( unset ), |
361 | Optimization( optimizeDisabled ), | 346 | Optimization( optimizeCustom ), |
362 | OptimizeForProcessor( procOptimizeBlended ), | 347 | OptimizeForProcessor( procOptimizeBlended ), |
363 | OptimizeForWindowsApplication( unset ), | 348 | OptimizeForWindowsApplication( unset ), |
349 | ProgramDataBaseFileName( "" ), | ||
364 | RuntimeLibrary( rtMultiThreaded ), | 350 | RuntimeLibrary( rtMultiThreaded ), |
365 | RuntimeTypeInfo( unset ), | 351 | RuntimeTypeInfo( unset ), |
366 | ShowIncludes( unset ), | 352 | ShowIncludes( unset ), |
367 | SmallerTypeCheck( unset ), | 353 | SmallerTypeCheck( unset ), |
368 | StringPooling( unset ), | 354 | StringPooling( unset ), |
369 | StructMemberAlignment( alignNotSet ), | 355 | StructMemberAlignment( alignNotSet ), |
370 | SuppressStartupBanner( unset ), | 356 | SuppressStartupBanner( unset ), |
371 | TreatWChar_tAsBuiltInType( unset ), | 357 | TreatWChar_tAsBuiltInType( unset ), |
372 | TurnOffAssemblyGeneration( unset ), | 358 | TurnOffAssemblyGeneration( unset ), |
373 | UndefineAllPreprocessorDefinitions( unset ), | 359 | UndefineAllPreprocessorDefinitions( unset ), |
374 | UsePrecompiledHeader( pchGenerateAuto ), | 360 | UsePrecompiledHeader( pchNone ), |
375 | WarnAsError( unset ), | 361 | WarnAsError( unset ), |
376 | WarningLevel( warningLevel_0 ), | 362 | WarningLevel( warningLevel_0 ), |
377 | WholeProgramOptimization( unset ) | 363 | WholeProgramOptimization( unset ) |
378 | { | 364 | { |
379 | } | 365 | } |
380 | 366 | ||
381 | QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) | 367 | QTextStream &operator<<( QTextStream &strm, const VCCLCompilerTool &tool ) |
382 | { | 368 | { |
383 | strm << _begTool3; | 369 | strm << _begTool3; |
384 | strm << _VCCLCompilerToolName; | 370 | strm << _VCCLCompilerToolName; |
385 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); | 371 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); |
386 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); | 372 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
387 | strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); | 373 | strm << XPair( _AdditionalUsingDirectories, tool.AdditionalUsingDirectories ); |
388 | strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation ); | 374 | strm << SPair( _AssemblerListingLocation, tool.AssemblerListingLocation ); |
389 | if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput ); | 375 | if ( tool.AssemblerOutput != asmListingNone ) strm << EPair( _AssemblerOutput, tool.AssemblerOutput ); |
390 | if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks ); | 376 | if ( tool.BasicRuntimeChecks != runtimeBasicCheckNone ) strm << EPair( _BasicRuntimeChecks, tool.BasicRuntimeChecks ); |
391 | if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation ); | 377 | if ( tool.BrowseInformation != brInfoNone ) strm << EPair( _BrowseInformation, tool.BrowseInformation ); |
392 | strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile ); | 378 | strm << SPair( _BrowseInformationFile, tool.BrowseInformationFile ); |
393 | strm << TPair( _BufferSecurityCheck, tool.BufferSecurityCheck ); | 379 | strm << TPair( _BufferSecurityCheck, tool.BufferSecurityCheck ); |
394 | if ( tool.CallingConvention != callConventionDefault ) strm << EPair( _CallingConvention, tool.CallingConvention ); | 380 | if ( tool.CallingConvention != callConventionDefault ) strm << EPair( _CallingConvention, tool.CallingConvention ); |
395 | if ( tool.CompileAs != compileAsDefault ) strm << EPair( _CompileAs, tool.CompileAs ); | 381 | if ( tool.CompileAs != compileAsDefault ) strm << EPair( _CompileAs, tool.CompileAs ); |
396 | if ( tool.CompileAsManaged != managedDefault ) strm << EPair( _CompileAsManaged, tool.CompileAsManaged ); | 382 | if ( tool.CompileAsManaged != managedDefault ) strm << EPair( _CompileAsManaged, tool.CompileAsManaged ); |
397 | strm << TPair( _CompileOnly, tool.CompileOnly ); | 383 | strm << TPair( _CompileOnly, tool.CompileOnly ); |
398 | strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat ); | 384 | if ( tool.DebugInformationFormat != debugUnknown ) strm << EPair( _DebugInformationFormat, tool.DebugInformationFormat ); |
399 | strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned ); | 385 | strm << TPair( _DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned ); |
400 | strm << TPair( _Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems ); | 386 | strm << TPair( _Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems ); |
401 | strm << TPair( _DisableLanguageExtensions, tool.DisableLanguageExtensions ); | 387 | strm << TPair( _DisableLanguageExtensions, tool.DisableLanguageExtensions ); |
402 | strm << XPair( _DisableSpecificWarnings, tool.DisableSpecificWarnings ); | 388 | strm << XPair( _DisableSpecificWarnings, tool.DisableSpecificWarnings ); |
403 | strm << TPair( _EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations ); | 389 | strm << TPair( _EnableFiberSafeOptimizations, tool.EnableFiberSafeOptimizations ); |
404 | strm << TPair( _EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking ); | 390 | strm << TPair( _EnableFunctionLevelLinking, tool.EnableFunctionLevelLinking ); |
405 | strm << TPair( _EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions ); | 391 | strm << TPair( _EnableIntrinsicFunctions, tool.EnableIntrinsicFunctions ); |
406 | strm << TPair( _ExceptionHandling, tool.ExceptionHandling ); | 392 | strm << TPair( _ExceptionHandling, tool.ExceptionHandling ); |
407 | strm << TPair( _ExpandAttributedSource, tool.ExpandAttributedSource ); | 393 | strm << TPair( _ExpandAttributedSource, tool.ExpandAttributedSource ); |
408 | if ( tool.FavorSizeOrSpeed != favorNone ) strm << EPair( _FavorSizeOrSpeed, tool.FavorSizeOrSpeed ); | 394 | if ( tool.FavorSizeOrSpeed != favorNone ) strm << EPair( _FavorSizeOrSpeed, tool.FavorSizeOrSpeed ); |
409 | strm << TPair( _ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope ); | 395 | strm << TPair( _ForceConformanceInForLoopScope, tool.ForceConformanceInForLoopScope ); |
410 | strm << XPair( _ForcedIncludeFiles, tool.ForcedIncludeFiles ); | 396 | strm << XPair( _ForcedIncludeFiles, tool.ForcedIncludeFiles ); |
411 | strm << XPair( _ForcedUsingFiles, tool.ForcedUsingFiles ); | 397 | strm << XPair( _ForcedUsingFiles, tool.ForcedUsingFiles ); |
412 | strm << EPair( _GeneratePreprocessedFile, tool.GeneratePreprocessedFile ); | 398 | if ( tool.GeneratePreprocessedFile != preprocessUnknown)strm << EPair( _GeneratePreprocessedFile, tool.GeneratePreprocessedFile ); |
413 | strm << TPair( _GlobalOptimizations, tool.GlobalOptimizations ); | 399 | strm << TPair( _GlobalOptimizations, tool.GlobalOptimizations ); |
414 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); | 400 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); |
415 | strm << TPair( _ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency ); | 401 | strm << TPair( _ImproveFloatingPointConsistency, tool.ImproveFloatingPointConsistency ); |
416 | strm << EPair( _InlineFunctionExpansion, tool.InlineFunctionExpansion ); | 402 | if ( tool.InlineFunctionExpansion != expandDefault ) strm << EPair( _InlineFunctionExpansion, tool.InlineFunctionExpansion ); |
417 | strm << TPair( _KeepComments, tool.KeepComments ); | 403 | strm << TPair( _KeepComments, tool.KeepComments ); |
418 | strm << TPair( _MinimalRebuild, tool.MinimalRebuild ); | 404 | strm << TPair( _MinimalRebuild, tool.MinimalRebuild ); |
419 | strm << SPair( _ObjectFile, tool.ObjectFile ); | 405 | strm << SPair( _ObjectFile, tool.ObjectFile ); |
420 | strm << TPair( _OmitFramePointers, tool.OmitFramePointers ); | 406 | strm << TPair( _OmitFramePointers, tool.OmitFramePointers ); |
421 | strm << EPair( _Optimization, tool.Optimization ); | 407 | if ( tool.Optimization != optimizeDefault ) strm << EPair( _Optimization, tool.Optimization ); |
422 | if ( tool.OptimizeForProcessor != procOptimizeBlended ) strm << EPair( _OptimizeForProcessor, tool.OptimizeForProcessor ); | 408 | if ( tool.OptimizeForProcessor != procOptimizeBlended ) strm << EPair( _OptimizeForProcessor, tool.OptimizeForProcessor ); |
423 | strm << TPair( _OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication ); | 409 | strm << TPair( _OptimizeForWindowsApplication, tool.OptimizeForWindowsApplication ); |
424 | strm << SPair( _OutputFile, tool.OutputFile ); | 410 | strm << SPair( _OutputFile, tool.OutputFile ); |
425 | strm << SPair( _PrecompiledHeaderFile, tool.PrecompiledHeaderFile ); | 411 | strm << SPair( _PrecompiledHeaderFile, tool.PrecompiledHeaderFile ); |
426 | strm << SPair( _PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough ); | 412 | strm << SPair( _PrecompiledHeaderThrough, tool.PrecompiledHeaderThrough ); |
427 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); | 413 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); |
428 | strm << SPair( _ProgramDataBaseFileName, tool.ProgramDataBaseFileName ); | 414 | if ( !tool.ProgramDataBaseFileName.isNull() ) strm << _ProgramDataBaseFileName << tool.ProgramDataBaseFileName.latin1() << "\""; |
429 | strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary ); | 415 | if ( tool.RuntimeLibrary != rtUnknown ) strm << EPair( _RuntimeLibrary, tool.RuntimeLibrary ); |
430 | strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo ); | 416 | strm << TPair( _RuntimeTypeInfo, tool.RuntimeTypeInfo ); |
431 | strm << TPair( _ShowIncludes, tool.ShowIncludes ); | 417 | strm << TPair( _ShowIncludes, tool.ShowIncludes ); |
432 | strm << TPair( _SmallerTypeCheck, tool.SmallerTypeCheck ); | 418 | strm << TPair( _SmallerTypeCheck, tool.SmallerTypeCheck ); |
433 | strm << TPair( _StringPooling, tool.StringPooling ); | 419 | strm << TPair( _StringPooling, tool.StringPooling ); |
434 | if ( tool.StructMemberAlignment != alignNotSet ) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment ); | 420 | if ( tool.StructMemberAlignment != alignNotSet ) strm << EPair( _StructMemberAlignment, tool.StructMemberAlignment ); |
435 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); | 421 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); |
436 | strm << TPair( _TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType ); | 422 | strm << TPair( _TreatWChar_tAsBuiltInType, tool.TreatWChar_tAsBuiltInType ); |
437 | strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration ); | 423 | strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration ); |
438 | strm << TPair( _UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions ); | 424 | strm << TPair( _UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions ); |
439 | strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); | 425 | strm << XPair( _UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions ); |
440 | if ( !tool.PrecompiledHeaderFile.isEmpty() || | 426 | if ( !tool.PrecompiledHeaderFile.isEmpty() || |
441 | !tool.PrecompiledHeaderThrough.isEmpty() ) | 427 | !tool.PrecompiledHeaderThrough.isEmpty() ) |
442 | strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader ); | 428 | strm << EPair( _UsePrecompiledHeader, tool.UsePrecompiledHeader ); |
443 | strm << TPair( _WarnAsError, tool.WarnAsError ); | 429 | strm << TPair( _WarnAsError, tool.WarnAsError ); |
444 | strm << EPair( _WarningLevel, tool.WarningLevel ); | 430 | if ( tool.WarningLevel != warningLevelUnknown ) strm << EPair( _WarningLevel, tool.WarningLevel ); |
445 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); | 431 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); |
446 | strm << "/>"; | 432 | strm << "/>"; |
447 | return strm; | 433 | return strm; |
448 | } | 434 | } |
449 | 435 | ||
450 | bool VCCLCompilerTool::parseOption( const char* option ) | 436 | bool VCCLCompilerTool::parseOption( const char* option ) |
451 | { | 437 | { |
452 | // skip index 0 ('/' or '-') | 438 | // skip index 0 ('/' or '-') |
453 | char first = option[1]; | 439 | char first = option[1]; |
454 | char second = option[2]; | 440 | char second = option[2]; |
455 | char third = option[3]; | 441 | char third = option[3]; |
456 | char fourth = option[4]; | 442 | char fourth = option[4]; |
457 | bool found = TRUE; | 443 | bool found = TRUE; |
458 | 444 | ||
459 | switch ( first ) { | 445 | switch ( first ) { |
460 | case '?': | 446 | case '?': |
461 | case 'h': | 447 | case 'h': |
462 | qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" ); | 448 | qWarning( "Generator: Option '/?', '/help': MSVC.NET projects do not support outputting help info" ); |
463 | found = FALSE; | 449 | found = FALSE; |
464 | break; | 450 | break; |
465 | case '@': | 451 | case '@': |
466 | qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); | 452 | qWarning( "Generator: Option '/@': MSVC.NET projects do not support the use of a response file" ); |
467 | found = FALSE; | 453 | found = FALSE; |
468 | break; | 454 | break; |
469 | case 'l': | 455 | case 'l': |
470 | qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); | 456 | qWarning( "Generator: Option '/link': qmake generator does not support passing link options through the compiler tool" ); |
471 | found = FALSE; | 457 | found = FALSE; |
472 | break; | 458 | break; |
473 | case 'A': | 459 | case 'A': |
474 | if ( second != 'I' ) { | 460 | if ( second != 'I' ) { |
475 | found = FALSE; break; | 461 | found = FALSE; break; |
476 | } | 462 | } |
477 | AdditionalUsingDirectories += option+2; | 463 | AdditionalUsingDirectories += option+3; |
478 | break; | 464 | break; |
479 | case 'C': | 465 | case 'C': |
480 | KeepComments = _True; | 466 | KeepComments = _True; |
481 | break; | 467 | break; |
482 | case 'D': | 468 | case 'D': |
483 | PreprocessorDefinitions += option+1; | 469 | PreprocessorDefinitions += option+2; |
484 | break; | 470 | break; |
485 | case 'E': | 471 | case 'E': |
486 | if ( second == 'H' ) { | 472 | if ( second == 'H' ) { |
487 | if ( third == 'a' || third == 'c' || third == 's' ) { | 473 | if ( third == 'a' |
474 | || (third == 'c' && fourth != 's') | ||
475 | || (third == 's' && fourth != 'c') ) { | ||
488 | // ExceptionHandling must be false, or it will override | 476 | // ExceptionHandling must be false, or it will override |
489 | // with an /EHsc option | 477 | // with an /EHsc option |
490 | ExceptionHandling = _False; | 478 | ExceptionHandling = _False; |
491 | AdditionalOptions += option; | 479 | AdditionalOptions += option; |
492 | break; | 480 | break; |
481 | } else if ( (third == 'c' && fourth == 's') | ||
482 | || (third == 's' && fourth == 'c') ) { | ||
483 | ExceptionHandling = _True; | ||
484 | AdditionalOptions += option; | ||
485 | break; | ||
493 | } | 486 | } |
494 | found = FALSE; break; | 487 | found = FALSE; break; |
495 | } | 488 | } |
496 | GeneratePreprocessedFile = preprocessYes; | 489 | GeneratePreprocessedFile = preprocessYes; |
497 | break; | 490 | break; |
498 | case 'F': | 491 | case 'F': |
499 | if ( second <= '9' && second >= '0' ) { | 492 | if ( second <= '9' && second >= '0' ) { |
500 | AdditionalOptions += option; | 493 | AdditionalOptions += option; |
501 | break; | 494 | break; |
502 | } else { | 495 | } else { |
503 | switch ( second ) { | 496 | switch ( second ) { |
504 | case 'A': | 497 | case 'A': |
505 | if ( third == 'c' ) { | 498 | if ( third == 'c' ) { |
506 | AssemblerOutput = asmListingAsmMachine; | 499 | AssemblerOutput = asmListingAsmMachine; |
507 | if ( fourth == 's' ) | 500 | if ( fourth == 's' ) |
508 | AssemblerOutput = asmListingAsmMachineSrc; | 501 | AssemblerOutput = asmListingAsmMachineSrc; |
509 | } else if ( third == 's' ) { | 502 | } else if ( third == 's' ) { |
510 | AssemblerOutput = asmListingAsmSrc; | 503 | AssemblerOutput = asmListingAsmSrc; |
511 | } else { | 504 | } else { |
512 | AssemblerOutput = asmListingAssemblyOnly; | 505 | AssemblerOutput = asmListingAssemblyOnly; |
513 | } | 506 | } |
514 | break; | 507 | break; |
515 | case 'a': | 508 | case 'a': |
516 | AssemblerListingLocation = option+3; | 509 | AssemblerListingLocation = option+3; |
517 | break; | 510 | break; |
518 | case 'I': | 511 | case 'I': |
519 | ForcedIncludeFiles += option+3; | 512 | ForcedIncludeFiles += option+3; |
520 | break; | 513 | break; |
521 | case 'R': | 514 | case 'R': |
522 | BrowseInformation = brAllInfo; | 515 | BrowseInformation = brAllInfo; |
523 | BrowseInformationFile = option+3; | 516 | BrowseInformationFile = option+3; |
524 | break; | 517 | break; |
525 | case 'r': | 518 | case 'r': |
526 | BrowseInformation = brNoLocalSymbols; | 519 | BrowseInformation = brNoLocalSymbols; |
527 | BrowseInformationFile = option+3; | 520 | BrowseInformationFile = option+3; |
528 | break; | 521 | break; |
529 | case 'U': | 522 | case 'U': |
530 | ForcedUsingFiles += option+3; | 523 | ForcedUsingFiles += option+3; |
531 | break; | 524 | break; |
532 | case 'd': | 525 | case 'd': |
533 | ProgramDataBaseFileName = option+3; | 526 | ProgramDataBaseFileName = option+3; |
534 | break; | 527 | break; |
535 | case 'e': | 528 | case 'e': |
536 | OutputFile = option+3; | 529 | OutputFile = option+3; |
537 | break; | 530 | break; |
538 | case 'm': | 531 | case 'm': |
539 | AdditionalOptions += option; | 532 | AdditionalOptions += option; |
540 | break; | 533 | break; |
541 | case 'o': | 534 | case 'o': |
542 | ObjectFile = option+3; | 535 | ObjectFile = option+3; |
543 | break; | 536 | break; |
544 | case 'p': | 537 | case 'p': |
545 | PrecompiledHeaderFile = option+3; | 538 | PrecompiledHeaderFile = option+3; |
546 | break; | 539 | break; |
547 | case 'x': | 540 | case 'x': |
548 | ExpandAttributedSource = _True; | 541 | ExpandAttributedSource = _True; |
549 | break; | 542 | break; |
550 | default: | 543 | default: |
551 | found = FALSE; break; | 544 | found = FALSE; break; |
552 | } | 545 | } |
553 | } | 546 | } |
554 | break; | 547 | break; |
555 | case 'G': | 548 | case 'G': |
556 | switch ( second ) { | 549 | switch ( second ) { |
557 | case '3': | 550 | case '3': |
558 | case '4': | 551 | case '4': |
559 | qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" ); | 552 | qWarning( "Option '/G3' and '/G4' were phased out in Visual C++ 5.0" ); |
560 | found = FALSE; break; | 553 | found = FALSE; break; |
561 | case '5': | 554 | case '5': |
562 | OptimizeForProcessor = procOptimizePentium; | 555 | OptimizeForProcessor = procOptimizePentium; |
563 | break; | 556 | break; |
564 | case '6': | 557 | case '6': |
565 | case 'B': | 558 | case 'B': |
566 | OptimizeForProcessor = procOptimizePentiumProAndAbove; | 559 | OptimizeForProcessor = procOptimizePentiumProAndAbove; |
567 | break; | 560 | break; |
568 | case 'A': | 561 | case 'A': |
569 | OptimizeForWindowsApplication = _True; | 562 | OptimizeForWindowsApplication = _True; |
570 | break; | 563 | break; |
571 | case 'F': | 564 | case 'F': |
572 | StringPooling = _True; | 565 | StringPooling = _True; |
573 | break; | 566 | break; |
574 | case 'H': | 567 | case 'H': |
575 | AdditionalOptions += option; | 568 | AdditionalOptions += option; |
576 | break; | 569 | break; |
577 | case 'L': | 570 | case 'L': |
578 | WholeProgramOptimization = _True; | 571 | WholeProgramOptimization = _True; |
579 | if ( third == '-' ) | 572 | if ( third == '-' ) |
580 | WholeProgramOptimization = _False; | 573 | WholeProgramOptimization = _False; |
581 | break; | 574 | break; |
582 | case 'R': | 575 | case 'R': |
583 | RuntimeTypeInfo = _True; | 576 | RuntimeTypeInfo = _True; |
584 | if ( third == '-' ) | 577 | if ( third == '-' ) |
585 | RuntimeTypeInfo = _False; | 578 | RuntimeTypeInfo = _False; |
586 | break; | 579 | break; |
587 | case 'S': | 580 | case 'S': |
588 | BufferSecurityCheck = _True; | 581 | BufferSecurityCheck = _True; |
589 | break; | 582 | break; |
590 | case 'T': | 583 | case 'T': |
591 | EnableFiberSafeOptimizations = _True; | 584 | EnableFiberSafeOptimizations = _True; |
592 | break; | 585 | break; |
593 | case 'X': | 586 | case 'X': |
587 | // ExceptionHandling == true will override with | ||
588 | // an /EHsc option, which is correct with /GX | ||
589 | ExceptionHandling = _True; // Fall-through | ||
594 | case 'Z': | 590 | case 'Z': |
595 | case 'e': | 591 | case 'e': |
596 | case 'h': | 592 | case 'h': |
597 | AdditionalOptions += option; | 593 | AdditionalOptions += option; |
598 | break; | 594 | break; |
599 | case 'd': | 595 | case 'd': |
600 | CallingConvention = callConventionCDecl; | 596 | CallingConvention = callConventionCDecl; |
601 | break; | 597 | break; |
602 | case 'f': | 598 | case 'f': |
603 | StringPooling = _True; | 599 | StringPooling = _True; |
604 | AdditionalOptions += option; | 600 | AdditionalOptions += option; |
605 | break; | 601 | break; |
606 | case 'm': | 602 | case 'm': |
607 | MinimalRebuild = _True; | 603 | MinimalRebuild = _True; |
608 | if ( third == '-' ) | 604 | if ( third == '-' ) |
609 | MinimalRebuild = _False; | 605 | MinimalRebuild = _False; |
610 | break; | 606 | break; |
611 | case 'r': | 607 | case 'r': |
612 | CallingConvention = callConventionFastCall; | 608 | CallingConvention = callConventionFastCall; |
613 | break; | 609 | break; |
614 | case 's': | 610 | case 's': |
615 | // Warning: following [num] is not used, | 611 | // Warning: following [num] is not used, |
616 | // were should we put it? | 612 | // were should we put it? |
617 | BufferSecurityCheck = _True; | 613 | BufferSecurityCheck = _True; |
618 | break; | 614 | break; |
619 | case 'y': | 615 | case 'y': |
620 | EnableFunctionLevelLinking = _True; | 616 | EnableFunctionLevelLinking = _True; |
621 | break; | 617 | break; |
622 | case 'z': | 618 | case 'z': |
623 | CallingConvention = callConventionStdCall; | 619 | CallingConvention = callConventionStdCall; |
624 | break; | 620 | break; |
625 | default: | 621 | default: |
626 | found = FALSE; break; | 622 | found = FALSE; break; |
627 | } | 623 | } |
628 | break; | 624 | break; |
629 | case 'H': | 625 | case 'H': |
630 | AdditionalOptions += option; | 626 | AdditionalOptions += option; |
631 | break; | 627 | break; |
632 | case 'I': | 628 | case 'I': |
633 | AdditionalIncludeDirectories += option+2; | 629 | AdditionalIncludeDirectories += option+2; |
634 | break; | 630 | break; |
635 | case 'L': | 631 | case 'L': |
636 | if ( second == 'D' ) { | 632 | if ( second == 'D' ) { |
637 | AdditionalOptions += option; | 633 | AdditionalOptions += option; |
638 | break; | 634 | break; |
639 | } | 635 | } |
640 | found = FALSE; break; | 636 | found = FALSE; break; |
641 | case 'M': | 637 | case 'M': |
642 | if ( second == 'D' ) { | 638 | if ( second == 'D' ) { |
643 | RuntimeLibrary = rtMultiThreadedDLL; | 639 | RuntimeLibrary = rtMultiThreadedDLL; |
644 | if ( third == 'd' ) | 640 | if ( third == 'd' ) |
645 | RuntimeLibrary = rtMultiThreadedDebugDLL; | 641 | RuntimeLibrary = rtMultiThreadedDebugDLL; |
646 | break; | 642 | break; |
647 | } else if ( second == 'L' ) { | 643 | } else if ( second == 'L' ) { |
648 | RuntimeLibrary = rtSingleThreaded; | 644 | RuntimeLibrary = rtSingleThreaded; |
649 | if ( third == 'd' ) | 645 | if ( third == 'd' ) |
650 | RuntimeLibrary = rtSingleThreadedDebug; | 646 | RuntimeLibrary = rtSingleThreadedDebug; |
651 | break; | 647 | break; |
652 | } else if ( second == 'T' ) { | 648 | } else if ( second == 'T' ) { |
653 | RuntimeLibrary = rtMultiThreaded; | 649 | RuntimeLibrary = rtMultiThreaded; |
654 | if ( third == 'd' ) | 650 | if ( third == 'd' ) |
655 | RuntimeLibrary = rtMultiThreadedDebug; | 651 | RuntimeLibrary = rtMultiThreadedDebug; |
656 | break; | 652 | break; |
657 | } | 653 | } |
658 | found = FALSE; break; | 654 | found = FALSE; break; |
659 | case 'O': | 655 | case 'O': |
660 | switch ( second ) { | 656 | switch ( second ) { |
661 | case '1': | 657 | case '1': |
662 | Optimization = optimizeMinSpace; | 658 | Optimization = optimizeMinSpace; |
663 | break; | 659 | break; |
664 | case '2': | 660 | case '2': |
665 | Optimization = optimizeMaxSpeed; | 661 | Optimization = optimizeMaxSpeed; |
666 | break; | 662 | break; |
667 | case 'a': | 663 | case 'a': |
668 | AdditionalOptions += option; | 664 | AdditionalOptions += option; |
669 | break; | 665 | break; |
670 | case 'b': | 666 | case 'b': |
671 | if ( third == '0' ) | 667 | if ( third == '0' ) |
672 | InlineFunctionExpansion = expandDisable; | 668 | InlineFunctionExpansion = expandDisable; |
673 | else if ( third == '1' ) | 669 | else if ( third == '1' ) |
674 | InlineFunctionExpansion = expandOnlyInline; | 670 | InlineFunctionExpansion = expandOnlyInline; |
675 | else if ( third == '2' ) | 671 | else if ( third == '2' ) |
676 | InlineFunctionExpansion = expandAnySuitable; | 672 | InlineFunctionExpansion = expandAnySuitable; |
677 | else | 673 | else |
678 | found = FALSE; | 674 | found = FALSE; |
679 | break; | 675 | break; |
680 | case 'd': | 676 | case 'd': |
681 | Optimization = optimizeDisabled; | 677 | Optimization = optimizeDisabled; |
682 | break; | 678 | break; |
683 | case 'g': | 679 | case 'g': |
684 | GlobalOptimizations = _True; | 680 | GlobalOptimizations = _True; |
685 | break; | 681 | break; |
686 | case 'i': | 682 | case 'i': |
687 | EnableIntrinsicFunctions = _True; | 683 | EnableIntrinsicFunctions = _True; |
688 | break; | 684 | break; |
689 | case 'p': | 685 | case 'p': |
@@ -861,258 +857,258 @@ bool VCCLCompilerTool::parseOption( const char* option ) | |||
861 | case '1': | 857 | case '1': |
862 | StructMemberAlignment = alignSingleByte; | 858 | StructMemberAlignment = alignSingleByte; |
863 | if ( fourth == '6' ) | 859 | if ( fourth == '6' ) |
864 | StructMemberAlignment = alignSixteenBytes; | 860 | StructMemberAlignment = alignSixteenBytes; |
865 | break; | 861 | break; |
866 | case '2': | 862 | case '2': |
867 | StructMemberAlignment = alignTwoBytes; | 863 | StructMemberAlignment = alignTwoBytes; |
868 | break; | 864 | break; |
869 | case '4': | 865 | case '4': |
870 | StructMemberAlignment = alignFourBytes; | 866 | StructMemberAlignment = alignFourBytes; |
871 | break; | 867 | break; |
872 | case '8': | 868 | case '8': |
873 | StructMemberAlignment = alignEightBytes; | 869 | StructMemberAlignment = alignEightBytes; |
874 | break; | 870 | break; |
875 | default: | 871 | default: |
876 | found = FALSE; break; | 872 | found = FALSE; break; |
877 | } | 873 | } |
878 | break; | 874 | break; |
879 | default: | 875 | default: |
880 | found = FALSE; break; | 876 | found = FALSE; break; |
881 | } | 877 | } |
882 | break; | 878 | break; |
883 | case 'c': | 879 | case 'c': |
884 | if ( second == '\0' ) { | 880 | if ( second == '\0' ) { |
885 | CompileOnly = _True; | 881 | CompileOnly = _True; |
886 | } else if ( second == 'l' ) { | 882 | } else if ( second == 'l' ) { |
887 | if ( *(option+5) == 'n' ) { | 883 | if ( *(option+5) == 'n' ) { |
888 | CompileAsManaged = managedAssembly; | 884 | CompileAsManaged = managedAssembly; |
889 | TurnOffAssemblyGeneration = _True; | 885 | TurnOffAssemblyGeneration = _True; |
890 | } else { | 886 | } else { |
891 | CompileAsManaged = managedAssembly; | 887 | CompileAsManaged = managedAssembly; |
892 | } | 888 | } |
893 | } else { | 889 | } else { |
894 | found = FALSE; break; | 890 | found = FALSE; break; |
895 | } | 891 | } |
896 | break; | 892 | break; |
897 | case 'd': | 893 | case 'd': |
898 | if ( second != 'r' ) { | 894 | if ( second != 'r' ) { |
899 | found = FALSE; break; | 895 | found = FALSE; break; |
900 | } | 896 | } |
901 | CompileAsManaged = managedAssembly; | 897 | CompileAsManaged = managedAssembly; |
902 | break; | 898 | break; |
903 | case 'n': | 899 | case 'n': |
904 | if ( second == 'o' && third == 'B' && fourth == 'o' ) { | 900 | if ( second == 'o' && third == 'B' && fourth == 'o' ) { |
905 | AdditionalOptions += "/noBool"; | 901 | AdditionalOptions += "/noBool"; |
906 | break; | 902 | break; |
907 | } | 903 | } |
908 | if ( second == 'o' && third == 'l' && fourth == 'o' ) { | 904 | if ( second == 'o' && third == 'l' && fourth == 'o' ) { |
909 | SuppressStartupBanner = _True; | 905 | SuppressStartupBanner = _True; |
910 | break; | 906 | break; |
911 | } | 907 | } |
912 | found = FALSE; break; | 908 | found = FALSE; break; |
913 | case 's': | 909 | case 's': |
914 | if ( second == 'h' && third == 'o' && fourth == 'w' ) { | 910 | if ( second == 'h' && third == 'o' && fourth == 'w' ) { |
915 | ShowIncludes = _True; | 911 | ShowIncludes = _True; |
916 | break; | 912 | break; |
917 | } | 913 | } |
918 | found = FALSE; break; | 914 | found = FALSE; break; |
919 | case 'u': | 915 | case 'u': |
920 | UndefineAllPreprocessorDefinitions = _True; | 916 | UndefineAllPreprocessorDefinitions = _True; |
921 | break; | 917 | break; |
922 | case 'v': | 918 | case 'v': |
923 | if ( second == 'd' || second == 'm' ) { | 919 | if ( second == 'd' || second == 'm' ) { |
924 | AdditionalOptions += option; | 920 | AdditionalOptions += option; |
925 | break; | 921 | break; |
926 | } | 922 | } |
927 | found = FALSE; break; | 923 | found = FALSE; break; |
928 | case 'w': | 924 | case 'w': |
929 | switch ( second ) { | 925 | switch ( second ) { |
930 | case '\0': | 926 | case '\0': |
931 | WarningLevel = warningLevel_0; | 927 | WarningLevel = warningLevel_0; |
932 | break; | 928 | break; |
933 | case 'd': | 929 | case 'd': |
934 | DisableSpecificWarnings += option+3; | 930 | DisableSpecificWarnings += option+3; |
935 | break; | 931 | break; |
936 | default: | 932 | default: |
937 | AdditionalOptions += option; | 933 | AdditionalOptions += option; |
938 | } | 934 | } |
939 | break; | 935 | break; |
940 | default: | 936 | default: |
941 | found = FALSE; break; | 937 | found = FALSE; break; |
942 | } | 938 | } |
943 | if( !found ) | 939 | if( !found ) |
944 | warn_msg( WarnLogic, "Could not parse Compiler option: %s", option ); | 940 | warn_msg( WarnLogic, "Could not parse Compiler option: %s", option ); |
945 | return TRUE; | 941 | return TRUE; |
946 | } | 942 | } |
947 | 943 | ||
948 | // VCLinkerTool ----------------------------------------------------- | 944 | // VCLinkerTool ----------------------------------------------------- |
949 | VCLinkerTool::VCLinkerTool() | 945 | VCLinkerTool::VCLinkerTool() |
950 | :EnableCOMDATFolding( optFoldingDefault ), | 946 | :EnableCOMDATFolding( optFoldingDefault ), |
951 | GenerateDebugInformation( unset ), | 947 | GenerateDebugInformation( unset ), |
952 | GenerateMapFile( unset ), | 948 | GenerateMapFile( unset ), |
953 | HeapCommitSize( -1 ), | 949 | HeapCommitSize( -1 ), |
954 | HeapReserveSize( -1 ), | 950 | HeapReserveSize( -1 ), |
955 | IgnoreAllDefaultLibraries( unset ), | 951 | IgnoreAllDefaultLibraries( unset ), |
956 | IgnoreEmbeddedIDL( unset ), | 952 | IgnoreEmbeddedIDL( unset ), |
957 | IgnoreImportLibrary( unset ), | 953 | IgnoreImportLibrary( _True ), |
958 | LargeAddressAware( addrAwareDefault ), | 954 | LargeAddressAware( addrAwareDefault ), |
959 | LinkDLL( unset ), | 955 | LinkDLL( unset ), |
960 | LinkIncremental( linkIncrementalYes ), | 956 | LinkIncremental( linkIncrementalDefault ), |
961 | LinkTimeCodeGeneration( unset ), | 957 | LinkTimeCodeGeneration( unset ), |
962 | MapExports( unset ), | 958 | MapExports( unset ), |
963 | MapLines( unset ), | 959 | MapLines( unset ), |
964 | OptimizeForWindows98( optWin98Default ), | 960 | OptimizeForWindows98( optWin98Default ), |
965 | OptimizeReferences( optReferencesDefault ), | 961 | OptimizeReferences( optReferencesDefault ), |
966 | RegisterOutput( unset ), | 962 | RegisterOutput( unset ), |
967 | ResourceOnlyDLL( unset ), | 963 | ResourceOnlyDLL( unset ), |
968 | SetChecksum( unset ), | 964 | SetChecksum( unset ), |
969 | ShowProgress( linkProgressNotSet ), | 965 | ShowProgress( linkProgressNotSet ), |
970 | StackCommitSize( -1 ), | 966 | StackCommitSize( -1 ), |
971 | StackReserveSize( -1 ), | 967 | StackReserveSize( -1 ), |
972 | SubSystem( subSystemNotSet ), | 968 | SubSystem( subSystemNotSet ), |
973 | SupportUnloadOfDelayLoadedDLL( unset ), | 969 | SupportUnloadOfDelayLoadedDLL( unset ), |
974 | SuppressStartupBanner( unset ), | 970 | SuppressStartupBanner( unset ), |
975 | SwapRunFromCD( unset ), | 971 | SwapRunFromCD( unset ), |
976 | SwapRunFromNet( unset ), | 972 | SwapRunFromNet( unset ), |
977 | TargetMachine( machineNotSet ), | 973 | TargetMachine( machineNotSet ), |
978 | TerminalServerAware( termSvrAwareDefault ), | 974 | TerminalServerAware( termSvrAwareDefault ), |
979 | TurnOffAssemblyGeneration( unset ), | 975 | TurnOffAssemblyGeneration( unset ), |
980 | TypeLibraryResourceID( 0 ) | 976 | TypeLibraryResourceID( 0 ) |
981 | { | 977 | { |
982 | } | 978 | } |
983 | 979 | ||
984 | QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) | 980 | QTextStream &operator<<( QTextStream &strm, const VCLinkerTool &tool ) |
985 | { | 981 | { |
986 | strm << _begTool3; | 982 | strm << _begTool3; |
987 | strm << _VCLinkerToolName; | 983 | strm << _VCLinkerToolName; |
988 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " ); | 984 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, " " ); |
989 | strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); | 985 | strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); |
990 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); | 986 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
991 | strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly ); | 987 | strm << XPair( _AddModuleNamesToAssembly, tool.AddModuleNamesToAssembly ); |
992 | strm << SPair( _BaseAddress, tool.BaseAddress ); | 988 | strm << SPair( _BaseAddress, tool.BaseAddress ); |
993 | strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs ); | 989 | strm << XPair( _DelayLoadDLLs, tool.DelayLoadDLLs ); |
994 | if ( tool.EnableCOMDATFolding != optFoldingDefault ) strm << EPair( _EnableCOMDATFolding, tool.EnableCOMDATFolding ); | 990 | if ( tool.EnableCOMDATFolding != optFoldingDefault ) strm << EPair( _EnableCOMDATFolding, tool.EnableCOMDATFolding ); |
995 | strm << SPair( _EntryPointSymbol, tool.EntryPointSymbol ); | 991 | strm << SPair( _EntryPointSymbol, tool.EntryPointSymbol ); |
996 | strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); | 992 | strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); |
997 | strm << SPair( _FunctionOrder, tool.FunctionOrder ); | 993 | strm << SPair( _FunctionOrder, tool.FunctionOrder ); |
998 | strm << TPair( _GenerateDebugInformation, tool.GenerateDebugInformation ); | 994 | strm << TPair( _GenerateDebugInformation, tool.GenerateDebugInformation ); |
999 | strm << TPair( _GenerateMapFile, tool.GenerateMapFile ); | 995 | strm << TPair( _GenerateMapFile, tool.GenerateMapFile ); |
1000 | if ( tool.HeapCommitSize != -1 ) strm << LPair( _HeapCommitSize, tool.HeapCommitSize ); | 996 | if ( tool.HeapCommitSize != -1 ) strm << LPair( _HeapCommitSize, tool.HeapCommitSize ); |
1001 | if ( tool.HeapReserveSize != -1 ) strm << LPair( _HeapReserveSize, tool.HeapReserveSize ); | 997 | if ( tool.HeapReserveSize != -1 ) strm << LPair( _HeapReserveSize, tool.HeapReserveSize ); |
1002 | strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); | 998 | strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); |
1003 | strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); | 999 | strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); |
1004 | strm << TPair( _IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL ); | 1000 | strm << TPair( _IgnoreEmbeddedIDL, tool.IgnoreEmbeddedIDL ); |
1005 | strm << TPair( _IgnoreImportLibrary, tool.IgnoreImportLibrary ); | 1001 | strm << TPair( _IgnoreImportLibrary, tool.IgnoreImportLibrary ); |
1006 | strm << SPair( _ImportLibrary, tool.ImportLibrary ); | 1002 | strm << SPair( _ImportLibrary, tool.ImportLibrary ); |
1007 | if ( tool.LargeAddressAware != addrAwareDefault ) strm << EPair( _LargeAddressAware, tool.LargeAddressAware ); | 1003 | if ( tool.LargeAddressAware != addrAwareDefault ) strm << EPair( _LargeAddressAware, tool.LargeAddressAware ); |
1008 | strm << TPair( _LinkDLL, tool.LinkDLL ); | 1004 | strm << TPair( _LinkDLL, tool.LinkDLL ); |
1009 | if ( tool.LinkIncremental != linkIncrementalDefault ) strm << EPair( _LinkIncremental, tool.LinkIncremental ); | 1005 | if ( tool.LinkIncremental != linkIncrementalDefault ) strm << EPair( _LinkIncremental, tool.LinkIncremental ); |
1010 | strm << TPair( _LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration ); | 1006 | strm << TPair( _LinkTimeCodeGeneration, tool.LinkTimeCodeGeneration ); |
1011 | strm << SPair( _LinkToManagedResourceFile, tool.LinkToManagedResourceFile ); | 1007 | strm << SPair( _LinkToManagedResourceFile, tool.LinkToManagedResourceFile ); |
1012 | strm << TPair( _MapExports, tool.MapExports ); | 1008 | strm << TPair( _MapExports, tool.MapExports ); |
1013 | strm << SPair( _MapFileName, tool.MapFileName ); | 1009 | strm << SPair( _MapFileName, tool.MapFileName ); |
1014 | strm << TPair( _MapLines, tool.MapLines ); | 1010 | strm << TPair( _MapLines, tool.MapLines ); |
1015 | strm << SPair( _MergedIDLBaseFileName, tool.MergedIDLBaseFileName ); | 1011 | strm << SPair( _MergedIDLBaseFileName, tool.MergedIDLBaseFileName ); |
1016 | strm << SPair( _MergeSections, tool.MergeSections ); | 1012 | strm << SPair( _MergeSections, tool.MergeSections ); |
1017 | strm << SPair( _MidlCommandFile, tool.MidlCommandFile ); | 1013 | strm << SPair( _MidlCommandFile, tool.MidlCommandFile ); |
1018 | strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); | 1014 | strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); |
1019 | if ( tool.OptimizeForWindows98 != optWin98Default ) strm << EPair( _OptimizeForWindows98, tool.OptimizeForWindows98 ); | 1015 | if ( tool.OptimizeForWindows98 != optWin98Default ) strm << EPair( _OptimizeForWindows98, tool.OptimizeForWindows98 ); |
1020 | if ( tool.OptimizeReferences != optReferencesDefault ) strm << EPair( _OptimizeReferences, tool.OptimizeReferences ); | 1016 | if ( tool.OptimizeReferences != optReferencesDefault ) strm << EPair( _OptimizeReferences, tool.OptimizeReferences ); |
1021 | strm << SPair( _OutputFile, tool.OutputFile ); | 1017 | strm << SPair( _OutputFile, tool.OutputFile ); |
1022 | strm << SPair( _ProgramDatabaseFile, tool.ProgramDatabaseFile ); | 1018 | strm << _ProgramDatabaseFile << tool.ProgramDatabaseFile << "\""; |
1023 | strm << TPair( _RegisterOutput, tool.RegisterOutput ); | 1019 | strm << TPair( _RegisterOutput, tool.RegisterOutput ); |
1024 | strm << TPair( _ResourceOnlyDLL, tool.ResourceOnlyDLL ); | 1020 | strm << TPair( _ResourceOnlyDLL, tool.ResourceOnlyDLL ); |
1025 | strm << TPair( _SetChecksum, tool.SetChecksum ); | 1021 | strm << TPair( _SetChecksum, tool.SetChecksum ); |
1026 | if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); | 1022 | if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); |
1027 | if ( tool.StackCommitSize != -1 ) strm << LPair( _StackCommitSize, tool.StackCommitSize ); | 1023 | if ( tool.StackCommitSize != -1 ) strm << LPair( _StackCommitSize, tool.StackCommitSize ); |
1028 | if ( tool.StackReserveSize != -1 ) strm << LPair( _StackReserveSize, tool.StackReserveSize ); | 1024 | if ( tool.StackReserveSize != -1 ) strm << LPair( _StackReserveSize, tool.StackReserveSize ); |
1029 | strm << SPair( _StripPrivateSymbols, tool.StripPrivateSymbols ); | 1025 | strm << SPair( _StripPrivateSymbols, tool.StripPrivateSymbols ); |
1030 | strm << EPair( _SubSystem, tool.SubSystem ); | 1026 | strm << EPair( _SubSystem, tool.SubSystem ); |
1031 | strm << TPair( _SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL ); | 1027 | strm << TPair( _SupportUnloadOfDelayLoadedDLL, tool.SupportUnloadOfDelayLoadedDLL ); |
1032 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); | 1028 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); |
1033 | strm << TPair( _SwapRunFromCD, tool.SwapRunFromCD ); | 1029 | strm << TPair( _SwapRunFromCD, tool.SwapRunFromCD ); |
1034 | strm << TPair( _SwapRunFromNet, tool.SwapRunFromNet ); | 1030 | strm << TPair( _SwapRunFromNet, tool.SwapRunFromNet ); |
1035 | if ( tool.TargetMachine != machineNotSet ) strm << EPair( _TargetMachine, tool.TargetMachine ); | 1031 | if ( tool.TargetMachine != machineNotSet ) strm << EPair( _TargetMachine, tool.TargetMachine ); |
1036 | if ( tool.TerminalServerAware != termSvrAwareDefault ) strm << EPair( _TerminalServerAware, tool.TerminalServerAware ); | 1032 | if ( tool.TerminalServerAware != termSvrAwareDefault ) strm << EPair( _TerminalServerAware, tool.TerminalServerAware ); |
1037 | strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration ); | 1033 | strm << TPair( _TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration ); |
1038 | strm << SPair( _TypeLibraryFile, tool.TypeLibraryFile ); | 1034 | strm << SPair( _TypeLibraryFile, tool.TypeLibraryFile ); |
1039 | if ( tool.TypeLibraryResourceID != rcUseDefault ) strm << LPair( _TypeLibraryResourceID, tool.TypeLibraryResourceID ); | 1035 | if ( tool.TypeLibraryResourceID != rcUseDefault ) strm << LPair( _TypeLibraryResourceID, tool.TypeLibraryResourceID ); |
1040 | strm << SPair( _Version4, tool.Version ); | 1036 | strm << SPair( _Version4, tool.Version ); |
1041 | strm << "/>"; | 1037 | strm << "/>"; |
1042 | return strm; | 1038 | return strm; |
1043 | } | 1039 | } |
1044 | 1040 | ||
1045 | // Hashing routine to do fast option lookups ---- | 1041 | // Hashing routine to do fast option lookups ---- |
1046 | // Slightly rewritten to stop on ':' ',' and '\0' | 1042 | // Slightly rewritten to stop on ':' ',' and '\0' |
1047 | // Original routine in qtranslator.cpp ---------- | 1043 | // Original routine in qtranslator.cpp ---------- |
1048 | static uint elfHash( const char* name ) | 1044 | static uint elfHash( const char* name ) |
1049 | { | 1045 | { |
1050 | const uchar *k; | 1046 | const uchar *k; |
1051 | uint h = 0; | 1047 | uint h = 0; |
1052 | uint g; | 1048 | uint g; |
1053 | 1049 | ||
1054 | if ( name ) { | 1050 | if ( name ) { |
1055 | k = (const uchar *) name; | 1051 | k = (const uchar *) name; |
1056 | while ( (*k) && | 1052 | while ( (*k) && |
1057 | (*k)!= ':' && | 1053 | (*k)!= ':' && |
1058 | (*k)!=',' && | 1054 | (*k)!=',' && |
1059 | (*k)!=' ' ) { | 1055 | (*k)!=' ' ) { |
1060 | h = ( h << 4 ) + *k++; | 1056 | h = ( h << 4 ) + *k++; |
1061 | if ( (g = (h & 0xf0000000)) != 0 ) | 1057 | if ( (g = (h & 0xf0000000)) != 0 ) |
1062 | h ^= g >> 24; | 1058 | h ^= g >> 24; |
1063 | h &= ~g; | 1059 | h &= ~g; |
1064 | } | 1060 | } |
1065 | } | 1061 | } |
1066 | if ( !h ) | 1062 | if ( !h ) |
1067 | h = 1; | 1063 | h = 1; |
1068 | return h; | 1064 | return h; |
1069 | } | 1065 | } |
1070 | 1066 | ||
1071 | //#define USE_DISPLAY_HASH | 1067 | //#define USE_DISPLAY_HASH |
1072 | #ifdef USE_DISPLAY_HASH | 1068 | #ifdef USE_DISPLAY_HASH |
1073 | static void displayHash( const char* str ) | 1069 | static void displayHash( const char* str ) |
1074 | { | 1070 | { |
1075 | printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str ); | 1071 | printf( "case 0x%07x: // %s\n break;\n", elfHash(str), str ); |
1076 | } | 1072 | } |
1077 | #endif | 1073 | #endif |
1078 | 1074 | ||
1079 | bool VCLinkerTool::parseOption( const char* option ) | 1075 | bool VCLinkerTool::parseOption( const char* option ) |
1080 | { | 1076 | { |
1081 | #ifdef USE_DISPLAY_HASH | 1077 | #ifdef USE_DISPLAY_HASH |
1082 | // Main options | 1078 | // Main options |
1083 | displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" ); | 1079 | displayHash( "/ALIGN" ); displayHash( "/ALLOWBIND" ); displayHash( "/ASSEMBLYMODULE" ); |
1084 | displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" ); | 1080 | displayHash( "/ASSEMBLYRESOURCE" ); displayHash( "/BASE" ); displayHash( "/DEBUG" ); |
1085 | displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" ); | 1081 | displayHash( "/DEF" ); displayHash( "/DEFAULTLIB" ); displayHash( "/DELAY" ); |
1086 | displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" ); | 1082 | displayHash( "/DELAYLOAD" ); displayHash( "/DLL" ); displayHash( "/DRIVER" ); |
1087 | displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" ); | 1083 | displayHash( "/ENTRY" ); displayHash( "/EXETYPE" ); displayHash( "/EXPORT" ); |
1088 | displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" ); | 1084 | displayHash( "/FIXED" ); displayHash( "/FORCE" ); displayHash( "/HEAP" ); |
1089 | displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" ); | 1085 | displayHash( "/IDLOUT" ); displayHash( "/IGNOREIDL" ); displayHash( "/IMPLIB" ); |
1090 | displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" ); | 1086 | displayHash( "/INCLUDE" ); displayHash( "/INCREMENTAL" ); displayHash( "/LARGEADDRESSAWARE" ); |
1091 | displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" ); | 1087 | displayHash( "/LIBPATH" ); displayHash( "/LTCG" ); displayHash( "/MACHINE" ); |
1092 | displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" ); | 1088 | displayHash( "/MAP" ); displayHash( "/MAPINFO" ); displayHash( "/MERGE" ); |
1093 | displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" ); | 1089 | displayHash( "/MIDL" ); displayHash( "/NOASSEMBLY" ); displayHash( "/NODEFAULTLIB" ); |
1094 | displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" ); | 1090 | displayHash( "/NOENTRY" ); displayHash( "/NOLOGO" ); displayHash( "/OPT" ); |
1095 | displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" ); | 1091 | displayHash( "/ORDER" ); displayHash( "/OUT" ); displayHash( "/PDB" ); |
1096 | displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" ); | 1092 | displayHash( "/PDBSTRIPPED" ); displayHash( "/RELEASE" ); displayHash( "/SECTION" ); |
1097 | displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" ); | 1093 | displayHash( "/STACK" ); displayHash( "/STUB" ); displayHash( "/SUBSYSTEM" ); |
1098 | displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" ); | 1094 | displayHash( "/SWAPRUN" ); displayHash( "/TLBID" ); displayHash( "/TLBOUT" ); |
1099 | displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" ); | 1095 | displayHash( "/TSAWARE" ); displayHash( "/VERBOSE" ); displayHash( "/VERSION" ); |
1100 | displayHash( "/VXD" ); displayHash( "/WS " ); | 1096 | displayHash( "/VXD" ); displayHash( "/WS " ); |
1101 | #endif | 1097 | #endif |
1102 | #ifdef USE_DISPLAY_HASH | 1098 | #ifdef USE_DISPLAY_HASH |
1103 | // Sub options | 1099 | // Sub options |
1104 | displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" ); | 1100 | displayHash( "UNLOAD" ); displayHash( "NOBIND" ); displayHash( "no" ); displayHash( "NOSTATUS" ); displayHash( "STATUS" ); |
1105 | displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" ); | 1101 | displayHash( "AM33" ); displayHash( "ARM" ); displayHash( "CEE" ); displayHash( "IA64" ); displayHash( "X86" ); displayHash( "M32R" ); |
1106 | displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" ); | 1102 | displayHash( "MIPS" ); displayHash( "MIPS16" ); displayHash( "MIPSFPU" ); displayHash( "MIPSFPU16" ); displayHash( "MIPSR41XX" ); displayHash( "PPC" ); |
1107 | displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" ); | 1103 | displayHash( "SH3" ); displayHash( "SH4" ); displayHash( "SH5" ); displayHash( "THUMB" ); displayHash( "TRICORE" ); displayHash( "EXPORTS" ); |
1108 | displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" ); | 1104 | displayHash( "LINES" ); displayHash( "REF" ); displayHash( "NOREF" ); displayHash( "ICF" ); displayHash( "WIN98" ); displayHash( "NOWIN98" ); |
1109 | displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" ); | 1105 | displayHash( "CONSOLE" ); displayHash( "EFI_APPLICATION" ); displayHash( "EFI_BOOT_SERVICE_DRIVER" ); displayHash( "EFI_ROM" ); displayHash( "EFI_RUNTIME_DRIVER" ); displayHash( "NATIVE" ); |
1110 | displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" ); | 1106 | displayHash( "POSIX" ); displayHash( "WINDOWS" ); displayHash( "WINDOWSCE" ); displayHash( "NET" ); displayHash( "CD" ); displayHash( "NO" ); |
1111 | #endif | 1107 | #endif |
1112 | bool found = TRUE; | 1108 | bool found = TRUE; |
1113 | switch ( elfHash(option) ) { | 1109 | switch ( elfHash(option) ) { |
1114 | case 0x3360dbe: // /ALIGN[:number] | 1110 | case 0x3360dbe: // /ALIGN[:number] |
1115 | case 0x1485c34: // /ALLOWBIND[:NO] | 1111 | case 0x1485c34: // /ALLOWBIND[:NO] |
1116 | case 0x6b21972: // /DEFAULTLIB:library | 1112 | case 0x6b21972: // /DEFAULTLIB:library |
1117 | case 0x396ea92: // /DRIVER[:UPONLY | :WDM] | 1113 | case 0x396ea92: // /DRIVER[:UPONLY | :WDM] |
1118 | case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386] | 1114 | case 0xaca9d75: // /EXETYPE[:DYNAMIC | :DEV386] |
@@ -1614,379 +1610,504 @@ bool VCMIDLTool::parseOption( const char* option ) | |||
1614 | case 0x5b1cb97: // /app_config | 1610 | case 0x5b1cb97: // /app_config |
1615 | case 0x3595cf4: // /c_ext | 1611 | case 0x3595cf4: // /c_ext |
1616 | case 0x5a2fc64: // /client {none|stub} | 1612 | case 0x5a2fc64: // /client {none|stub} |
1617 | case 0xa64d3dd: // /confirm | 1613 | case 0xa64d3dd: // /confirm |
1618 | case 0xa765b64: // /cpp_cmd cmd_line | 1614 | case 0xa765b64: // /cpp_cmd cmd_line |
1619 | case 0x35aabb2: // /cstub filename | 1615 | case 0x35aabb2: // /cstub filename |
1620 | case 0x03629f4: // /lcid | 1616 | case 0x03629f4: // /lcid |
1621 | case 0x6495cc4: // /ms_ext | 1617 | case 0x6495cc4: // /ms_ext |
1622 | case 0x96c7a1e: // /ms_union | 1618 | case 0x96c7a1e: // /ms_union |
1623 | case 0x4996fa2: // /msc_ver <nnnn> | 1619 | case 0x4996fa2: // /msc_ver <nnnn> |
1624 | case 0x64ceb12: // /newtlb | 1620 | case 0x64ceb12: // /newtlb |
1625 | case 0x6555a40: // /no_cpp | 1621 | case 0x6555a40: // /no_cpp |
1626 | case 0xf64d6a6: // /no_default_epv | 1622 | case 0xf64d6a6: // /no_default_epv |
1627 | case 0x6dd9384: // /no_format_opt | 1623 | case 0x6dd9384: // /no_format_opt |
1628 | case 0x556dbee: // /no_warn | 1624 | case 0x556dbee: // /no_warn |
1629 | case 0x3655a70: // /nocpp | 1625 | case 0x3655a70: // /nocpp |
1630 | case 0x2b455a3: // /oldnames | 1626 | case 0x2b455a3: // /oldnames |
1631 | case 0x662bb12: // /oldtlb | 1627 | case 0x662bb12: // /oldtlb |
1632 | case 0x0036696: // /osf | 1628 | case 0x0036696: // /osf |
1633 | case 0x036679b: // /pack {N} | 1629 | case 0x036679b: // /pack {N} |
1634 | case 0x678bd38: // /prefix {all|client|server|switch} | 1630 | case 0x678bd38: // /prefix {all|client|server|switch} |
1635 | case 0x96b702c: // /protocol {all|dce|ndr64} | 1631 | case 0x96b702c: // /protocol {all|dce|ndr64} |
1636 | case 0x3696aa3: // /rpcss | 1632 | case 0x3696aa3: // /rpcss |
1637 | case 0x698ca60: // /savePP | 1633 | case 0x698ca60: // /savePP |
1638 | case 0x69c9cf2: // /server {none|stub} | 1634 | case 0x69c9cf2: // /server {none|stub} |
1639 | case 0x36aabb2: // /sstub filename | 1635 | case 0x36aabb2: // /sstub filename |
1640 | case 0xce9b12b: // /syntax_check | 1636 | case 0xce9b12b: // /syntax_check |
1641 | case 0xc9b5f16: // /use_epv | 1637 | case 0xc9b5f16: // /use_epv |
1642 | AdditionalOptions += option; | 1638 | AdditionalOptions += option; |
1643 | break; | 1639 | break; |
1644 | default: | 1640 | default: |
1645 | // /W{0|1|2|3|4} case | 1641 | // /W{0|1|2|3|4} case |
1646 | if ( *(option+1) == 'W' ) { | 1642 | if ( *(option+1) == 'W' ) { |
1647 | switch ( *(option+2) ) { | 1643 | switch ( *(option+2) ) { |
1648 | case '0': | 1644 | case '0': |
1649 | WarningLevel = midlWarningLevel_0; | 1645 | WarningLevel = midlWarningLevel_0; |
1650 | break; | 1646 | break; |
1651 | case '1': | 1647 | case '1': |
1652 | WarningLevel = midlWarningLevel_1; | 1648 | WarningLevel = midlWarningLevel_1; |
1653 | break; | 1649 | break; |
1654 | case '2': | 1650 | case '2': |
1655 | WarningLevel = midlWarningLevel_2; | 1651 | WarningLevel = midlWarningLevel_2; |
1656 | break; | 1652 | break; |
1657 | case '3': | 1653 | case '3': |
1658 | WarningLevel = midlWarningLevel_3; | 1654 | WarningLevel = midlWarningLevel_3; |
1659 | break; | 1655 | break; |
1660 | case '4': | 1656 | case '4': |
1661 | WarningLevel = midlWarningLevel_4; | 1657 | WarningLevel = midlWarningLevel_4; |
1662 | break; | 1658 | break; |
1663 | default: | 1659 | default: |
1664 | found = FALSE; | 1660 | found = FALSE; |
1665 | } | 1661 | } |
1666 | } | 1662 | } |
1667 | break; | 1663 | break; |
1668 | } | 1664 | } |
1669 | if( !found ) | 1665 | if( !found ) |
1670 | warn_msg( WarnLogic, "Could not parse MIDL option: %s", option ); | 1666 | warn_msg( WarnLogic, "Could not parse MIDL option: %s", option ); |
1671 | return TRUE; | 1667 | return TRUE; |
1672 | } | 1668 | } |
1673 | 1669 | ||
1674 | // VCLibrarianTool -------------------------------------------------- | 1670 | // VCLibrarianTool -------------------------------------------------- |
1675 | VCLibrarianTool::VCLibrarianTool() | 1671 | VCLibrarianTool::VCLibrarianTool() |
1676 | :IgnoreAllDefaultLibraries( unset ), | 1672 | :IgnoreAllDefaultLibraries( unset ), |
1677 | SuppressStartupBanner( _True ) | 1673 | SuppressStartupBanner( _True ) |
1678 | { | 1674 | { |
1679 | } | 1675 | } |
1680 | 1676 | ||
1681 | QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool ) | 1677 | QTextStream &operator<<( QTextStream &strm, const VCLibrarianTool &tool ) |
1682 | { | 1678 | { |
1683 | strm << _begTool3; | 1679 | strm << _begTool3; |
1684 | strm << SPair( _ToolName, QString( "VCLibrarianTool" ) ); | 1680 | strm << SPair( _ToolName, QString( "VCLibrarianTool" ) ); |
1685 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies ); | 1681 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies ); |
1686 | strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); | 1682 | strm << XPair( _AdditionalLibraryDirectories, tool.AdditionalLibraryDirectories ); |
1687 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); | 1683 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
1688 | strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions ); | 1684 | strm << XPair( _ExportNamedFunctions, tool.ExportNamedFunctions ); |
1689 | strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); | 1685 | strm << XPair( _ForceSymbolReferences, tool.ForceSymbolReferences ); |
1690 | strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); | 1686 | strm << TPair( _IgnoreAllDefaultLibraries, tool.IgnoreAllDefaultLibraries ); |
1691 | strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); | 1687 | strm << XPair( _IgnoreDefaultLibraryNames, tool.IgnoreDefaultLibraryNames ); |
1692 | strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); | 1688 | strm << SPair( _ModuleDefinitionFile, tool.ModuleDefinitionFile ); |
1693 | strm << SPair( _OutputFile, tool.OutputFile ); | 1689 | strm << SPair( _OutputFile, tool.OutputFile ); |
1694 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); | 1690 | strm << TPair( _SuppressStartupBanner, tool.SuppressStartupBanner ); |
1695 | strm << "/>"; | 1691 | strm << "/>"; |
1696 | return strm; | 1692 | return strm; |
1697 | } | 1693 | } |
1698 | 1694 | ||
1699 | // VCCustomBuildTool ------------------------------------------------ | 1695 | // VCCustomBuildTool ------------------------------------------------ |
1700 | VCCustomBuildTool::VCCustomBuildTool() | 1696 | VCCustomBuildTool::VCCustomBuildTool() |
1701 | { | 1697 | { |
1702 | ToolName = "VCCustomBuildTool"; | 1698 | ToolName = "VCCustomBuildTool"; |
1703 | } | 1699 | } |
1704 | 1700 | ||
1705 | QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool ) | 1701 | QTextStream &operator<<( QTextStream &strm, const VCCustomBuildTool &tool ) |
1706 | { | 1702 | { |
1707 | strm << _begTool3; | 1703 | strm << _begTool3; |
1708 | strm << SPair( _ToolName, tool.ToolName ); | 1704 | strm << SPair( _ToolName, tool.ToolName ); |
1709 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, ";" ); | 1705 | strm << XPair( _AdditionalDependencies4, tool.AdditionalDependencies, ";" ); |
1710 | strm << SPair( _CommandLine4, tool.CommandLine ); | 1706 | strm << XPair( _CommandLine4, tool.CommandLine, "\n" ); |
1711 | strm << SPair( _Description4, tool.Description ); | 1707 | strm << SPair( _Description4, tool.Description ); |
1712 | strm << SPair( _Outputs4, tool.Outputs ); | 1708 | strm << XPair( _Outputs4, tool.Outputs, ";" ); |
1713 | strm << SPair( _ToolPath, tool.ToolPath ); | 1709 | strm << SPair( _ToolPath, tool.ToolPath ); |
1714 | strm << "/>"; | 1710 | strm << "/>"; |
1715 | return strm; | 1711 | return strm; |
1716 | } | 1712 | } |
1717 | 1713 | ||
1718 | // VCResourceCompilerTool ------------------------------------------- | 1714 | // VCResourceCompilerTool ------------------------------------------- |
1719 | VCResourceCompilerTool::VCResourceCompilerTool() | 1715 | VCResourceCompilerTool::VCResourceCompilerTool() |
1720 | : Culture( rcUseDefault ), | 1716 | : Culture( rcUseDefault ), |
1721 | IgnoreStandardIncludePath( unset ), | 1717 | IgnoreStandardIncludePath( unset ), |
1722 | ShowProgress( linkProgressNotSet ) | 1718 | ShowProgress( linkProgressNotSet ) |
1723 | { | 1719 | { |
1724 | PreprocessorDefinitions = "NDEBUG"; | 1720 | PreprocessorDefinitions = "NDEBUG"; |
1725 | } | 1721 | } |
1726 | 1722 | ||
1727 | QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool ) | 1723 | QTextStream &operator<<( QTextStream &strm, const VCResourceCompilerTool &tool ) |
1728 | { | 1724 | { |
1729 | strm << _begTool3; | 1725 | strm << _begTool3; |
1730 | strm << _VCResourceCompilerToolName; | 1726 | strm << _VCResourceCompilerToolName; |
1731 | strm << SPair( _ToolPath, tool.ToolPath ); | 1727 | strm << SPair( _ToolPath, tool.ToolPath ); |
1732 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); | 1728 | strm << XPair( _AdditionalIncludeDirectories, tool.AdditionalIncludeDirectories ); |
1733 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); | 1729 | strm << XPair( _AdditionalOptions, tool.AdditionalOptions, " " ); |
1734 | if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture ); | 1730 | if ( tool.Culture != rcUseDefault ) strm << EPair( _Culture, tool.Culture ); |
1735 | strm << XPair( _FullIncludePath, tool.FullIncludePath ); | 1731 | strm << XPair( _FullIncludePath, tool.FullIncludePath ); |
1736 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); | 1732 | strm << TPair( _IgnoreStandardIncludePath, tool.IgnoreStandardIncludePath ); |
1737 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); | 1733 | strm << XPair( _PreprocessorDefinitions, tool.PreprocessorDefinitions ); |
1738 | strm << SPair( _ResourceOutputFileName, tool.ResourceOutputFileName ); | 1734 | strm << SPair( _ResourceOutputFileName, tool.ResourceOutputFileName ); |
1739 | if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); | 1735 | if ( tool.ShowProgress != linkProgressNotSet ) strm << EPair( _ShowProgress, tool.ShowProgress ); |
1740 | strm << "/>"; | 1736 | strm << "/>"; |
1741 | return strm; | 1737 | return strm; |
1742 | } | 1738 | } |
1743 | 1739 | ||
1744 | // VCEventTool ------------------------------------------------- | 1740 | // VCEventTool ------------------------------------------------- |
1745 | QTextStream &operator<<( QTextStream &strm, const VCEventTool &tool ) | 1741 | QTextStream &operator<<( QTextStream &strm, const VCEventTool &tool ) |
1746 | { | 1742 | { |
1747 | strm << _begTool3; | 1743 | strm << _begTool3; |
1748 | strm << SPair( _ToolName, tool.ToolName ); | 1744 | strm << SPair( _ToolName, tool.ToolName ); |
1749 | strm << SPair( _ToolPath, tool.ToolPath ); | 1745 | strm << SPair( _ToolPath, tool.ToolPath ); |
1750 | strm << SPair( _CommandLine4, tool.CommandLine ); | 1746 | strm << SPair( _CommandLine4, tool.CommandLine ); |
1751 | strm << SPair( _Description4, tool.Description ); | 1747 | strm << SPair( _Description4, tool.Description ); |
1752 | strm << TPair( _ExcludedFromBuild, tool.ExcludedFromBuild ); | 1748 | strm << TPair( _ExcludedFromBuild, tool.ExcludedFromBuild ); |
1753 | strm << "/>"; | 1749 | strm << "/>"; |
1754 | return strm; | 1750 | return strm; |
1755 | } | 1751 | } |
1756 | 1752 | ||
1757 | // VCPostBuildEventTool --------------------------------------------- | 1753 | // VCPostBuildEventTool --------------------------------------------- |
1758 | VCPostBuildEventTool::VCPostBuildEventTool() | 1754 | VCPostBuildEventTool::VCPostBuildEventTool() |
1759 | { | 1755 | { |
1760 | ToolName = "VCPostBuildEventTool"; | 1756 | ToolName = "VCPostBuildEventTool"; |
1761 | } | 1757 | } |
1762 | 1758 | ||
1763 | // VCPreBuildEventTool ---------------------------------------------- | 1759 | // VCPreBuildEventTool ---------------------------------------------- |
1764 | VCPreBuildEventTool::VCPreBuildEventTool() | 1760 | VCPreBuildEventTool::VCPreBuildEventTool() |
1765 | { | 1761 | { |
1766 | ToolName = "VCPreBuildEventTool"; | 1762 | ToolName = "VCPreBuildEventTool"; |
1767 | } | 1763 | } |
1768 | 1764 | ||
1769 | // VCPreLinkEventTool ----------------------------------------------- | 1765 | // VCPreLinkEventTool ----------------------------------------------- |
1770 | VCPreLinkEventTool::VCPreLinkEventTool() | 1766 | VCPreLinkEventTool::VCPreLinkEventTool() |
1771 | { | 1767 | { |
1772 | ToolName = "VCPreLinkEventTool"; | 1768 | ToolName = "VCPreLinkEventTool"; |
1773 | } | 1769 | } |
1774 | 1770 | ||
1775 | // VCConfiguration -------------------------------------------------- | 1771 | // VCConfiguration -------------------------------------------------- |
1776 | 1772 | ||
1777 | VCConfiguration::VCConfiguration() | 1773 | VCConfiguration::VCConfiguration() |
1778 | :ATLMinimizesCRunTimeLibraryUsage( unset ), | 1774 | :ATLMinimizesCRunTimeLibraryUsage( unset ), |
1779 | BuildBrowserInformation( unset ), | 1775 | BuildBrowserInformation( unset ), |
1780 | CharacterSet( charSetNotSet ), | 1776 | CharacterSet( charSetNotSet ), |
1781 | ConfigurationType( typeApplication ), | 1777 | ConfigurationType( typeApplication ), |
1782 | RegisterOutput( unset ), | 1778 | RegisterOutput( unset ), |
1783 | UseOfATL( useATLNotSet ), | 1779 | UseOfATL( useATLNotSet ), |
1784 | UseOfMfc( useMfcStdWin ), | 1780 | UseOfMfc( useMfcStdWin ), |
1785 | WholeProgramOptimization( unset ) | 1781 | WholeProgramOptimization( unset ) |
1786 | { | 1782 | { |
1787 | compiler.config = this; | 1783 | compiler.config = this; |
1788 | linker.config = this; | 1784 | linker.config = this; |
1789 | idl.config = this; | 1785 | idl.config = this; |
1790 | } | 1786 | } |
1791 | 1787 | ||
1792 | QTextStream &operator<<( QTextStream &strm, const VCConfiguration &tool ) | 1788 | QTextStream &operator<<( QTextStream &strm, const VCConfiguration &tool ) |
1793 | { | 1789 | { |
1794 | strm << _begConfiguration; | 1790 | strm << _begConfiguration; |
1795 | strm << SPair( _Name3, tool.Name ); | 1791 | strm << SPair( _Name3, tool.Name ); |
1796 | strm << SPair( _OutputDirectory3, tool.OutputDirectory ); | 1792 | strm << SPair( _OutputDirectory3, tool.OutputDirectory ); |
1797 | strm << TPair( _ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage ); | 1793 | strm << TPair( _ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage ); |
1798 | strm << TPair( _BuildBrowserInformation, tool.BuildBrowserInformation ); | 1794 | strm << TPair( _BuildBrowserInformation, tool.BuildBrowserInformation ); |
1799 | if ( tool.CharacterSet != charSetNotSet)strm << EPair( _CharacterSet, tool.CharacterSet ); | 1795 | if ( tool.CharacterSet != charSetNotSet)strm << EPair( _CharacterSet, tool.CharacterSet ); |
1800 | strm << EPair( _ConfigurationType, tool.ConfigurationType ); | 1796 | strm << EPair( _ConfigurationType, tool.ConfigurationType ); |
1801 | strm << SPair( _DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean ); | 1797 | strm << SPair( _DeleteExtensionsOnClean, tool.DeleteExtensionsOnClean ); |
1802 | strm << SPair( _ImportLibrary, tool.ImportLibrary ); | 1798 | strm << SPair( _ImportLibrary, tool.ImportLibrary ); |
1803 | strm << SPair( _IntermediateDirectory, tool.IntermediateDirectory ); | 1799 | strm << SPair( _IntermediateDirectory, tool.IntermediateDirectory ); |
1804 | strm << SPair( _PrimaryOutput, tool.PrimaryOutput ); | 1800 | strm << SPair( _PrimaryOutput, tool.PrimaryOutput ); |
1805 | strm << SPair( _ProgramDatabase, tool.ProgramDatabase ); | 1801 | strm << SPair( _ProgramDatabase, tool.ProgramDatabase ); |
1806 | strm << TPair( _RegisterOutput, tool.RegisterOutput ); | 1802 | strm << TPair( _RegisterOutput, tool.RegisterOutput ); |
1807 | if ( tool.UseOfATL != useATLNotSet) strm << EPair( _UseOfATL, tool.UseOfATL ); | 1803 | if ( tool.UseOfATL != useATLNotSet) strm << EPair( _UseOfATL, tool.UseOfATL ); |
1808 | strm << EPair( _UseOfMfc, tool.UseOfMfc ); | 1804 | strm << EPair( _UseOfMfc, tool.UseOfMfc ); |
1809 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); | 1805 | strm << TPair( _WholeProgramOptimization, tool.WholeProgramOptimization ); |
1810 | strm << ">"; | 1806 | strm << ">"; |
1811 | strm << tool.compiler; | 1807 | strm << tool.compiler; |
1812 | strm << tool.custom; | 1808 | strm << tool.custom; |
1813 | if ( tool.ConfigurationType == typeStaticLibrary ) | 1809 | if ( tool.ConfigurationType == typeStaticLibrary ) |
1814 | strm << tool.librarian; | 1810 | strm << tool.librarian; |
1815 | else | 1811 | else |
1816 | strm << tool.linker; | 1812 | strm << tool.linker; |
1817 | strm << tool.idl; | 1813 | strm << tool.idl; |
1818 | strm << tool.postBuild; | 1814 | strm << tool.postBuild; |
1819 | strm << tool.preBuild; | 1815 | strm << tool.preBuild; |
1820 | strm << tool.preLink; | 1816 | strm << tool.preLink; |
1821 | strm << tool.resource; | 1817 | strm << tool.resource; |
1822 | strm << _endConfiguration; | 1818 | strm << _endConfiguration; |
1823 | return strm; | 1819 | return strm; |
1824 | } | 1820 | } |
1825 | // VCFilter --------------------------------------------------------- | 1821 | // VCFilter --------------------------------------------------------- |
1826 | VCFilter::VCFilter() | 1822 | VCFilter::VCFilter() |
1827 | : ParseFiles( unset ) | 1823 | : ParseFiles( unset ) |
1828 | { | 1824 | { |
1825 | useCustomBuildTool = FALSE; | ||
1826 | useCompilerTool = FALSE; | ||
1829 | } | 1827 | } |
1830 | 1828 | ||
1831 | void VCFilter::generateMOC( QTextStream &strm, QString str ) const | 1829 | void VCFilter::addMOCstage( QTextStream &strm, QString filename ) |
1832 | { | 1830 | { |
1833 | QString mocOutput = Project->findMocDestination( str ); | 1831 | QString mocOutput = Project->findMocDestination( filename ); |
1834 | QString mocApp = Project->var( "QMAKE_MOC" ); | 1832 | QString mocApp = Project->var( "QMAKE_MOC" ); |
1835 | 1833 | ||
1836 | if( mocOutput.isEmpty() ) { | 1834 | if( mocOutput.isEmpty() && filename.endsWith(".moc") ) { |
1837 | // In specialcases we DO moc .cpp files | 1835 | // In specialcases we DO moc .cpp files |
1838 | // when the result is an .moc file | 1836 | // when the result is an .moc file |
1839 | if ( !str.endsWith(".moc") ) | 1837 | mocOutput = filename; |
1840 | return; | 1838 | filename = Project->findMocSource( mocOutput ); |
1841 | mocOutput = str; | ||
1842 | str = Project->findMocSource( mocOutput ); | ||
1843 | } | 1839 | } |
1844 | 1840 | ||
1845 | strm << _begFileConfiguration; | 1841 | if (mocOutput.isEmpty()) |
1846 | strm << _Name5; | 1842 | return; |
1847 | strm << Config->Name; | 1843 | |
1848 | strm << "\">"; | 1844 | CustomBuildTool = VCCustomBuildTool(); |
1849 | strm << _begTool5; | 1845 | useCustomBuildTool = TRUE; |
1850 | strm << _VCCustomBuildTool; | 1846 | CustomBuildTool.Description = "Moc'ing " + filename + "..."; |
1851 | strm << _Description6; | 1847 | CustomBuildTool.CommandLine += (mocApp + " " |
1852 | strm << "Moc'ing " << str << "...\""; | 1848 | + filename + " -o " + mocOutput); |
1853 | strm << _CommandLine6; | 1849 | CustomBuildTool.AdditionalDependencies = mocApp; |
1854 | strm << mocApp; | 1850 | CustomBuildTool.Outputs += mocOutput; |
1855 | strm << " " << str << " -o " << mocOutput << "\""; | ||
1856 | strm << _AdditionalDependencies6; | ||
1857 | strm << mocApp << "\""; | ||
1858 | strm << _Outputs6; | ||
1859 | strm << mocOutput << "\""; | ||
1860 | strm << "/>"; | ||
1861 | strm << _endFileConfiguration; | ||
1862 | } | 1851 | } |
1863 | 1852 | ||
1864 | void VCFilter::generateUIC( QTextStream &strm, const QString& str ) const | 1853 | void VCFilter::addUICstage( QTextStream &strm, QString str ) |
1865 | { | 1854 | { |
1855 | CustomBuildTool = VCCustomBuildTool(); | ||
1856 | useCustomBuildTool = TRUE; | ||
1857 | |||
1866 | QString uicApp = Project->var("QMAKE_UIC"); | 1858 | QString uicApp = Project->var("QMAKE_UIC"); |
1867 | QString mocApp = Project->var( "QMAKE_MOC" ); | 1859 | QString mocApp = Project->var( "QMAKE_MOC" ); |
1868 | QString fname = str.section( '\\', -1 ); | 1860 | QString fname = str.section( '\\', -1 ); |
1869 | QString mocDir = Project->var( "MOC_DIR" ); | 1861 | QString mocDir = Project->var( "MOC_DIR" ); |
1870 | QString uiDir = Project->var( "UI_DIR" ); | 1862 | QString uiDir = Project->var( "UI_DIR" ); |
1871 | QString uiHeaders; | 1863 | QString uiHeaders; |
1872 | QString uiSources; | 1864 | QString uiSources; |
1873 | 1865 | ||
1874 | // Determining the paths for the output files. | 1866 | // Determining the paths for the output files. |
1875 | int slash = str.findRev( '\\' ); | 1867 | int slash = str.findRev( '\\' ); |
1876 | QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" ); | 1868 | QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" ); |
1877 | if( !uiDir.isEmpty() ) { | 1869 | if( !uiDir.isEmpty() ) { |
1878 | uiHeaders = uiDir; | 1870 | uiHeaders = uiDir; |
1879 | uiSources = uiDir; | 1871 | uiSources = uiDir; |
1880 | } else { | 1872 | } else { |
1881 | uiHeaders = Project->var( "UI_HEADERS_DIR" ); | 1873 | uiHeaders = Project->var( "UI_HEADERS_DIR" ); |
1882 | uiSources = Project->var( "UI_SOURCES_DIR" ); | 1874 | uiSources = Project->var( "UI_SOURCES_DIR" ); |
1883 | if( uiHeaders.isEmpty() ) | 1875 | if( uiHeaders.isEmpty() ) |
1884 | uiHeaders = pname; | 1876 | uiHeaders = pname; |
1885 | if( uiSources.isEmpty() ) | 1877 | if( uiSources.isEmpty() ) |
1886 | uiSources = pname; | 1878 | uiSources = pname; |
1887 | } | 1879 | } |
1888 | if( !uiHeaders.endsWith( "\\" ) ) | 1880 | if( !uiHeaders.endsWith( "\\" ) ) |
1889 | uiHeaders += "\\"; | 1881 | uiHeaders += "\\"; |
1890 | if( !uiSources.endsWith( "\\" ) ) | 1882 | if( !uiSources.endsWith( "\\" ) ) |
1891 | uiSources += "\\"; | 1883 | uiSources += "\\"; |
1892 | 1884 | ||
1893 | // Determine the file name. | 1885 | // Determine the file name. |
1894 | int dot = fname.findRev( '.' ); | 1886 | int dot = fname.findRev( '.' ); |
1895 | if( dot != -1 ) | 1887 | if( dot != -1 ) |
1896 | fname.truncate( dot ); | 1888 | fname.truncate( dot ); |
1897 | 1889 | ||
1898 | strm << _begFileConfiguration; | 1890 | if ( mocDir.isEmpty() ) |
1899 | strm << _Name5; | 1891 | mocDir = pname; |
1900 | strm << Config->Name; | 1892 | |
1901 | strm << "\">"; | 1893 | CustomBuildTool.Description = ("Uic'ing " + str + "...\""); |
1902 | strm << _begTool5; | 1894 | CustomBuildTool.CommandLine += // Create .h from .ui file |
1903 | strm << _VCCustomBuildTool; | 1895 | uicApp + " " + str + " -o " + uiHeaders + fname + ".h"; |
1904 | strm << _Description6; | 1896 | CustomBuildTool.CommandLine += // Create .cpp from .ui file |
1905 | strm << "Uic'ing " << str << "...\""; | 1897 | uicApp + " " + str + " -i " + fname + ".h -o " + uiSources + fname + ".cpp"; |
1906 | strm << _CommandLine6; | 1898 | CustomBuildTool.CommandLine += // Moc the headerfile |
1907 | strm << uicApp << " " << str << " -o " << uiHeaders << fname << ".h && "; // Create .h from .ui file | 1899 | mocApp + " " + uiHeaders + fname + ".h -o " + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext; |
1908 | strm << uicApp << " " << str << " -i " << fname << ".h -o " << uiSources << fname << ".cpp && ";// Create .cpp from .ui file | 1900 | |
1909 | strm << mocApp << " " << uiHeaders << fname << ".h -o " << mocDir << "moc_" << fname << ".cpp\""; | 1901 | CustomBuildTool.AdditionalDependencies += mocApp; |
1910 | strm << _AdditionalDependencies6; | 1902 | CustomBuildTool.AdditionalDependencies += uicApp; |
1911 | strm << mocApp << ";" << uicApp << "\""; | 1903 | CustomBuildTool.Outputs += |
1912 | strm << _Outputs6; | 1904 | uiHeaders + fname + ".h;" + uiSources + fname + ".cpp;" + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext; |
1913 | strm << uiHeaders << fname << ".h;" << uiSources << fname << ".cpp;" << mocDir << "moc_" << fname << ".cpp\""; | ||
1914 | strm << "/>"; | ||
1915 | strm << _endFileConfiguration; | ||
1916 | } | 1905 | } |
1917 | 1906 | ||
1918 | QTextStream &operator<<( QTextStream &strm, const VCFilter &tool ) | 1907 | void VCFilter::modifyPCHstage( QTextStream &strm, QString str ) |
1908 | { | ||
1909 | bool isCFile = str.endsWith(".c"); | ||
1910 | bool isHFile = (str.endsWith(".h") && str == Project->precompH); | ||
1911 | |||
1912 | if (!isCFile && !isHFile) | ||
1913 | return; | ||
1914 | |||
1915 | CompilerTool = VCCLCompilerTool(); | ||
1916 | useCompilerTool = TRUE; | ||
1917 | |||
1918 | // Unset some default options | ||
1919 | CompilerTool.BufferSecurityCheck = unset; | ||
1920 | CompilerTool.DebugInformationFormat = debugUnknown; | ||
1921 | CompilerTool.ExceptionHandling = unset; | ||
1922 | CompilerTool.GeneratePreprocessedFile = preprocessUnknown; | ||
1923 | CompilerTool.Optimization = optimizeDefault; | ||
1924 | CompilerTool.ProgramDataBaseFileName = QString::null; | ||
1925 | CompilerTool.RuntimeLibrary = rtUnknown; | ||
1926 | CompilerTool.WarningLevel = warningLevelUnknown; | ||
1927 | |||
1928 | // Setup PCH options | ||
1929 | CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); | ||
1930 | CompilerTool.PrecompiledHeaderThrough = "$(NOINHERIT)"; | ||
1931 | CompilerTool.ForcedIncludeFiles = "$(NOINHERIT)"; | ||
1932 | } | ||
1933 | |||
1934 | bool VCFilter::addIMGstage( QTextStream &strm, QString str ) | ||
1935 | { | ||
1936 | bool isCorH = FALSE; | ||
1937 | if (str.endsWith(".c") || str.endsWith(".rc")) | ||
1938 | isCorH = TRUE; | ||
1939 | QStringList::Iterator it; | ||
1940 | for(it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) | ||
1941 | if(str.endsWith(*it)) | ||
1942 | isCorH = TRUE; | ||
1943 | for(it = Option::h_ext.begin(); it != Option::h_ext.end(); ++it) | ||
1944 | if(str.endsWith(*it)) | ||
1945 | isCorH = TRUE; | ||
1946 | |||
1947 | QString collectionName = Project->project->first("QMAKE_IMAGE_COLLECTION"); | ||
1948 | if (str.isEmpty() || isCorH || collectionName.isEmpty()) | ||
1949 | return FALSE; | ||
1950 | |||
1951 | CustomBuildTool = VCCustomBuildTool(); | ||
1952 | useCustomBuildTool = TRUE; | ||
1953 | |||
1954 | // Some projects (like designer core) may have too many images to | ||
1955 | // call uic directly. Therefor we have to create a temporary | ||
1956 | // file, with the image list, and call uic with the -f option. | ||
1957 | QString tmpFileCmd = "echo "; | ||
1958 | QString tmpImageFilename = ".imgcol"; | ||
1959 | QStringList& list = Project->project->variables()["IMAGES"]; | ||
1960 | bool firstOutput = TRUE; | ||
1961 | it = list.begin(); | ||
1962 | while( it!=list.end() ) { | ||
1963 | tmpFileCmd += (*it) + " "; | ||
1964 | ++it; | ||
1965 | if (tmpFileCmd.length()>250 || it==list.end()) { | ||
1966 | CustomBuildTool.CommandLine += tmpFileCmd | ||
1967 | + (firstOutput?"> ":">> ") | ||
1968 | + tmpImageFilename; | ||
1969 | tmpFileCmd = "echo "; | ||
1970 | firstOutput = FALSE; | ||
1971 | } | ||
1972 | } | ||
1973 | |||
1974 | QString uicApp = Project->var("QMAKE_UIC"); | ||
1975 | CustomBuildTool.Description = ("Generate imagecollection"); | ||
1976 | CustomBuildTool.CommandLine += | ||
1977 | uicApp + " -embed " + Project->project->first("QMAKE_ORIG_TARGET") | ||
1978 | + " -f .imgcol -o " + collectionName; | ||
1979 | CustomBuildTool.AdditionalDependencies += uicApp; | ||
1980 | CustomBuildTool.AdditionalDependencies += list; | ||
1981 | CustomBuildTool.Outputs = collectionName; | ||
1982 | CustomBuildTool.Outputs += tmpImageFilename; | ||
1983 | return TRUE; | ||
1984 | } | ||
1985 | |||
1986 | QTextStream &operator<<( QTextStream &strm, VCFilter &tool ) | ||
1919 | { | 1987 | { |
1920 | if ( tool.Files.count() == 0 ) | 1988 | if ( tool.Files.count() == 0 ) |
1921 | return strm; | 1989 | return strm; |
1922 | 1990 | ||
1923 | strm << _begFilter; | 1991 | strm << _begFilter; |
1924 | strm << SPair( _Name3, tool.Name ); | 1992 | strm << SPair( _Name3, tool.Name ); |
1925 | strm << TPair( _ParseFiles, tool.ParseFiles ); | 1993 | strm << TPair( _ParseFiles, tool.ParseFiles ); |
1926 | strm << SPair( _Filter, tool.Filter ); | 1994 | strm << SPair( _Filter, tool.Filter ); |
1927 | strm << ">"; | 1995 | strm << ">"; |
1996 | |||
1997 | bool resourceBuild = FALSE; | ||
1998 | int currentLevels = 0; | ||
1999 | QStringList currentDirs; | ||
1928 | for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) { | 2000 | for ( QStringList::ConstIterator it = tool.Files.begin(); it != tool.Files.end(); ++it ) { |
2001 | if ( !tool.flat_files ) { | ||
2002 | QStringList newDirs = QStringList::split('\\',(*it)); | ||
2003 | newDirs.pop_back(); // Skip the filename | ||
2004 | |||
2005 | int newLevels = int(newDirs.count()); | ||
2006 | int equalLevels = 0; | ||
2007 | for (int i = 0; i<currentLevels; i++, equalLevels++ ) | ||
2008 | if (currentDirs[i] != newDirs[i]) | ||
2009 | break; | ||
2010 | int closeFilters = currentLevels - equalLevels; | ||
2011 | int openFilters = newLevels - equalLevels; | ||
2012 | |||
2013 | // close previous non-equal filter | ||
2014 | while ( closeFilters-- ) | ||
2015 | strm << _endFilter; | ||
2016 | |||
2017 | // open new non-equal filters | ||
2018 | newLevels = 0; | ||
2019 | while ( openFilters-- ) { | ||
2020 | strm << _begFilter; | ||
2021 | strm << SPair( _Name3, newDirs[equalLevels + newLevels] ); | ||
2022 | strm << _Filter << "\">"; // Blank filter | ||
2023 | ++newLevels; | ||
2024 | } | ||
2025 | currentDirs = newDirs; | ||
2026 | currentLevels = int(newDirs.count()); | ||
2027 | } | ||
2028 | |||
2029 | tool.useCustomBuildTool = FALSE; | ||
2030 | tool.useCompilerTool = FALSE; | ||
2031 | // Add UIC, MOC and PCH stages to file | ||
2032 | if ( tool.CustomBuild == moc ) | ||
2033 | tool.addMOCstage( strm, *it ); | ||
2034 | else if ( tool.CustomBuild == uic ) | ||
2035 | tool.addUICstage( strm, *it ); | ||
2036 | else if ( tool.CustomBuild == resource ) { | ||
2037 | if (!resourceBuild) | ||
2038 | resourceBuild = tool.addIMGstage(strm, *it); | ||
2039 | } | ||
2040 | if (tool.Project->usePCH) | ||
2041 | tool.modifyPCHstage( strm, *it ); | ||
2042 | |||
1929 | strm << _begFile; | 2043 | strm << _begFile; |
1930 | strm << SPair( _RelativePath, *it ); | 2044 | strm << SPair( _RelativePath, *it ); |
1931 | strm << ">"; | 2045 | strm << ">"; |
1932 | if ( tool.CustomBuild == moc ) | 2046 | // Output custom build and compiler options |
1933 | tool.generateMOC( strm, *it ); | 2047 | // for all configurations |
1934 | else if ( tool.CustomBuild == uic ) | 2048 | if (tool.useCustomBuildTool || tool.useCompilerTool) { |
1935 | tool.generateUIC( strm, *it ); | 2049 | for ( uint i = 0; i < tool.Config->count(); i++ ) { |
2050 | strm << _begFileConfiguration; | ||
2051 | strm << _Name5; | ||
2052 | strm << (*tool.Config)[i].Name; | ||
2053 | strm << "\">"; | ||
2054 | if (tool.useCustomBuildTool) | ||
2055 | strm << tool.CustomBuildTool; | ||
2056 | if (tool.useCompilerTool) | ||
2057 | strm << tool.CompilerTool; | ||
2058 | strm << _endFileConfiguration; | ||
2059 | } | ||
2060 | } | ||
1936 | strm << _endFile; | 2061 | strm << _endFile; |
1937 | } | 2062 | } |
1938 | 2063 | // close remaining open filters, in non-flat mode | |
2064 | while ( !tool.flat_files && currentLevels-- ) { | ||
2065 | strm << _endFilter; | ||
2066 | } | ||
1939 | strm << _endFilter; | 2067 | strm << _endFilter; |
1940 | return strm; | 2068 | return strm; |
1941 | } | 2069 | } |
1942 | 2070 | ||
1943 | // VCProject -------------------------------------------------------- | 2071 | // VCProject -------------------------------------------------------- |
1944 | VCProject::VCProject() | 2072 | VCProject::VCProject() |
1945 | { | 2073 | { |
1946 | #if defined(Q_WS_WIN32) | 2074 | VCConfiguration conf; |
1947 | GUID guid; | 2075 | Configuration += conf ; // Release |
1948 | QUuid uniqueId; | 2076 | //Configuration += conf ; // Debug added later, after Release init |
1949 | HRESULT h = CoCreateGuid( &guid ); | ||
1950 | if ( h == S_OK ) | ||
1951 | uniqueId = QUuid( guid ); | ||
1952 | ProjectGUID = uniqueId.toString(); | ||
1953 | #else | ||
1954 | // Qt doesn't support GUID on other platforms yet | ||
1955 | ProjectGUID = ""; | ||
1956 | #endif | ||
1957 | } | 2077 | } |
1958 | 2078 | ||
1959 | QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) | 2079 | QTextStream &operator<<( QTextStream &strm, const VCProject &tool ) |
1960 | { | 2080 | { |
1961 | strm << _xmlInit; | 2081 | strm << _xmlInit; |
1962 | strm << _begVisualStudioProject; | 2082 | strm << _begVisualStudioProject; |
1963 | strm << _ProjectType; | 2083 | strm << _ProjectType; |
1964 | strm << SPair( _Version1, tool.Version ); | 2084 | strm << SPair( _Version1, tool.Version ); |
1965 | strm << SPair( _Name1, tool.Name ); | 2085 | strm << SPair( _Name1, tool.Name ); |
1966 | strm << SPair( _ProjectGUID, tool.ProjectGUID ); | 2086 | strm << SPair( _ProjectGUID, tool.ProjectGUID ); |
1967 | strm << SPair( _SccProjectName, tool.SccProjectName ); | 2087 | strm << SPair( _SccProjectName, tool.SccProjectName ); |
1968 | strm << SPair( _SccLocalPath, tool.SccLocalPath ); | 2088 | strm << SPair( _SccLocalPath, tool.SccLocalPath ); |
1969 | strm << ">"; | 2089 | strm << ">"; |
1970 | strm << _begPlatforms; | 2090 | strm << _begPlatforms; |
1971 | strm << _begPlatform; | 2091 | strm << _begPlatform; |
1972 | strm << SPair( _Name3, tool.PlatformName ); | 2092 | strm << SPair( _Name3, tool.PlatformName ); |
1973 | strm << "/>"; | 2093 | strm << "/>"; |
1974 | strm << _endPlatforms; | 2094 | strm << _endPlatforms; |
1975 | strm << _begConfigurations; | 2095 | strm << _begConfigurations; |
1976 | strm << tool.Configuration; | 2096 | for ( uint i = 0; i < tool.Configuration.count(); i++ ) |
2097 | strm << tool.Configuration[i]; | ||
1977 | strm << _endConfigurations; | 2098 | strm << _endConfigurations; |
1978 | strm << _begFiles; | 2099 | strm << _begFiles; |
1979 | strm << tool.SourceFiles; | 2100 | strm << (VCFilter&)tool.SourceFiles; |
1980 | strm << tool.HeaderFiles; | 2101 | strm << (VCFilter&)tool.HeaderFiles; |
1981 | strm << tool.MOCFiles; | 2102 | strm << (VCFilter&)tool.MOCFiles; |
1982 | strm << tool.UICFiles; | 2103 | strm << (VCFilter&)tool.UICFiles; |
1983 | strm << tool.FormFiles; | 2104 | strm << (VCFilter&)tool.FormFiles; |
1984 | strm << tool.TranslationFiles; | 2105 | strm << (VCFilter&)tool.TranslationFiles; |
1985 | strm << tool.LexYaccFiles; | 2106 | strm << (VCFilter&)tool.LexYaccFiles; |
1986 | strm << tool.ResourceFiles; | 2107 | strm << (VCFilter&)tool.ResourceFiles; |
1987 | strm << _endFiles; | 2108 | strm << _endFiles; |
1988 | strm << _begGlobals; | 2109 | strm << _begGlobals; |
1989 | strm << _endGlobals; | 2110 | strm << _endGlobals; |
1990 | strm << _endVisualStudioProject; | 2111 | strm << _endVisualStudioProject; |
1991 | return strm; | 2112 | return strm; |
1992 | } | 2113 | } |
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 1dca68d..9ce38d2 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h | |||
@@ -1,477 +1,485 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of VCProject class. |
5 | ** | 5 | ** |
6 | ** Copyright (C) 2002 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 2002-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
9 | ** | 9 | ** |
10 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
11 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
12 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
15 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
16 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
17 | ** packaging of this file. | 17 | ** packaging of this file. |
18 | ** | 18 | ** |
19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
20 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
21 | ** with the Software. | 21 | ** with the Software. |
22 | ** | 22 | ** |
23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
25 | ** | 25 | ** |
26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
27 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
30 | ** | 30 | ** |
31 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
32 | ** not clear to you. | 32 | ** not clear to you. |
33 | ** | 33 | ** |
34 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
35 | #ifndef __MSVC_OBJECTMODEL_H__ | 36 | #ifndef __MSVC_OBJECTMODEL_H__ |
36 | #define __MSVC_OBJECTMODEL_H__ | 37 | #define __MSVC_OBJECTMODEL_H__ |
37 | 38 | ||
38 | #include "project.h" | 39 | #include "project.h" |
39 | #include <qstring.h> | 40 | #include <qstring.h> |
40 | #include <qstringlist.h> | 41 | #include <qstringlist.h> |
41 | 42 | ||
42 | /* | 43 | /* |
43 | This Object model is of course VERY simplyfied, | 44 | This Object model is of course VERY simplyfied, |
44 | and does not actually follow the original MSVC | 45 | and does not actually follow the original MSVC |
45 | object model. However, it fulfilles the basic | 46 | object model. However, it fulfilles the basic |
46 | needs for qmake | 47 | needs for qmake |
47 | */ | 48 | */ |
48 | 49 | ||
49 | /* | 50 | /* |
50 | If a triState value is 'unset' then the | 51 | If a triState value is 'unset' then the |
51 | corresponding property is not in the output, | 52 | corresponding property is not in the output, |
52 | forcing the tool to utilize default values. | 53 | forcing the tool to utilize default values. |
53 | False/True values will be in the output... | 54 | False/True values will be in the output... |
54 | */ | 55 | */ |
55 | enum customBuildCheck { | 56 | enum customBuildCheck { |
56 | none, | 57 | none, |
57 | moc, | 58 | moc, |
58 | uic, | 59 | uic, |
59 | lexyacc | 60 | lexyacc, |
61 | resource | ||
60 | }; | 62 | }; |
61 | enum triState { | 63 | enum triState { |
62 | unset = -1, | 64 | unset = -1, |
63 | _False = 0, | 65 | _False = 0, |
64 | _True = 1 | 66 | _True = 1 |
65 | }; | 67 | }; |
66 | enum addressAwarenessType { | 68 | enum addressAwarenessType { |
67 | addrAwareDefault, | 69 | addrAwareDefault, |
68 | addrAwareNoLarge, | 70 | addrAwareNoLarge, |
69 | addrAwareLarge | 71 | addrAwareLarge |
70 | }; | 72 | }; |
71 | enum asmListingOption { | 73 | enum asmListingOption { |
72 | asmListingNone, | 74 | asmListingNone, |
73 | asmListingAssemblyOnly, | 75 | asmListingAssemblyOnly, |
74 | asmListingAsmMachineSrc, | 76 | asmListingAsmMachineSrc, |
75 | asmListingAsmMachine, | 77 | asmListingAsmMachine, |
76 | asmListingAsmSrc | 78 | asmListingAsmSrc |
77 | }; | 79 | }; |
78 | enum basicRuntimeCheckOption { | 80 | enum basicRuntimeCheckOption { |
79 | runtimeBasicCheckNone, | 81 | runtimeBasicCheckNone, |
80 | runtimeCheckStackFrame, | 82 | runtimeCheckStackFrame, |
81 | runtimeCheckUninitVariables, | 83 | runtimeCheckUninitVariables, |
82 | runtimeBasicCheckAll | 84 | runtimeBasicCheckAll |
83 | }; | 85 | }; |
84 | enum browseInfoOption { | 86 | enum browseInfoOption { |
85 | brInfoNone, | 87 | brInfoNone, |
86 | brAllInfo, | 88 | brAllInfo, |
87 | brNoLocalSymbols | 89 | brNoLocalSymbols |
88 | }; | 90 | }; |
89 | enum callingConventionOption { | 91 | enum callingConventionOption { |
90 | callConventionDefault = -1, | 92 | callConventionDefault = -1, |
91 | callConventionCDecl, | 93 | callConventionCDecl, |
92 | callConventionFastCall, | 94 | callConventionFastCall, |
93 | callConventionStdCall | 95 | callConventionStdCall |
94 | }; | 96 | }; |
95 | enum charSet { | 97 | enum charSet { |
96 | charSetNotSet, | 98 | charSetNotSet, |
97 | charSetUnicode, | 99 | charSetUnicode, |
98 | charSetMBCS | 100 | charSetMBCS |
99 | }; | 101 | }; |
100 | enum compileAsManagedOptions { | 102 | enum compileAsManagedOptions { |
101 | managedDefault = -1, | 103 | managedDefault = -1, |
102 | managedAssembly = 2 | 104 | managedAssembly = 2 |
103 | }; | 105 | }; |
104 | enum CompileAsOptions{ | 106 | enum CompileAsOptions{ |
105 | compileAsDefault, | 107 | compileAsDefault, |
106 | compileAsC, | 108 | compileAsC, |
107 | compileAsCPlusPlus | 109 | compileAsCPlusPlus |
108 | }; | 110 | }; |
109 | enum ConfigurationTypes { | 111 | enum ConfigurationTypes { |
110 | typeUnknown = 0, | 112 | typeUnknown = 0, |
111 | typeApplication = 1, | 113 | typeApplication = 1, |
112 | typeDynamicLibrary = 2, | 114 | typeDynamicLibrary = 2, |
113 | typeStaticLibrary = 4, | 115 | typeStaticLibrary = 4, |
114 | typeGeneric = 10 | 116 | typeGeneric = 10 |
115 | }; | 117 | }; |
116 | enum debugOption { | 118 | enum debugOption { |
119 | debugUnknown = -1, | ||
117 | debugDisabled, | 120 | debugDisabled, |
118 | debugOldStyleInfo, | 121 | debugOldStyleInfo, |
119 | debugLineInfoOnly, | 122 | debugLineInfoOnly, |
120 | debugEnabled, | 123 | debugEnabled, |
121 | debugEditAndContinue | 124 | debugEditAndContinue |
122 | }; | 125 | }; |
123 | enum eAppProtectionOption { | 126 | enum eAppProtectionOption { |
124 | eAppProtectUnchanged, | 127 | eAppProtectUnchanged, |
125 | eAppProtectLow, | 128 | eAppProtectLow, |
126 | eAppProtectMedium, | 129 | eAppProtectMedium, |
127 | eAppProtectHigh | 130 | eAppProtectHigh |
128 | }; | 131 | }; |
129 | enum enumResourceLangID { | 132 | enum enumResourceLangID { |
130 | rcUseDefault = 0, | 133 | rcUseDefault = 0, |
131 | rcAfrikaans = 1078, | 134 | rcAfrikaans = 1078, |
132 | rcAlbanian = 1052, | 135 | rcAlbanian = 1052, |
133 | rcArabicAlgeria = 5121, | 136 | rcArabicAlgeria = 5121, |
134 | rcArabicBahrain = 15361, | 137 | rcArabicBahrain = 15361, |
135 | rcArabicEgypt = 3073, | 138 | rcArabicEgypt = 3073, |
136 | rcArabicIraq = 2049, | 139 | rcArabicIraq = 2049, |
137 | rcArabicJordan = 11265, | 140 | rcArabicJordan = 11265, |
138 | rcArabicKuwait = 13313, | 141 | rcArabicKuwait = 13313, |
139 | rcArabicLebanon = 12289, | 142 | rcArabicLebanon = 12289, |
140 | rcArabicLibya = 4097, | 143 | rcArabicLibya = 4097, |
141 | rcArabicMorocco = 6145, | 144 | rcArabicMorocco = 6145, |
142 | rcArabicOman = 8193, | 145 | rcArabicOman = 8193, |
143 | rcArabicQatar = 16385, | 146 | rcArabicQatar = 16385, |
144 | rcArabicSaudi = 1025, | 147 | rcArabicSaudi = 1025, |
145 | rcArabicSyria = 10241, | 148 | rcArabicSyria = 10241, |
146 | rcArabicTunisia = 7169, | 149 | rcArabicTunisia = 7169, |
147 | rcArabicUnitedArabEmirates= 14337, | 150 | rcArabicUnitedArabEmirates= 14337, |
148 | rcArabicYemen = 9217, | 151 | rcArabicYemen = 9217, |
149 | rcBasque = 1069, | 152 | rcBasque = 1069, |
150 | rcBulgarian = 1026, | 153 | rcBulgarian = 1026, |
151 | rcByelorussian = 1059, | 154 | rcByelorussian = 1059, |
152 | rcCatalan = 1027, | 155 | rcCatalan = 1027, |
153 | rcChineseHongKong = 3076, | 156 | rcChineseHongKong = 3076, |
154 | rcChinesePRC = 2052, | 157 | rcChinesePRC = 2052, |
155 | rcChineseSingapore = 4100, | 158 | rcChineseSingapore = 4100, |
156 | rcChineseTaiwan = 1028, | 159 | rcChineseTaiwan = 1028, |
157 | rcCroatian = 1050, | 160 | rcCroatian = 1050, |
158 | rcCzech = 1029, | 161 | rcCzech = 1029, |
159 | rcDanish = 1030, | 162 | rcDanish = 1030, |
160 | rcDutchBelgium = 2067, | 163 | rcDutchBelgium = 2067, |
161 | rcDutchStandard = 1043, | 164 | rcDutchStandard = 1043, |
162 | rcEnglishAustralia = 3081, | 165 | rcEnglishAustralia = 3081, |
163 | rcEnglishBritain = 2057, | 166 | rcEnglishBritain = 2057, |
164 | rcEnglishCanada = 4105, | 167 | rcEnglishCanada = 4105, |
165 | RcEnglishCaribbean = 9225, | 168 | RcEnglishCaribbean = 9225, |
166 | rcEnglishIreland = 6153, | 169 | rcEnglishIreland = 6153, |
167 | rcEnglishJamaica = 8201, | 170 | rcEnglishJamaica = 8201, |
168 | rcEnglishNewZealand = 5129, | 171 | rcEnglishNewZealand = 5129, |
169 | rcEnglishSouthAfrica= 7177, | 172 | rcEnglishSouthAfrica= 7177, |
170 | rcEnglishUS = 1033, | 173 | rcEnglishUS = 1033, |
171 | rcEstonian = 1061, | 174 | rcEstonian = 1061, |
172 | rcFarsi = 1065, | 175 | rcFarsi = 1065, |
173 | rcFinnish = 1035, | 176 | rcFinnish = 1035, |
174 | rcFrenchBelgium = 2060, | 177 | rcFrenchBelgium = 2060, |
175 | rcFrenchCanada = 3084, | 178 | rcFrenchCanada = 3084, |
176 | rcFrenchLuxembourg = 5132, | 179 | rcFrenchLuxembourg = 5132, |
177 | rcFrenchStandard = 1036, | 180 | rcFrenchStandard = 1036, |
178 | rcFrenchSwitzerland = 4108, | 181 | rcFrenchSwitzerland = 4108, |
179 | rcGermanAustria = 3079, | 182 | rcGermanAustria = 3079, |
180 | rcGermanLichtenstein= 5127, | 183 | rcGermanLichtenstein= 5127, |
181 | rcGermanLuxembourg = 4103, | 184 | rcGermanLuxembourg = 4103, |
182 | rcGermanStandard = 1031, | 185 | rcGermanStandard = 1031, |
183 | rcGermanSwitzerland = 2055, | 186 | rcGermanSwitzerland = 2055, |
184 | rcGreek = 1032, | 187 | rcGreek = 1032, |
185 | rcHebrew = 1037, | 188 | rcHebrew = 1037, |
186 | rcHungarian = 1038, | 189 | rcHungarian = 1038, |
187 | rcIcelandic = 1039, | 190 | rcIcelandic = 1039, |
188 | rcIndonesian = 1057, | 191 | rcIndonesian = 1057, |
189 | rcItalianStandard = 1040, | 192 | rcItalianStandard = 1040, |
190 | rcItalianSwitzerland= 2064, | 193 | rcItalianSwitzerland= 2064, |
191 | rcJapanese = 1041, | 194 | rcJapanese = 1041, |
192 | rcKorean = 1042, | 195 | rcKorean = 1042, |
193 | rcKoreanJohab = 2066, | 196 | rcKoreanJohab = 2066, |
194 | rcLatvian = 1062, | 197 | rcLatvian = 1062, |
195 | rcLithuanian = 1063, | 198 | rcLithuanian = 1063, |
196 | rcNorwegianBokmal = 1044, | 199 | rcNorwegianBokmal = 1044, |
197 | rcNorwegianNynorsk = 2068, | 200 | rcNorwegianNynorsk = 2068, |
198 | rcPolish = 1045, | 201 | rcPolish = 1045, |
199 | rcPortugueseBrazilian= 1046, | 202 | rcPortugueseBrazilian= 1046, |
200 | rcPortugueseStandard= 2070, | 203 | rcPortugueseStandard= 2070, |
201 | rcRomanian = 1048, | 204 | rcRomanian = 1048, |
202 | rcRussian = 1049, | 205 | rcRussian = 1049, |
203 | rcSerbian = 2074, | 206 | rcSerbian = 2074, |
204 | rcSlovak = 1051, | 207 | rcSlovak = 1051, |
205 | rcSpanishArgentina = 11274, | 208 | rcSpanishArgentina = 11274, |
206 | rcSpanishBolivia = 16394, | 209 | rcSpanishBolivia = 16394, |
207 | rcSpanishChile = 13322, | 210 | rcSpanishChile = 13322, |
208 | rcSpanishColombia = 9226, | 211 | rcSpanishColombia = 9226, |
209 | rcSpanishCostaRica = 5130, | 212 | rcSpanishCostaRica = 5130, |
210 | rcSpanishDominicanRepublic= 7178, | 213 | rcSpanishDominicanRepublic= 7178, |
211 | rcSpanishEcuador = 12298, | 214 | rcSpanishEcuador = 12298, |
212 | rcSpanishGuatemala = 4106, | 215 | rcSpanishGuatemala = 4106, |
213 | rcSpanishMexico = 2058, | 216 | rcSpanishMexico = 2058, |
214 | rcSpanishModern = 3082, | 217 | rcSpanishModern = 3082, |
215 | rcSpanishPanama = 6154, | 218 | rcSpanishPanama = 6154, |
216 | rcSpanishParaguay = 15370, | 219 | rcSpanishParaguay = 15370, |
217 | rcSpanishPeru = 10250, | 220 | rcSpanishPeru = 10250, |
218 | rcSpanishTraditional= 1034, | 221 | rcSpanishTraditional= 1034, |
219 | rcSpanishUruguay = 14346, | 222 | rcSpanishUruguay = 14346, |
220 | rcSpanishVenezuela = 8202, | 223 | rcSpanishVenezuela = 8202, |
221 | rcSwedish = 1053, | 224 | rcSwedish = 1053, |
222 | rcThai = 1054, | 225 | rcThai = 1054, |
223 | rcTurkish = 1055, | 226 | rcTurkish = 1055, |
224 | rcUkrainian = 1058, | 227 | rcUkrainian = 1058, |
225 | rcUrdu = 1056 | 228 | rcUrdu = 1056 |
226 | }; | 229 | }; |
227 | enum enumSccEvent { | 230 | enum enumSccEvent { |
228 | eProjectInScc, | 231 | eProjectInScc, |
229 | ePreDirtyNotification | 232 | ePreDirtyNotification |
230 | }; | 233 | }; |
231 | enum favorSizeOrSpeedOption { | 234 | enum favorSizeOrSpeedOption { |
232 | favorNone, | 235 | favorNone, |
233 | favorSpeed, | 236 | favorSpeed, |
234 | favorSize | 237 | favorSize |
235 | }; | 238 | }; |
236 | enum genProxyLanguage { | 239 | enum genProxyLanguage { |
237 | genProxyNative, | 240 | genProxyNative, |
238 | genProxyManaged | 241 | genProxyManaged |
239 | }; | 242 | }; |
240 | enum inlineExpansionOption { | 243 | enum inlineExpansionOption { |
241 | expandDisable, | 244 | expandDisable, |
242 | expandOnlyInline, | 245 | expandOnlyInline, |
243 | expandAnySuitable | 246 | expandAnySuitable, |
247 | expandDefault // Not useful number, but stops the output | ||
244 | }; | 248 | }; |
245 | enum linkIncrementalType { | 249 | enum linkIncrementalType { |
246 | linkIncrementalDefault, | 250 | linkIncrementalDefault, |
247 | linkIncrementalNo, | 251 | linkIncrementalNo, |
248 | linkIncrementalYes | 252 | linkIncrementalYes |
249 | }; | 253 | }; |
250 | enum linkProgressOption { | 254 | enum linkProgressOption { |
251 | linkProgressNotSet, | 255 | linkProgressNotSet, |
252 | linkProgressAll, | 256 | linkProgressAll, |
253 | linkProgressLibs | 257 | linkProgressLibs |
254 | }; | 258 | }; |
255 | enum machineTypeOption { | 259 | enum machineTypeOption { |
256 | machineNotSet, | 260 | machineNotSet, |
257 | machineX86 | 261 | machineX86 |
258 | }; | 262 | }; |
259 | enum midlCharOption { | 263 | enum midlCharOption { |
260 | midlCharUnsigned, | 264 | midlCharUnsigned, |
261 | midlCharSigned, | 265 | midlCharSigned, |
262 | midlCharAscii7 | 266 | midlCharAscii7 |
263 | }; | 267 | }; |
264 | enum midlErrorCheckOption { | 268 | enum midlErrorCheckOption { |
265 | midlEnableCustom, | 269 | midlEnableCustom, |
266 | midlDisableAll, | 270 | midlDisableAll, |
267 | midlEnableAll | 271 | midlEnableAll |
268 | }; | 272 | }; |
269 | enum midlStructMemberAlignOption { | 273 | enum midlStructMemberAlignOption { |
270 | midlAlignNotSet, | 274 | midlAlignNotSet, |
271 | midlAlignSingleByte, | 275 | midlAlignSingleByte, |
272 | midlAlignTwoBytes, | 276 | midlAlignTwoBytes, |
273 | midlAlignFourBytes, | 277 | midlAlignFourBytes, |
274 | midlAlignEightBytes, | 278 | midlAlignEightBytes, |
275 | midlAlignSixteenBytes | 279 | midlAlignSixteenBytes |
276 | }; | 280 | }; |
277 | enum midlTargetEnvironment { | 281 | enum midlTargetEnvironment { |
278 | midlTargetNotSet, | 282 | midlTargetNotSet, |
279 | midlTargetWin32, | 283 | midlTargetWin32, |
280 | midlTargetWin64 | 284 | midlTargetWin64 |
281 | }; | 285 | }; |
282 | enum midlWarningLevelOption { | 286 | enum midlWarningLevelOption { |
283 | midlWarningLevel_0, | 287 | midlWarningLevel_0, |
284 | midlWarningLevel_1, | 288 | midlWarningLevel_1, |
285 | midlWarningLevel_2, | 289 | midlWarningLevel_2, |
286 | midlWarningLevel_3, | 290 | midlWarningLevel_3, |
287 | midlWarningLevel_4 | 291 | midlWarningLevel_4 |
288 | }; | 292 | }; |
289 | enum optFoldingType { | 293 | enum optFoldingType { |
290 | optFoldingDefault, | 294 | optFoldingDefault, |
291 | optNoFolding, | 295 | optNoFolding, |
292 | optFolding | 296 | optFolding |
293 | }; | 297 | }; |
294 | enum optimizeOption { | 298 | enum optimizeOption { |
295 | optimizeDisabled, | 299 | optimizeDisabled, |
296 | optimizeMinSpace, | 300 | optimizeMinSpace, |
297 | optimizeMaxSpeed, | 301 | optimizeMaxSpeed, |
298 | optimizeFull, | 302 | optimizeFull, |
299 | optimizeCustom | 303 | optimizeCustom, |
304 | optimizeDefault // Not useful number, but stops the output | ||
300 | }; | 305 | }; |
301 | enum optRefType { | 306 | enum optRefType { |
302 | optReferencesDefault, | 307 | optReferencesDefault, |
303 | optNoReferences, | 308 | optNoReferences, |
304 | optReferences | 309 | optReferences |
305 | }; | 310 | }; |
306 | enum optWin98Type { | 311 | enum optWin98Type { |
307 | optWin98Default, | 312 | optWin98Default, |
308 | optWin98No, | 313 | optWin98No, |
309 | optWin98Yes | 314 | optWin98Yes |
310 | }; | 315 | }; |
311 | enum pchOption { | 316 | enum pchOption { |
312 | pchNone, | 317 | pchNone, |
313 | pchCreateUsingSpecific, | 318 | pchCreateUsingSpecific, |
314 | pchGenerateAuto, | 319 | pchGenerateAuto, |
315 | pchUseUsingSpecific | 320 | pchUseUsingSpecific |
316 | }; | 321 | }; |
317 | enum preprocessOption { | 322 | enum preprocessOption { |
323 | preprocessUnknown = -1, | ||
318 | preprocessNo, | 324 | preprocessNo, |
319 | preprocessYes, | 325 | preprocessYes, |
320 | preprocessNoLineNumbers | 326 | preprocessNoLineNumbers |
321 | }; | 327 | }; |
322 | enum ProcessorOptimizeOption { | 328 | enum ProcessorOptimizeOption { |
323 | procOptimizeBlended, | 329 | procOptimizeBlended, |
324 | procOptimizePentium, | 330 | procOptimizePentium, |
325 | procOptimizePentiumProAndAbove | 331 | procOptimizePentiumProAndAbove |
326 | }; | 332 | }; |
327 | enum RemoteDebuggerType { | 333 | enum RemoteDebuggerType { |
328 | DbgLocal, | 334 | DbgLocal, |
329 | DbgRemote, | 335 | DbgRemote, |
330 | DbgRemoteTCPIP | 336 | DbgRemoteTCPIP |
331 | }; | 337 | }; |
332 | enum runtimeLibraryOption { | 338 | enum runtimeLibraryOption { |
339 | rtUnknown = -1, | ||
333 | rtMultiThreaded, | 340 | rtMultiThreaded, |
334 | rtMultiThreadedDebug, | 341 | rtMultiThreadedDebug, |
335 | rtMultiThreadedDLL, | 342 | rtMultiThreadedDLL, |
336 | rtMultiThreadedDebugDLL, | 343 | rtMultiThreadedDebugDLL, |
337 | rtSingleThreaded, | 344 | rtSingleThreaded, |
338 | rtSingleThreadedDebug | 345 | rtSingleThreadedDebug |
339 | }; | 346 | }; |
340 | enum structMemberAlignOption { | 347 | enum structMemberAlignOption { |
341 | alignNotSet, | 348 | alignNotSet, |
342 | alignSingleByte, | 349 | alignSingleByte, |
343 | alignTwoBytes, | 350 | alignTwoBytes, |
344 | alignFourBytes, | 351 | alignFourBytes, |
345 | alignEightBytes, | 352 | alignEightBytes, |
346 | alignSixteenBytes | 353 | alignSixteenBytes |
347 | }; | 354 | }; |
348 | enum subSystemOption { | 355 | enum subSystemOption { |
349 | subSystemNotSet, | 356 | subSystemNotSet, |
350 | subSystemConsole, | 357 | subSystemConsole, |
351 | subSystemWindows | 358 | subSystemWindows |
352 | }; | 359 | }; |
353 | enum termSvrAwarenessType { | 360 | enum termSvrAwarenessType { |
354 | termSvrAwareDefault, | 361 | termSvrAwareDefault, |
355 | termSvrAwareNo, | 362 | termSvrAwareNo, |
356 | termSvrAwareYes | 363 | termSvrAwareYes |
357 | }; | 364 | }; |
358 | enum toolSetType { | 365 | enum toolSetType { |
359 | toolSetUtility, | 366 | toolSetUtility, |
360 | toolSetMakefile, | 367 | toolSetMakefile, |
361 | toolSetLinker, | 368 | toolSetLinker, |
362 | toolSetLibrarian, | 369 | toolSetLibrarian, |
363 | toolSetAll | 370 | toolSetAll |
364 | }; | 371 | }; |
365 | enum TypeOfDebugger { | 372 | enum TypeOfDebugger { |
366 | DbgNativeOnly, | 373 | DbgNativeOnly, |
367 | DbgManagedOnly, | 374 | DbgManagedOnly, |
368 | DbgMixed, | 375 | DbgMixed, |
369 | DbgAuto | 376 | DbgAuto |
370 | }; | 377 | }; |
371 | enum useOfATL { | 378 | enum useOfATL { |
372 | useATLNotSet, | 379 | useATLNotSet, |
373 | useATLStatic, | 380 | useATLStatic, |
374 | useATLDynamic | 381 | useATLDynamic |
375 | }; | 382 | }; |
376 | enum useOfMfc { | 383 | enum useOfMfc { |
377 | useMfcStdWin, | 384 | useMfcStdWin, |
378 | useMfcStatic, | 385 | useMfcStatic, |
379 | useMfcDynamic | 386 | useMfcDynamic |
380 | }; | 387 | }; |
381 | enum warningLevelOption { | 388 | enum warningLevelOption { |
389 | warningLevelUnknown = -1, | ||
382 | warningLevel_0, | 390 | warningLevel_0, |
383 | warningLevel_1, | 391 | warningLevel_1, |
384 | warningLevel_2, | 392 | warningLevel_2, |
385 | warningLevel_3, | 393 | warningLevel_3, |
386 | warningLevel_4 | 394 | warningLevel_4 |
387 | }; | 395 | }; |
388 | 396 | ||
389 | class VCToolBase { | 397 | class VCToolBase { |
390 | protected: | 398 | protected: |
391 | // Functions | 399 | // Functions |
392 | VCToolBase(){}; | 400 | VCToolBase(){}; |
393 | virtual ~VCToolBase(){} | 401 | virtual ~VCToolBase(){} |
394 | virtual bool parseOption( const char* option ) = 0; | 402 | virtual bool parseOption( const char* option ) = 0; |
395 | public: | 403 | public: |
396 | void parseOptions( QStringList& options ) { | 404 | void parseOptions( QStringList& options ) { |
397 | for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++ ) | 405 | for ( QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++ ) |
398 | parseOption( (*it).latin1() ); | 406 | parseOption( (*it).latin1() ); |
399 | } | 407 | } |
400 | }; | 408 | }; |
401 | 409 | ||
402 | class VCConfiguration; | 410 | class VCConfiguration; |
403 | class VCProject; | 411 | class VCProject; |
404 | 412 | ||
405 | class VCCLCompilerTool : public VCToolBase | 413 | class VCCLCompilerTool : public VCToolBase |
406 | { | 414 | { |
407 | public: | 415 | public: |
408 | // Functions | 416 | // Functions |
409 | VCCLCompilerTool(); | 417 | VCCLCompilerTool(); |
410 | virtual ~VCCLCompilerTool(){} | 418 | virtual ~VCCLCompilerTool(){} |
411 | bool parseOption( const char* option ); | 419 | bool parseOption( const char* option ); |
412 | 420 | ||
413 | // Variables | 421 | // Variables |
414 | QStringList AdditionalIncludeDirectories; | 422 | QStringList AdditionalIncludeDirectories; |
415 | QStringList AdditionalOptions; | 423 | QStringList AdditionalOptions; |
416 | QStringList AdditionalUsingDirectories; | 424 | QStringList AdditionalUsingDirectories; |
417 | QString AssemblerListingLocation; | 425 | QString AssemblerListingLocation; |
418 | asmListingOption AssemblerOutput; | 426 | asmListingOption AssemblerOutput; |
419 | basicRuntimeCheckOption BasicRuntimeChecks; | 427 | basicRuntimeCheckOption BasicRuntimeChecks; |
420 | browseInfoOption BrowseInformation; | 428 | browseInfoOption BrowseInformation; |
421 | QString BrowseInformationFile; | 429 | QString BrowseInformationFile; |
422 | triState BufferSecurityCheck; | 430 | triState BufferSecurityCheck; |
423 | callingConventionOption CallingConvention; | 431 | callingConventionOption CallingConvention; |
424 | CompileAsOptions CompileAs; | 432 | CompileAsOptions CompileAs; |
425 | compileAsManagedOptions CompileAsManaged; | 433 | compileAsManagedOptions CompileAsManaged; |
426 | triState CompileOnly; | 434 | triState CompileOnly; |
427 | debugOption DebugInformationFormat; | 435 | debugOption DebugInformationFormat; |
428 | triState DefaultCharIsUnsigned; | 436 | triState DefaultCharIsUnsigned; |
429 | triState Detect64BitPortabilityProblems; | 437 | triState Detect64BitPortabilityProblems; |
430 | triState DisableLanguageExtensions; | 438 | triState DisableLanguageExtensions; |
431 | QStringList DisableSpecificWarnings; | 439 | QStringList DisableSpecificWarnings; |
432 | triState EnableFiberSafeOptimizations; | 440 | triState EnableFiberSafeOptimizations; |
433 | triState EnableFunctionLevelLinking; | 441 | triState EnableFunctionLevelLinking; |
434 | triState EnableIntrinsicFunctions; | 442 | triState EnableIntrinsicFunctions; |
435 | triState ExceptionHandling; | 443 | triState ExceptionHandling; |
436 | triState ExpandAttributedSource; | 444 | triState ExpandAttributedSource; |
437 | favorSizeOrSpeedOption FavorSizeOrSpeed; | 445 | favorSizeOrSpeedOption FavorSizeOrSpeed; |
438 | triState ForceConformanceInForLoopScope; | 446 | triState ForceConformanceInForLoopScope; |
439 | QStringList ForcedIncludeFiles; | 447 | QStringList ForcedIncludeFiles; |
440 | QStringList ForcedUsingFiles; | 448 | QStringList ForcedUsingFiles; |
441 | preprocessOption GeneratePreprocessedFile; | 449 | preprocessOption GeneratePreprocessedFile; |
442 | triState GlobalOptimizations; | 450 | triState GlobalOptimizations; |
443 | triState IgnoreStandardIncludePath; | 451 | triState IgnoreStandardIncludePath; |
444 | triState ImproveFloatingPointConsistency; | 452 | triState ImproveFloatingPointConsistency; |
445 | inlineExpansionOption InlineFunctionExpansion; | 453 | inlineExpansionOption InlineFunctionExpansion; |
446 | triState KeepComments; | 454 | triState KeepComments; |
447 | triState MinimalRebuild; | 455 | triState MinimalRebuild; |
448 | QString ObjectFile; | 456 | QString ObjectFile; |
449 | triState OmitFramePointers; | 457 | triState OmitFramePointers; |
450 | optimizeOption Optimization; | 458 | optimizeOption Optimization; |
451 | ProcessorOptimizeOption OptimizeForProcessor; | 459 | ProcessorOptimizeOption OptimizeForProcessor; |
452 | triState OptimizeForWindowsApplication; | 460 | triState OptimizeForWindowsApplication; |
453 | QString OutputFile; | 461 | QString OutputFile; |
454 | QString PrecompiledHeaderFile; | 462 | QString PrecompiledHeaderFile; |
455 | QString PrecompiledHeaderThrough; | 463 | QString PrecompiledHeaderThrough; |
456 | QStringList PreprocessorDefinitions; | 464 | QStringList PreprocessorDefinitions; |
457 | QString ProgramDataBaseFileName; | 465 | QString ProgramDataBaseFileName; |
458 | runtimeLibraryOption RuntimeLibrary; | 466 | runtimeLibraryOption RuntimeLibrary; |
459 | triState RuntimeTypeInfo; | 467 | triState RuntimeTypeInfo; |
460 | triState ShowIncludes; | 468 | triState ShowIncludes; |
461 | triState SmallerTypeCheck; | 469 | triState SmallerTypeCheck; |
462 | triState StringPooling; | 470 | triState StringPooling; |
463 | structMemberAlignOption StructMemberAlignment; | 471 | structMemberAlignOption StructMemberAlignment; |
464 | triState SuppressStartupBanner; | 472 | triState SuppressStartupBanner; |
465 | triState TreatWChar_tAsBuiltInType; | 473 | triState TreatWChar_tAsBuiltInType; |
466 | triState TurnOffAssemblyGeneration; | 474 | triState TurnOffAssemblyGeneration; |
467 | triState UndefineAllPreprocessorDefinitions; | 475 | triState UndefineAllPreprocessorDefinitions; |
468 | QStringList UndefinePreprocessorDefinitions; | 476 | QStringList UndefinePreprocessorDefinitions; |
469 | pchOption UsePrecompiledHeader; | 477 | pchOption UsePrecompiledHeader; |
470 | triState WarnAsError; | 478 | triState WarnAsError; |
471 | warningLevelOption WarningLevel; | 479 | warningLevelOption WarningLevel; |
472 | triState WholeProgramOptimization; | 480 | triState WholeProgramOptimization; |
473 | VCConfiguration* config; | 481 | VCConfiguration* config; |
474 | }; | 482 | }; |
475 | 483 | ||
476 | class VCLinkerTool : public VCToolBase | 484 | class VCLinkerTool : public VCToolBase |
477 | { | 485 | { |
@@ -518,256 +526,263 @@ public: | |||
518 | QString OutputFile; | 526 | QString OutputFile; |
519 | QString ProgramDatabaseFile; | 527 | QString ProgramDatabaseFile; |
520 | triState RegisterOutput; | 528 | triState RegisterOutput; |
521 | triState ResourceOnlyDLL; | 529 | triState ResourceOnlyDLL; |
522 | triState SetChecksum; | 530 | triState SetChecksum; |
523 | linkProgressOption ShowProgress; | 531 | linkProgressOption ShowProgress; |
524 | long StackCommitSize; | 532 | long StackCommitSize; |
525 | long StackReserveSize; | 533 | long StackReserveSize; |
526 | QString StripPrivateSymbols; // Should be list? | 534 | QString StripPrivateSymbols; // Should be list? |
527 | subSystemOption SubSystem; | 535 | subSystemOption SubSystem; |
528 | triState SupportUnloadOfDelayLoadedDLL; | 536 | triState SupportUnloadOfDelayLoadedDLL; |
529 | triState SuppressStartupBanner; | 537 | triState SuppressStartupBanner; |
530 | triState SwapRunFromCD; | 538 | triState SwapRunFromCD; |
531 | triState SwapRunFromNet; | 539 | triState SwapRunFromNet; |
532 | machineTypeOption TargetMachine; | 540 | machineTypeOption TargetMachine; |
533 | termSvrAwarenessType TerminalServerAware; | 541 | termSvrAwarenessType TerminalServerAware; |
534 | triState TurnOffAssemblyGeneration; | 542 | triState TurnOffAssemblyGeneration; |
535 | QString TypeLibraryFile; | 543 | QString TypeLibraryFile; |
536 | long TypeLibraryResourceID; | 544 | long TypeLibraryResourceID; |
537 | QString Version; | 545 | QString Version; |
538 | VCConfiguration* config; | 546 | VCConfiguration* config; |
539 | }; | 547 | }; |
540 | 548 | ||
541 | class VCMIDLTool : public VCToolBase | 549 | class VCMIDLTool : public VCToolBase |
542 | { | 550 | { |
543 | public: | 551 | public: |
544 | // Functions | 552 | // Functions |
545 | VCMIDLTool(); | 553 | VCMIDLTool(); |
546 | virtual ~VCMIDLTool(){} | 554 | virtual ~VCMIDLTool(){} |
547 | bool parseOption( const char* option ); | 555 | bool parseOption( const char* option ); |
548 | 556 | ||
549 | // Variables | 557 | // Variables |
550 | QStringList AdditionalIncludeDirectories; | 558 | QStringList AdditionalIncludeDirectories; |
551 | QStringList AdditionalOptions; | 559 | QStringList AdditionalOptions; |
552 | QStringList CPreprocessOptions; | 560 | QStringList CPreprocessOptions; |
553 | midlCharOption DefaultCharType; | 561 | midlCharOption DefaultCharType; |
554 | QString DLLDataFileName; // Should be list? | 562 | QString DLLDataFileName; // Should be list? |
555 | midlErrorCheckOption EnableErrorChecks; | 563 | midlErrorCheckOption EnableErrorChecks; |
556 | triState ErrorCheckAllocations; | 564 | triState ErrorCheckAllocations; |
557 | triState ErrorCheckBounds; | 565 | triState ErrorCheckBounds; |
558 | triState ErrorCheckEnumRange; | 566 | triState ErrorCheckEnumRange; |
559 | triState ErrorCheckRefPointers; | 567 | triState ErrorCheckRefPointers; |
560 | triState ErrorCheckStubData; | 568 | triState ErrorCheckStubData; |
561 | QStringList FullIncludePath; | 569 | QStringList FullIncludePath; |
562 | triState GenerateStublessProxies; | 570 | triState GenerateStublessProxies; |
563 | triState GenerateTypeLibrary; | 571 | triState GenerateTypeLibrary; |
564 | QString HeaderFileName; | 572 | QString HeaderFileName; |
565 | triState IgnoreStandardIncludePath; | 573 | triState IgnoreStandardIncludePath; |
566 | QString InterfaceIdentifierFileName; | 574 | QString InterfaceIdentifierFileName; |
567 | triState MkTypLibCompatible; | 575 | triState MkTypLibCompatible; |
568 | QString OutputDirectory; | 576 | QString OutputDirectory; |
569 | QStringList PreprocessorDefinitions; | 577 | QStringList PreprocessorDefinitions; |
570 | QString ProxyFileName; | 578 | QString ProxyFileName; |
571 | QString RedirectOutputAndErrors; | 579 | QString RedirectOutputAndErrors; |
572 | midlStructMemberAlignOption StructMemberAlignment; | 580 | midlStructMemberAlignOption StructMemberAlignment; |
573 | triState SuppressStartupBanner; | 581 | triState SuppressStartupBanner; |
574 | midlTargetEnvironment TargetEnvironment; | 582 | midlTargetEnvironment TargetEnvironment; |
575 | QString TypeLibraryName; | 583 | QString TypeLibraryName; |
576 | QStringList UndefinePreprocessorDefinitions; | 584 | QStringList UndefinePreprocessorDefinitions; |
577 | triState ValidateParameters; | 585 | triState ValidateParameters; |
578 | triState WarnAsError; | 586 | triState WarnAsError; |
579 | midlWarningLevelOption WarningLevel; | 587 | midlWarningLevelOption WarningLevel; |
580 | VCConfiguration* config; | 588 | VCConfiguration* config; |
581 | }; | 589 | }; |
582 | 590 | ||
583 | class VCLibrarianTool : public VCToolBase | 591 | class VCLibrarianTool : public VCToolBase |
584 | { | 592 | { |
585 | public: | 593 | public: |
586 | // Functions | 594 | // Functions |
587 | VCLibrarianTool(); | 595 | VCLibrarianTool(); |
588 | virtual ~VCLibrarianTool(){} | 596 | virtual ~VCLibrarianTool(){} |
589 | bool parseOption( const char* ){ return FALSE; }; | 597 | bool parseOption( const char* ){ return FALSE; }; |
590 | 598 | ||
591 | // Variables | 599 | // Variables |
592 | QStringList AdditionalDependencies; | 600 | QStringList AdditionalDependencies; |
593 | QStringList AdditionalLibraryDirectories; | 601 | QStringList AdditionalLibraryDirectories; |
594 | QStringList AdditionalOptions; | 602 | QStringList AdditionalOptions; |
595 | QStringList ExportNamedFunctions; | 603 | QStringList ExportNamedFunctions; |
596 | QStringList ForceSymbolReferences; | 604 | QStringList ForceSymbolReferences; |
597 | triState IgnoreAllDefaultLibraries; | 605 | triState IgnoreAllDefaultLibraries; |
598 | QStringList IgnoreDefaultLibraryNames; | 606 | QStringList IgnoreDefaultLibraryNames; |
599 | QString ModuleDefinitionFile; | 607 | QString ModuleDefinitionFile; |
600 | QString OutputFile; | 608 | QString OutputFile; |
601 | triState SuppressStartupBanner; | 609 | triState SuppressStartupBanner; |
602 | }; | 610 | }; |
603 | 611 | ||
604 | class VCCustomBuildTool : public VCToolBase | 612 | class VCCustomBuildTool : public VCToolBase |
605 | { | 613 | { |
606 | public: | 614 | public: |
607 | // Functions | 615 | // Functions |
608 | VCCustomBuildTool(); | 616 | VCCustomBuildTool(); |
609 | virtual ~VCCustomBuildTool(){} | 617 | virtual ~VCCustomBuildTool(){} |
610 | bool parseOption( const char* ){ return FALSE; }; | 618 | bool parseOption( const char* ){ return FALSE; }; |
611 | 619 | ||
612 | // Variables | 620 | // Variables |
613 | QStringList AdditionalDependencies; | 621 | QStringList AdditionalDependencies; |
614 | QString CommandLine; | 622 | QStringList CommandLine; |
615 | QString Description; | 623 | QString Description; |
616 | QString Outputs; | 624 | QStringList Outputs; |
617 | QString ToolName; | 625 | QString ToolName; |
618 | QString ToolPath; | 626 | QString ToolPath; |
619 | }; | 627 | }; |
620 | 628 | ||
621 | class VCResourceCompilerTool : public VCToolBase | 629 | class VCResourceCompilerTool : public VCToolBase |
622 | { | 630 | { |
623 | public: | 631 | public: |
624 | // Functions | 632 | // Functions |
625 | VCResourceCompilerTool(); | 633 | VCResourceCompilerTool(); |
626 | virtual ~VCResourceCompilerTool(){} | 634 | virtual ~VCResourceCompilerTool(){} |
627 | bool parseOption( const char* ){ return FALSE; }; | 635 | bool parseOption( const char* ){ return FALSE; }; |
628 | 636 | ||
629 | // Variables | 637 | // Variables |
630 | QStringList AdditionalIncludeDirectories; | 638 | QStringList AdditionalIncludeDirectories; |
631 | QStringList AdditionalOptions; | 639 | QStringList AdditionalOptions; |
632 | enumResourceLangID Culture; | 640 | enumResourceLangID Culture; |
633 | QStringList FullIncludePath; | 641 | QStringList FullIncludePath; |
634 | triState IgnoreStandardIncludePath; | 642 | triState IgnoreStandardIncludePath; |
635 | QStringList PreprocessorDefinitions; | 643 | QStringList PreprocessorDefinitions; |
636 | QString ResourceOutputFileName; | 644 | QString ResourceOutputFileName; |
637 | linkProgressOption ShowProgress; | 645 | linkProgressOption ShowProgress; |
638 | QString ToolPath; | 646 | QString ToolPath; |
639 | }; | 647 | }; |
640 | 648 | ||
641 | class VCEventTool : public VCToolBase | 649 | class VCEventTool : public VCToolBase |
642 | { | 650 | { |
643 | protected: | 651 | protected: |
644 | // Functions | 652 | // Functions |
645 | VCEventTool() : ExcludedFromBuild( unset ){}; | 653 | VCEventTool() : ExcludedFromBuild( unset ){}; |
646 | virtual ~VCEventTool(){} | 654 | virtual ~VCEventTool(){} |
647 | bool parseOption( const char* ){ return FALSE; }; | 655 | bool parseOption( const char* ){ return FALSE; }; |
648 | 656 | ||
649 | public: | 657 | public: |
650 | // Variables | 658 | // Variables |
651 | QString CommandLine; | 659 | QString CommandLine; |
652 | QString Description; | 660 | QString Description; |
653 | triState ExcludedFromBuild; | 661 | triState ExcludedFromBuild; |
654 | QString ToolName; | 662 | QString ToolName; |
655 | QString ToolPath; | 663 | QString ToolPath; |
656 | }; | 664 | }; |
657 | 665 | ||
658 | class VCPostBuildEventTool : public VCEventTool | 666 | class VCPostBuildEventTool : public VCEventTool |
659 | { | 667 | { |
660 | public: | 668 | public: |
661 | VCPostBuildEventTool(); | 669 | VCPostBuildEventTool(); |
662 | ~VCPostBuildEventTool(){} | 670 | ~VCPostBuildEventTool(){} |
663 | }; | 671 | }; |
664 | 672 | ||
665 | class VCPreBuildEventTool : public VCEventTool | 673 | class VCPreBuildEventTool : public VCEventTool |
666 | { | 674 | { |
667 | public: | 675 | public: |
668 | VCPreBuildEventTool(); | 676 | VCPreBuildEventTool(); |
669 | ~VCPreBuildEventTool(){} | 677 | ~VCPreBuildEventTool(){} |
670 | }; | 678 | }; |
671 | 679 | ||
672 | class VCPreLinkEventTool : public VCEventTool | 680 | class VCPreLinkEventTool : public VCEventTool |
673 | { | 681 | { |
674 | public: | 682 | public: |
675 | VCPreLinkEventTool(); | 683 | VCPreLinkEventTool(); |
676 | ~VCPreLinkEventTool(){} | 684 | ~VCPreLinkEventTool(){} |
677 | }; | 685 | }; |
678 | 686 | ||
679 | class VCConfiguration | 687 | class VCConfiguration |
680 | { | 688 | { |
681 | public: | 689 | public: |
682 | // Functions | 690 | // Functions |
683 | VCConfiguration(); | 691 | VCConfiguration(); |
684 | ~VCConfiguration(){} | 692 | ~VCConfiguration(){} |
685 | 693 | ||
686 | // Variables | 694 | // Variables |
687 | triState ATLMinimizesCRunTimeLibraryUsage; | 695 | triState ATLMinimizesCRunTimeLibraryUsage; |
688 | triState BuildBrowserInformation; | 696 | triState BuildBrowserInformation; |
689 | charSet CharacterSet; | 697 | charSet CharacterSet; |
690 | ConfigurationTypesConfigurationType; | 698 | ConfigurationTypesConfigurationType; |
691 | QString DeleteExtensionsOnClean; | 699 | QString DeleteExtensionsOnClean; |
692 | QString ImportLibrary; | 700 | QString ImportLibrary; |
693 | QString IntermediateDirectory; | 701 | QString IntermediateDirectory; |
694 | QString Name; | 702 | QString Name; |
695 | QString OutputDirectory; | 703 | QString OutputDirectory; |
696 | QString PrimaryOutput; | 704 | QString PrimaryOutput; |
697 | QString ProgramDatabase; | 705 | QString ProgramDatabase; |
698 | triState RegisterOutput; | 706 | triState RegisterOutput; |
699 | useOfATL UseOfATL; | 707 | useOfATL UseOfATL; |
700 | useOfMfc UseOfMfc; | 708 | useOfMfc UseOfMfc; |
701 | triState WholeProgramOptimization; | 709 | triState WholeProgramOptimization; |
702 | 710 | ||
703 | // XML sub-parts | 711 | // XML sub-parts |
704 | VCCLCompilerTool compiler; | 712 | VCCLCompilerTool compiler; |
705 | VCLinkerTool linker; | 713 | VCLinkerTool linker; |
706 | VCLibrarianTool librarian; | 714 | VCLibrarianTool librarian; |
707 | VCCustomBuildTool custom; | 715 | VCCustomBuildTool custom; |
708 | VCMIDLTool idl; | 716 | VCMIDLTool idl; |
709 | VCPostBuildEventTool postBuild; | 717 | VCPostBuildEventTool postBuild; |
710 | VCPreBuildEventTool preBuild; | 718 | VCPreBuildEventTool preBuild; |
711 | VCPreLinkEventTool preLink; | 719 | VCPreLinkEventTool preLink; |
712 | VCResourceCompilerTool resource; | 720 | VCResourceCompilerTool resource; |
713 | }; | 721 | }; |
714 | 722 | ||
715 | class VcprojGenerator; | 723 | class VcprojGenerator; |
716 | class VCFilter | 724 | class VCFilter |
717 | { | 725 | { |
718 | public: | 726 | public: |
719 | // Functions | 727 | // Functions |
720 | VCFilter(); | 728 | VCFilter(); |
721 | ~VCFilter(){} | 729 | ~VCFilter(){} |
722 | void generateMOC( QTextStream &strm, QString str ) const; | 730 | void addMOCstage( QTextStream &strm, QString str ); |
723 | void generateUIC( QTextStream &strm, const QString& str ) const; | 731 | void addUICstage( QTextStream &strm, QString str ); |
732 | bool addIMGstage( QTextStream &strm, QString str ); | ||
733 | void modifyPCHstage( QTextStream &strm, QString str ); | ||
724 | 734 | ||
725 | // Variables | 735 | // Variables |
726 | QString Name; | 736 | QString Name; |
727 | QString Filter; | 737 | QString Filter; |
728 | triState ParseFiles; | 738 | triState ParseFiles; |
729 | QStringList Files; | 739 | QStringList Files; |
730 | VcprojGenerator*Project; | 740 | VcprojGenerator*Project; |
731 | VCConfiguration*Config; | 741 | QValueList<VCConfiguration> *Config; |
732 | customBuildCheckCustomBuild; | 742 | customBuildCheckCustomBuild; |
743 | bool useCustomBuildTool; | ||
744 | VCCustomBuildTool CustomBuildTool; | ||
745 | bool useCompilerTool; | ||
746 | VCCLCompilerTool CompilerTool; | ||
747 | bool flat_files; | ||
733 | }; | 748 | }; |
734 | 749 | ||
735 | class VCProject | 750 | class VCProject |
736 | { | 751 | { |
737 | public: | 752 | public: |
738 | // Functions | 753 | // Functions |
739 | VCProject(); | 754 | VCProject(); |
740 | ~VCProject(){} | 755 | ~VCProject(){} |
741 | 756 | ||
742 | // Variables | 757 | // Variables |
743 | QString Name; | 758 | QString Name; |
744 | QString Version; | 759 | QString Version; |
745 | QString ProjectGUID; | 760 | QString ProjectGUID; |
746 | QString SccProjectName; | 761 | QString SccProjectName; |
747 | QString SccLocalPath; | 762 | QString SccLocalPath; |
748 | QString PlatformName; | 763 | QString PlatformName; |
749 | 764 | ||
750 | // XML sub-parts | 765 | // XML sub-parts |
751 | VCConfigurationConfiguration; | 766 | QValueList<VCConfiguration> Configuration; |
752 | VCFilter SourceFiles; | 767 | VCFilter SourceFiles; |
753 | VCFilter HeaderFiles; | 768 | VCFilter HeaderFiles; |
754 | VCFilter MOCFiles; | 769 | VCFilter MOCFiles; |
755 | VCFilter UICFiles; | 770 | VCFilter UICFiles; |
756 | VCFilter FormFiles; | 771 | VCFilter FormFiles; |
757 | VCFilter TranslationFiles; | 772 | VCFilter TranslationFiles; |
758 | VCFilter LexYaccFiles; | 773 | VCFilter LexYaccFiles; |
759 | VCFilter ResourceFiles; | 774 | VCFilter ResourceFiles; |
760 | }; | 775 | }; |
761 | 776 | ||
762 | QTextStream &operator<<( QTextStream &, const VCCLCompilerTool & ); | 777 | QTextStream &operator<<( QTextStream &, const VCCLCompilerTool & ); |
763 | QTextStream &operator<<( QTextStream &, const VCLinkerTool & ); | 778 | QTextStream &operator<<( QTextStream &, const VCLinkerTool & ); |
764 | QTextStream &operator<<( QTextStream &, const VCMIDLTool & ); | 779 | QTextStream &operator<<( QTextStream &, const VCMIDLTool & ); |
765 | QTextStream &operator<<( QTextStream &, const VCCustomBuildTool & ); | 780 | QTextStream &operator<<( QTextStream &, const VCCustomBuildTool & ); |
766 | QTextStream &operator<<( QTextStream &, const VCLibrarianTool & ); | 781 | QTextStream &operator<<( QTextStream &, const VCLibrarianTool & ); |
767 | QTextStream &operator<<( QTextStream &, const VCResourceCompilerTool & ); | 782 | QTextStream &operator<<( QTextStream &, const VCResourceCompilerTool & ); |
768 | QTextStream &operator<<( QTextStream &, const VCEventTool & ); | 783 | QTextStream &operator<<( QTextStream &, const VCEventTool & ); |
769 | QTextStream &operator<<( QTextStream &, const VCConfiguration & ); | 784 | QTextStream &operator<<( QTextStream &, const VCConfiguration & ); |
770 | QTextStream &operator<<( QTextStream &, const VCFilter & ); | 785 | QTextStream &operator<<( QTextStream &, VCFilter & ); |
771 | QTextStream &operator<<( QTextStream &, const VCProject & ); | 786 | QTextStream &operator<<( QTextStream &, const VCProject & ); |
772 | 787 | ||
773 | #endif //__MSVC_OBJECTMODEL_H__ | 788 | #endif //__MSVC_OBJECTMODEL_H__ |
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index d2cbc31..aa8fe16 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp | |||
@@ -1,1214 +1,1462 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of VcprojGenerator class. | 4 | ** Implementation of VcprojGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "msvc_vcproj.h" | 36 | #include "msvc_vcproj.h" |
39 | #include "option.h" | 37 | #include "option.h" |
38 | #include "qtmd5.h" // SG's MD5 addon | ||
40 | #include <qdir.h> | 39 | #include <qdir.h> |
41 | #include <qregexp.h> | 40 | #include <qregexp.h> |
42 | #include <qdict.h> | 41 | #include <qdict.h> |
43 | #include <quuid.h> | 42 | #include <quuid.h> |
44 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | #include <qsettings.h> | ||
45 | |||
46 | //#define DEBUG_SOLUTION_GEN | ||
47 | //#define DEBUG_PROJECT_GEN | ||
48 | |||
49 | // Registry keys for .NET version detection ------------------------- | ||
50 | const char* _regNet2002 = "Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir"; | ||
51 | const char* _regNet2003 = "Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir"; | ||
45 | 52 | ||
46 | #if defined(Q_OS_WIN32) | 53 | bool use_net2003_version() |
47 | #include <objbase.h> | ||
48 | #ifndef GUID_DEFINED | ||
49 | #define GUID_DEFINED | ||
50 | typedef struct _GUID | ||
51 | { | 54 | { |
52 | ulong Data1; | 55 | #ifndef Q_OS_WIN32 |
53 | ushort Data2; | 56 | return FALSE; // Always generate 7.0 versions on other platforms |
54 | ushort Data3; | 57 | #else |
55 | uchar Data4[8]; | 58 | // Only search for the version once |
56 | } GUID; | 59 | static int current_version = -1; |
57 | #endif | 60 | if (current_version!=-1) |
61 | return (current_version==71); | ||
62 | |||
63 | // Fallback to .NET 2002 | ||
64 | current_version = 70; | ||
65 | |||
66 | // Get registry entries for both versions | ||
67 | bool ok = false; | ||
68 | QSettings setting; | ||
69 | QString path2002 = setting.readEntry(_regNet2002); | ||
70 | QString path2003 = setting.readEntry(_regNet2003); | ||
71 | |||
72 | if ( path2002.isNull() || path2003.isNull() ) { | ||
73 | // Only have one MSVC, so use that one | ||
74 | current_version = (path2003.isNull() ? 70 : 71); | ||
75 | } else { | ||
76 | // Have both, so figure out the current | ||
77 | QString paths = getenv("PATH"); | ||
78 | QStringList pathlist = QStringList::split(";", paths.lower()); | ||
79 | |||
80 | path2003 = path2003.lower(); | ||
81 | QStringList::iterator it; | ||
82 | for(it=pathlist.begin(); it!=pathlist.end(); ++it) { | ||
83 | if ((*it).contains(path2003)) { | ||
84 | current_version = 71; | ||
85 | } else if ((*it).contains(path2002) | ||
86 | && current_version == 71) { | ||
87 | fprintf( stderr, "Both .NET 2002 & .NET 2003 directories for VC found in you PATH variable!\nFallback to .NET 2002 project generation" ); | ||
88 | current_version = 70; | ||
89 | break; | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | return (current_version==71); | ||
58 | #endif | 94 | #endif |
95 | }; | ||
59 | 96 | ||
60 | // Flatfile Tags ---------------------------------------------------- | 97 | // Flatfile Tags ---------------------------------------------------- |
61 | const char* _snlHeader = "Microsoft Visual Studio Solution File, Format Version 7.00"; | 98 | const char* _slnHeader70= "Microsoft Visual Studio Solution File, Format Version 7.00"; |
99 | const char* _slnHeader71= "Microsoft Visual Studio Solution File, Format Version 8.00"; | ||
62 | // The following UUID _may_ change for later servicepacks... | 100 | // The following UUID _may_ change for later servicepacks... |
63 | // If so we need to search through the registry at | 101 | // If so we need to search through the registry at |
64 | // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects | 102 | // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects |
65 | // to find the subkey that contains a "PossibleProjectExtension" | 103 | // to find the subkey that contains a "PossibleProjectExtension" |
66 | // containing "vcproj"... | 104 | // containing "vcproj"... |
67 | // Use the hardcoded value for now so projects generated on other | 105 | // Use the hardcoded value for now so projects generated on other |
68 | // platforms are actually usable. | 106 | // platforms are actually usable. |
69 | const char* _snlMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; | 107 | const char* _slnMSVCvcprojGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; |
70 | const char* _snlProjectBeg= "\nProject(\""; | 108 | const char* _slnProjectBeg= "\nProject(\""; |
71 | const char* _snlProjectMid= "\") = "; | 109 | const char* _slnProjectMid= "\") = "; |
72 | const char* _snlProjectEnd= "\nEndProject"; | 110 | const char* _slnProjectEnd= "\nEndProject"; |
73 | const char* _snlGlobalBeg= "\nGlobal"; | 111 | const char* _slnGlobalBeg= "\nGlobal"; |
74 | const char* _snlGlobalEnd= "\nEndGlobal"; | 112 | const char* _slnGlobalEnd= "\nEndGlobal"; |
75 | const char* _snlSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution" | 113 | const char* _slnSolutionConf= "\n\tGlobalSection(SolutionConfiguration) = preSolution" |
76 | "\n\t\tConfigName.0 = Release" | 114 | "\n\t\tConfigName.0 = Debug" |
115 | "\n\t\tConfigName.1 = Release" | ||
77 | "\n\tEndGlobalSection"; | 116 | "\n\tEndGlobalSection"; |
78 | const char* _snlProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution"; | 117 | const char* _slnProjDepBeg= "\n\tGlobalSection(ProjectDependencies) = postSolution"; |
79 | const char* _snlProjDepEnd= "\n\tEndGlobalSection"; | 118 | const char* _slnProjDepEnd= "\n\tEndGlobalSection"; |
80 | const char* _snlProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution"; | 119 | const char* _slnProjConfBeg= "\n\tGlobalSection(ProjectConfiguration) = postSolution"; |
81 | const char* _snlProjConfTag1= ".Release.ActiveCfg = Release|Win32"; | 120 | const char* _slnProjRelConfTag1= ".Release.ActiveCfg = Release|Win32"; |
82 | const char* _snlProjConfTag2= ".Release.Build.0 = Release|Win32"; | 121 | const char* _slnProjRelConfTag2= ".Release.Build.0 = Release|Win32"; |
83 | const char* _snlProjConfEnd= "\n\tEndGlobalSection"; | 122 | const char* _slnProjDbgConfTag1= ".Debug.ActiveCfg = Debug|Win32"; |
84 | const char* _snlExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" | 123 | const char* _slnProjDbgConfTag2= ".Debug.Build.0 = Debug|Win32"; |
124 | const char* _slnProjConfEnd= "\n\tEndGlobalSection"; | ||
125 | const char* _slnExtSections= "\n\tGlobalSection(ExtensibilityGlobals) = postSolution" | ||
85 | "\n\tEndGlobalSection" | 126 | "\n\tEndGlobalSection" |
86 | "\n\tGlobalSection(ExtensibilityAddIns) = postSolution" | 127 | "\n\tGlobalSection(ExtensibilityAddIns) = postSolution" |
87 | "\n\tEndGlobalSection"; | 128 | "\n\tEndGlobalSection"; |
88 | // ------------------------------------------------------------------ | 129 | // ------------------------------------------------------------------ |
89 | 130 | ||
90 | VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) | 131 | VcprojGenerator::VcprojGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE) |
91 | { | 132 | { |
92 | } | 133 | } |
93 | 134 | ||
94 | /* \internal | 135 | /* \internal |
95 | Generates a project file for the given profile. | 136 | Generates a project file for the given profile. |
96 | Options are either a Visual Studio projectfiles, or | 137 | Options are either a Visual Studio projectfiles, or |
97 | solutionfiles by parsing recursive projectdirectories. | 138 | solutionfiles by parsing recursive projectdirectories. |
98 | */ | 139 | */ |
99 | bool VcprojGenerator::writeMakefile(QTextStream &t) | 140 | bool VcprojGenerator::writeMakefile(QTextStream &t) |
100 | { | 141 | { |
101 | // Check if all requirements are fullfilled | 142 | // Check if all requirements are fullfilled |
102 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 143 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
103 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", | 144 | fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", |
104 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); | 145 | var("QMAKE_FAILED_REQUIREMENTS").latin1()); |
105 | return TRUE; | 146 | return TRUE; |
106 | } | 147 | } |
107 | 148 | ||
108 | // Generate project file | 149 | // Generate project file |
109 | if(project->first("TEMPLATE") == "vcapp" || | 150 | if(project->first("TEMPLATE") == "vcapp" || |
110 | project->first("TEMPLATE") == "vclib") { | 151 | project->first("TEMPLATE") == "vclib") { |
111 | debug_msg(1, "Generator: MSVC.NET: Writing project file" ); | 152 | debug_msg(1, "Generator: MSVC.NET: Writing project file" ); |
112 | t << vcProject; | 153 | t << vcProject; |
113 | return TRUE; | 154 | return TRUE; |
114 | } | 155 | } |
115 | // Generate solution file | 156 | // Generate solution file |
116 | else if(project->first("TEMPLATE") == "vcsubdirs") { | 157 | else if(project->first("TEMPLATE") == "vcsubdirs") { |
117 | debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); | 158 | debug_msg(1, "Generator: MSVC.NET: Writing solution file" ); |
118 | writeSubDirs(t); | 159 | writeSubDirs(t); |
119 | return TRUE; | 160 | return TRUE; |
120 | } | 161 | } |
121 | return FALSE; | 162 | return FALSE; |
122 | 163 | ||
123 | } | 164 | } |
124 | 165 | ||
125 | struct VcsolutionDepend { | 166 | struct VcsolutionDepend { |
126 | QString uuid; | 167 | QString uuid; |
127 | QString vcprojFile, orig_target, target; | 168 | QString vcprojFile, orig_target, target; |
128 | ::target targetType; | 169 | ::target targetType; |
170 | bool debugBuild; | ||
129 | QStringList dependencies; | 171 | QStringList dependencies; |
130 | }; | 172 | }; |
131 | 173 | ||
174 | QUuid VcprojGenerator::getProjectUUID(const QString &filename) | ||
175 | { | ||
176 | bool validUUID = true; | ||
177 | |||
178 | // Read GUID from variable-space | ||
179 | QUuid uuid = project->first("GUID"); | ||
180 | |||
181 | // If none, create one based on the MD5 of absolute project path | ||
182 | if (uuid.isNull() || !filename.isNull()) { | ||
183 | QString abspath = filename.isNull()?project->first("QMAKE_MAKEFILE"):filename; | ||
184 | qtMD5(abspath.utf8(), (unsigned char*)(&uuid)); | ||
185 | validUUID = !uuid.isNull(); | ||
186 | uuid.data4[0] = (uuid.data4[0] & 0x3F) | 0x80; // UV_DCE variant | ||
187 | uuid.data3 = (uuid.data3 & 0x0FFF) | (QUuid::Name<<12); | ||
188 | } | ||
189 | |||
190 | // If still not valid, generate new one, and suggest adding to .pro | ||
191 | if (uuid.isNull() || !validUUID) { | ||
192 | uuid = QUuid::createUuid(); | ||
193 | fprintf(stderr, | ||
194 | "qmake couldn't create a GUID based on filepath, and we couldn't\nfind a valid GUID in the .pro file (Consider adding\n'GUID = %s' to the .pro file)\n", | ||
195 | uuid.toString().upper().latin1()); | ||
196 | } | ||
197 | |||
198 | // Store GUID in variable-space | ||
199 | project->values("GUID") = uuid.toString().upper(); | ||
200 | return uuid; | ||
201 | } | ||
202 | |||
132 | QUuid VcprojGenerator::increaseUUID( const QUuid &id ) | 203 | QUuid VcprojGenerator::increaseUUID( const QUuid &id ) |
133 | { | 204 | { |
134 | QUuid result( id ); | 205 | QUuid result( id ); |
135 | Q_LONG dataFirst = (result.data4[0] << 24) + | 206 | Q_LONG dataFirst = (result.data4[0] << 24) + |
136 | (result.data4[1] << 16) + | 207 | (result.data4[1] << 16) + |
137 | (result.data4[2] << 8) + | 208 | (result.data4[2] << 8) + |
138 | result.data4[3]; | 209 | result.data4[3]; |
139 | Q_LONG dataLast = (result.data4[4] << 24) + | 210 | Q_LONG dataLast = (result.data4[4] << 24) + |
140 | (result.data4[5] << 16) + | 211 | (result.data4[5] << 16) + |
141 | (result.data4[6] << 8) + | 212 | (result.data4[6] << 8) + |
142 | result.data4[7]; | 213 | result.data4[7]; |
143 | 214 | ||
144 | if ( !(dataLast++) ) | 215 | if ( !(dataLast++) ) |
145 | dataFirst++; | 216 | dataFirst++; |
146 | 217 | ||
147 | result.data4[0] = uchar((dataFirst >> 24) & 0xff); | 218 | result.data4[0] = uchar((dataFirst >> 24) & 0xff); |
148 | result.data4[1] = uchar((dataFirst >> 16) & 0xff); | 219 | result.data4[1] = uchar((dataFirst >> 16) & 0xff); |
149 | result.data4[2] = uchar((dataFirst >> 8) & 0xff); | 220 | result.data4[2] = uchar((dataFirst >> 8) & 0xff); |
150 | result.data4[3] = uchar( dataFirst & 0xff); | 221 | result.data4[3] = uchar( dataFirst & 0xff); |
151 | result.data4[4] = uchar((dataLast >> 24) & 0xff); | 222 | result.data4[4] = uchar((dataLast >> 24) & 0xff); |
152 | result.data4[5] = uchar((dataLast >> 16) & 0xff); | 223 | result.data4[5] = uchar((dataLast >> 16) & 0xff); |
153 | result.data4[6] = uchar((dataLast >> 8) & 0xff); | 224 | result.data4[6] = uchar((dataLast >> 8) & 0xff); |
154 | result.data4[7] = uchar( dataLast & 0xff); | 225 | result.data4[7] = uchar( dataLast & 0xff); |
155 | return result; | 226 | return result; |
156 | } | 227 | } |
157 | 228 | ||
158 | void VcprojGenerator::writeSubDirs(QTextStream &t) | 229 | void VcprojGenerator::writeSubDirs(QTextStream &t) |
159 | { | 230 | { |
160 | if(project->first("TEMPLATE") == "subdirs") { | 231 | if(project->first("TEMPLATE") == "subdirs") { |
161 | writeHeader(t); | 232 | writeHeader(t); |
162 | Win32MakefileGenerator::writeSubDirs(t); | 233 | Win32MakefileGenerator::writeSubDirs(t); |
163 | return; | 234 | return; |
164 | } | 235 | } |
165 | 236 | ||
166 | t << _snlHeader; | 237 | t << (use_net2003_version() ? _slnHeader71 : _slnHeader70); |
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 | 238 | ||
179 | QDict<VcsolutionDepend> solution_depends; | 239 | QDict<VcsolutionDepend> solution_depends; |
240 | |||
180 | QPtrList<VcsolutionDepend> solution_cleanup; | 241 | QPtrList<VcsolutionDepend> solution_cleanup; |
181 | solution_cleanup.setAutoDelete(TRUE); | 242 | solution_cleanup.setAutoDelete(TRUE); |
243 | |||
244 | |||
182 | QStringList subdirs = project->variables()["SUBDIRS"]; | 245 | QStringList subdirs = project->variables()["SUBDIRS"]; |
183 | QString oldpwd = QDir::currentDirPath(); | 246 | QString oldpwd = QDir::currentDirPath(); |
247 | |||
184 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { | 248 | for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) { |
185 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); | 249 | QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE)); |
186 | if(fi.exists()) { | 250 | if(fi.exists()) { |
187 | if(fi.isDir()) { | 251 | if(fi.isDir()) { |
188 | QString profile = (*it); | 252 | QString profile = (*it); |
189 | if(!profile.endsWith(Option::dir_sep)) | 253 | if(!profile.endsWith(Option::dir_sep)) |
190 | profile += Option::dir_sep; | 254 | profile += Option::dir_sep; |
191 | profile += fi.baseName() + ".pro"; | 255 | profile += fi.baseName() + ".pro"; |
192 | subdirs.append(profile); | 256 | subdirs.append(profile); |
193 | } else { | 257 | } else { |
194 | QMakeProject tmp_proj; | 258 | QMakeProject tmp_proj; |
195 | QString dir = fi.dirPath(), fn = fi.fileName(); | 259 | QString dir = fi.dirPath(), fn = fi.fileName(); |
196 | if(!dir.isEmpty()) { | 260 | if(!dir.isEmpty()) { |
197 | if(!QDir::setCurrent(dir)) | 261 | if(!QDir::setCurrent(dir)) |
198 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); | 262 | fprintf(stderr, "Cannot find directory: %s\n", dir.latin1()); |
199 | } | 263 | } |
200 | if(tmp_proj.read(fn, oldpwd)) { | 264 | if(tmp_proj.read(fn, oldpwd)) { |
201 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { | 265 | if(tmp_proj.first("TEMPLATE") == "vcsubdirs") { |
202 | QStringList tmp_subdirs = fileFixify(tmp_proj.variables()["SUBDIRS"]); | 266 | subdirs += fileFixify(tmp_proj.variables()["SUBDIRS"]); |
203 | subdirs += tmp_subdirs; | ||
204 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { | 267 | } else if(tmp_proj.first("TEMPLATE") == "vcapp" || tmp_proj.first("TEMPLATE") == "vclib") { |
205 | // Initialize a 'fake' project to get the correct variables | 268 | // Initialize a 'fake' project to get the correct variables |
206 | // and to be able to extract all the dependencies | 269 | // and to be able to extract all the dependencies |
207 | VcprojGenerator tmp_vcproj(&tmp_proj); | 270 | VcprojGenerator tmp_vcproj(&tmp_proj); |
208 | tmp_vcproj.setNoIO(TRUE); | 271 | tmp_vcproj.setNoIO(TRUE); |
209 | tmp_vcproj.init(); | 272 | tmp_vcproj.init(); |
210 | if(Option::debug_level) { | 273 | if(Option::debug_level) { |
211 | QMap<QString, QStringList> &vars = tmp_proj.variables(); | 274 | QMap<QString, QStringList> &vars = tmp_proj.variables(); |
212 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); | 275 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); |
213 | it != vars.end(); ++it) { | 276 | it != vars.end(); ++it) { |
214 | if(it.key().left(1) != "." && !it.data().isEmpty()) | 277 | if(it.key().left(1) != "." && !it.data().isEmpty()) |
215 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), | 278 | debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(), |
216 | it.data().join(" :: ").latin1()); | 279 | it.data().join(" :: ").latin1()); |
217 | } | 280 | } |
218 | } | 281 | } |
219 | 282 | ||
220 | // We assume project filename is [QMAKE_ORIG_TARGET].vcproj | 283 | // We assume project filename is [QMAKE_ORIG_TARGET].vcproj |
221 | QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION"); | 284 | QString vcproj = fixFilename(tmp_vcproj.project->first("QMAKE_ORIG_TARGET")) + project->first("VCPROJ_EXTENSION"); |
222 | 285 | ||
223 | // If file doesn't exsist, then maybe the users configuration | 286 | // If file doesn't exsist, then maybe the users configuration |
224 | // doesn't allow it to be created. Skip to next... | 287 | // doesn't allow it to be created. Skip to next... |
225 | if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) { | 288 | if(!QFile::exists(QDir::currentDirPath() + Option::dir_sep + vcproj)) { |
226 | qDebug( "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() ); | 289 | warn_msg(WarnLogic, "Ignored (not found) '%s'", QString(QDir::currentDirPath() + Option::dir_sep + vcproj).latin1() ); |
227 | goto nextfile; // # Dirty! | 290 | goto nextfile; // # Dirty! |
228 | } | 291 | } |
229 | 292 | ||
230 | VcsolutionDepend *newDep = new VcsolutionDepend; | 293 | VcsolutionDepend *newDep = new VcsolutionDepend; |
231 | newDep->vcprojFile = fileFixify(vcproj); | 294 | newDep->vcprojFile = fileFixify(vcproj); |
232 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); | 295 | newDep->orig_target = tmp_proj.first("QMAKE_ORIG_TARGET"); |
233 | newDep->target = tmp_proj.first("TARGET").section(Option::dir_sep, -1); | 296 | newDep->target = tmp_proj.first("MSVCPROJ_TARGET").section(Option::dir_sep, -1); |
234 | newDep->targetType = tmp_vcproj.projectTarget; | 297 | newDep->targetType = tmp_vcproj.projectTarget; |
235 | { | 298 | newDep->debugBuild = tmp_proj.isActiveConfig("debug"); |
236 | static QUuid uuid = solutionGUID; | 299 | newDep->uuid = getProjectUUID(Option::fixPathToLocalOS(QDir::currentDirPath() + QDir::separator() + vcproj)).toString().upper(); |
237 | uuid = increaseUUID( uuid ); | 300 | |
238 | newDep->uuid = uuid.toString().upper(); | 301 | // We want to store it as the .lib name. |
239 | } | ||
240 | if(newDep->target.endsWith(".dll")) | 302 | if(newDep->target.endsWith(".dll")) |
241 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; | 303 | newDep->target = newDep->target.left(newDep->target.length()-3) + "lib"; |
304 | |||
305 | // All projects using Forms are dependent on uic.exe | ||
242 | if(!tmp_proj.isEmpty("FORMS")) | 306 | if(!tmp_proj.isEmpty("FORMS")) |
243 | newDep->dependencies << "uic.exe"; | 307 | newDep->dependencies << "uic.exe"; |
244 | { | 308 | |
245 | QStringList where("QMAKE_LIBS"); | 309 | // Add all unknown libs to the deps |
246 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 310 | QStringList where("QMAKE_LIBS"); |
247 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; | 311 | if(!tmp_proj.isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
248 | for(QStringList::iterator wit = where.begin(); | 312 | where = tmp_proj.variables()["QMAKE_INTERNAL_PRL_LIBS"]; |
249 | wit != where.end(); ++wit) { | 313 | for(QStringList::iterator wit = where.begin(); |
250 | QStringList &l = tmp_proj.variables()[(*wit)]; | 314 | wit != where.end(); ++wit) { |
251 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 315 | QStringList &l = tmp_proj.variables()[(*wit)]; |
252 | QString opt = (*it); | 316 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
253 | if(!opt.startsWith("/")) //Not a switch | 317 | QString opt = (*it); |
254 | newDep->dependencies << opt.section(Option::dir_sep, -1); | 318 | if(!opt.startsWith("/") && // Not a switch |
319 | opt != newDep->target && // Not self | ||
320 | opt != "opengl32.lib" && // We don't care about these libs | ||
321 | opt != "glu32.lib" && // to make depgen alittle faster | ||
322 | opt != "kernel32.lib" && | ||
323 | opt != "user32.lib" && | ||
324 | opt != "gdi32.lib" && | ||
325 | opt != "comdlg32.lib" && | ||
326 | opt != "advapi32.lib" && | ||
327 | opt != "shell32.lib" && | ||
328 | opt != "ole32.lib" && | ||
329 | opt != "oleaut32.lib" && | ||
330 | opt != "uuid.lib" && | ||
331 | opt != "imm32.lib" && | ||
332 | opt != "winmm.lib" && | ||
333 | opt != "wsock32.lib" && | ||
334 | opt != "winspool.lib" && | ||
335 | opt != "delayimp.lib" ) | ||
336 | { | ||
337 | newDep->dependencies << opt.section(Option::dir_sep, -1); | ||
255 | } | 338 | } |
256 | } | 339 | } |
257 | } | 340 | } |
341 | #ifdef DEBUG_SOLUTION_GEN | ||
342 | qDebug( "Deps for %20s: [%s]", newDep->target.latin1(), newDep->dependencies.join(" :: " ).latin1() ); | ||
343 | #endif | ||
258 | solution_cleanup.append(newDep); | 344 | solution_cleanup.append(newDep); |
259 | solution_depends.insert(newDep->target, newDep); | 345 | solution_depends.insert(newDep->target, newDep); |
260 | { | 346 | t << _slnProjectBeg << _slnMSVCvcprojGUID << _slnProjectMid |
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); | ||
265 | } | ||
266 | t << _snlProjectBeg << _snlMSVCvcprojGUID << _snlProjectMid | ||
267 | << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile | 347 | << "\"" << newDep->orig_target << "\", \"" << newDep->vcprojFile |
268 | << "\", \"" << newDep->uuid << "\""; | 348 | << "\", \"" << newDep->uuid << "\""; |
269 | t << _snlProjectEnd; | 349 | t << _slnProjectEnd; |
270 | } | 350 | } |
271 | } | 351 | } |
272 | nextfile: | 352 | nextfile: |
273 | QDir::setCurrent(oldpwd); | 353 | QDir::setCurrent(oldpwd); |
274 | } | 354 | } |
275 | } | 355 | } |
276 | } | 356 | } |
277 | t << _snlGlobalBeg; | 357 | t << _slnGlobalBeg; |
278 | t << _snlSolutionConf; | 358 | t << _slnSolutionConf; |
279 | t << _snlProjDepBeg; | 359 | t << _slnProjDepBeg; |
360 | |||
361 | // Figure out dependencies | ||
280 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { | 362 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { |
363 | if(solution_cleanup.current()->targetType == StaticLib) | ||
364 | continue; // Shortcut, Static libs are not dep. | ||
281 | int cnt = 0; | 365 | int cnt = 0; |
282 | for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin(); | 366 | for(QStringList::iterator dit = solution_cleanup.current()->dependencies.begin(); |
283 | dit != solution_cleanup.current()->dependencies.end(); | 367 | dit != solution_cleanup.current()->dependencies.end(); |
284 | ++dit) { | 368 | ++dit) |
285 | VcsolutionDepend *vc; | 369 | { |
286 | if((vc=solution_depends[*dit])) { | 370 | VcsolutionDepend *vc = solution_depends[*dit]; |
287 | if(solution_cleanup.current()->targetType != StaticLib || vc->targetType == Application) | 371 | if(vc) |
288 | t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid; | 372 | t << "\n\t\t" << solution_cleanup.current()->uuid << "." << cnt++ << " = " << vc->uuid; |
289 | } | ||
290 | } | 373 | } |
291 | } | 374 | } |
292 | t << _snlProjDepEnd; | 375 | t << _slnProjDepEnd; |
293 | t << _snlProjConfBeg; | 376 | t << _slnProjConfBeg; |
294 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { | 377 | for(solution_cleanup.first(); solution_cleanup.current(); solution_cleanup.next()) { |
295 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag1; | 378 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjDbgConfTag1; |
296 | t << "\n\t\t" << solution_cleanup.current()->uuid << _snlProjConfTag2; | 379 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjDbgConfTag2; |
380 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjRelConfTag1; | ||
381 | t << "\n\t\t" << solution_cleanup.current()->uuid << _slnProjRelConfTag2; | ||
297 | } | 382 | } |
298 | t << _snlProjConfEnd; | 383 | t << _slnProjConfEnd; |
299 | t << _snlExtSections; | 384 | t << _slnExtSections; |
300 | t << _snlGlobalEnd; | 385 | t << _slnGlobalEnd; |
301 | } | 386 | } |
302 | 387 | ||
303 | // ------------------------------------------------------------------------------------------------ | 388 | // ------------------------------------------------------------------------------------------------ |
304 | // ------------------------------------------------------------------------------------------------ | 389 | // ------------------------------------------------------------------------------------------------ |
305 | 390 | ||
306 | void VcprojGenerator::init() | 391 | void VcprojGenerator::init() |
307 | { | 392 | { |
308 | if( init_flag ) | 393 | if( init_flag ) |
309 | return; | 394 | return; |
310 | if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs | 395 | if(project->first("TEMPLATE") == "vcsubdirs") { //too much work for subdirs |
311 | init_flag = TRUE; | 396 | init_flag = TRUE; |
312 | return; | 397 | return; |
313 | } | 398 | } |
314 | 399 | ||
315 | debug_msg(1, "Generator: MSVC.NET: Initializing variables" ); | 400 | debug_msg(1, "Generator: MSVC.NET: Initializing variables" ); |
316 | 401 | ||
317 | /* | 402 | /* |
318 | // Once to be nice and clean code... | 403 | // Once to be nice and clean code... |
319 | // Wouldn't life be great? | 404 | // Wouldn't life be great? |
320 | 405 | ||
321 | // Are we building Qt? | 406 | // Are we building Qt? |
322 | bool is_qt = | 407 | bool is_qt = |
323 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || | 408 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || |
324 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); | 409 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); |
325 | 410 | ||
326 | // Are we using Qt? | 411 | // Are we using Qt? |
327 | bool isQtActive = project->isActiveConfig("qt"); | 412 | bool isQtActive = project->isActiveConfig("qt"); |
328 | 413 | ||
329 | if ( isQtActive ) { | 414 | if ( isQtActive ) { |
330 | project->variables()["CONFIG"] += "moc"; | 415 | project->variables()["CONFIG"] += "moc"; |
331 | project->variables()["CONFIG"] += "windows"; | 416 | project->variables()["CONFIG"] += "windows"; |
332 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; | 417 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; |
333 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 418 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
334 | 419 | ||
335 | if( projectTarget == SharedLib ) | 420 | if( projectTarget == SharedLib ) |
336 | project->variables()["DEFINES"] += "QT_DLL"; | 421 | project->variables()["DEFINES"] += "QT_DLL"; |
337 | 422 | ||
338 | if( project->isActiveConfig("accessibility" ) ) | 423 | if( project->isActiveConfig("accessibility" ) ) |
339 | project->variables()["DEFINES"] += "QT_ACCESSIBILITY_SUPPORT"; | 424 | project->variables()["DEFINES"] += "QT_ACCESSIBILITY_SUPPORT"; |
340 | 425 | ||
341 | if ( project->isActiveConfig("plugin")) { | 426 | if ( project->isActiveConfig("plugin")) { |
342 | project->variables()["DEFINES"] += "QT_PLUGIN"; | 427 | project->variables()["DEFINES"] += "QT_PLUGIN"; |
343 | project->variables()["CONFIG"] += "dll"; | 428 | project->variables()["CONFIG"] += "dll"; |
344 | } | 429 | } |
345 | 430 | ||
346 | if( project->isActiveConfig("thread") ) { | 431 | if( project->isActiveConfig("thread") ) { |
347 | project->variables()["DEFINES"] += "QT_THREAD_SUPPORT"; | 432 | project->variables()["DEFINES"] += "QT_THREAD_SUPPORT"; |
348 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 433 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
349 | } else { | 434 | } else { |
350 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 435 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
351 | } | 436 | } |
352 | } | 437 | } |
353 | 438 | ||
354 | if ( project->isActiveConfig("opengl") ) { | 439 | if ( project->isActiveConfig("opengl") ) { |
355 | project->variables()["CONFIG"] += "windows"; // <-- Also in 'qt' above | 440 | project->variables()["CONFIG"] += "windows"; // <-- Also in 'qt' above |
356 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 441 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
357 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 442 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
358 | 443 | ||
359 | } | 444 | } |
360 | */ | 445 | */ |
361 | initOld(); // Currently calling old DSP code to set variables. CLEAN UP! | 446 | initOld(); // Currently calling old DSP code to set variables. CLEAN UP! |
362 | 447 | ||
363 | // Figure out what we're trying to build | 448 | // Figure out what we're trying to build |
364 | if ( project->first("TEMPLATE") == "vcapp" ) { | 449 | if ( project->first("TEMPLATE") == "vcapp" ) { |
365 | projectTarget = Application; | 450 | projectTarget = Application; |
366 | } else if ( project->first("TEMPLATE") == "vclib") { | 451 | } else if ( project->first("TEMPLATE") == "vclib") { |
367 | if ( project->isActiveConfig( "staticlib" ) ) | 452 | if ( project->isActiveConfig( "staticlib" ) ) |
368 | projectTarget = StaticLib; | 453 | projectTarget = StaticLib; |
369 | else | 454 | else |
370 | projectTarget = SharedLib; | 455 | projectTarget = SharedLib; |
371 | } | 456 | } |
457 | |||
458 | // Setup PCH variables | ||
459 | precompH = project->first("PRECOMPILED_HEADER"); | ||
460 | usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header"); | ||
461 | if (usePCH) { | ||
462 | precompHFilename = QFileInfo(precompH).fileName(); | ||
463 | // Created files | ||
464 | QString origTarget = project->first("QMAKE_ORIG_TARGET"); | ||
465 | precompObj = origTarget + Option::obj_ext; | ||
466 | precompPch = origTarget + ".pch"; | ||
467 | // Add PRECOMPILED_HEADER to HEADERS | ||
468 | if (!project->variables()["HEADERS"].contains(precompH)) | ||
469 | project->variables()["HEADERS"] += precompH; | ||
470 | // Return to variable pool | ||
471 | project->variables()["PRECOMPILED_OBJECT"] = precompObj; | ||
472 | project->variables()["PRECOMPILED_PCH"] = precompPch; | ||
473 | } | ||
474 | |||
372 | initProject(); // Fills the whole project with proper data | 475 | initProject(); // Fills the whole project with proper data |
373 | } | 476 | } |
374 | 477 | ||
375 | void VcprojGenerator::initProject() | 478 | void VcprojGenerator::initProject() |
376 | { | 479 | { |
377 | // Initialize XML sub elements | 480 | // Initialize XML sub elements |
378 | // - Do this first since project elements may need | 481 | // - Do this first since project elements may need |
379 | // - to know of certain configuration options | 482 | // - to know of certain configuration options |
380 | initConfiguration(); | 483 | initConfiguration(); |
381 | initSourceFiles(); | 484 | initSourceFiles(); |
382 | initHeaderFiles(); | 485 | initHeaderFiles(); |
383 | initMOCFiles(); | 486 | initMOCFiles(); |
384 | initUICFiles(); | 487 | initUICFiles(); |
385 | initFormsFiles(); | 488 | initFormsFiles(); |
386 | initTranslationFiles(); | 489 | initTranslationFiles(); |
387 | initLexYaccFiles(); | 490 | initLexYaccFiles(); |
388 | initResourceFiles(); | 491 | initResourceFiles(); |
389 | 492 | ||
390 | // Own elements ----------------------------- | 493 | // Own elements ----------------------------- |
391 | vcProject.Name = project->first("QMAKE_ORIG_TARGET"); | 494 | vcProject.Name = project->first("QMAKE_ORIG_TARGET"); |
392 | vcProject.Version = "7.00"; | 495 | vcProject.Version = use_net2003_version() ? "7.10" : "7.00"; |
393 | vcProject.PlatformName = ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 496 | vcProject.ProjectGUID = getProjectUUID().toString().upper(); |
497 | vcProject.PlatformName = ( vcProject.Configuration[0].idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | ||
394 | // These are not used by Qt, but may be used by customers | 498 | // These are not used by Qt, but may be used by customers |
395 | vcProject.SccProjectName = project->first("SCCPROJECTNAME"); | 499 | vcProject.SccProjectName = project->first("SCCPROJECTNAME"); |
396 | vcProject.SccLocalPath = project->first("SCCLOCALPATH"); | 500 | vcProject.SccLocalPath = project->first("SCCLOCALPATH"); |
397 | } | 501 | } |
398 | 502 | ||
399 | void VcprojGenerator::initConfiguration() | 503 | void VcprojGenerator::initConfiguration() |
400 | { | 504 | { |
401 | // Initialize XML sub elements | 505 | // Initialize XML sub elements |
402 | // - Do this first since main configuration elements may need | 506 | // - Do this first since main configuration elements may need |
403 | // - to know of certain compiler/linker options | 507 | // - to know of certain compiler/linker options |
404 | initCompilerTool(); | 508 | initCompilerTool(); |
405 | if ( projectTarget == StaticLib ) | 509 | if ( projectTarget == StaticLib ) |
406 | initLibrarianTool(); | 510 | initLibrarianTool(); |
407 | else | 511 | else |
408 | initLinkerTool(); | 512 | initLinkerTool(); |
409 | initIDLTool(); | 513 | initIDLTool(); |
410 | 514 | ||
411 | // Own elements ----------------------------- | 515 | // Own elements ----------------------------- |
412 | QString temp = project->first("BuildBrowserInformation"); | 516 | QString temp = project->first("BuildBrowserInformation"); |
413 | switch ( projectTarget ) { | 517 | switch ( projectTarget ) { |
414 | case SharedLib: | 518 | case SharedLib: |
415 | vcProject.Configuration.ConfigurationType = typeDynamicLibrary; | 519 | vcProject.Configuration[0].ConfigurationType = typeDynamicLibrary; |
416 | break; | 520 | break; |
417 | case StaticLib: | 521 | case StaticLib: |
418 | vcProject.Configuration.ConfigurationType = typeStaticLibrary; | 522 | vcProject.Configuration[0].ConfigurationType = typeStaticLibrary; |
419 | break; | 523 | break; |
420 | case Application: | 524 | case Application: |
421 | default: | 525 | default: |
422 | vcProject.Configuration.ConfigurationType = typeApplication; | 526 | vcProject.Configuration[0].ConfigurationType = typeApplication; |
423 | break; | 527 | break; |
424 | } | 528 | } |
425 | vcProject.Configuration.Name = ( project->isActiveConfig( "debug" ) ? "Debug|" : "Release|" ); | 529 | |
426 | vcProject.Configuration.Name += ( vcProject.Configuration.idl.TargetEnvironment == midlTargetWin64 ? "Win64" : "Win32" ); | 530 | // Release version of the Configuration --------------- |
427 | vcProject.Configuration.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); | 531 | VCConfiguration &RConf = vcProject.Configuration[0]; |
428 | vcProject.Configuration.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() ); | 532 | RConf.Name = "Release"; |
533 | RConf.Name += ( RConf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32" ); | ||
534 | RConf.ATLMinimizesCRunTimeLibraryUsage = ( project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True ); | ||
535 | RConf.BuildBrowserInformation = triState( temp.isEmpty() ? (short)unset : temp.toShort() ); | ||
429 | temp = project->first("CharacterSet"); | 536 | temp = project->first("CharacterSet"); |
430 | vcProject.Configuration.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() ); | 537 | RConf.CharacterSet = charSet( temp.isEmpty() ? (short)charSetNotSet : temp.toShort() ); |
431 | vcProject.Configuration.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); | 538 | RConf.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); |
432 | vcProject.Configuration.ImportLibrary = vcProject.Configuration.linker.ImportLibrary; | 539 | RConf.ImportLibrary = RConf.linker.ImportLibrary; |
433 | vcProject.Configuration.IntermediateDirectory = project->first("OBJECTS_DIR"); | 540 | RConf.IntermediateDirectory = project->first("OBJECTS_DIR"); |
434 | // temp = (projectTarget == StaticLib) ? project->first("DESTDIR"):project->first("DLLDESTDIR"); | 541 | RConf.OutputDirectory = "."; |
435 | vcProject.Configuration.OutputDirectory = "."; //( temp.isEmpty() ? QString(".") : temp ); | 542 | RConf.PrimaryOutput = project->first("PrimaryOutput"); |
436 | vcProject.Configuration.PrimaryOutput = project->first("PrimaryOutput"); | 543 | RConf.WholeProgramOptimization = RConf.compiler.WholeProgramOptimization; |
437 | vcProject.Configuration.WholeProgramOptimization = vcProject.Configuration.compiler.WholeProgramOptimization; | ||
438 | temp = project->first("UseOfATL"); | 544 | temp = project->first("UseOfATL"); |
439 | if ( !temp.isEmpty() ) | 545 | if ( !temp.isEmpty() ) |
440 | vcProject.Configuration.UseOfATL = useOfATL( temp.toShort() ); | 546 | RConf.UseOfATL = useOfATL( temp.toShort() ); |
441 | temp = project->first("UseOfMfc"); | 547 | temp = project->first("UseOfMfc"); |
442 | if ( !temp.isEmpty() ) | 548 | if ( !temp.isEmpty() ) |
443 | vcProject.Configuration.UseOfMfc = useOfMfc( temp.toShort() ); | 549 | RConf.UseOfMfc = useOfMfc( temp.toShort() ); |
444 | 550 | ||
445 | // Configuration does not need parameters from | 551 | // Configuration does not need parameters from |
446 | // these sub XML items; | 552 | // these sub XML items; |
447 | initCustomBuildTool(); | 553 | initCustomBuildTool(); |
448 | initPreBuildEventTools(); | 554 | initPreBuildEventTools(); |
449 | initPostBuildEventTools(); | 555 | initPostBuildEventTools(); |
450 | initPreLinkEventTools(); | 556 | initPreLinkEventTools(); |
557 | |||
558 | // Debug version of the Configuration ----------------- | ||
559 | VCConfiguration DConf = vcProject.Configuration[0]; // Create copy configuration for debug | ||
560 | DConf.Name = "Debug"; | ||
561 | DConf.Name += ( DConf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32" ); | ||
562 | |||
563 | // Set definite values in both configurations | ||
564 | DConf.compiler.PreprocessorDefinitions.remove("NDEBUG"); | ||
565 | RConf.compiler.PreprocessorDefinitions += "NDEBUG"; | ||
566 | RConf.linker.GenerateDebugInformation = _False; | ||
567 | DConf.linker.GenerateDebugInformation = _True; | ||
568 | |||
569 | // Modify configurations, based on Qt build | ||
570 | if ( project->isActiveConfig("debug") ) { | ||
571 | RConf.IntermediateDirectory = | ||
572 | RConf.compiler.AssemblerListingLocation = | ||
573 | RConf.compiler.ObjectFile = "Release\\"; | ||
574 | RConf.librarian.OutputFile = | ||
575 | RConf.linker.OutputFile = RConf.IntermediateDirectory + "\\" + project->first("MSVCPROJ_TARGET"); | ||
576 | RConf.linker.parseOptions(project->variables()["QMAKE_LFLAGS_RELEASE"]); | ||
577 | RConf.compiler.parseOptions(project->variables()["QMAKE_CFLAGS_RELEASE"]); | ||
578 | } else { | ||
579 | DConf.IntermediateDirectory = | ||
580 | DConf.compiler.AssemblerListingLocation = | ||
581 | DConf.compiler.ObjectFile = "Debug\\"; | ||
582 | DConf.librarian.OutputFile = | ||
583 | DConf.linker.OutputFile = DConf.IntermediateDirectory + "\\" + project->first("MSVCPROJ_TARGET"); | ||
584 | DConf.linker.DelayLoadDLLs.clear(); | ||
585 | DConf.compiler.parseOptions(project->variables()["QMAKE_CFLAGS_DEBUG"]); | ||
586 | } | ||
587 | |||
588 | // Add Debug configuration to project | ||
589 | vcProject.Configuration += DConf; | ||
451 | } | 590 | } |
452 | 591 | ||
453 | void VcprojGenerator::initCompilerTool() | 592 | void VcprojGenerator::initCompilerTool() |
454 | { | 593 | { |
455 | QString placement = project->first("OBJECTS_DIR"); | 594 | QString placement = project->first("OBJECTS_DIR"); |
456 | if ( placement.isEmpty() ) | 595 | if ( placement.isEmpty() ) |
457 | placement = ".\\"; | 596 | placement = ".\\"; |
458 | 597 | ||
459 | vcProject.Configuration.compiler.AssemblerListingLocation = placement ; | 598 | VCConfiguration &RConf = vcProject.Configuration[0]; |
460 | vcProject.Configuration.compiler.ProgramDataBaseFileName = placement ; | 599 | RConf.compiler.AssemblerListingLocation = placement ; |
461 | vcProject.Configuration.compiler.ObjectFile = placement ; | 600 | RConf.compiler.ProgramDataBaseFileName = ".\\" ; |
462 | vcProject.Configuration.compiler.PrecompiledHeaderFile = placement + project->first("QMAKE_ORIG_TARGET") + ".pch"; | 601 | RConf.compiler.ObjectFile = placement ; |
602 | // PCH | ||
603 | if ( usePCH ) { | ||
604 | RConf.compiler.UsePrecompiledHeader = pchUseUsingSpecific; | ||
605 | RConf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch; | ||
606 | RConf.compiler.PrecompiledHeaderThrough = precompHFilename; | ||
607 | RConf.compiler.ForcedIncludeFiles = precompHFilename; | ||
608 | // Minimal build option triggers an Internal Compiler Error | ||
609 | // when used in conjunction with /FI and /Yu, so remove it | ||
610 | project->variables()["QMAKE_CFLAGS_DEBUG"].remove("-Gm"); | ||
611 | project->variables()["QMAKE_CFLAGS_DEBUG"].remove("/Gm"); | ||
612 | project->variables()["QMAKE_CXXFLAGS_DEBUG"].remove("-Gm"); | ||
613 | project->variables()["QMAKE_CXXFLAGS_DEBUG"].remove("/Gm"); | ||
614 | } | ||
463 | 615 | ||
464 | if ( project->isActiveConfig("debug") ){ | 616 | if ( project->isActiveConfig("debug") ){ |
465 | // Debug version | 617 | // Debug version |
466 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 618 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
467 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); | 619 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_DEBUG"] ); |
468 | if ( project->isActiveConfig("thread") ) { | 620 | if ( project->isActiveConfig("thread") ) { |
469 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 621 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
470 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); | 622 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); |
471 | else | 623 | else |
472 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); | 624 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"] ); |
473 | } else { | 625 | } else { |
474 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST_DBG"] ); | 626 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DBG"] ); |
475 | } | 627 | } |
476 | } else { | 628 | } else { |
477 | // Release version | 629 | // Release version |
478 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); | 630 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS"] ); |
479 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); | 631 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_RELEASE"] ); |
480 | vcProject.Configuration.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; | 632 | RConf.compiler.PreprocessorDefinitions += "QT_NO_DEBUG"; |
481 | vcProject.Configuration.compiler.PreprocessorDefinitions += "NDEBUG"; | 633 | RConf.compiler.PreprocessorDefinitions += "NDEBUG"; |
482 | if ( project->isActiveConfig("thread") ) { | 634 | if ( project->isActiveConfig("thread") ) { |
483 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) | 635 | if ( (projectTarget == Application) || (projectTarget == StaticLib) ) |
484 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); | 636 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); |
485 | else | 637 | else |
486 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); | 638 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT_DLL"] ); |
487 | } else { | 639 | } else { |
488 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_ST"] ); | 640 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_MT"] ); |
489 | } | 641 | } |
490 | } | 642 | } |
491 | 643 | ||
492 | // Common for both release and debug | 644 | // Common for both release and debug |
493 | if ( project->isActiveConfig("warn_off") ) | 645 | if ( project->isActiveConfig("warn_off") ) |
494 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); | 646 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_OFF"] ); |
495 | else if ( project->isActiveConfig("warn_on") ) | 647 | else if ( project->isActiveConfig("warn_on") ) |
496 | vcProject.Configuration.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); | 648 | RConf.compiler.parseOptions( project->variables()["QMAKE_CXXFLAGS_WARN_ON"] ); |
497 | if ( project->isActiveConfig("windows") ) | 649 | if ( project->isActiveConfig("windows") ) |
498 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; | 650 | RConf.compiler.PreprocessorDefinitions += project->variables()["MSVCPROJ_WINCONDEF"]; |
499 | 651 | ||
500 | // Can this be set for ALL configs? | 652 | // Can this be set for ALL configs? |
501 | // If so, use qmake.conf! | 653 | // If so, use qmake.conf! |
502 | if ( projectTarget == SharedLib ) | 654 | if ( projectTarget == SharedLib ) |
503 | vcProject.Configuration.compiler.PreprocessorDefinitions += "_WINDOWS"; | 655 | RConf.compiler.PreprocessorDefinitions += "_WINDOWS"; |
504 | 656 | ||
505 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; | 657 | RConf.compiler.PreprocessorDefinitions += project->variables()["DEFINES"]; |
506 | vcProject.Configuration.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; | 658 | RConf.compiler.PreprocessorDefinitions += project->variables()["PRL_EXPORT_DEFINES"]; |
507 | vcProject.Configuration.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); | 659 | QStringList::iterator it; |
660 | for(it=RConf.compiler.PreprocessorDefinitions.begin(); | ||
661 | it!=RConf.compiler.PreprocessorDefinitions.end(); | ||
662 | ++it) | ||
663 | (*it).replace('\"', """); | ||
664 | |||
665 | RConf.compiler.parseOptions( project->variables()["MSVCPROJ_INCPATH"] ); | ||
508 | } | 666 | } |
509 | 667 | ||
510 | void VcprojGenerator::initLibrarianTool() | 668 | void VcprojGenerator::initLibrarianTool() |
511 | { | 669 | { |
512 | vcProject.Configuration.librarian.OutputFile = project->first( "DESTDIR" ); | 670 | VCConfiguration &RConf = vcProject.Configuration[0]; |
513 | if( vcProject.Configuration.librarian.OutputFile.isEmpty() ) | 671 | RConf.librarian.OutputFile = project->first( "DESTDIR" ); |
514 | vcProject.Configuration.librarian.OutputFile = ".\\"; | 672 | if( RConf.librarian.OutputFile.isEmpty() ) |
673 | RConf.librarian.OutputFile = ".\\"; | ||
515 | 674 | ||
516 | if( !vcProject.Configuration.librarian.OutputFile.endsWith("\\") ) | 675 | if( !RConf.librarian.OutputFile.endsWith("\\") ) |
517 | vcProject.Configuration.librarian.OutputFile += '\\'; | 676 | RConf.librarian.OutputFile += '\\'; |
518 | 677 | ||
519 | vcProject.Configuration.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); | 678 | RConf.librarian.OutputFile += project->first("MSVCPROJ_TARGET"); |
520 | } | 679 | } |
521 | 680 | ||
522 | void VcprojGenerator::initLinkerTool() | 681 | void VcprojGenerator::initLinkerTool() |
523 | { | 682 | { |
524 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); | 683 | VCConfiguration &RConf = vcProject.Configuration[0]; |
525 | vcProject.Configuration.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; | 684 | RConf.linker.parseOptions( project->variables()["MSVCPROJ_LFLAGS"] ); |
685 | RConf.linker.AdditionalDependencies += project->variables()["MSVCPROJ_LIBS"]; | ||
526 | 686 | ||
527 | switch ( projectTarget ) { | 687 | switch ( projectTarget ) { |
528 | case Application: | 688 | case Application: |
529 | vcProject.Configuration.linker.OutputFile = project->first( "DESTDIR" ); | 689 | RConf.linker.OutputFile = project->first( "DESTDIR" ); |
530 | break; | 690 | break; |
531 | case SharedLib: | 691 | case SharedLib: |
532 | vcProject.Configuration.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); | 692 | RConf.linker.parseOptions( project->variables()["MSVCPROJ_LIBOPTIONS"] ); |
533 | vcProject.Configuration.linker.OutputFile = project->first( "DLLDESTDIR" ); | 693 | RConf.linker.OutputFile = project->first( "DESTDIR" ); |
534 | break; | 694 | break; |
535 | case StaticLib: //unhandled - added to remove warnings.. | 695 | case StaticLib: //unhandled - added to remove warnings.. |
536 | break; | 696 | break; |
537 | } | 697 | } |
538 | 698 | ||
539 | if( vcProject.Configuration.linker.OutputFile.isEmpty() ) | 699 | if( RConf.linker.OutputFile.isEmpty() ) |
540 | vcProject.Configuration.linker.OutputFile = ".\\"; | 700 | RConf.linker.OutputFile = ".\\"; |
541 | 701 | ||
542 | if( !vcProject.Configuration.linker.OutputFile.endsWith("\\") ) | 702 | if( !RConf.linker.OutputFile.endsWith("\\") ) |
543 | vcProject.Configuration.linker.OutputFile += '\\'; | 703 | RConf.linker.OutputFile += '\\'; |
544 | 704 | ||
545 | vcProject.Configuration.linker.OutputFile += project->first("MSVCPROJ_TARGET"); | 705 | RConf.linker.OutputFile += project->first("MSVCPROJ_TARGET"); |
546 | vcProject.Configuration.linker.ProgramDatabaseFile = project->first("OBJECTS_DIR") + project->first("QMAKE_ORIG_TARGET") + ".pdb"; | ||
547 | 706 | ||
548 | if ( project->isActiveConfig("debug") ){ | 707 | if ( project->isActiveConfig("debug") ){ |
549 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); | 708 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_DEBUG"] ); |
550 | } else { | 709 | } else { |
551 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); | 710 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_RELEASE"] ); |
552 | } | 711 | } |
553 | 712 | ||
554 | if ( project->isActiveConfig("dll") ){ | 713 | if ( project->isActiveConfig("dll") ){ |
555 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] ); | 714 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_QT_DLL"] ); |
556 | } | 715 | } |
557 | 716 | ||
558 | if ( project->isActiveConfig("console") ){ | 717 | if ( project->isActiveConfig("console") ){ |
559 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] ); | 718 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_CONSOLE"] ); |
560 | } else { | 719 | } else { |
561 | vcProject.Configuration.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] ); | 720 | RConf.linker.parseOptions( project->variables()["QMAKE_LFLAGS_WINDOWS"] ); |
562 | } | 721 | } |
563 | 722 | ||
564 | } | 723 | } |
565 | 724 | ||
566 | void VcprojGenerator::initIDLTool() | 725 | void VcprojGenerator::initIDLTool() |
567 | { | 726 | { |
568 | } | 727 | } |
569 | 728 | ||
570 | void VcprojGenerator::initCustomBuildTool() | 729 | void VcprojGenerator::initCustomBuildTool() |
571 | { | 730 | { |
572 | } | 731 | } |
573 | 732 | ||
574 | void VcprojGenerator::initPreBuildEventTools() | 733 | void VcprojGenerator::initPreBuildEventTools() |
575 | { | 734 | { |
576 | QString collectionName = project->first("QMAKE_IMAGE_COLLECTION"); | ||
577 | if( !collectionName.isEmpty() ) { | ||
578 | QStringList& list = project->variables()["IMAGES"]; | ||
579 | vcProject.Configuration.preBuild.Description = "Generate imagecollection"; | ||
580 | //vcProject.Configuration.preBuild.AdditionalDependencies += list; | ||
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; | ||
592 | //vcProject.Configuration.preBuild.Outputs = collectionName; | ||
593 | |||
594 | } | ||
595 | } | 735 | } |
596 | 736 | ||
597 | void VcprojGenerator::initPostBuildEventTools() | 737 | void VcprojGenerator::initPostBuildEventTools() |
598 | { | 738 | { |
739 | VCConfiguration &RConf = vcProject.Configuration[0]; | ||
599 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) { | 740 | if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) { |
600 | vcProject.Configuration.postBuild.Description = var("QMAKE_POST_LINK"); | 741 | RConf.postBuild.Description = var("QMAKE_POST_LINK"); |
601 | vcProject.Configuration.postBuild.CommandLine = var("QMAKE_POST_LINK"); | 742 | RConf.postBuild.CommandLine = var("QMAKE_POST_LINK"); |
743 | RConf.postBuild.Description.replace(" && ", " && "); | ||
744 | RConf.postBuild.CommandLine.replace(" && ", " && "); | ||
745 | } | ||
746 | if ( !project->variables()["MSVCPROJ_COPY_DLL"].isEmpty() ) { | ||
747 | if ( !RConf.postBuild.CommandLine.isEmpty() ) | ||
748 | RConf.postBuild.CommandLine += " && "; | ||
749 | RConf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC"); | ||
750 | RConf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL"); | ||
602 | } | 751 | } |
603 | if( project->isActiveConfig( "activeqt" ) ) { | 752 | if( project->isActiveConfig( "activeqt" ) ) { |
604 | QString name = project->first( "QMAKE_ORIG_TARGET" ); | 753 | QString name = project->first( "QMAKE_ORIG_TARGET" ); |
605 | QString nameext = project->first( "TARGET" ); | 754 | QString nameext = project->first( "TARGET" ); |
606 | QString objdir = project->first( "OBJECTS_DIR" ); | 755 | QString objdir = project->first( "OBJECTS_DIR" ); |
607 | QString idc = project->first( "QMAKE_IDC" ); | 756 | QString idc = project->first( "QMAKE_IDC" ); |
608 | 757 | ||
609 | vcProject.Configuration.postBuild.Description = "Finalizing ActiveQt server..."; | 758 | RConf.postBuild.Description = "Finalizing ActiveQt server..."; |
610 | if ( !vcProject.Configuration.postBuild.CommandLine.isEmpty() ) | 759 | if ( !RConf.postBuild.CommandLine.isEmpty() ) |
611 | vcProject.Configuration.postBuild.CommandLine += " && "; | 760 | RConf.postBuild.CommandLine += " && "; |
612 | 761 | ||
613 | if( project->isActiveConfig( "dll" ) ) { // In process | 762 | if( project->isActiveConfig( "dll" ) ) { // In process |
614 | vcProject.Configuration.postBuild.CommandLine += | 763 | RConf.postBuild.CommandLine += |
615 | // call idc to generate .idl file from .dll | 764 | // call idc to generate .idl file from .dll |
616 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " -idl " + objdir + name + ".idl -version 1.0 && " + | 765 | idc + " "$(TargetPath)" -idl " + objdir + name + ".idl -version 1.0 && " + |
617 | // call midl to create implementations of the .idl file | 766 | // call midl to create implementations of the .idl file |
618 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 767 | project->first( "QMAKE_IDL" ) + " /nologo " + objdir + name + ".idl /tlb " + objdir + name + ".tlb && " + |
619 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | ||
620 | objdir + "dump.midl && " + | ||
621 | // call idc to replace tlb... | 768 | // call idc to replace tlb... |
622 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 769 | idc + " "$(TargetPath)" /tlb " + objdir + name + ".tlb && " + |
623 | // register server | 770 | // register server |
624 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /regserver"; | 771 | idc + " "$(TargetPath)" /regserver"; |
625 | } else { // out of process | 772 | } else { // out of process |
626 | vcProject.Configuration.postBuild.CommandLine = | 773 | RConf.postBuild.CommandLine = |
627 | // call application to dump idl | 774 | // call application to dump idl |
628 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -dumpidl " + objdir + name + ".idl -version 1.0 && " + | 775 | ""$(TargetPath)" -dumpidl " + objdir + name + ".idl -version 1.0 && " + |
629 | // call midl to create implementations of the .idl file | 776 | // call midl to create implementations of the .idl file |
630 | project->first( "QMAKE_IDL" ) + " " + objdir + name + ".idl /nologo /o " + objdir + name + ".midl /tlb " + objdir + name + ".tlb /iid " + objdir + | 777 | project->first( "QMAKE_IDL" ) + " /nologo " + objdir + name + ".idl /tlb " + objdir + name + ".tlb && " + |
631 | "dump.midl /dlldata " + objdir + "dump.midl /cstub " + objdir + "dump.midl /header " + objdir + "dump.midl /proxy " + objdir + "dump.midl /sstub " + | ||
632 | objdir + "dump.midl && " + | ||
633 | // call idc to replace tlb... | 778 | // call idc to replace tlb... |
634 | idc + " " + vcProject.Configuration.OutputDirectory + "\\" + nameext + " /tlb " + objdir + name + ".tlb && " + | 779 | idc + " "$(TargetPath)" /tlb " + objdir + name + ".tlb && " + |
635 | // call app to register | 780 | // call app to register |
636 | vcProject.Configuration.OutputDirectory + "\\" + nameext + " -regserver"; | 781 | ""$(TargetPath)" -regserver"; |
637 | } | 782 | } |
638 | } | 783 | } |
639 | } | 784 | } |
640 | 785 | ||
641 | void VcprojGenerator::initPreLinkEventTools() | 786 | void VcprojGenerator::initPreLinkEventTools() |
642 | { | 787 | { |
643 | } | 788 | } |
644 | 789 | ||
790 | |||
791 | // ------------------------------------------------------------------ | ||
792 | // Helper functions to do proper sorting of the | ||
793 | // qstringlists, for both flat and non-flat modes. | ||
794 | inline bool XLessThanY( QString &x, QString &y, bool flat_mode ) | ||
795 | { | ||
796 | if ( flat_mode ) { | ||
797 | QString subX = x.mid( x.findRev('\\')+1 ); | ||
798 | QString subY = y.mid( y.findRev('\\')+1 ); | ||
799 | return QString::compare(subX, subY) < 0; | ||
800 | } | ||
801 | |||
802 | int xPos = 0; | ||
803 | int yPos = 0; | ||
804 | int xSlashPos; | ||
805 | int ySlashPos; | ||
806 | for (;;) { | ||
807 | xSlashPos = x.find('\\', xPos); | ||
808 | ySlashPos = y.find('\\', yPos); | ||
809 | |||
810 | if (xSlashPos == -1 && ySlashPos != -1) { | ||
811 | return false; | ||
812 | } else if (xSlashPos != -1 && ySlashPos == -1) { | ||
813 | return true; | ||
814 | } else if (xSlashPos == -1 /* && yySlashPos == -1 */) { | ||
815 | QString subX = x.mid(xPos); | ||
816 | QString subY = y.mid(yPos); | ||
817 | return QString::compare(subX, subY) < 0; | ||
818 | } else { | ||
819 | QString subX = x.mid(xPos, xSlashPos - xPos); | ||
820 | QString subY = y.mid(yPos, ySlashPos - yPos); | ||
821 | int cmp = QString::compare(subX, subY); | ||
822 | if (cmp != 0) | ||
823 | return cmp < 0; | ||
824 | } | ||
825 | xPos = xSlashPos + 1; | ||
826 | yPos = ySlashPos + 1; | ||
827 | } | ||
828 | return false; | ||
829 | } | ||
830 | void nonflatDir_BubbleSort( QStringList& list, bool flat_mode ) | ||
831 | { | ||
832 | QStringList::Iterator b = list.begin(); | ||
833 | QStringList::Iterator e = list.end(); | ||
834 | QStringList::Iterator last = e; | ||
835 | --last; // goto last | ||
836 | if ( last == b )// shortcut | ||
837 | return; | ||
838 | while( b != last ) {// sort them | ||
839 | bool swapped = FALSE; | ||
840 | QStringList::Iterator swap_pos = b; | ||
841 | QStringList::Iterator x = e; | ||
842 | QStringList::Iterator y = x; | ||
843 | --y; | ||
844 | QString swap_str; | ||
845 | do { | ||
846 | --x; | ||
847 | --y; | ||
848 | if ( XLessThanY(*x,*y, flat_mode) ) { | ||
849 | swapped = TRUE; | ||
850 | swap_str = (*x); // Swap ------- | ||
851 | (*x) = (*y); | ||
852 | (*y) = swap_str; // ------------ | ||
853 | swap_pos = y; | ||
854 | } | ||
855 | } while( y != b ); | ||
856 | if ( !swapped ) | ||
857 | return; | ||
858 | b = swap_pos; | ||
859 | ++b; | ||
860 | } | ||
861 | } | ||
862 | // ------------------------------------------------------------------ | ||
863 | |||
645 | void VcprojGenerator::initSourceFiles() | 864 | void VcprojGenerator::initSourceFiles() |
646 | { | 865 | { |
866 | vcProject.SourceFiles.flat_files = project->isActiveConfig("flat"); | ||
647 | vcProject.SourceFiles.Name = "Source Files"; | 867 | vcProject.SourceFiles.Name = "Source Files"; |
648 | vcProject.SourceFiles.Filter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"; | 868 | vcProject.SourceFiles.Filter = "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"; |
649 | vcProject.SourceFiles.Files += project->variables()["SOURCES"]; | 869 | vcProject.SourceFiles.Files += project->variables()["SOURCES"]; |
650 | vcProject.SourceFiles.Files.sort(); | 870 | nonflatDir_BubbleSort( vcProject.SourceFiles.Files, |
871 | vcProject.SourceFiles.flat_files ); | ||
651 | vcProject.SourceFiles.Project = this; | 872 | vcProject.SourceFiles.Project = this; |
652 | vcProject.SourceFiles.Config = &(vcProject.Configuration); | 873 | vcProject.SourceFiles.Config = &(vcProject.Configuration); |
653 | vcProject.SourceFiles.CustomBuild = none; | 874 | vcProject.SourceFiles.CustomBuild = none; |
654 | } | 875 | } |
655 | 876 | ||
656 | void VcprojGenerator::initHeaderFiles() | 877 | void VcprojGenerator::initHeaderFiles() |
657 | { | 878 | { |
879 | vcProject.HeaderFiles.flat_files = project->isActiveConfig("flat"); | ||
658 | vcProject.HeaderFiles.Name = "Header Files"; | 880 | vcProject.HeaderFiles.Name = "Header Files"; |
659 | vcProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl"; | 881 | vcProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl"; |
660 | vcProject.HeaderFiles.Files += project->variables()["HEADERS"]; | 882 | vcProject.HeaderFiles.Files += project->variables()["HEADERS"]; |
661 | vcProject.HeaderFiles.Files.sort(); | 883 | if (usePCH) { // Generated PCH cpp file |
884 | if (!vcProject.HeaderFiles.Files.contains(precompH)) | ||
885 | vcProject.HeaderFiles.Files += precompH; | ||
886 | } | ||
887 | nonflatDir_BubbleSort( vcProject.HeaderFiles.Files, | ||
888 | vcProject.HeaderFiles.flat_files ); | ||
662 | vcProject.HeaderFiles.Project = this; | 889 | vcProject.HeaderFiles.Project = this; |
663 | vcProject.HeaderFiles.Config = &(vcProject.Configuration); | 890 | vcProject.HeaderFiles.Config = &(vcProject.Configuration); |
664 | vcProject.HeaderFiles.CustomBuild = moc; | 891 | vcProject.HeaderFiles.CustomBuild = moc; |
665 | } | 892 | } |
666 | 893 | ||
667 | void VcprojGenerator::initMOCFiles() | 894 | void VcprojGenerator::initMOCFiles() |
668 | { | 895 | { |
896 | vcProject.MOCFiles.flat_files = project->isActiveConfig("flat"); | ||
669 | vcProject.MOCFiles.Name = "Generated MOC Files"; | 897 | vcProject.MOCFiles.Name = "Generated MOC Files"; |
670 | vcProject.MOCFiles.Filter = "cpp;c;cxx;moc"; | 898 | vcProject.MOCFiles.Filter = "cpp;c;cxx;moc"; |
671 | vcProject.MOCFiles.Files += project->variables()["SRCMOC"]; | 899 | vcProject.MOCFiles.Files += project->variables()["SRCMOC"]; |
672 | vcProject.MOCFiles.Files.sort(); | 900 | nonflatDir_BubbleSort( vcProject.MOCFiles.Files, |
901 | vcProject.MOCFiles.flat_files ); | ||
673 | vcProject.MOCFiles.Project = this; | 902 | vcProject.MOCFiles.Project = this; |
674 | vcProject.MOCFiles.Config = &(vcProject.Configuration); | 903 | vcProject.MOCFiles.Config = &(vcProject.Configuration); |
675 | vcProject.MOCFiles.CustomBuild = moc; | 904 | vcProject.MOCFiles.CustomBuild = moc; |
676 | } | 905 | } |
677 | 906 | ||
678 | void VcprojGenerator::initUICFiles() | 907 | void VcprojGenerator::initUICFiles() |
679 | { | 908 | { |
680 | vcProject.UICFiles.Name = "Generated UI Files"; | 909 | vcProject.UICFiles.flat_files = project->isActiveConfig("flat"); |
910 | vcProject.UICFiles.Name = "Generated Form Files"; | ||
681 | vcProject.UICFiles.Filter = "cpp;c;cxx;h;hpp;hxx;"; | 911 | vcProject.UICFiles.Filter = "cpp;c;cxx;h;hpp;hxx;"; |
682 | vcProject.UICFiles.Project = this; | 912 | vcProject.UICFiles.Project = this; |
683 | vcProject.UICFiles.Files += project->variables()["UICDECLS"]; | 913 | vcProject.UICFiles.Files += project->variables()["UICDECLS"]; |
684 | vcProject.UICFiles.Files += project->variables()["UICIMPLS"]; | 914 | vcProject.UICFiles.Files += project->variables()["UICIMPLS"]; |
685 | vcProject.UICFiles.Files.sort(); | 915 | nonflatDir_BubbleSort( vcProject.UICFiles.Files, |
916 | vcProject.UICFiles.flat_files ); | ||
686 | vcProject.UICFiles.Config = &(vcProject.Configuration); | 917 | vcProject.UICFiles.Config = &(vcProject.Configuration); |
687 | vcProject.UICFiles.CustomBuild = none; | 918 | vcProject.UICFiles.CustomBuild = none; |
688 | } | 919 | } |
689 | 920 | ||
690 | void VcprojGenerator::initFormsFiles() | 921 | void VcprojGenerator::initFormsFiles() |
691 | { | 922 | { |
923 | vcProject.FormFiles.flat_files = project->isActiveConfig("flat"); | ||
692 | vcProject.FormFiles.Name = "Forms"; | 924 | vcProject.FormFiles.Name = "Forms"; |
693 | vcProject.FormFiles.ParseFiles = _False; | 925 | vcProject.FormFiles.ParseFiles = _False; |
694 | vcProject.FormFiles.Filter = "ui"; | 926 | vcProject.FormFiles.Filter = "ui"; |
695 | vcProject.FormFiles.Files += project->variables()["FORMS"]; | 927 | vcProject.FormFiles.Files += project->variables()["FORMS"]; |
696 | vcProject.FormFiles.Files.sort(); | 928 | nonflatDir_BubbleSort( vcProject.FormFiles.Files, |
929 | vcProject.FormFiles.flat_files ); | ||
697 | vcProject.FormFiles.Project = this; | 930 | vcProject.FormFiles.Project = this; |
698 | vcProject.FormFiles.Config = &(vcProject.Configuration); | 931 | vcProject.FormFiles.Config = &(vcProject.Configuration); |
699 | vcProject.FormFiles.CustomBuild = uic; | 932 | vcProject.FormFiles.CustomBuild = uic; |
700 | } | 933 | } |
701 | 934 | ||
702 | void VcprojGenerator::initTranslationFiles() | 935 | void VcprojGenerator::initTranslationFiles() |
703 | { | 936 | { |
937 | vcProject.TranslationFiles.flat_files = project->isActiveConfig("flat"); | ||
704 | vcProject.TranslationFiles.Name = "Translations Files"; | 938 | vcProject.TranslationFiles.Name = "Translations Files"; |
705 | vcProject.TranslationFiles.ParseFiles = _False; | 939 | vcProject.TranslationFiles.ParseFiles = _False; |
706 | vcProject.TranslationFiles.Filter = "ts"; | 940 | vcProject.TranslationFiles.Filter = "ts"; |
707 | vcProject.TranslationFiles.Files += project->variables()["TRANSLATIONS"]; | 941 | vcProject.TranslationFiles.Files += project->variables()["TRANSLATIONS"]; |
708 | vcProject.TranslationFiles.Files.sort(); | 942 | nonflatDir_BubbleSort( vcProject.TranslationFiles.Files, |
943 | vcProject.TranslationFiles.flat_files ); | ||
709 | vcProject.TranslationFiles.Project = this; | 944 | vcProject.TranslationFiles.Project = this; |
710 | vcProject.TranslationFiles.Config = &(vcProject.Configuration); | 945 | vcProject.TranslationFiles.Config = &(vcProject.Configuration); |
711 | vcProject.TranslationFiles.CustomBuild = none; | 946 | vcProject.TranslationFiles.CustomBuild = none; |
712 | } | 947 | } |
713 | 948 | ||
714 | void VcprojGenerator::initLexYaccFiles() | 949 | void VcprojGenerator::initLexYaccFiles() |
715 | { | 950 | { |
951 | vcProject.LexYaccFiles.flat_files = project->isActiveConfig("flat"); | ||
716 | vcProject.LexYaccFiles.Name = "Lex / Yacc Files"; | 952 | vcProject.LexYaccFiles.Name = "Lex / Yacc Files"; |
717 | vcProject.LexYaccFiles.ParseFiles = _False; | 953 | vcProject.LexYaccFiles.ParseFiles = _False; |
718 | vcProject.LexYaccFiles.Filter = "l;y"; | 954 | vcProject.LexYaccFiles.Filter = "l;y"; |
719 | vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"]; | 955 | vcProject.LexYaccFiles.Files += project->variables()["LEXSOURCES"]; |
720 | vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"]; | 956 | vcProject.LexYaccFiles.Files += project->variables()["YACCSOURCES"]; |
721 | vcProject.LexYaccFiles.Files.sort(); | 957 | nonflatDir_BubbleSort( vcProject.LexYaccFiles.Files, |
958 | vcProject.LexYaccFiles.flat_files ); | ||
722 | vcProject.LexYaccFiles.Project = this; | 959 | vcProject.LexYaccFiles.Project = this; |
960 | vcProject.LexYaccFiles.Config = &(vcProject.Configuration); | ||
723 | vcProject.LexYaccFiles.CustomBuild = lexyacc; | 961 | vcProject.LexYaccFiles.CustomBuild = lexyacc; |
724 | } | 962 | } |
725 | 963 | ||
726 | void VcprojGenerator::initResourceFiles() | 964 | void VcprojGenerator::initResourceFiles() |
727 | { | 965 | { |
966 | vcProject.ResourceFiles.flat_files = project->isActiveConfig("flat"); | ||
728 | vcProject.ResourceFiles.Name = "Resources"; | 967 | vcProject.ResourceFiles.Name = "Resources"; |
729 | vcProject.ResourceFiles.ParseFiles = _False; | 968 | vcProject.ResourceFiles.ParseFiles = _False; |
730 | vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; | 969 | vcProject.ResourceFiles.Filter = "cpp;ico;png;jpg;jpeg;gif;xpm;bmp;rc;ts"; |
731 | vcProject.ResourceFiles.Files += project->variables()["RC_FILE"]; | 970 | vcProject.ResourceFiles.Files += project->variables()["RC_FILE"]; |
732 | vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; | 971 | vcProject.ResourceFiles.Files += project->variables()["QMAKE_IMAGE_COLLECTION"]; |
733 | vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; | 972 | vcProject.ResourceFiles.Files += project->variables()["IMAGES"]; |
734 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; | 973 | vcProject.ResourceFiles.Files += project->variables()["IDLSOURCES"]; |
735 | vcProject.ResourceFiles.Files.sort(); | 974 | nonflatDir_BubbleSort( vcProject.ResourceFiles.Files, |
975 | vcProject.ResourceFiles.flat_files ); | ||
736 | vcProject.ResourceFiles.Project = this; | 976 | vcProject.ResourceFiles.Project = this; |
737 | vcProject.ResourceFiles.CustomBuild = none; | 977 | vcProject.ResourceFiles.Config = &(vcProject.Configuration); |
978 | vcProject.ResourceFiles.CustomBuild = resource; | ||
738 | } | 979 | } |
739 | 980 | ||
740 | /* \internal | 981 | /* \internal |
741 | Sets up all needed variables from the environment and all the different caches and .conf files | 982 | Sets up all needed variables from the environment and all the different caches and .conf files |
742 | */ | 983 | */ |
743 | 984 | ||
744 | void VcprojGenerator::initOld() | 985 | void VcprojGenerator::initOld() |
745 | { | 986 | { |
746 | if( init_flag ) | 987 | if( init_flag ) |
747 | return; | 988 | return; |
748 | 989 | ||
749 | init_flag = TRUE; | 990 | init_flag = TRUE; |
750 | QStringList::Iterator it; | 991 | QStringList::Iterator it; |
751 | 992 | ||
752 | if ( project->isActiveConfig("stl") ) { | 993 | if ( project->isActiveConfig("stl") ) { |
753 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; | 994 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; |
754 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; | 995 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; |
755 | } else { | 996 | } else { |
756 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; | 997 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; |
757 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; | 998 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; |
758 | } | 999 | } |
759 | if ( project->isActiveConfig("exceptions") ) { | 1000 | if ( project->isActiveConfig("exceptions") ) { |
760 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; | 1001 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; |
761 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; | 1002 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; |
762 | } else { | 1003 | } else { |
763 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; | 1004 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; |
764 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; | 1005 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; |
765 | } | 1006 | } |
766 | if ( project->isActiveConfig("rtti") ) { | 1007 | if ( project->isActiveConfig("rtti") ) { |
767 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; | 1008 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; |
768 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; | 1009 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; |
769 | } else { | 1010 | } else { |
770 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; | 1011 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; |
771 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; | 1012 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; |
772 | } | 1013 | } |
773 | 1014 | ||
774 | // this should probably not be here, but I'm using it to wrap the .t files | 1015 | // this should probably not be here, but I'm using it to wrap the .t files |
775 | if(project->first("TEMPLATE") == "vcapp" ) | 1016 | if(project->first("TEMPLATE") == "vcapp" ) |
776 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 1017 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
777 | else if(project->first("TEMPLATE") == "vclib") | 1018 | else if(project->first("TEMPLATE") == "vclib") |
778 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 1019 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
779 | if ( project->variables()["QMAKESPEC"].isEmpty() ) | 1020 | if ( project->variables()["QMAKESPEC"].isEmpty() ) |
780 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); | 1021 | project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); |
781 | 1022 | ||
782 | bool is_qt = | 1023 | bool is_qt = |
783 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || | 1024 | ( project->first("TARGET") == "qt"QTDLL_POSTFIX || |
784 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); | 1025 | project->first("TARGET") == "qt-mt"QTDLL_POSTFIX ); |
785 | 1026 | ||
786 | QStringList &configs = project->variables()["CONFIG"]; | 1027 | QStringList &configs = project->variables()["CONFIG"]; |
787 | 1028 | ||
788 | if ( project->isActiveConfig( "shared" ) ) | 1029 | if ( project->isActiveConfig( "shared" ) ) |
789 | project->variables()["DEFINES"].append( "QT_DLL" ); | 1030 | project->variables()["DEFINES"].append( "QT_DLL" ); |
790 | 1031 | ||
791 | if ( project->isActiveConfig( "qt_dll" ) && | 1032 | if ( project->isActiveConfig( "qt_dll" ) && |
792 | configs.findIndex("qt") == -1 ) | 1033 | configs.findIndex("qt") == -1 ) |
793 | configs.append("qt"); | 1034 | configs.append("qt"); |
794 | 1035 | ||
795 | if ( project->isActiveConfig( "qt" ) ) { | 1036 | if ( project->isActiveConfig( "qt" ) ) { |
796 | if ( project->isActiveConfig( "plugin" ) ) { | 1037 | if ( project->isActiveConfig( "plugin" ) ) { |
797 | project->variables()["CONFIG"].append( "dll" ); | 1038 | project->variables()["CONFIG"].append( "dll" ); |
798 | project->variables()["DEFINES"].append( "QT_PLUGIN" ); | 1039 | project->variables()["DEFINES"].append( "QT_PLUGIN" ); |
799 | } | 1040 | } |
800 | if ( ( project->variables()["DEFINES"].findIndex( "QT_NODLL" ) == -1 ) && | 1041 | if ( ( project->variables()["DEFINES"].findIndex( "QT_NODLL" ) == -1 ) && |
801 | (( project->variables()["DEFINES"].findIndex( "QT_MAKEDLL" ) != -1 || | 1042 | (( project->variables()["DEFINES"].findIndex( "QT_MAKEDLL" ) != -1 || |
802 | project->variables()["DEFINES"].findIndex( "QT_DLL" ) != -1 ) || | 1043 | project->variables()["DEFINES"].findIndex( "QT_DLL" ) != -1 ) || |
803 | ( getenv( "QT_DLL" ) && !getenv( "QT_NODLL" ))) ) { | 1044 | ( getenv( "QT_DLL" ) && !getenv( "QT_NODLL" ))) ) { |
804 | project->variables()["QMAKE_QT_DLL"].append( "1" ); | 1045 | project->variables()["QMAKE_QT_DLL"].append( "1" ); |
805 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) | 1046 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) |
806 | project->variables()["CONFIG"].append( "dll" ); | 1047 | project->variables()["CONFIG"].append( "dll" ); |
807 | } | 1048 | } |
808 | } | 1049 | } |
809 | 1050 | ||
810 | // If we are a dll, then we cannot be a staticlib at the same time... | 1051 | // If we are a dll, then we cannot be a staticlib at the same time... |
811 | if ( project->isActiveConfig( "dll" ) || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 1052 | if ( project->isActiveConfig( "dll" ) || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
812 | project->variables()["CONFIG"].remove( "staticlib" ); | 1053 | project->variables()["CONFIG"].remove( "staticlib" ); |
813 | project->variables()["QMAKE_APP_OR_DLL"].append( "1" ); | 1054 | project->variables()["QMAKE_APP_OR_DLL"].append( "1" ); |
814 | } else { | 1055 | } else { |
815 | project->variables()["CONFIG"].append( "staticlib" ); | 1056 | project->variables()["CONFIG"].append( "staticlib" ); |
816 | } | 1057 | } |
817 | 1058 | ||
818 | // If we need 'qt' and/or 'opengl', then we need windows and not console | 1059 | // If we need 'qt' and/or 'opengl', then we need windows and not console |
819 | if ( project->isActiveConfig( "qt" ) || project->isActiveConfig( "opengl" ) ) { | 1060 | if ( project->isActiveConfig( "qt" ) || project->isActiveConfig( "opengl" ) ) { |
820 | project->variables()["CONFIG"].append( "windows" ); | 1061 | project->variables()["CONFIG"].append( "windows" ); |
821 | } | 1062 | } |
822 | 1063 | ||
823 | // Decode version, and add it to $$MSVCPROJ_VERSION -------------- | 1064 | // Decode version, and add it to $$MSVCPROJ_VERSION -------------- |
824 | if ( !project->variables()["VERSION"].isEmpty() ) { | 1065 | if ( !project->variables()["VERSION"].isEmpty() ) { |
825 | QString version = project->variables()["VERSION"][0]; | 1066 | QString version = project->variables()["VERSION"][0]; |
826 | int firstDot = version.find( "." ); | 1067 | int firstDot = version.find( "." ); |
827 | QString major = version.left( firstDot ); | 1068 | QString major = version.left( firstDot ); |
828 | QString minor = version.right( version.length() - firstDot - 1 ); | 1069 | QString minor = version.right( version.length() - firstDot - 1 ); |
829 | minor.replace( QRegExp( "\\." ), "" ); | 1070 | minor.replace( QRegExp( "\\." ), "" ); |
830 | project->variables()["MSVCPROJ_VERSION"].append( "/VERSION:" + major + "." + minor ); | 1071 | project->variables()["MSVCPROJ_VERSION"].append( "/VERSION:" + major + "." + minor ); |
831 | } | 1072 | } |
832 | 1073 | ||
833 | // QT ------------------------------------------------------------ | 1074 | // QT ------------------------------------------------------------ |
834 | if ( project->isActiveConfig("qt") ) { | 1075 | if ( project->isActiveConfig("qt") ) { |
835 | project->variables()["CONFIG"].append("moc"); | 1076 | project->variables()["CONFIG"].append("moc"); |
836 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; | 1077 | project->variables()["INCLUDEPATH"] +=project->variables()["QMAKE_INCDIR_QT"]; |
837 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; | 1078 | project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; |
838 | 1079 | ||
839 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 1080 | if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
840 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 1081 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
841 | project->variables()["DEFINES"].append("QT_MAKEDLL"); | 1082 | project->variables()["DEFINES"].append("QT_MAKEDLL"); |
842 | project->variables()["QMAKE_LFLAGS"].append("/BASE:0x39D00000"); | 1083 | project->variables()["QMAKE_LFLAGS"].append("/BASE:0x39D00000"); |
843 | } | 1084 | } |
844 | } else { | 1085 | } else { |
845 | if(project->isActiveConfig("thread")) | 1086 | if(project->isActiveConfig("thread")) |
846 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 1087 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
847 | else | 1088 | else |
848 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 1089 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
849 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { | 1090 | if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { |
850 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); | 1091 | int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); |
851 | if( hver==-1 ) { | 1092 | if( hver==-1 ) { |
852 | hver = findHighestVersion( project->first("QMAKE_LIBDIR_QT"), "qt-mt" ); | 1093 | hver = findHighestVersion( project->first("QMAKE_LIBDIR_QT"), "qt-mt" ); |
853 | } | 1094 | } |
854 | 1095 | ||
855 | if(hver != -1) { | 1096 | if(hver != -1) { |
856 | QString ver; | 1097 | QString ver; |
857 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); | 1098 | ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); |
858 | QStringList &libs = project->variables()["QMAKE_LIBS"]; | 1099 | QStringList &libs = project->variables()["QMAKE_LIBS"]; |
859 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) | 1100 | for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) |
860 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); | 1101 | (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); |
861 | } | 1102 | } |
862 | } | 1103 | } |
863 | if ( project->isActiveConfig( "activeqt" ) ) { | 1104 | if ( project->isActiveConfig( "activeqt" ) ) { |
864 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); | 1105 | project->variables().remove("QMAKE_LIBS_QT_ENTRY"); |
865 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; | 1106 | project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; |
866 | if ( project->isActiveConfig( "dll" ) ) { | 1107 | if ( project->isActiveConfig( "dll" ) ) { |
867 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 1108 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
868 | project->variables()["MSVCPROJ_LFLAGS"].append("/DEF:"+project->first("DEF_FILE")); | ||
869 | } | 1109 | } |
870 | } | 1110 | } |
871 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { | 1111 | if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { |
872 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; | 1112 | project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; |
873 | } | 1113 | } |
874 | } | 1114 | } |
875 | } | 1115 | } |
876 | 1116 | ||
877 | // Set target directories ---------------------------------------- | 1117 | // Set target directories ---------------------------------------- |
878 | // if ( !project->first("OBJECTS_DIR").isEmpty() ) | 1118 | // if ( !project->first("OBJECTS_DIR").isEmpty() ) |
879 | //project->variables()["MSVCPROJ_OBJECTSDIR"] = project->first("OBJECTS_DIR"); | 1119 | //project->variables()["MSVCPROJ_OBJECTSDIR"] = project->first("OBJECTS_DIR"); |
880 | // else | 1120 | // else |
881 | //project->variables()["MSVCPROJ_OBJECTSDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; | 1121 | //project->variables()["MSVCPROJ_OBJECTSDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; |
882 | // if ( !project->first("DESTDIR").isEmpty() ) | 1122 | // if ( !project->first("DESTDIR").isEmpty() ) |
883 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->first("DESTDIR"); | 1123 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->first("DESTDIR"); |
884 | // else | 1124 | // else |
885 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; | 1125 | //project->variables()["MSVCPROJ_TARGETDIR"] = project->isActiveConfig( "release" )?"Release":"Debug"; |
886 | 1126 | ||
887 | // OPENGL -------------------------------------------------------- | 1127 | // OPENGL -------------------------------------------------------- |
888 | if ( project->isActiveConfig("opengl") ) { | 1128 | if ( project->isActiveConfig("opengl") ) { |
889 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 1129 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
890 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; | 1130 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; |
891 | } | 1131 | } |
892 | 1132 | ||
893 | // THREAD -------------------------------------------------------- | 1133 | // THREAD -------------------------------------------------------- |
894 | if ( project->isActiveConfig("thread") ) { | 1134 | if ( project->isActiveConfig("thread") ) { |
895 | if(project->isActiveConfig("qt")) | 1135 | if(project->isActiveConfig("qt")) |
896 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); | 1136 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); |
897 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt | 1137 | if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt |
898 | && project->first("TARGET") != "qtmain" ) | 1138 | && project->first("TARGET") != "qtmain" ) |
899 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:libc"); | 1139 | project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:libc"); |
900 | } | 1140 | } |
901 | 1141 | ||
902 | // ACCESSIBILITY ------------------------------------------------- | 1142 | // ACCESSIBILITY ------------------------------------------------- |
903 | if(project->isActiveConfig("qt")) { | 1143 | if(project->isActiveConfig("qt")) { |
904 | if ( project->isActiveConfig("accessibility" ) ) | 1144 | if ( project->isActiveConfig("accessibility" ) ) |
905 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 1145 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
906 | if ( project->isActiveConfig("tablet") ) | 1146 | if ( project->isActiveConfig("tablet") ) |
907 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 1147 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
908 | } | 1148 | } |
909 | 1149 | ||
910 | // DLL ----------------------------------------------------------- | 1150 | // DLL ----------------------------------------------------------- |
911 | if ( project->isActiveConfig("dll") ) { | 1151 | if ( project->isActiveConfig("dll") ) { |
912 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { | 1152 | if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { |
913 | QString ver_xyz(project->first("VERSION")); | 1153 | QString ver_xyz(project->first("VERSION")); |
914 | ver_xyz.replace(QRegExp("\\."), ""); | 1154 | ver_xyz.replace(QRegExp("\\."), ""); |
915 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); | 1155 | project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); |
916 | } else { | 1156 | } else { |
917 | project->variables()["TARGET_EXT"].append(".dll"); | 1157 | project->variables()["TARGET_EXT"].append(".dll"); |
918 | } | 1158 | } |
919 | } | 1159 | } |
920 | // EXE / LIB ----------------------------------------------------- | 1160 | // EXE / LIB ----------------------------------------------------- |
921 | else { | 1161 | else { |
922 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) | 1162 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) |
923 | project->variables()["TARGET_EXT"].append(".exe"); | 1163 | project->variables()["TARGET_EXT"].append(".exe"); |
924 | else | 1164 | else |
925 | project->variables()["TARGET_EXT"].append(".lib"); | 1165 | project->variables()["TARGET_EXT"].append(".lib"); |
926 | } | 1166 | } |
927 | 1167 | ||
928 | project->variables()["MSVCPROJ_VER"] = "7.00"; | 1168 | project->variables()["MSVCPROJ_VER"] = "7.00"; |
929 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; | 1169 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /ZI"; |
930 | 1170 | ||
931 | // INCREMENTAL:NO ------------------------------------------------ | 1171 | // INCREMENTAL:NO ------------------------------------------------ |
932 | if(!project->isActiveConfig("incremental")) { | 1172 | if(!project->isActiveConfig("incremental")) { |
933 | project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no")); | 1173 | project->variables()["QMAKE_LFLAGS"].append(QString("/INCREMENTAL:no")); |
934 | if ( is_qt ) | 1174 | if ( is_qt ) |
935 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; | 1175 | project->variables()["MSVCPROJ_DEBUG_OPT"] = "/GZ /Zi"; |
936 | } | 1176 | } |
937 | 1177 | ||
938 | // MOC ----------------------------------------------------------- | 1178 | // MOC ----------------------------------------------------------- |
939 | if ( project->isActiveConfig("moc") ) | 1179 | if ( project->isActiveConfig("moc") ) |
940 | setMocAware(TRUE); | 1180 | setMocAware(TRUE); |
941 | 1181 | ||
1182 | // /VERSION:x.yz ------------------------------------------------- | ||
1183 | if ( !project->variables()["VERSION"].isEmpty() ) { | ||
1184 | QString version = project->variables()["VERSION"][0]; | ||
1185 | int firstDot = version.find( "." ); | ||
1186 | QString major = version.left( firstDot ); | ||
1187 | QString minor = version.right( version.length() - firstDot - 1 ); | ||
1188 | minor.replace( ".", "" ); | ||
1189 | project->variables()["QMAKE_LFLAGS"].append( "/VERSION:" + major + "." + minor ); | ||
1190 | } | ||
942 | 1191 | ||
943 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 1192 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
944 | // Update -lname to name.lib, and -Ldir to | 1193 | // Update -lname to name.lib, and -Ldir to |
945 | QStringList &libList = project->variables()["QMAKE_LIBS"]; | 1194 | QStringList &libList = project->variables()["QMAKE_LIBS"]; |
946 | for( it = libList.begin(); it != libList.end(); ) { | 1195 | for( it = libList.begin(); it != libList.end(); ) { |
947 | QString s = *it; | 1196 | QString s = *it; |
948 | if( s.startsWith( "-l" ) ) { | 1197 | if( s.startsWith( "-l" ) ) { |
949 | it = libList.remove( it ); | 1198 | it = libList.remove( it ); |
950 | it = libList.insert( it, s.mid( 2 ) + ".lib" ); | 1199 | it = libList.insert( it, s.mid( 2 ) + ".lib" ); |
951 | } else if( s.startsWith( "-L" ) ) { | 1200 | } else if( s.startsWith( "-L" ) ) { |
1201 | project->variables()["QMAKE_LIBDIR"] += (*it).mid(2); | ||
952 | it = libList.remove( it ); | 1202 | it = libList.remove( it ); |
953 | } else { | 1203 | } else { |
954 | it++; | 1204 | it++; |
955 | } | 1205 | } |
956 | } | 1206 | } |
957 | 1207 | ||
958 | // Run through all variables containing filepaths, and ----------- | 1208 | // Run through all variables containing filepaths, and ----------- |
959 | // slash-slosh them correctly depending on current OS ----------- | 1209 | // slash-slosh them correctly depending on current OS ----------- |
960 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); | 1210 | project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ', "HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH"); |
961 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; | 1211 | QStringList &l = project->variables()["QMAKE_FILETAGS"]; |
962 | for(it = l.begin(); it != l.end(); ++it) { | 1212 | for(it = l.begin(); it != l.end(); ++it) { |
963 | QStringList &gdmf = project->variables()[(*it)]; | 1213 | QStringList &gdmf = project->variables()[(*it)]; |
964 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) | 1214 | for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) |
965 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); | 1215 | (*inner) = Option::fixPathToTargetOS((*inner), FALSE); |
966 | } | 1216 | } |
967 | 1217 | ||
968 | // Get filename w/o extention ----------------------------------- | 1218 | // Get filename w/o extention ----------------------------------- |
969 | QString msvcproj_project = ""; | 1219 | QString msvcproj_project = ""; |
970 | QString targetfilename = ""; | 1220 | QString targetfilename = ""; |
971 | if ( project->variables()["TARGET"].count() ) { | 1221 | if ( project->variables()["TARGET"].count() ) { |
972 | msvcproj_project = project->variables()["TARGET"].first(); | 1222 | msvcproj_project = project->variables()["TARGET"].first(); |
973 | targetfilename = msvcproj_project; | 1223 | targetfilename = msvcproj_project; |
974 | } | 1224 | } |
975 | 1225 | ||
976 | // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ | 1226 | // Save filename w/o extention in $$QMAKE_ORIG_TARGET ------------ |
977 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 1227 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
978 | 1228 | ||
979 | // TARGET (add extention to $$TARGET) | 1229 | // TARGET (add extention to $$TARGET) |
980 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT"); | 1230 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue(".first() += project->first("TARGET_EXT"); |
981 | 1231 | ||
982 | // Init base class too ------------------------------------------- | 1232 | // Init base class too ------------------------------------------- |
983 | MakefileGenerator::init(); | 1233 | MakefileGenerator::init(); |
984 | 1234 | ||
985 | 1235 | ||
986 | if ( msvcproj_project.isEmpty() ) | 1236 | if ( msvcproj_project.isEmpty() ) |
987 | msvcproj_project = Option::output.name(); | 1237 | msvcproj_project = Option::output.name(); |
988 | 1238 | ||
989 | msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 ); | 1239 | msvcproj_project = msvcproj_project.right( msvcproj_project.length() - msvcproj_project.findRev( "\\" ) - 1 ); |
990 | msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) ); | 1240 | msvcproj_project = msvcproj_project.left( msvcproj_project.findRev( "." ) ); |
991 | msvcproj_project.replace(QRegExp("-"), ""); | 1241 | msvcproj_project.replace(QRegExp("-"), ""); |
992 | 1242 | ||
993 | project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project); | 1243 | project->variables()["MSVCPROJ_PROJECT"].append(msvcproj_project); |
994 | QStringList &proj = project->variables()["MSVCPROJ_PROJECT"]; | 1244 | QStringList &proj = project->variables()["MSVCPROJ_PROJECT"]; |
995 | 1245 | ||
996 | for(it = proj.begin(); it != proj.end(); ++it) | 1246 | for(it = proj.begin(); it != proj.end(); ++it) |
997 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); | 1247 | (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); |
998 | 1248 | ||
999 | // SUBSYSTEM ----------------------------------------------------- | 1249 | // SUBSYSTEM ----------------------------------------------------- |
1000 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 1250 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
1001 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32app" + project->first( "VCPROJ_EXTENSION" ) ); | 1251 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32app" + project->first( "VCPROJ_EXTENSION" ) ); |
1002 | if ( project->isActiveConfig("console") ) { | 1252 | if ( project->isActiveConfig("console") ) { |
1003 | project->variables()["MSVCPROJ_CONSOLE"].append("CONSOLE"); | 1253 | project->variables()["MSVCPROJ_CONSOLE"].append("CONSOLE"); |
1004 | project->variables()["MSVCPROJ_WINCONDEF"].append("_CONSOLE"); | 1254 | project->variables()["MSVCPROJ_WINCONDEF"].append("_CONSOLE"); |
1005 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0103"); | 1255 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0103"); |
1006 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("CONSOLE"); | 1256 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("CONSOLE"); |
1007 | } else { | 1257 | } else { |
1008 | project->variables()["MSVCPROJ_CONSOLE"].clear(); | 1258 | project->variables()["MSVCPROJ_CONSOLE"].clear(); |
1009 | project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS"); | 1259 | project->variables()["MSVCPROJ_WINCONDEF"].append("_WINDOWS"); |
1010 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101"); | 1260 | project->variables()["MSVCPROJ_VCPROJTYPE"].append("0x0101"); |
1011 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS"); | 1261 | project->variables()["MSVCPROJ_SUBSYSTEM"].append("WINDOWS"); |
1012 | } | 1262 | } |
1013 | } else { | 1263 | } else { |
1014 | if ( project->isActiveConfig("dll") ) { | 1264 | if ( project->isActiveConfig("dll") ) { |
1015 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) ); | 1265 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32dll" + project->first( "VCPROJ_EXTENSION" ) ); |
1016 | } else { | 1266 | } else { |
1017 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) ); | 1267 | project->variables()["MSVCPROJ_TEMPLATE"].append("win32lib" + project->first( "VCPROJ_EXTENSION" ) ); |
1018 | } | 1268 | } |
1019 | } | 1269 | } |
1020 | 1270 | ||
1021 | // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- | 1271 | // $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- |
1022 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; | 1272 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS"]; |
1023 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; | 1273 | project->variables()["MSVCPROJ_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; |
1024 | project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; | 1274 | project->variables()["MSVCPROJ_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; |
1025 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) { | 1275 | if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) { |
1026 | QStringList strl = project->variables()["QMAKE_LIBDIR"]; | 1276 | QStringList strl = project->variables()["QMAKE_LIBDIR"]; |
1027 | QStringList::iterator stri; | 1277 | QStringList::iterator stri; |
1028 | for ( stri = strl.begin(); stri != strl.end(); ++stri ) { | 1278 | for ( stri = strl.begin(); stri != strl.end(); ++stri ) { |
1029 | if ( !(*stri).startsWith("/LIBPATH:") ) | 1279 | if ( !(*stri).startsWith("/LIBPATH:") ) |
1030 | (*stri).prepend( "/LIBPATH:" ); | 1280 | (*stri).prepend( "/LIBPATH:" ); |
1031 | } | 1281 | } |
1032 | project->variables()["MSVCPROJ_LFLAGS"] += strl; | 1282 | project->variables()["MSVCPROJ_LFLAGS"] += strl; |
1033 | } | 1283 | } |
1034 | project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; | 1284 | project->variables()["MSVCPROJ_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; |
1035 | // We don't use this... Direct manipulation of compiler object | 1285 | // We don't use this... Direct manipulation of compiler object |
1036 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); | 1286 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); |
1037 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); | 1287 | //project->variables()["MSVCPROJ_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); |
1038 | QStringList &incs = project->variables()["INCLUDEPATH"]; | 1288 | QStringList &incs = project->variables()["INCLUDEPATH"]; |
1039 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { | 1289 | for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { |
1040 | QString inc = (*incit); | 1290 | QString inc = (*incit); |
1041 | inc.replace(QRegExp("\""), ""); | 1291 | inc.replace(QRegExp("\""), ""); |
1042 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); | 1292 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + inc ); |
1043 | } | 1293 | } |
1044 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); | 1294 | project->variables()["MSVCPROJ_INCPATH"].append("/I" + specdir()); |
1045 | 1295 | ||
1046 | QString dest; | 1296 | QString dest; |
1047 | project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); | 1297 | project->variables()["MSVCPROJ_TARGET"] = project->first("TARGET"); |
1048 | Option::fixPathToTargetOS(project->first("TARGET")); | 1298 | Option::fixPathToTargetOS(project->first("TARGET")); |
1049 | dest = project->first("TARGET") + project->first( "TARGET_EXT" ); | 1299 | dest = project->first("TARGET") + project->first( "TARGET_EXT" ); |
1050 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) | 1300 | if ( project->first("TARGET").startsWith("$(QTDIR)") ) |
1051 | dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); | 1301 | dest.replace( QRegExp("\\$\\(QTDIR\\)"), getenv("QTDIR") ); |
1052 | project->variables()["MSVCPROJ_TARGET"] = dest; | 1302 | project->variables()["MSVCPROJ_TARGET"] = dest; |
1053 | if ( project->isActiveConfig("dll") ) { | ||
1054 | QString imp = project->first( "DESTDIR" ); | ||
1055 | if( !imp.isNull() && !imp.endsWith( "\\" ) ) | ||
1056 | imp += "\\"; | ||
1057 | imp += dest; | ||
1058 | imp.replace(QRegExp("\\.dll"), ".lib"); | ||
1059 | project->variables()["MSVCPROJ_LIBOPTIONS"] += QString("/IMPLIB:") + imp; | ||
1060 | } | ||
1061 | 1303 | ||
1062 | // DLL COPY ------------------------------------------------------ | 1304 | // DLL COPY ------------------------------------------------------ |
1063 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { | 1305 | if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { |
1064 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; | 1306 | QStringList dlldirs = project->variables()["DLLDESTDIR"]; |
1065 | QString copydll = "# Begin Special Build Tool\n" | 1307 | QString copydll(""); |
1066 | "TargetPath=" + dest + "\n" | 1308 | QStringList::Iterator dlldir; |
1067 | "SOURCE=$(InputPath)\n" | 1309 | for ( dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { |
1068 | "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" | 1310 | if ( !copydll.isEmpty() ) |
1069 | "PostBuild_Cmds="; | 1311 | copydll += " && "; |
1070 | 1312 | copydll += "copy "$(TargetPath)" "" + *dlldir + """; | |
1071 | for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { | ||
1072 | copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; | ||
1073 | } | 1313 | } |
1074 | 1314 | ||
1075 | copydll += "\n# End Special Build Tool"; | 1315 | QString deststr( "Copy " + dest + " to " ); |
1076 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( copydll ); | 1316 | for ( dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ) { |
1077 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( copydll ); | 1317 | deststr += *dlldir; |
1318 | ++dlldir; | ||
1319 | if ( dlldir != dlldirs.end() ) | ||
1320 | deststr += ", "; | ||
1321 | } | ||
1322 | |||
1323 | project->variables()["MSVCPROJ_COPY_DLL"].append( copydll ); | ||
1324 | project->variables()["MSVCPROJ_COPY_DLL_DESC"].append( deststr ); | ||
1078 | } | 1325 | } |
1079 | 1326 | ||
1080 | // ACTIVEQT ------------------------------------------------------ | 1327 | // ACTIVEQT ------------------------------------------------------ |
1081 | if ( project->isActiveConfig("activeqt") ) { | 1328 | if ( project->isActiveConfig("activeqt") ) { |
1082 | QString idl = project->variables()["QMAKE_IDL"].first(); | 1329 | QString idl = project->variables()["QMAKE_IDL"].first(); |
1083 | QString idc = project->variables()["QMAKE_IDC"].first(); | 1330 | QString idc = project->variables()["QMAKE_IDC"].first(); |
1084 | QString version = project->variables()["VERSION"].first(); | 1331 | QString version = project->variables()["VERSION"].first(); |
1085 | if ( version.isEmpty() ) | 1332 | if ( version.isEmpty() ) |
1086 | version = "1.0"; | 1333 | version = "1.0"; |
1087 | 1334 | ||
1088 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); | 1335 | QString objdir = project->first( "OBJECTS_DIR" ); |
1089 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); | 1336 | project->variables()["MSVCPROJ_IDLSOURCES"].append( objdir + targetfilename + ".idl" ); |
1090 | project->variables()["MSVCPROJ_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); | ||
1091 | if ( project->isActiveConfig( "dll" ) ) { | 1337 | if ( project->isActiveConfig( "dll" ) ) { |
1092 | QString regcmd = "# Begin Special Build Tool\n" | 1338 | QString regcmd = "# Begin Special Build Tool\n" |
1093 | "TargetPath=" + targetfilename + "\n" | 1339 | "TargetPath=" + targetfilename + "\n" |
1094 | "SOURCE=$(InputPath)\n" | 1340 | "SOURCE=$(InputPath)\n" |
1095 | "PostBuild_Desc=Finalizing ActiveQt server...\n" | 1341 | "PostBuild_Desc=Finalizing ActiveQt server...\n" |
1096 | "PostBuild_Cmds=" + | 1342 | "PostBuild_Cmds=" + |
1097 | idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + | 1343 | idc + " %1 -idl " + objdir + targetfilename + ".idl -version " + version + |
1098 | "\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" | 1344 | "\t" + idl + " /nologo " + objdir + targetfilename + ".idl /tlb " + objdir + targetfilename + ".tlb" + |
1099 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 1345 | "\t" + idc + " %1 /tlb " + objdir + targetfilename + ".tlb" |
1100 | "\tregsvr32 /s %1\n" | 1346 | "\tregsvr32 /s %1\n" |
1101 | "# End Special Build Tool"; | 1347 | "# End Special Build Tool"; |
1102 | 1348 | ||
1103 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); | 1349 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); |
1104 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1350 | project->variables()["MSVCPROJ_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
1105 | 1351 | ||
1106 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); | 1352 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); |
1107 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1353 | project->variables()["MSVCPROJ_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
1108 | } else { | 1354 | } else { |
1109 | QString regcmd = "# Begin Special Build Tool\n" | 1355 | QString regcmd = "# Begin Special Build Tool\n" |
1110 | "TargetPath=" + targetfilename + "\n" | 1356 | "TargetPath=" + targetfilename + "\n" |
1111 | "SOURCE=$(InputPath)\n" | 1357 | "SOURCE=$(InputPath)\n" |
1112 | "PostBuild_Desc=Finalizing ActiveQt server...\n" | 1358 | "PostBuild_Desc=Finalizing ActiveQt server...\n" |
1113 | "PostBuild_Cmds=" | 1359 | "PostBuild_Cmds=" |
1114 | "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + | 1360 | "%1 -dumpidl " + objdir + targetfilename + ".idl -version " + version + |
1115 | "\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" | 1361 | "\t" + idl + " /nologo " + objdir + targetfilename + ".idl /tlb " + objdir + targetfilename + ".tlb" |
1116 | "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" | 1362 | "\t" + idc + " %1 /tlb " + objdir + targetfilename + ".tlb" |
1117 | "\t%1 -regserver\n" | 1363 | "\t%1 -regserver\n" |
1118 | "# End Special Build Tool"; | 1364 | "# End Special Build Tool"; |
1119 | 1365 | ||
1120 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); | 1366 | QString executable = project->variables()["MSVCPROJ_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); |
1121 | project->variables()["MSVCPROJ_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1367 | project->variables()["MSVCPROJ_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
1122 | 1368 | ||
1123 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); | 1369 | executable = project->variables()["MSVCPROJ_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); |
1124 | project->variables()["MSVCPROJ_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); | 1370 | project->variables()["MSVCPROJ_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); |
1125 | } | 1371 | } |
1126 | |||
1127 | } | 1372 | } |
1128 | 1373 | ||
1374 | if ( !project->variables()["DEF_FILE"].isEmpty() ) | ||
1375 | project->variables()["MSVCPROJ_LFLAGS"].append("/DEF:"+project->first("DEF_FILE")); | ||
1376 | |||
1129 | // FORMS --------------------------------------------------------- | 1377 | // FORMS --------------------------------------------------------- |
1130 | QStringList &list = project->variables()["FORMS"]; | 1378 | QStringList &list = project->variables()["FORMS"]; |
1131 | for( it = list.begin(); it != list.end(); ++it ) { | 1379 | for( it = list.begin(); it != list.end(); ++it ) { |
1132 | if ( QFile::exists( *it + ".h" ) ) | 1380 | if ( QFile::exists( *it + ".h" ) ) |
1133 | project->variables()["SOURCES"].append( *it + ".h" ); | 1381 | project->variables()["SOURCES"].append( *it + ".h" ); |
1134 | } | 1382 | } |
1135 | 1383 | ||
1136 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCPROJ_LFLAGS" << "MSVCPROJ_LIBS"; | 1384 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCPROJ_LFLAGS" << "MSVCPROJ_LIBS"; |
1137 | 1385 | ||
1138 | // Verbose output if "-d -d"... | 1386 | // Verbose output if "-d -d"... |
1139 | outputVariables(); | 1387 | outputVariables(); |
1140 | } | 1388 | } |
1141 | 1389 | ||
1142 | // ------------------------------------------------------------------------------------------------ | 1390 | // ------------------------------------------------------------------------------------------------ |
1143 | // ------------------------------------------------------------------------------------------------ | 1391 | // ------------------------------------------------------------------------------------------------ |
1144 | 1392 | ||
1145 | bool VcprojGenerator::openOutput(QFile &file) const | 1393 | bool VcprojGenerator::openOutput(QFile &file) const |
1146 | { | 1394 | { |
1147 | QString outdir; | 1395 | QString outdir; |
1148 | if(!file.name().isEmpty()) { | 1396 | if(!file.name().isEmpty()) { |
1149 | QFileInfo fi(file); | 1397 | QFileInfo fi(file); |
1150 | if(fi.isDir()) | 1398 | if(fi.isDir()) |
1151 | outdir = file.name() + QDir::separator(); | 1399 | outdir = file.name() + QDir::separator(); |
1152 | } | 1400 | } |
1153 | if(!outdir.isEmpty() || file.name().isEmpty()) { | 1401 | if(!outdir.isEmpty() || file.name().isEmpty()) { |
1154 | QString ext = project->first("VCPROJ_EXTENSION"); | 1402 | QString ext = project->first("VCPROJ_EXTENSION"); |
1155 | if(project->first("TEMPLATE") == "vcsubdirs") | 1403 | if(project->first("TEMPLATE") == "vcsubdirs") |
1156 | ext = project->first("VCSOLUTION_EXTENSION"); | 1404 | ext = project->first("VCSOLUTION_EXTENSION"); |
1157 | file.setName(outdir + project->first("TARGET") + ext); | 1405 | file.setName(outdir + project->first("TARGET") + ext); |
1158 | } | 1406 | } |
1159 | if(QDir::isRelativePath(file.name())) { | 1407 | if(QDir::isRelativePath(file.name())) { |
1160 | file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) ); | 1408 | file.setName( Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + fixFilename(file.name())) ); |
1161 | } | 1409 | } |
1162 | return Win32MakefileGenerator::openOutput(file); | 1410 | return Win32MakefileGenerator::openOutput(file); |
1163 | } | 1411 | } |
1164 | 1412 | ||
1165 | QString VcprojGenerator::fixFilename(QString ofile) const | 1413 | QString VcprojGenerator::fixFilename(QString ofile) const |
1166 | { | 1414 | { |
1167 | int slashfind = ofile.findRev('\\'); | 1415 | int slashfind = ofile.findRev('\\'); |
1168 | if (slashfind == -1) { | 1416 | if (slashfind == -1) { |
1169 | ofile = ofile.replace('-', '_'); | 1417 | ofile = ofile.replace('-', '_'); |
1170 | } else { | 1418 | } else { |
1171 | int hypenfind = ofile.find('-', slashfind); | 1419 | int hypenfind = ofile.find('-', slashfind); |
1172 | while (hypenfind != -1 && slashfind < hypenfind) { | 1420 | while (hypenfind != -1 && slashfind < hypenfind) { |
1173 | ofile = ofile.replace(hypenfind, 1, '_'); | 1421 | ofile = ofile.replace(hypenfind, 1, '_'); |
1174 | hypenfind = ofile.find('-', hypenfind + 1); | 1422 | hypenfind = ofile.find('-', hypenfind + 1); |
1175 | } | 1423 | } |
1176 | } | 1424 | } |
1177 | return ofile; | 1425 | return ofile; |
1178 | } | 1426 | } |
1179 | 1427 | ||
1180 | QString VcprojGenerator::findTemplate(QString file) | 1428 | QString VcprojGenerator::findTemplate(QString file) |
1181 | { | 1429 | { |
1182 | QString ret; | 1430 | QString ret; |
1183 | if(!QFile::exists((ret = file)) && | 1431 | if(!QFile::exists((ret = file)) && |
1184 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && | 1432 | !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && |
1185 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) && | 1433 | !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc.net/" + file)) && |
1186 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) | 1434 | !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) |
1187 | return ""; | 1435 | return ""; |
1188 | debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.latin1() ); | 1436 | debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.latin1() ); |
1189 | return ret; | 1437 | return ret; |
1190 | } | 1438 | } |
1191 | 1439 | ||
1192 | 1440 | ||
1193 | void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l) | 1441 | void VcprojGenerator::processPrlVariable(const QString &var, const QStringList &l) |
1194 | { | 1442 | { |
1195 | if(var == "QMAKE_PRL_DEFINES") { | 1443 | if(var == "QMAKE_PRL_DEFINES") { |
1196 | QStringList &out = project->variables()["MSVCPROJ_DEFINES"]; | 1444 | QStringList &out = project->variables()["MSVCPROJ_DEFINES"]; |
1197 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { | 1445 | for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { |
1198 | if(out.findIndex((*it)) == -1) | 1446 | if(out.findIndex((*it)) == -1) |
1199 | out.append((" /D " + *it )); | 1447 | out.append((" /D " + *it )); |
1200 | } | 1448 | } |
1201 | } else { | 1449 | } else { |
1202 | MakefileGenerator::processPrlVariable(var, l); | 1450 | MakefileGenerator::processPrlVariable(var, l); |
1203 | } | 1451 | } |
1204 | } | 1452 | } |
1205 | 1453 | ||
1206 | void VcprojGenerator::outputVariables() | 1454 | void VcprojGenerator::outputVariables() |
1207 | { | 1455 | { |
1208 | #if 0 | 1456 | #if 0 |
1209 | qDebug( "Generator: MSVC.NET: List of current variables:" ); | 1457 | qDebug( "Generator: MSVC.NET: List of current variables:" ); |
1210 | for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) { | 1458 | for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) { |
1211 | qDebug( "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() ); | 1459 | qDebug( "Generator: MSVC.NET: %s => %s", it.key().latin1(), it.data().join(" | ").latin1() ); |
1212 | } | 1460 | } |
1213 | #endif | 1461 | #endif |
1214 | } | 1462 | } |
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 69e0c02..d1ca666 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h | |||
@@ -1,115 +1,119 @@ | |||
1 | |||
1 | /**************************************************************************** | 2 | /**************************************************************************** |
2 | ** $Id$ | 3 | ** |
3 | ** | 4 | ** |
4 | ** Definition of VcprojGenerator class. | 5 | ** Definition of VcprojGenerator class. |
5 | ** | 6 | ** |
6 | ** Created : 970521 | 7 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | ||
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | ||
9 | ** | 8 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 9 | ** This file is part of qmake. |
11 | ** | 10 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 11 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 12 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 13 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 14 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 15 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 16 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 17 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 18 | ** packaging of this file. |
20 | ** | 19 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 20 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 21 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 22 | ** with the Software. |
24 | ** | 23 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 24 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 25 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 26 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 27 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 28 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 29 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 30 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 31 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 32 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 33 | ** not clear to you. |
35 | ** | 34 | ** |
36 | **********************************************************************/ | 35 | **********************************************************************/ |
36 | |||
37 | #ifndef __MSVC_VCPROJ_H__ | 37 | #ifndef __MSVC_VCPROJ_H__ |
38 | #define __MSVC_VCPROJ_H__ | 38 | #define __MSVC_VCPROJ_H__ |
39 | 39 | ||
40 | #include "winmakefile.h" | 40 | #include "winmakefile.h" |
41 | #include "msvc_objectmodel.h" | 41 | #include "msvc_objectmodel.h" |
42 | 42 | ||
43 | enum target { | 43 | enum target { |
44 | Application, | 44 | Application, |
45 | SharedLib, | 45 | SharedLib, |
46 | StaticLib | 46 | StaticLib |
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct QUuid; | 49 | struct QUuid; |
50 | class VcprojGenerator : public Win32MakefileGenerator | 50 | class VcprojGenerator : public Win32MakefileGenerator |
51 | { | 51 | { |
52 | bool init_flag; | 52 | bool init_flag; |
53 | bool writeVcprojParts(QTextStream &); | 53 | bool writeVcprojParts(QTextStream &); |
54 | 54 | ||
55 | bool writeMakefile(QTextStream &); | 55 | bool writeMakefile(QTextStream &); |
56 | virtual void writeSubDirs(QTextStream &t); | 56 | virtual void writeSubDirs(QTextStream &t); |
57 | QString findTemplate(QString file); | 57 | QString findTemplate(QString file); |
58 | void init(); | 58 | void init(); |
59 | 59 | ||
60 | public: | 60 | public: |
61 | VcprojGenerator(QMakeProject *p); | 61 | VcprojGenerator(QMakeProject *p); |
62 | ~VcprojGenerator(); | 62 | ~VcprojGenerator(); |
63 | 63 | ||
64 | QString defaultMakefile() const; | 64 | QString defaultMakefile() const; |
65 | virtual bool doDepends() const { return FALSE; } //never necesary | 65 | virtual bool doDepends() const { return FALSE; } //never necesary |
66 | QString precompH, precompHFilename, | ||
67 | precompObj, precompPch; | ||
68 | bool usePCH; | ||
66 | 69 | ||
67 | protected: | 70 | protected: |
68 | virtual bool openOutput(QFile &file) const; | 71 | virtual bool openOutput(QFile &file) const; |
69 | virtual void processPrlVariable(const QString &, const QStringList &); | 72 | virtual void processPrlVariable(const QString &, const QStringList &); |
70 | virtual bool findLibraries(); | 73 | virtual bool findLibraries(); |
71 | virtual void outputVariables(); | 74 | virtual void outputVariables(); |
72 | QString fixFilename(QString ofile) const; | 75 | QString fixFilename(QString ofile) const; |
73 | 76 | ||
74 | void initOld(); | 77 | void initOld(); |
75 | void initProject(); | 78 | void initProject(); |
76 | void initConfiguration(); | 79 | void initConfiguration(); |
77 | void initCompilerTool(); | 80 | void initCompilerTool(); |
78 | void initLinkerTool(); | 81 | void initLinkerTool(); |
79 | void initLibrarianTool(); | 82 | void initLibrarianTool(); |
80 | void initIDLTool(); | 83 | void initIDLTool(); |
81 | void initCustomBuildTool(); | 84 | void initCustomBuildTool(); |
82 | void initPreBuildEventTools(); | 85 | void initPreBuildEventTools(); |
83 | void initPostBuildEventTools(); | 86 | void initPostBuildEventTools(); |
84 | void initPreLinkEventTools(); | 87 | void initPreLinkEventTools(); |
85 | void initSourceFiles(); | 88 | void initSourceFiles(); |
86 | void initHeaderFiles(); | 89 | void initHeaderFiles(); |
87 | void initMOCFiles(); | 90 | void initMOCFiles(); |
88 | void initUICFiles(); | 91 | void initUICFiles(); |
89 | void initFormsFiles(); | 92 | void initFormsFiles(); |
90 | void initTranslationFiles(); | 93 | void initTranslationFiles(); |
91 | void initLexYaccFiles(); | 94 | void initLexYaccFiles(); |
92 | void initResourceFiles(); | 95 | void initResourceFiles(); |
93 | 96 | ||
94 | VCProject vcProject; | 97 | VCProject vcProject; |
95 | target projectTarget; | 98 | target projectTarget; |
96 | 99 | ||
97 | private: | 100 | private: |
101 | QUuid getProjectUUID(const QString &filename=QString::null); | ||
98 | QUuid increaseUUID(const QUuid &id); | 102 | QUuid increaseUUID(const QUuid &id); |
99 | friend class VCFilter; | 103 | friend class VCFilter; |
100 | }; | 104 | }; |
101 | 105 | ||
102 | inline VcprojGenerator::~VcprojGenerator() | 106 | inline VcprojGenerator::~VcprojGenerator() |
103 | { } | 107 | { } |
104 | 108 | ||
105 | inline QString VcprojGenerator::defaultMakefile() const | 109 | inline QString VcprojGenerator::defaultMakefile() const |
106 | { | 110 | { |
107 | return project->first("TARGET") + project->first("VCPROJ_EXTENSION"); | 111 | return project->first("TARGET") + project->first("VCPROJ_EXTENSION"); |
108 | } | 112 | } |
109 | 113 | ||
110 | inline bool VcprojGenerator::findLibraries() | 114 | inline bool VcprojGenerator::findLibraries() |
111 | { | 115 | { |
112 | return Win32MakefileGenerator::findLibraries("MSVCVCPROJ_LIBS"); | 116 | return Win32MakefileGenerator::findLibraries("MSVCVCPROJ_LIBS"); |
113 | } | 117 | } |
114 | 118 | ||
115 | #endif /* __MSVC_VCPROJ_H__ */ | 119 | #endif /* __MSVC_VCPROJ_H__ */ |
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index bc3fed9..cd733c6 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp | |||
@@ -1,400 +1,475 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of Win32MakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "winmakefile.h" | 36 | #include "winmakefile.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include "project.h" | 38 | #include "project.h" |
39 | #include "meta.h" | ||
41 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
42 | #include <qstring.h> | 41 | #include <qstring.h> |
43 | #include <qdict.h> | 42 | #include <qdict.h> |
44 | #include <qregexp.h> | 43 | #include <qregexp.h> |
45 | #include <qstringlist.h> | 44 | #include <qstringlist.h> |
46 | #include <qdir.h> | 45 | #include <qdir.h> |
47 | 46 | ||
48 | 47 | ||
49 | Win32MakefileGenerator::Win32MakefileGenerator(QMakeProject *p) : MakefileGenerator(p) | 48 | Win32MakefileGenerator::Win32MakefileGenerator(QMakeProject *p) : MakefileGenerator(p) |
50 | { | 49 | { |
51 | 50 | ||
52 | } | 51 | } |
53 | 52 | ||
54 | 53 | ||
55 | struct SubDir | 54 | struct SubDir |
56 | { | 55 | { |
57 | QString directory, profile, target, makefile; | 56 | QString directory, profile, target, makefile; |
58 | }; | 57 | }; |
59 | 58 | ||
60 | void | 59 | void |
61 | Win32MakefileGenerator::writeSubDirs(QTextStream &t) | 60 | Win32MakefileGenerator::writeSubDirs(QTextStream &t) |
62 | { | 61 | { |
63 | QPtrList<SubDir> subdirs; | 62 | QPtrList<SubDir> subdirs; |
64 | { | 63 | { |
65 | QStringList subdirs_in = project->variables()["SUBDIRS"]; | 64 | QStringList subdirs_in = project->variables()["SUBDIRS"]; |
66 | for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { | 65 | for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { |
67 | QString file = (*it); | 66 | QString file = (*it); |
68 | file = fileFixify(file); | 67 | file = fileFixify(file); |
69 | SubDir *sd = new SubDir; | 68 | SubDir *sd = new SubDir; |
70 | subdirs.append(sd); | 69 | subdirs.append(sd); |
71 | sd->makefile = "$(MAKEFILE)"; | 70 | sd->makefile = "$(MAKEFILE)"; |
72 | if((*it).right(4) == ".pro") { | 71 | if((*it).right(4) == ".pro") { |
73 | int slsh = file.findRev(Option::dir_sep); | 72 | int slsh = file.findRev(Option::dir_sep); |
74 | if(slsh != -1) { | 73 | if(slsh != -1) { |
75 | sd->directory = file.left(slsh+1); | 74 | sd->directory = file.left(slsh+1); |
76 | sd->profile = file.mid(slsh+1); | 75 | sd->profile = file.mid(slsh+1); |
77 | } else { | 76 | } else { |
78 | sd->profile = file; | 77 | sd->profile = file; |
79 | } | 78 | } |
80 | } else { | 79 | } else { |
81 | sd->directory = file; | 80 | sd->directory = file; |
82 | } | 81 | } |
83 | while(sd->directory.right(1) == Option::dir_sep) | 82 | while(sd->directory.right(1) == Option::dir_sep) |
84 | sd->directory = sd->directory.left(sd->directory.length() - 1); | 83 | sd->directory = sd->directory.left(sd->directory.length() - 1); |
85 | if(!sd->profile.isEmpty()) { | 84 | if(!sd->profile.isEmpty()) { |
86 | QString basename = sd->directory; | 85 | QString basename = sd->directory; |
87 | int new_slsh = basename.findRev(Option::dir_sep); | 86 | int new_slsh = basename.findRev(Option::dir_sep); |
88 | if(new_slsh != -1) | 87 | if(new_slsh != -1) |
89 | basename = basename.mid(new_slsh+1); | 88 | basename = basename.mid(new_slsh+1); |
90 | if(sd->profile != basename + ".pro") | 89 | if(sd->profile != basename + ".pro") |
91 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro | 90 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro |
92 | } | 91 | } |
93 | sd->target = "sub-" + (*it); | 92 | sd->target = "sub-" + (*it); |
94 | sd->target.replace('/', '-'); | 93 | sd->target.replace('/', '-'); |
95 | sd->target.replace('.', '_'); | 94 | sd->target.replace('.', '_'); |
96 | } | 95 | } |
97 | } | 96 | } |
98 | QPtrListIterator<SubDir> it(subdirs); | 97 | QPtrListIterator<SubDir> it(subdirs); |
99 | 98 | ||
100 | if(!project->isEmpty("MAKEFILE")) | 99 | t << "MAKEFILE = " << (project->isEmpty("MAKEFILE") ? QString("Makefile") : var("MAKEFILE")) << endl; |
101 | t << "MAKEFILE=" << var("MAKEFILE") << endl; | ||
102 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; | 100 | t << "QMAKE =" << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
103 | t << "SUBTARGETS= "; | 101 | t << "SUBTARGETS= "; |
104 | for( it.toFirst(); it.current(); ++it) | 102 | for( it.toFirst(); it.current(); ++it) |
105 | t << " \\\n\t\t" << it.current()->target; | 103 | t << " \\\n\t\t" << it.current()->target; |
106 | t << endl << endl; | 104 | t << endl << endl; |
107 | t << "all: qmake_all $(SUBTARGETS)" << endl << endl; | 105 | t << "all: $(MAKEFILE) $(SUBTARGETS)" << endl << endl; |
108 | 106 | ||
109 | for( it.toFirst(); it.current(); ++it) { | 107 | for( it.toFirst(); it.current(); ++it) { |
110 | bool have_dir = !(*it)->directory.isEmpty(); | 108 | bool have_dir = !(*it)->directory.isEmpty(); |
111 | 109 | ||
112 | //make the makefile | 110 | //make the makefile |
113 | QString mkfile = (*it)->makefile; | 111 | QString mkfile = (*it)->makefile; |
114 | if(have_dir) | 112 | if(have_dir) |
115 | mkfile.prepend((*it)->directory + Option::dir_sep); | 113 | mkfile.prepend((*it)->directory + Option::dir_sep); |
116 | t << mkfile << ":"; | 114 | t << mkfile << ":"; |
117 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | ||
118 | t << " FORCE"; | ||
119 | if(have_dir) | 115 | if(have_dir) |
120 | t << "\n\t" << "cd " << (*it)->directory; | 116 | t << "\n\t" << "cd " << (*it)->directory; |
121 | t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); | 117 | t << "\n\t" << "$(QMAKE) " << (*it)->profile << " " << buildArgs(); |
122 | t << " -o " << (*it)->makefile; | 118 | t << " -o " << (*it)->makefile; |
123 | if(have_dir) { | 119 | if(have_dir) { |
124 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; | 120 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; |
125 | t << "\n\t" << "@cd .."; | 121 | t << "\n\t" << "@cd .."; |
126 | for(int i = 1; i < subLevels; i++ ) | 122 | for(int i = 1; i < subLevels; i++ ) |
127 | t << Option::dir_sep << ".."; | 123 | t << Option::dir_sep << ".."; |
128 | } | 124 | } |
129 | t << endl; | 125 | t << endl; |
130 | 126 | ||
131 | //now actually build | 127 | //now actually build |
132 | t << (*it)->target << ": " << mkfile; | 128 | t << (*it)->target << ": " << mkfile; |
133 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | 129 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) |
134 | t << " FORCE"; | 130 | t << " FORCE"; |
135 | if(have_dir) | 131 | if(have_dir) |
136 | t << "\n\t" << "cd " << (*it)->directory; | 132 | t << "\n\t" << "cd " << (*it)->directory; |
137 | t << "\n\t" << "$(MAKE)"; | 133 | t << "\n\t" << "$(MAKE)"; |
138 | t << " -f " << (*it)->makefile; | 134 | t << " -f " << (*it)->makefile; |
139 | if(have_dir) { | 135 | if(have_dir) { |
140 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; | 136 | int subLevels = it.current()->directory.contains(Option::dir_sep) + 1; |
141 | t << "\n\t" << "@cd .."; | 137 | t << "\n\t" << "@cd .."; |
142 | for(int i = 1; i < subLevels; i++ ) | 138 | for(int i = 1; i < subLevels; i++ ) |
143 | t << Option::dir_sep << ".."; | 139 | t << Option::dir_sep << ".."; |
144 | } | 140 | } |
145 | t << endl << endl; | 141 | t << endl << endl; |
146 | } | 142 | } |
147 | 143 | ||
144 | if (project->isActiveConfig("ordered")) { // generate dependencies | ||
145 | for( it.toFirst(); it.current(); ) { | ||
146 | QString tar = it.current()->target; | ||
147 | ++it; | ||
148 | if (it.current()) | ||
149 | t << it.current()->target << ": " << tar << endl; | ||
150 | } | ||
151 | t << endl; | ||
152 | } | ||
153 | |||
148 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) | 154 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) |
149 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); | 155 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); |
150 | writeMakeQmake(t); | 156 | writeMakeQmake(t); |
151 | 157 | ||
152 | t << "qmake_all:"; | 158 | t << "qmake_all:"; |
153 | if ( !subdirs.isEmpty() ) { | 159 | if ( !subdirs.isEmpty() ) { |
154 | for( it.toFirst(); it.current(); ++it) { | 160 | for( it.toFirst(); it.current(); ++it) { |
155 | QString subdir = (*it)->directory; | 161 | QString subdir = (*it)->directory; |
156 | QString profile = (*it)->profile; | 162 | QString profile = (*it)->profile; |
157 | int subLevels = subdir.contains(Option::dir_sep) + 1; | 163 | int subLevels = subdir.contains(Option::dir_sep) + 1; |
158 | t << "\n\t" | 164 | t << "\n\t" |
159 | << "cd " << subdir << "\n\t"; | 165 | << "cd " << subdir << "\n\t"; |
160 | int lastSlash = subdir.findRev(Option::dir_sep); | 166 | int lastSlash = subdir.findRev(Option::dir_sep); |
161 | if(lastSlash != -1) | 167 | if(lastSlash != -1) |
162 | subdir = subdir.mid( lastSlash + 1 ); | 168 | subdir = subdir.mid( lastSlash + 1 ); |
163 | t << "$(QMAKE) " | 169 | t << "$(QMAKE) " |
164 | << ( !profile.isEmpty() ? profile : subdir + ".pro" ) | 170 | << ( !profile.isEmpty() ? profile : subdir + ".pro" ) |
165 | << " -o " << (*it)->makefile | 171 | << " -o " << (*it)->makefile |
166 | << " " << buildArgs() << "\n\t" | 172 | << " " << buildArgs() << "\n\t" |
167 | << "@cd .."; | 173 | << "@cd .."; |
168 | for(int i = 1; i < subLevels; i++ ) | 174 | for(int i = 1; i < subLevels; i++ ) |
169 | t << Option::dir_sep << ".."; | 175 | t << Option::dir_sep << ".."; |
170 | } | 176 | } |
171 | } else { | 177 | } else { |
172 | // Borland make does not like empty an empty command section, so insert | 178 | // Borland make does not like empty an empty command section, so insert |
173 | // a dummy command. | 179 | // a dummy command. |
174 | t << "\n\t" << "@cd ."; | 180 | t << "\n\t" << "@cd ."; |
175 | } | 181 | } |
176 | t << endl << endl; | 182 | t << endl << endl; |
177 | 183 | ||
178 | QString targs[] = { QString("clean"), QString("install"), QString("mocclean"), QString::null }; | 184 | QStringList targs; |
179 | for(int x = 0; targs[x] != QString::null; x++) { | 185 | targs << "clean" << "install_subdirs" << "mocables" << "uicables" << "uiclean" << "mocclean"; |
180 | t << targs[x] << ": qmake_all"; | 186 | targs += project->values("SUBDIR_TARGETS"); |
181 | if(targs[x] == "clean") | 187 | for(QStringList::Iterator targ_it = targs.begin(); targ_it != targs.end(); ++targ_it) { |
182 | t << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ", ""); | 188 | t << (*targ_it) << ": qmake_all"; |
189 | QString targ = (*targ_it); | ||
190 | if(targ == "install_subdirs") | ||
191 | targ = "install"; | ||
192 | else if(targ == "uninstall_subdirs") | ||
193 | targ = "uninstall"; | ||
194 | if(targ == "clean") | ||
195 | t << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ", ""); | ||
183 | if (!subdirs.isEmpty()) { | 196 | if (!subdirs.isEmpty()) { |
184 | for( it.toFirst(); it.current(); ++it) { | 197 | for( it.toFirst(); it.current(); ++it) { |
185 | int subLevels = (*it)->directory.contains(Option::dir_sep) + 1; | 198 | int subLevels = (*it)->directory.contains(Option::dir_sep) + 1; |
186 | bool have_dir = !(*it)->directory.isEmpty(); | 199 | bool have_dir = !(*it)->directory.isEmpty(); |
187 | if(have_dir) | 200 | if(have_dir) |
188 | t << "\n\t" << "cd " << (*it)->directory; | 201 | t << "\n\t" << "cd " << (*it)->directory; |
189 | QString in_file = " -f " + (*it)->makefile; | 202 | QString in_file = " -f " + (*it)->makefile; |
190 | t << "\n\t" << "$(MAKE) " << in_file << " " << targs[x]; | 203 | t << "\n\t" << "$(MAKE) " << in_file << " " << targ; |
191 | if(have_dir) { | 204 | if(have_dir) { |
192 | t << "\n\t" << "@cd .."; | 205 | t << "\n\t" << "@cd .."; |
193 | for(int i = 1; i < subLevels; i++ ) | 206 | for(int i = 1; i < subLevels; i++ ) |
194 | t << Option::dir_sep << ".."; | 207 | t << Option::dir_sep << ".."; |
195 | } | 208 | } |
196 | } | 209 | } |
197 | } else { | 210 | } else { |
198 | // Borland make does not like empty an empty command section, so | 211 | // Borland make does not like empty an empty command section, so |
199 | // insert a dummy command. | 212 | // insert a dummy command. |
200 | t << "\n\t" << "@cd ."; | 213 | t << "\n\t" << "@cd ."; |
201 | } | 214 | } |
202 | t << endl << endl; | 215 | t << endl << endl; |
203 | } | 216 | } |
204 | 217 | ||
218 | //installations | ||
219 | project->variables()["INSTALLDEPS"] += "install_subdirs"; | ||
220 | project->variables()["UNINSTALLDEPS"] += "uninstall_subdirs"; | ||
221 | writeInstalls(t, "INSTALLS"); | ||
222 | |||
223 | // user defined targets | ||
224 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
225 | for(QStringList::Iterator sit = qut.begin(); sit != qut.end(); ++sit) { | ||
226 | QString targ = var((*sit) + ".target"), | ||
227 | cmd = var((*sit) + ".commands"), deps; | ||
228 | if(targ.isEmpty()) | ||
229 | targ = (*sit); | ||
230 | QStringList &deplist = project->variables()[(*sit) + ".depends"]; | ||
231 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | ||
232 | QString dep = var((*dep_it) + ".target"); | ||
233 | if(dep.isEmpty()) | ||
234 | dep = (*dep_it); | ||
235 | deps += " " + dep; | ||
236 | } | ||
237 | if(!project->variables()["QMAKE_NOFORCE"].isEmpty() && | ||
238 | project->variables()[(*sit) + ".CONFIG"].findIndex("phony") != -1) | ||
239 | deps += QString(" ") + "FORCE"; | ||
240 | t << "\n\n" << targ << ":" << deps << "\n\t" | ||
241 | << cmd; | ||
242 | } | ||
243 | |||
205 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) | 244 | if(project->variables()["QMAKE_NOFORCE"].isEmpty()) |
206 | t << "FORCE:" << endl << endl; | 245 | t << "FORCE:" << endl << endl; |
207 | } | 246 | } |
208 | 247 | ||
209 | 248 | ||
210 | int | 249 | int |
211 | Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem) | 250 | Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem) |
212 | { | 251 | { |
213 | QString bd = Option::fixPathToLocalOS(d, TRUE); | 252 | QString bd = Option::fixPathToLocalOS(d, TRUE); |
214 | if(!QFile::exists(bd)) | 253 | if(!QFile::exists(bd)) |
215 | return -1; | 254 | return -1; |
216 | if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty()) | 255 | if(!project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].isEmpty()) |
217 | return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt(); | 256 | return project->variables()["QMAKE_" + stem.upper() + "_VERSION_OVERRIDE"].first().toInt(); |
218 | 257 | ||
219 | QDir dir(bd); | 258 | QDir dir(bd); |
220 | int biggest=-1; | 259 | int biggest=-1; |
221 | QStringList entries = dir.entryList(); | 260 | QStringList entries = dir.entryList(); |
222 | QString dllStem = stem + QTDLL_POSTFIX; | 261 | QString dllStem = stem + QTDLL_POSTFIX; |
223 | QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE ); | 262 | QRegExp regx( "(" + dllStem + "([0-9]*)).lib", FALSE ); |
224 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { | 263 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { |
225 | if(regx.exactMatch((*it))) | 264 | if(regx.exactMatch((*it))) |
226 | biggest = QMAX(biggest, (regx.cap(1) == dllStem || | 265 | biggest = QMAX(biggest, (regx.cap(1) == dllStem || |
227 | regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); | 266 | regx.cap(2).isEmpty()) ? -1 : regx.cap(2).toInt()); |
228 | } | 267 | } |
229 | if(dir.exists(dllStem + Option::prl_ext)) { | 268 | QMakeMetaInfo libinfo; |
230 | QMakeProject proj; | 269 | if(libinfo.readLib(bd + dllStem)) { |
231 | if(proj.read(bd + dllStem + Option::prl_ext, QDir::currentDirPath(), TRUE)) { | 270 | if(!libinfo.isEmpty("QMAKE_PRL_VERSION")) |
232 | if(!proj.isEmpty("QMAKE_PRL_VERSION")) | 271 | biggest = QMAX(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); |
233 | biggest = QMAX(biggest, proj.first("QMAKE_PRL_VERSION").replace(".", "").toInt()); | ||
234 | } | ||
235 | } | 272 | } |
236 | return biggest; | 273 | return biggest; |
237 | } | 274 | } |
238 | 275 | ||
276 | QString | ||
277 | Win32MakefileGenerator::findDependency(const QString &dep) | ||
278 | { | ||
279 | { | ||
280 | QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"]; | ||
281 | for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { | ||
282 | QString targ = var((*it) + ".target"); | ||
283 | if(targ.isEmpty()) | ||
284 | targ = (*it); | ||
285 | if(targ.endsWith(dep)) | ||
286 | return targ; | ||
287 | } | ||
288 | } | ||
289 | { | ||
290 | QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"]; | ||
291 | for(QStringList::Iterator it = quc.begin(); it != quc.end(); ++it) { | ||
292 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
293 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
294 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
295 | continue; | ||
296 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
297 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
298 | QStringList &inputs = project->variables()[(*it2)]; | ||
299 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
300 | QString out = tmp_out; | ||
301 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
302 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
303 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
304 | if(out.endsWith(dep)) | ||
305 | return out; | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | return MakefileGenerator::findDependency(dep); | ||
311 | } | ||
239 | 312 | ||
240 | bool | 313 | bool |
241 | Win32MakefileGenerator::findLibraries(const QString &where) | 314 | Win32MakefileGenerator::findLibraries(const QString &where) |
242 | { | 315 | { |
243 | 316 | ||
244 | QStringList &l = project->variables()[where]; | 317 | QStringList &l = project->variables()[where]; |
245 | QPtrList<MakefileDependDir> dirs; | 318 | QPtrList<MakefileDependDir> dirs; |
246 | { | 319 | { |
247 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; | 320 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; |
248 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { | 321 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { |
249 | QString r = (*libpathit), l = r; | 322 | QString r = (*libpathit), l = r; |
250 | fixEnvVariables(l); | 323 | fixEnvVariables(l); |
251 | dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); | 324 | dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); |
252 | } | 325 | } |
253 | } | 326 | } |
254 | dirs.setAutoDelete(TRUE); | 327 | dirs.setAutoDelete(TRUE); |
255 | for(QStringList::Iterator it = l.begin(); it != l.end(); ) { | 328 | for(QStringList::Iterator it = l.begin(); it != l.end(); ) { |
256 | QChar quote; | 329 | QChar quote; |
257 | bool modified_opt = FALSE, remove = FALSE; | 330 | bool modified_opt = FALSE, remove = FALSE; |
258 | QString opt = (*it).stripWhiteSpace(); | 331 | QString opt = (*it).stripWhiteSpace(); |
259 | if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) { | 332 | if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) { |
260 | quote = opt[0]; | 333 | quote = opt[0]; |
261 | opt = opt.mid(1, opt.length()-2); | 334 | opt = opt.mid(1, opt.length()-2); |
262 | } | 335 | } |
263 | if(opt.startsWith("/LIBPATH:")) { | 336 | if(opt.startsWith("/LIBPATH:")) { |
264 | QString r = opt.mid(9), l = Option::fixPathToLocalOS(r); | 337 | QString r = opt.mid(9), l = Option::fixPathToLocalOS(r); |
265 | dirs.append(new MakefileDependDir(r.replace("\"",""), | 338 | dirs.append(new MakefileDependDir(r.replace("\"",""), |
266 | l.replace("\"",""))); | 339 | l.replace("\"",""))); |
267 | } else if(opt.startsWith("-L") || opt.startsWith("/L")) { | 340 | } else if(opt.startsWith("-L") || opt.startsWith("/L")) { |
268 | QString r = opt.mid(2), l = Option::fixPathToLocalOS(r); | 341 | QString r = opt.mid(2), l = Option::fixPathToLocalOS(r); |
269 | dirs.append(new MakefileDependDir(r.replace("\"",""), | 342 | dirs.append(new MakefileDependDir(r.replace("\"",""), |
270 | l.replace("\"",""))); | 343 | l.replace("\"",""))); |
271 | remove = TRUE; //we eat this switch | 344 | remove = TRUE; //we eat this switch |
272 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) { | 345 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) { |
273 | QString lib = opt.right(opt.length() - 2), out; | 346 | QString lib = opt.right(opt.length() - 2), out; |
274 | if(!lib.isEmpty()) { | 347 | if(!lib.isEmpty()) { |
275 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { | 348 | for(MakefileDependDir *mdd = dirs.first(); mdd; mdd = dirs.next() ) { |
276 | QString extension; | 349 | QString extension; |
277 | int ver = findHighestVersion(mdd->local_dir, lib); | 350 | int ver = findHighestVersion(mdd->local_dir, lib); |
278 | if(ver > 0) | 351 | if(ver > 0) |
279 | extension += QString::number(ver); | 352 | extension += QString::number(ver); |
280 | extension += ".lib"; | 353 | extension += ".lib"; |
281 | if(QFile::exists(mdd->local_dir + Option::dir_sep + lib + Option::prl_ext) || | 354 | if(QMakeMetaInfo::libExists(mdd->local_dir + Option::dir_sep + lib) || |
282 | QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) { | 355 | QFile::exists(mdd->local_dir + Option::dir_sep + lib + extension)) { |
283 | out = mdd->real_dir + Option::dir_sep + lib + extension; | 356 | out = mdd->real_dir + Option::dir_sep + lib + extension; |
284 | break; | 357 | break; |
285 | } | 358 | } |
286 | } | 359 | } |
287 | } | 360 | } |
288 | if(out.isEmpty()) { | 361 | if(out.isEmpty()) { |
289 | remove = TRUE; //just eat it since we cannot find one.. | 362 | remove = TRUE; //just eat it since we cannot find one.. |
290 | } else { | 363 | } else { |
291 | modified_opt = TRUE; | 364 | modified_opt = TRUE; |
292 | (*it) = out; | 365 | (*it) = out; |
293 | } | 366 | } |
294 | } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { | 367 | } else if(!QFile::exists(Option::fixPathToLocalOS(opt))) { |
295 | QPtrList<MakefileDependDir> lib_dirs; | 368 | QPtrList<MakefileDependDir> lib_dirs; |
296 | QString file = opt; | 369 | QString file = opt; |
297 | int slsh = file.findRev(Option::dir_sep); | 370 | int slsh = file.findRev(Option::dir_sep); |
298 | if(slsh != -1) { | 371 | if(slsh != -1) { |
299 | QString r = file.left(slsh+1), l = r; | 372 | QString r = file.left(slsh+1), l = r; |
300 | fixEnvVariables(l); | 373 | fixEnvVariables(l); |
301 | lib_dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); | 374 | lib_dirs.append(new MakefileDependDir(r.replace("\"",""), l.replace("\"",""))); |
302 | file = file.right(file.length() - slsh - 1); | 375 | file = file.right(file.length() - slsh - 1); |
303 | } else { | 376 | } else { |
304 | lib_dirs = dirs; | 377 | lib_dirs = dirs; |
305 | } | 378 | } |
306 | if(file.endsWith(".lib")) { | 379 | if (!project->variables()["QMAKE_QT_DLL"].isEmpty()) { |
307 | file = file.left(file.length() - 4); | 380 | if(file.endsWith(".lib")) { |
308 | if(!file.at(file.length()-1).isNumber()) { | 381 | file = file.left(file.length() - 4); |
309 | for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) { | 382 | if(!file.at(file.length()-1).isNumber()) { |
310 | QString lib_tmpl(file + "%1" + ".lib"); | 383 | for(MakefileDependDir *mdd = lib_dirs.first(); mdd; mdd = lib_dirs.next() ) { |
311 | int ver = findHighestVersion(mdd->local_dir, file); | 384 | QString lib_tmpl(file + "%1" + ".lib"); |
312 | if(ver != -1) { | 385 | int ver = findHighestVersion(mdd->local_dir, file); |
313 | if(ver) | 386 | if(ver != -1) { |
314 | lib_tmpl = lib_tmpl.arg(ver); | 387 | if(ver) |
315 | else | 388 | lib_tmpl = lib_tmpl.arg(ver); |
316 | lib_tmpl = lib_tmpl.arg(""); | 389 | else |
317 | if(slsh != -1) { | 390 | lib_tmpl = lib_tmpl.arg(""); |
318 | QString dir = mdd->real_dir; | 391 | if(slsh != -1) { |
319 | if(!dir.endsWith(Option::dir_sep)) | 392 | QString dir = mdd->real_dir; |
320 | dir += Option::dir_sep; | 393 | if(!dir.endsWith(Option::dir_sep)) |
321 | lib_tmpl.prepend(dir); | 394 | dir += Option::dir_sep; |
395 | lib_tmpl.prepend(dir); | ||
396 | } | ||
397 | modified_opt = TRUE; | ||
398 | (*it) = lib_tmpl; | ||
399 | break; | ||
322 | } | 400 | } |
323 | modified_opt = TRUE; | ||
324 | (*it) = lib_tmpl; | ||
325 | break; | ||
326 | } | 401 | } |
327 | } | 402 | } |
328 | } | 403 | } |
329 | } | 404 | } |
330 | } | 405 | } |
331 | if(remove) { | 406 | if(remove) { |
332 | it = l.remove(it); | 407 | it = l.remove(it); |
333 | } else { | 408 | } else { |
334 | if(!quote.isNull() && modified_opt) | 409 | if(!quote.isNull() && modified_opt) |
335 | (*it) = quote + (*it) + quote; | 410 | (*it) = quote + (*it) + quote; |
336 | ++it; | 411 | ++it; |
337 | } | 412 | } |
338 | } | 413 | } |
339 | return TRUE; | 414 | return TRUE; |
340 | } | 415 | } |
341 | 416 | ||
342 | void | 417 | void |
343 | Win32MakefileGenerator::processPrlFiles() | 418 | Win32MakefileGenerator::processPrlFiles() |
344 | { | 419 | { |
345 | QDict<void> processed; | 420 | QDict<void> processed; |
346 | QPtrList<MakefileDependDir> libdirs; | 421 | QPtrList<MakefileDependDir> libdirs; |
347 | libdirs.setAutoDelete(TRUE); | 422 | libdirs.setAutoDelete(TRUE); |
348 | { | 423 | { |
349 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; | 424 | QStringList &libpaths = project->variables()["QMAKE_LIBDIR"]; |
350 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { | 425 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) { |
351 | QString r = (*libpathit), l = r; | 426 | QString r = (*libpathit), l = r; |
352 | fixEnvVariables(l); | 427 | fixEnvVariables(l); |
353 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 428 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
354 | l.replace("\"",""))); | 429 | l.replace("\"",""))); |
355 | } | 430 | } |
356 | } | 431 | } |
357 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 432 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
358 | //read in any prl files included.. | 433 | //read in any prl files included.. |
359 | QStringList l_out; | 434 | QStringList l_out; |
360 | QString where = "QMAKE_LIBS"; | 435 | QString where = "QMAKE_LIBS"; |
361 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | 436 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) |
362 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); | 437 | where = project->first("QMAKE_INTERNAL_PRL_LIBS"); |
363 | QStringList &l = project->variables()[where]; | 438 | QStringList &l = project->variables()[where]; |
364 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 439 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
365 | QString opt = (*it); | 440 | QString opt = (*it); |
366 | if(opt.startsWith("/")) { | 441 | if(opt.startsWith("/")) { |
367 | if(opt.startsWith("/LIBPATH:")) { | 442 | if(opt.startsWith("/LIBPATH:")) { |
368 | QString r = opt.mid(9), l = r; | 443 | QString r = opt.mid(9), l = r; |
369 | fixEnvVariables(l); | 444 | fixEnvVariables(l); |
370 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 445 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
371 | l.replace("\"",""))); | 446 | l.replace("\"",""))); |
372 | } | 447 | } |
373 | } else { | 448 | } else { |
374 | if(!processed[opt]) { | 449 | if(!processed[opt]) { |
375 | if(processPrlFile(opt)) { | 450 | if(processPrlFile(opt)) { |
376 | processed.insert(opt, (void*)1); | 451 | processed.insert(opt, (void*)1); |
377 | ret = TRUE; | 452 | ret = TRUE; |
378 | } else { | 453 | } else { |
379 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 454 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
380 | QString prl = mdd->local_dir + Option::dir_sep + opt; | 455 | QString prl = mdd->local_dir + Option::dir_sep + opt; |
381 | if(processed[prl]) { | 456 | if(processed[prl]) { |
382 | break; | 457 | break; |
383 | } else if(processPrlFile(prl)) { | 458 | } else if(processPrlFile(prl)) { |
384 | processed.insert(prl, (void*)1); | 459 | processed.insert(prl, (void*)1); |
385 | ret = TRUE; | 460 | ret = TRUE; |
386 | break; | 461 | break; |
387 | } | 462 | } |
388 | } | 463 | } |
389 | } | 464 | } |
390 | } | 465 | } |
391 | } | 466 | } |
392 | if(!opt.isEmpty()) | 467 | if(!opt.isEmpty()) |
393 | l_out.append(opt); | 468 | l_out.append(opt); |
394 | } | 469 | } |
395 | if(ret) | 470 | if(ret) |
396 | l = l_out; | 471 | l = l_out; |
397 | else | 472 | else |
398 | break; | 473 | break; |
399 | } | 474 | } |
400 | } | 475 | } |
diff --git a/qmake/generators/win32/winmakefile.h b/qmake/generators/win32/winmakefile.h index 75ba0e0..dac4a99 100644 --- a/qmake/generators/win32/winmakefile.h +++ b/qmake/generators/win32/winmakefile.h | |||
@@ -1,72 +1,72 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of Win32MakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
35 | |||
37 | #ifndef __WINMAKEFILE_H__ | 36 | #ifndef __WINMAKEFILE_H__ |
38 | #define __WINMAKEFILE_H__ | 37 | #define __WINMAKEFILE_H__ |
39 | 38 | ||
40 | #include "makefile.h" | 39 | #include "makefile.h" |
41 | 40 | ||
42 | // In the Qt evaluation and educational version, we have a postfix in the | 41 | // In the Qt evaluation and educational version, we have a postfix in the |
43 | // library name (e.g. qtmteval301.dll). QTDLL_POSTFIX is used for this. | 42 | // library name (e.g. qtmteval301.dll). QTDLL_POSTFIX is used for this. |
44 | // A script modifies these lines when building eval/edu version, so be careful | 43 | // A script modifies these lines when building eval/edu version, so be careful |
45 | // when changing them. | 44 | // when changing them. |
46 | #ifndef QTDLL_POSTFIX | 45 | #ifndef QTDLL_POSTFIX |
47 | #define QTDLL_POSTFIX "" | 46 | #define QTDLL_POSTFIX "" |
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | class Win32MakefileGenerator : public MakefileGenerator | 49 | class Win32MakefileGenerator : public MakefileGenerator |
51 | { | 50 | { |
52 | protected: | 51 | protected: |
53 | virtual void writeSubDirs(QTextStream &t); | 52 | virtual void writeSubDirs(QTextStream &t); |
54 | int findHighestVersion(const QString &dir, const QString &stem); | 53 | int findHighestVersion(const QString &dir, const QString &stem); |
55 | bool findLibraries(const QString &); | 54 | bool findLibraries(const QString &); |
55 | QString findDependency(const QString &); | ||
56 | virtual bool findLibraries(); | 56 | virtual bool findLibraries(); |
57 | virtual void processPrlFiles(); | 57 | virtual void processPrlFiles(); |
58 | 58 | ||
59 | public: | 59 | public: |
60 | Win32MakefileGenerator(QMakeProject *p); | 60 | Win32MakefileGenerator(QMakeProject *p); |
61 | ~Win32MakefileGenerator(); | 61 | ~Win32MakefileGenerator(); |
62 | }; | 62 | }; |
63 | 63 | ||
64 | inline Win32MakefileGenerator::~Win32MakefileGenerator() | 64 | inline Win32MakefileGenerator::~Win32MakefileGenerator() |
65 | { } | 65 | { } |
66 | 66 | ||
67 | inline bool Win32MakefileGenerator::findLibraries() | 67 | inline bool Win32MakefileGenerator::findLibraries() |
68 | { return findLibraries("QMAKE_LIBS"); } | 68 | { return findLibraries("QMAKE_LIBS"); } |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | #endif /* __WINMAKEFILE_H__ */ | 72 | #endif /* __WINMAKEFILE_H__ */ |