Diffstat (limited to 'qmake/generators/win32/mingw_make.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 1232 |
1 files changed, 708 insertions, 524 deletions
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 | } | ||