Diffstat (limited to 'qmake/generators/win32/borland_bmake.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/win32/borland_bmake.cpp | 246 |
1 files changed, 199 insertions, 47 deletions
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,42 +1,40 @@ | |||
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> |
@@ -54,342 +52,460 @@ BorlandMakefileGenerator::writeMakefile(QTextStream &t) | |||
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 | } |
@@ -439,71 +555,107 @@ BorlandMakefileGenerator::init() | |||
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 | } |