summaryrefslogtreecommitdiff
path: root/qmake
authorkergoth <kergoth>2003-01-16 06:18:34 (UTC)
committer kergoth <kergoth>2003-01-16 06:18:34 (UTC)
commit9a90cb1a9e61d2bc3298f2131671d9f32abbac5a (patch) (unidiff)
tree1d2d0eb0372f32e682fe139b3e89882f381dc0db /qmake
parent216efd1cb2210211816b865b5574866e598bf3bd (diff)
downloadopie-9a90cb1a9e61d2bc3298f2131671d9f32abbac5a.zip
opie-9a90cb1a9e61d2bc3298f2131671d9f32abbac5a.tar.gz
opie-9a90cb1a9e61d2bc3298f2131671d9f32abbac5a.tar.bz2
i18n for new buildsystem :)
Diffstat (limited to 'qmake') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/unix/unixmake2.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 1797b98..cbe2014 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1,598 +1,599 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Definition of ________ class. 4** Definition of ________ class.
5** 5**
6** Created : 970521 6** Created : 970521
7** 7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the network module of the Qt GUI Toolkit. 10** This file is part of the network module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** 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 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
15** 15**
16** This file may be distributed and/or modified under the terms of the 16** 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 17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the 18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file. 19** packaging of this file.
20** 20**
21** Licensees holding valid Qt Enterprise Edition licenses may use this 21** Licensees holding valid Qt Enterprise Edition licenses may use this
22** file in accordance with the Qt Commercial License Agreement provided 22** file in accordance with the Qt Commercial License Agreement provided
23** with the Software. 23** with the Software.
24** 24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 25** 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. 26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27** 27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements. 29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#include "unixmake.h" 38#include "unixmake.h"
39#include "option.h" 39#include "option.h"
40#include <qregexp.h> 40#include <qregexp.h>
41#include <qfile.h> 41#include <qfile.h>
42#include <qdir.h> 42#include <qdir.h>
43#include <time.h> 43#include <time.h>
44 44
45 45
46UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE) 46UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE)
47{ 47{
48 48
49} 49}
50 50
51bool 51bool
52UnixMakefileGenerator::writeMakefile(QTextStream &t) 52UnixMakefileGenerator::writeMakefile(QTextStream &t)
53{ 53{
54 writeHeader(t); 54 writeHeader(t);
55 if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { 55 if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
56 t << "all clean:" << "\n\t" 56 t << "all clean:" << "\n\t"
57 << "@echo \"Some of the required modules (" 57 << "@echo \"Some of the required modules ("
58 << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" 58 << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
59 << "@echo \"Skipped.\"" << endl << endl; 59 << "@echo \"Skipped.\"" << endl << endl;
60 writeMakeQmake(t); 60 writeMakeQmake(t);
61 return TRUE; 61 return TRUE;
62 } 62 }
63 63
64 if (project->variables()["TEMPLATE"].first() == "app" || 64 if (project->variables()["TEMPLATE"].first() == "app" ||
65 project->variables()["TEMPLATE"].first() == "lib") { 65 project->variables()["TEMPLATE"].first() == "lib") {
66 writeMakeParts(t); 66 writeMakeParts(t);
67 return MakefileGenerator::writeMakefile(t); 67 return MakefileGenerator::writeMakefile(t);
68 } else if(project->variables()["TEMPLATE"].first() == "subdirs") { 68 } else if(project->variables()["TEMPLATE"].first() == "subdirs") {
69 writeSubdirs(t); 69 writeSubdirs(t);
70 return TRUE; 70 return TRUE;
71 } 71 }
72 return FALSE; 72 return FALSE;
73} 73}
74 74
75void 75void
76UnixMakefileGenerator::writeMakeParts(QTextStream &t) 76UnixMakefileGenerator::writeMakeParts(QTextStream &t)
77{ 77{
78 QString deps = fileFixify(Option::output.name()), prl; 78 QString deps = fileFixify(Option::output.name()), prl;
79 bool do_incremental = (project->isActiveConfig("incremental") && 79 bool do_incremental = (project->isActiveConfig("incremental") &&
80 !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && 80 !project->variables()["QMAKE_INCREMENTAL"].isEmpty() &&
81 (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || 81 (!project->variables()["QMAKE_APP_FLAG"].isEmpty() ||
82 !project->isActiveConfig("staticlib"))), 82 !project->isActiveConfig("staticlib"))),
83 src_incremental=FALSE, moc_incremental=FALSE; 83 src_incremental=FALSE, moc_incremental=FALSE;
84 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); 84 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 );
85 85
86 t << "####### Compiler, tools and options" << endl << endl; 86 t << "####### Compiler, tools and options" << endl << endl;
87 t << "CC = "; 87 t << "CC = ";
88 if (project->isActiveConfig("thread") && 88 if (project->isActiveConfig("thread") &&
89 ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) 89 ! project->variables()["QMAKE_CC_THREAD"].isEmpty())
90 t << var("QMAKE_CC_THREAD") << endl; 90 t << var("QMAKE_CC_THREAD") << endl;
91 else 91 else
92 t << var("QMAKE_CC") << endl; 92 t << var("QMAKE_CC") << endl;
93 93
94 t << "CXX = "; 94 t << "CXX = ";
95 if (project->isActiveConfig("thread") && 95 if (project->isActiveConfig("thread") &&
96 ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) 96 ! project->variables()["QMAKE_CXX_THREAD"].isEmpty())
97 t << var("QMAKE_CXX_THREAD") << endl; 97 t << var("QMAKE_CXX_THREAD") << endl;
98 else 98 else
99 t << var("QMAKE_CXX") << endl; 99 t << var("QMAKE_CXX") << endl;
100 100
101 t << "LEX = " << var("QMAKE_LEX") << endl; 101 t << "LEX = " << var("QMAKE_LEX") << endl;
102 t << "YACC = " << var("QMAKE_YACC") << endl; 102 t << "YACC = " << var("QMAKE_YACC") << endl;
103 t << "CFLAGS = " << var("QMAKE_CFLAGS") << " " 103 t << "CFLAGS = " << var("QMAKE_CFLAGS") << " "
104 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " 104 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
105 << varGlue("DEFINES","-D"," -D","") << endl; 105 << varGlue("DEFINES","-D"," -D","") << endl;
106 t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " " 106 t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " "
107 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " 107 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
108 << varGlue("DEFINES","-D"," -D","") << endl; 108 << varGlue("DEFINES","-D"," -D","") << endl;
109 t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; 109 t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl;
110 t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; 110 t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl;
111 t << "INCPATH = " << varGlue("INCLUDEPATH","-I", " -I", "") << " -I" << specdir() << endl; 111 t << "INCPATH = " << varGlue("INCLUDEPATH","-I", " -I", "") << " -I" << specdir() << endl;
112 112
113 if(!project->isActiveConfig("staticlib")) { 113 if(!project->isActiveConfig("staticlib")) {
114 t << "LINK = "; 114 t << "LINK = ";
115 if (project->isActiveConfig("thread") && 115 if (project->isActiveConfig("thread") &&
116 ! project->variables()["QMAKE_LINK_THREAD"].isEmpty()) 116 ! project->variables()["QMAKE_LINK_THREAD"].isEmpty())
117 t << var("QMAKE_LINK_THREAD") << endl; 117 t << var("QMAKE_LINK_THREAD") << endl;
118 else 118 else
119 t << var("QMAKE_LINK") << endl; 119 t << var("QMAKE_LINK") << endl;
120 120
121 t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; 121 t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl;
122 t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; 122 t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl;
123 } 123 }
124 124
125 t << "AR = " << var("QMAKE_AR") << endl; 125 t << "AR = " << var("QMAKE_AR") << endl;
126 t << "RANLIB = " << var("QMAKE_RANLIB") << endl; 126 t << "RANLIB = " << var("QMAKE_RANLIB") << endl;
127 t << "MOC = " << var("QMAKE_MOC") << endl; 127 t << "MOC = " << var("QMAKE_MOC") << endl;
128 t << "UIC = "<< var("QMAKE_UIC") << endl; 128 t << "UIC = "<< var("QMAKE_UIC") << endl;
129 t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; 129 t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
130 t << "TAR = "<< var("QMAKE_TAR") << endl; 130 t << "TAR = "<< var("QMAKE_TAR") << endl;
131 t << "GZIP = " << var("QMAKE_GZIP") << endl; 131 t << "GZIP = " << var("QMAKE_GZIP") << endl;
132 t << "COPY = " << var("QMAKE_COPY") << endl; 132 t << "COPY = " << var("QMAKE_COPY") << endl;
133 t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; 133 t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl;
134 t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; 134 t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl;
135 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; 135 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
136 t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; 136 t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl;
137 t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; 137 t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
138 t << "MOVE = " << var("QMAKE_MOVE") << endl; 138 t << "MOVE = " << var("QMAKE_MOVE") << endl;
139 t << endl; 139 t << endl;
140 140
141 t << "####### Output directory" << endl << endl; 141 t << "####### Output directory" << endl << endl;
142 if (! project->variables()["OBJECTS_DIR"].isEmpty()) 142 if (! project->variables()["OBJECTS_DIR"].isEmpty())
143 t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; 143 t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl;
144 else 144 else
145 t << "OBJECTS_DIR = ./" << endl; 145 t << "OBJECTS_DIR = ./" << endl;
146 t << endl; 146 t << endl;
147 147
148 /* files */ 148 /* files */
149 t << "####### Files" << endl << endl; 149 t << "####### Files" << endl << endl;
150 t << "HEADERS = " << varList("HEADERS") << endl; 150 t << "HEADERS = " << varList("HEADERS") << endl;
151 t << "SOURCES = " << varList("SOURCES") << endl; 151 t << "SOURCES = " << varList("SOURCES") << endl;
152 if(do_incremental) { 152 if(do_incremental) {
153 QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; 153 QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out;
154 t << "OBJECTS = "; 154 t << "OBJECTS = ";
155 for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { 155 for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) {
156 bool increment = FALSE; 156 bool increment = FALSE;
157 for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { 157 for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {
158 if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { 158 if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) {
159 increment = TRUE; 159 increment = TRUE;
160 incrs_out.append((*objit)); 160 incrs_out.append((*objit));
161 break; 161 break;
162 } 162 }
163 } 163 }
164 if(!increment) 164 if(!increment)
165 t << "\\\n\t\t" << (*objit); 165 t << "\\\n\t\t" << (*objit);
166 } 166 }
167 if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! 167 if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!
168 t << incrs_out.join(" \\\n\t\t") << endl; 168 t << incrs_out.join(" \\\n\t\t") << endl;
169 } else if(!incrs_out.count()) { 169 } else if(!incrs_out.count()) {
170 t << endl; 170 t << endl;
171 } else { 171 } else {
172 src_incremental = TRUE; 172 src_incremental = TRUE;
173 t << endl; 173 t << endl;
174 t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl; 174 t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl;
175 } 175 }
176 } else { 176 } else {
177 t << "OBJECTS = " << varList("OBJECTS") << endl; 177 t << "OBJECTS = " << varList("OBJECTS") << endl;
178 } 178 }
179 t << "FORMS = " << varList("FORMS") << endl; 179 t << "FORMS = " << varList("FORMS") << endl;
180 t << "UICDECLS = " << varList("UICDECLS") << endl; 180 t << "UICDECLS = " << varList("UICDECLS") << endl;
181 t << "UICIMPLS = " << varList("UICIMPLS") << endl; 181 t << "UICIMPLS = " << varList("UICIMPLS") << endl;
182 QString srcMoc = varList("SRCMOC"), objMoc = varList("OBJMOC"); 182 QString srcMoc = varList("SRCMOC"), objMoc = varList("OBJMOC");
183 t << "SRCMOC = " << srcMoc << endl; 183 t << "SRCMOC = " << srcMoc << endl;
184 if(do_incremental) { 184 if(do_incremental) {
185 QStringList &objs = project->variables()["OBJMOC"], 185 QStringList &objs = project->variables()["OBJMOC"],
186 &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; 186 &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out;
187 t << "OBJMOC = "; 187 t << "OBJMOC = ";
188 for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { 188 for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) {
189 bool increment = FALSE; 189 bool increment = FALSE;
190 for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { 190 for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {
191 if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { 191 if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) {
192 increment = TRUE; 192 increment = TRUE;
193 incrs_out.append((*objit)); 193 incrs_out.append((*objit));
194 break; 194 break;
195 } 195 }
196 } 196 }
197 if(!increment) 197 if(!increment)
198 t << "\\\n\t\t" << (*objit); 198 t << "\\\n\t\t" << (*objit);
199 } 199 }
200 if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! 200 if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!
201 t << incrs_out.join(" \\\n\t\t") << endl; 201 t << incrs_out.join(" \\\n\t\t") << endl;
202 } else if(!incrs_out.count()) { 202 } else if(!incrs_out.count()) {
203 t << endl; 203 t << endl;
204 } else { 204 } else {
205 moc_incremental = TRUE; 205 moc_incremental = TRUE;
206 t << endl; 206 t << endl;
207 t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; 207 t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl;
208 } 208 }
209 } else { 209 } else {
210 t << "OBJMOC = " << objMoc << endl; 210 t << "OBJMOC = " << objMoc << endl;
211 } 211 }
212 if(do_incremental && !moc_incremental && !src_incremental) 212 if(do_incremental && !moc_incremental && !src_incremental)
213 do_incremental = FALSE; 213 do_incremental = FALSE;
214 t << "DIST = " << varList("DISTFILES") << endl; 214 t << "DIST = " << varList("DISTFILES") << endl;
215 t << "PRO = " << fileFixify(project->projectFile()) << endl;
215 t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; 216 t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
216 t << "DESTDIR = " << var("DESTDIR") << endl; 217 t << "DESTDIR = " << var("DESTDIR") << endl;
217 t << "TARGET = " << var("TARGET") << endl; 218 t << "TARGET = " << var("TARGET") << endl;
218 if(project->isActiveConfig("plugin") ) { 219 if(project->isActiveConfig("plugin") ) {
219 t << "TARGETD = " << var("TARGET") << endl; 220 t << "TARGETD = " << var("TARGET") << endl;
220 } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { 221 } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
221 t << "TARGETA= " << var("TARGETA") << endl; 222 t << "TARGETA= " << var("TARGETA") << endl;
222 if (os == "hpux") { 223 if (os == "hpux") {
223 t << "TARGETD= " << var("TARGET_x") << endl; 224 t << "TARGETD= " << var("TARGET_x") << endl;
224 t << "TARGET0= " << var("TARGET_") << endl; 225 t << "TARGET0= " << var("TARGET_") << endl;
225 } 226 }
226 else { 227 else {
227 t << "TARGETD= " << var("TARGET_x.y.z") << endl; 228 t << "TARGETD= " << var("TARGET_x.y.z") << endl;
228 t << "TARGET0= " << var("TARGET_") << endl; 229 t << "TARGET0= " << var("TARGET_") << endl;
229 t << "TARGET1= " << var("TARGET_x") << endl; 230 t << "TARGET1= " << var("TARGET_x") << endl;
230 t << "TARGET2= " << var("TARGET_x.y") << endl; 231 t << "TARGET2= " << var("TARGET_x.y") << endl;
231 } 232 }
232 } 233 }
233 t << endl; 234 t << endl;
234 235
235 // blasted incldues 236 // blasted incldues
236 QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; 237 QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"];
237 QStringList::Iterator it; 238 QStringList::Iterator it;
238 for( it = qeui.begin(); it != qeui.end(); ++it) 239 for( it = qeui.begin(); it != qeui.end(); ++it)
239 t << "include " << (*it) << endl; 240 t << "include " << (*it) << endl;
240 241
241 /* rules */ 242 /* rules */
242 t << "first: all" << endl; 243 t << "first: all" << endl;
243 t << "####### Implicit rules" << endl << endl; 244 t << "####### Implicit rules" << endl << endl;
244 t << ".SUFFIXES: .c"; 245 t << ".SUFFIXES: .c";
245 QStringList::Iterator cppit; 246 QStringList::Iterator cppit;
246 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) 247 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
247 t << " " << (*cppit); 248 t << " " << (*cppit);
248 t << endl << endl; 249 t << endl << endl;
249 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) 250 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
250 t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 251 t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
251 t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; 252 t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
252 253
253 if(include_deps) { 254 if(include_deps) {
254 QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; 255 QString cmd=var("QMAKE_CFLAGS_DEPS") + " ";
255 cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); 256 cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D","");
256 if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) 257 if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH"))
257 cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; 258 cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " ";
258 cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); 259 cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", "");
259 QString odir; 260 QString odir;
260 if(!project->variables()["OBJECTS_DIR"].isEmpty()) 261 if(!project->variables()["OBJECTS_DIR"].isEmpty())
261 odir = project->first("OBJECTS_DIR"); 262 odir = project->first("OBJECTS_DIR");
262 t << "###### Dependancies" << endl << endl; 263 t << "###### Dependancies" << endl << endl;
263 t << odir << ".deps/%.d: %.cpp\n\t" 264 t << odir << ".deps/%.d: %.cpp\n\t"
264 << "@echo Creating depend for $<" << "\n\t" 265 << "@echo Creating depend for $<" << "\n\t"
265 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" 266 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t"
266 << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; 267 << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
267 268
268 t << odir << ".deps/%.d: %.c\n\t" 269 t << odir << ".deps/%.d: %.c\n\t"
269 << "@echo Creating depend for $<" << "\n\t" 270 << "@echo Creating depend for $<" << "\n\t"
270 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" 271 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t"
271 << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; 272 << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
272 273
273 274
274 QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; 275 QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null };
275 for(int x = 0; !src[x].isNull(); x++) { 276 for(int x = 0; !src[x].isNull(); x++) {
276 QStringList &l = project->variables()[src[x]]; 277 QStringList &l = project->variables()[src[x]];
277 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { 278 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
278 if(!(*it).isEmpty()) { 279 if(!(*it).isEmpty()) {
279 QString d_file; 280 QString d_file;
280 if((*it).endsWith(".c")) { 281 if((*it).endsWith(".c")) {
281 d_file = (*it).left((*it).length() - 2); 282 d_file = (*it).left((*it).length() - 2);
282 } else { 283 } else {
283 for(QStringList::Iterator cppit = Option::cpp_ext.begin(); 284 for(QStringList::Iterator cppit = Option::cpp_ext.begin();
284 cppit != Option::cpp_ext.end(); ++cppit) { 285 cppit != Option::cpp_ext.end(); ++cppit) {
285 if((*it).endsWith((*cppit))) { 286 if((*it).endsWith((*cppit))) {
286 d_file = (*it).left((*it).length() - (*cppit).length()); 287 d_file = (*it).left((*it).length() - (*cppit).length());
287 break; 288 break;
288 } 289 }
289 } 290 }
290 } 291 }
291 if(!d_file.isEmpty()) { 292 if(!d_file.isEmpty()) {
292 d_file = odir + ".deps/" + d_file + ".d"; 293 d_file = odir + ".deps/" + d_file + ".d";
293 QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$")); 294 QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$"));
294 if(!deps.isEmpty()) 295 if(!deps.isEmpty())
295 t << d_file << ": " << deps.join(" ") << endl; 296 t << d_file << ": " << deps.join(" ") << endl;
296 t << "-include " << d_file << endl; 297 t << "-include " << d_file << endl;
297 } 298 }
298 } 299 }
299 } 300 }
300 } 301 }
301 } 302 }
302 303
303 t << "####### Build rules" << endl << endl; 304 t << "####### Build rules" << endl << endl;
304 if(!project->variables()["SUBLIBS"].isEmpty()) { 305 if(!project->variables()["SUBLIBS"].isEmpty()) {
305 QString libdir = "tmp/"; 306 QString libdir = "tmp/";
306 if(!project->isEmpty("SUBLIBS_DIR")) 307 if(!project->isEmpty("SUBLIBS_DIR"))
307 libdir = project->first("SUBLIBS_DIR"); 308 libdir = project->first("SUBLIBS_DIR");
308 t << "SUBLIBS= "; 309 t << "SUBLIBS= ";
309 QStringList &l = project->variables()["SUBLIBS"]; 310 QStringList &l = project->variables()["SUBLIBS"];
310 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) 311 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it)
311 t << libdir << "lib" << (*it) << ".a "; 312 t << libdir << "lib" << (*it) << ".a ";
312 t << endl << endl; 313 t << endl << endl;
313 } 314 }
314 if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { 315 if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) {
315 QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; 316 QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"];
316 QStringList::Iterator it; 317 QStringList::Iterator it;
317 for(it = l.begin(); it != l.end(); ++it) { 318 for(it = l.begin(); it != l.end(); ++it) {
318 QMakeProject proj; 319 QMakeProject proj;
319 if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) { 320 if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) {
320 QString dir; 321 QString dir;
321 int slsh = (*it).findRev(Option::dir_sep); 322 int slsh = (*it).findRev(Option::dir_sep);
322 if(slsh != -1) 323 if(slsh != -1)
323 dir = (*it).left(slsh + 1); 324 dir = (*it).left(slsh + 1);
324 QString targ = dir + proj.first("QMAKE_PRL_TARGET"); 325 QString targ = dir + proj.first("QMAKE_PRL_TARGET");
325 deps += " " + targ; 326 deps += " " + targ;
326 t << targ << ":" << "\n\t" 327 t << targ << ":" << "\n\t"
327 << "@echo \"Creating '" << targ << "'\"" << "\n\t" 328 << "@echo \"Creating '" << targ << "'\"" << "\n\t"
328 << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";" 329 << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";"
329 << "$(MAKE) )" << endl; 330 << "$(MAKE) )" << endl;
330 } 331 }
331 } 332 }
332 } 333 }
333 if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { 334 if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
334 QString destdir = project->first("DESTDIR"); 335 QString destdir = project->first("DESTDIR");
335 if(do_incremental) { 336 if(do_incremental) {
336 //incremental target 337 //incremental target
337 QString incr_target = var("TARGET") + "_incremental"; 338 QString incr_target = var("TARGET") + "_incremental";
338 if(incr_target.find(Option::dir_sep) != -1) 339 if(incr_target.find(Option::dir_sep) != -1)
339 incr_target = incr_target.right(incr_target.length() - 340 incr_target = incr_target.right(incr_target.length() -
340 (incr_target.findRev(Option::dir_sep) + 1)); 341 (incr_target.findRev(Option::dir_sep) + 1));
341 QString incr_deps, incr_objs; 342 QString incr_deps, incr_objs;
342 if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { 343 if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
343 QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; 344 QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext;
344 //actual target 345 //actual target
345 t << incr_target_dir << ": $(OBJECTS)" << "\n\t" 346 t << incr_target_dir << ": $(OBJECTS)" << "\n\t"
346 << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl; 347 << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl;
347 //communicated below 348 //communicated below
348 deps.prepend(incr_target_dir + " "); 349 deps.prepend(incr_target_dir + " ");
349 incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)"; 350 incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)";
350 if(!incr_objs.isEmpty()) 351 if(!incr_objs.isEmpty())
351 incr_objs += " "; 352 incr_objs += " ";
352 incr_objs += incr_target_dir; 353 incr_objs += incr_target_dir;
353 } else { 354 } else {
354 //actual target 355 //actual target
355 QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + 356 QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." +
356 project->variables()["QMAKE_EXTENSION_SHLIB"].first(); 357 project->variables()["QMAKE_EXTENSION_SHLIB"].first();
357 QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; 358 QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " ";
358 if(project->isActiveConfig("debug")) 359 if(project->isActiveConfig("debug"))
359 incr_lflags += var("QMAKE_LFLAGS_DEBUG"); 360 incr_lflags += var("QMAKE_LFLAGS_DEBUG");
360 else 361 else
361 incr_lflags += var("QMAKE_LFLAGS_RELEASE"); 362 incr_lflags += var("QMAKE_LFLAGS_RELEASE");
362 t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; 363 t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t";
363 if(!destdir.isEmpty()) 364 if(!destdir.isEmpty())
364 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 365 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
365 t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << 366 t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir <<
366 " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; 367 " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl;
367 //communicated below 368 //communicated below
368 if(!destdir.isEmpty()) { 369 if(!destdir.isEmpty()) {
369 if(!incr_objs.isEmpty()) 370 if(!incr_objs.isEmpty())
370 incr_objs += " "; 371 incr_objs += " ";
371 incr_objs += "-L" + destdir; 372 incr_objs += "-L" + destdir;
372 } else { 373 } else {
373 if(!incr_objs.isEmpty()) 374 if(!incr_objs.isEmpty())
374 incr_objs += " "; 375 incr_objs += " ";
375 incr_objs += "-L" + QDir::currentDirPath(); 376 incr_objs += "-L" + QDir::currentDirPath();
376 } 377 }
377 if(!incr_objs.isEmpty()) 378 if(!incr_objs.isEmpty())
378 incr_objs += " "; 379 incr_objs += " ";
379 incr_objs += " -l" + incr_target; 380 incr_objs += " -l" + incr_target;
380 deps.prepend(incr_target_dir + " "); 381 deps.prepend(incr_target_dir + " ");
381 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 382 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
382 } 383 }
383 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" 384 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
384 << endl << endl; 385 << endl << endl;
385 386
386 //real target 387 //real target
387 t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t"; 388 t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t";
388 if(!destdir.isEmpty()) 389 if(!destdir.isEmpty())
389 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 390 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
390 if(!project->isEmpty("QMAKE_PRE_LINK")) 391 if(!project->isEmpty("QMAKE_PRE_LINK"))
391 t << var("QMAKE_PRE_LINK") << "\n\t"; 392 t << var("QMAKE_PRE_LINK") << "\n\t";
392 t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; 393 t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)";
393 if(!project->isEmpty("QMAKE_POST_LINK")) 394 if(!project->isEmpty("QMAKE_POST_LINK"))
394 t << "\n\t" << var("QMAKE_POST_LINK"); 395 t << "\n\t" << var("QMAKE_POST_LINK");
395 t << endl << endl; 396 t << endl << endl;
396 } else { 397 } else {
397 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" 398 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
398 << endl << endl; 399 << endl << endl;
399 400
400 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t"; 401 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t";
401 if(!destdir.isEmpty()) 402 if(!destdir.isEmpty())
402 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 403 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
403 if(!project->isEmpty("QMAKE_PRE_LINK")) 404 if(!project->isEmpty("QMAKE_PRE_LINK"))
404 t << var("QMAKE_PRE_LINK") << "\n\t"; 405 t << var("QMAKE_PRE_LINK") << "\n\t";
405 t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; 406 t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)";
406 if(!project->isEmpty("QMAKE_POST_LINK")) 407 if(!project->isEmpty("QMAKE_POST_LINK"))
407 t << "\n\t" << var("QMAKE_POST_LINK"); 408 t << "\n\t" << var("QMAKE_POST_LINK");
408 t << endl << endl; 409 t << endl << endl;
409 } 410 }
410 } else if(!project->isActiveConfig("staticlib")) { 411 } else if(!project->isActiveConfig("staticlib")) {
411 QString destdir = project->first("DESTDIR"), incr_deps; 412 QString destdir = project->first("DESTDIR"), incr_deps;
412 if(do_incremental) { 413 if(do_incremental) {
413 QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); 414 QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first();
414 QString incr_target = var("QMAKE_ORIG_TARGET").replace( 415 QString incr_target = var("QMAKE_ORIG_TARGET").replace(
415 QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; 416 QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental";
416 if(incr_target.find(Option::dir_sep) != -1) 417 if(incr_target.find(Option::dir_sep) != -1)
417 incr_target = incr_target.right(incr_target.length() - 418 incr_target = incr_target.right(incr_target.length() -
418 (incr_target.findRev(Option::dir_sep) + 1)); 419 (incr_target.findRev(Option::dir_sep) + 1));
419 420
420 if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { 421 if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
421 QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; 422 QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext;
422 //actual target 423 //actual target
423 const QString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 424 const QString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
424 t << incr_target_dir << ": " << link_deps << "\n\t" 425 t << incr_target_dir << ": " << link_deps << "\n\t"
425 << "ld -r -o " << incr_target_dir << " " << link_deps << endl; 426 << "ld -r -o " << incr_target_dir << " " << link_deps << endl;
426 //communicated below 427 //communicated below
427 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; 428 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"];
428 cmd.first().replace("$(OBJECTS) $(OBJMOC)", 429 cmd.first().replace("$(OBJECTS) $(OBJMOC)",
429 "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick 430 "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick
430 cmd.append(incr_target_dir); 431 cmd.append(incr_target_dir);
431 deps.prepend(incr_target_dir + " "); 432 deps.prepend(incr_target_dir + " ");
432 incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 433 incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
433 } else { 434 } else {
434 //actual target 435 //actual target
435 QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext; 436 QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext;
436 QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; 437 QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " ";
437 if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL")) 438 if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL"))
438 incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " "; 439 incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " ";
439 if(project->isActiveConfig("debug")) 440 if(project->isActiveConfig("debug"))
440 incr_lflags += var("QMAKE_LFLAGS_DEBUG"); 441 incr_lflags += var("QMAKE_LFLAGS_DEBUG");
441 else 442 else
442 incr_lflags += var("QMAKE_LFLAGS_RELEASE"); 443 incr_lflags += var("QMAKE_LFLAGS_RELEASE");
443 t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; 444 t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t";
444 if(!destdir.isEmpty()) 445 if(!destdir.isEmpty())
445 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 446 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
446 t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << 447 t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir <<
447 " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; 448 " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl;
448 //communicated below 449 //communicated below
449 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; 450 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"];
450 if(!destdir.isEmpty()) 451 if(!destdir.isEmpty())
451 cmd.append(" -L" + destdir); 452 cmd.append(" -L" + destdir);
452 cmd.append(" -l" + incr_target); 453 cmd.append(" -l" + incr_target);
453 deps.prepend(incr_target_dir + " "); 454 deps.prepend(incr_target_dir + " ");
454 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 455 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
455 } 456 }
456 457
457 t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") 458 t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","")
458 << " " << var("DESTDIR_TARGET") << endl << endl; 459 << " " << var("DESTDIR_TARGET") << endl << endl;
459 460
460 //real target 461 //real target
461 t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " << 462 t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " <<
462 var("TARGETDEPS"); 463 var("TARGETDEPS");
463 } else { 464 } else {
464 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << 465 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " <<
465 var("DESTDIR_TARGET") << endl << endl; 466 var("DESTDIR_TARGET") << endl << endl;
466 t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << 467 t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " <<
467 var("TARGETDEPS"); 468 var("TARGETDEPS");
468 } 469 }
469 if(!destdir.isEmpty()) 470 if(!destdir.isEmpty())
470 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; 471 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir;
471 if(!project->isEmpty("QMAKE_PRE_LINK")) 472 if(!project->isEmpty("QMAKE_PRE_LINK"))
472 t << "\n\t" << var("QMAKE_PRE_LINK"); 473 t << "\n\t" << var("QMAKE_PRE_LINK");
473 474
474 if(project->isActiveConfig("plugin")) { 475 if(project->isActiveConfig("plugin")) {
475 t << "\n\t" 476 t << "\n\t"
476 << "-$(DEL_FILE) $(TARGET)" << "\n\t" 477 << "-$(DEL_FILE) $(TARGET)" << "\n\t"
477 << var("QMAKE_LINK_SHLIB_CMD"); 478 << var("QMAKE_LINK_SHLIB_CMD");
478 if(!destdir.isEmpty()) 479 if(!destdir.isEmpty())
479 t << "\n\t" 480 t << "\n\t"
480 << "-$(MOVE) $(TARGET) " << var("DESTDIR"); 481 << "-$(MOVE) $(TARGET) " << var("DESTDIR");
481 if(!project->isEmpty("QMAKE_POST_LINK")) 482 if(!project->isEmpty("QMAKE_POST_LINK"))
482 t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; 483 t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t";
483 t << endl << endl; 484 t << endl << endl;
484 } else if ( os == "hpux" ) { 485 } else if ( os == "hpux" ) {
485 t << "\n\t" 486 t << "\n\t"
486 << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" 487 << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t"
487 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; 488 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
488 t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); 489 t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
489 if(!destdir.isEmpty()) 490 if(!destdir.isEmpty())
490 t << "\n\t" 491 t << "\n\t"
491 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" 492 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
492 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" 493 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
493 << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); 494 << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
494 if(!project->isEmpty("QMAKE_POST_LINK")) 495 if(!project->isEmpty("QMAKE_POST_LINK"))
495 t << "\n\t" << var("QMAKE_POST_LINK"); 496 t << "\n\t" << var("QMAKE_POST_LINK");
496 t << endl << endl; 497 t << endl << endl;
497 } else { 498 } else {
498 t << "\n\t" 499 t << "\n\t"
499 << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" 500 << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t"
500 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; 501 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
501 t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" 502 t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t"
502 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" 503 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
503 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); 504 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
504 if(!destdir.isEmpty()) 505 if(!destdir.isEmpty())
505 t << "\n\t" 506 t << "\n\t"
506 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" 507 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
507 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" 508 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
508 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" 509 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t"
509 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" 510 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t"
510 << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); 511 << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR");
511 if(!project->isEmpty("QMAKE_POST_LINK")) 512 if(!project->isEmpty("QMAKE_POST_LINK"))
512 t << "\n\t" << var("QMAKE_POST_LINK"); 513 t << "\n\t" << var("QMAKE_POST_LINK");
513 t << endl << endl; 514 t << endl << endl;
514 } 515 }
515 t << endl << endl; 516 t << endl << endl;
516 517
517 if (! project->isActiveConfig("plugin")) { 518 if (! project->isActiveConfig("plugin")) {
518 t << "staticlib: $(TARGETA)" << endl << endl; 519 t << "staticlib: $(TARGETA)" << endl << endl;
519 t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)"; 520 t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)";
520 if(do_incremental) 521 if(do_incremental)
521 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 522 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
522 t << var("TARGETDEPS") << "\n\t" 523 t << var("TARGETDEPS") << "\n\t"
523 << "-$(DEL_FILE) $(TARGETA) " << "\n\t" 524 << "-$(DEL_FILE) $(TARGETA) " << "\n\t"
524 << var("QMAKE_AR_CMD"); 525 << var("QMAKE_AR_CMD");
525 if(do_incremental) 526 if(do_incremental)
526 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 527 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
527 if(!project->isEmpty("QMAKE_RANLIB")) 528 if(!project->isEmpty("QMAKE_RANLIB"))
528 t << "\n\t" << "$(RANLIB) $(TARGETA)"; 529 t << "\n\t" << "$(RANLIB) $(TARGETA)";
529 t << endl << endl; 530 t << endl << endl;
530 } 531 }
531 } else { 532 } else {
532 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " 533 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) "
533 << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" 534 << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n"
534 << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; 535 << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n";
535 if(project->isEmpty("QMAKE_AR_SUBLIBS")) { 536 if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
536 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t"; 537 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t";
537 if(!project->isEmpty("DESTDIR")) { 538 if(!project->isEmpty("DESTDIR")) {
538 QString destdir = project->first("DESTDIR"); 539 QString destdir = project->first("DESTDIR");
539 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 540 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
540 } 541 }
541 t << "-$(DEL_FILE) $(TARGET)" << "\n\t" 542 t << "-$(DEL_FILE) $(TARGET)" << "\n\t"
542 << var("QMAKE_AR_CMD") << "\n"; 543 << var("QMAKE_AR_CMD") << "\n";
543 if(!project->isEmpty("QMAKE_POST_LINK")) 544 if(!project->isEmpty("QMAKE_POST_LINK"))
544 t << "\t" << var("QMAKE_POST_LINK") << "\n"; 545 t << "\t" << var("QMAKE_POST_LINK") << "\n";
545 if(!project->isEmpty("QMAKE_RANLIB")) 546 if(!project->isEmpty("QMAKE_RANLIB"))
546 t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; 547 t << "\t" << "$(RANLIB) $(TARGET)" << "\n";
547 if(!project->isEmpty("DESTDIR")) 548 if(!project->isEmpty("DESTDIR"))
548 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" 549 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n"
549 << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; 550 << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n";
550 } else { 551 } else {
551 int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); 552 int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
552 QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], 553 QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"],
553 libs = project->variables()["QMAKE_AR_SUBLIBS"]; 554 libs = project->variables()["QMAKE_AR_SUBLIBS"];
554 libs.prepend("$(TARGET)"); 555 libs.prepend("$(TARGET)");
555 for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); 556 for(QStringList::Iterator libit = libs.begin(), objit = objs.begin();
556 libit != libs.end(); ++libit) { 557 libit != libs.end(); ++libit) {
557 QStringList build; 558 QStringList build;
558 for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) 559 for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
559 build << (*objit); 560 build << (*objit);
560 QString ar; 561 QString ar;
561 if((*libit) == "$(TARGET)") { 562 if((*libit) == "$(TARGET)") {
562 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " 563 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) "
563 << valList(build) << "\n\t"; 564 << valList(build) << "\n\t";
564 ar = project->variables()["QMAKE_AR_CMD"].first(); 565 ar = project->variables()["QMAKE_AR_CMD"].first();
565 ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", 566 ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)",
566 build.join(" ")); 567 build.join(" "));
567 } else { 568 } else {
568 t << (*libit) << ": " << valList(build) << "\n\t"; 569 t << (*libit) << ": " << valList(build) << "\n\t";
569 ar = "$(AR) " + (*libit) + " " + build.join(" "); 570 ar = "$(AR) " + (*libit) + " " + build.join(" ");
570 } 571 }
571 if(!project->isEmpty("DESTDIR")) { 572 if(!project->isEmpty("DESTDIR")) {
572 QString destdir = project->first("DESTDIR"); 573 QString destdir = project->first("DESTDIR");
573 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 574 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
574 } 575 }
575 t << "-$(DEL_FILE) " << (*libit) << "\n\t" 576 t << "-$(DEL_FILE) " << (*libit) << "\n\t"
576 << ar << "\n"; 577 << ar << "\n";
577 if(!project->isEmpty("QMAKE_POST_LINK")) 578 if(!project->isEmpty("QMAKE_POST_LINK"))
578 t << "\t" << var("QMAKE_POST_LINK") << "\n"; 579 t << "\t" << var("QMAKE_POST_LINK") << "\n";
579 if(!project->isEmpty("QMAKE_RANLIB")) 580 if(!project->isEmpty("QMAKE_RANLIB"))
580 t << "\t" << "$(RANLIB) " << (*libit) << "\n"; 581 t << "\t" << "$(RANLIB) " << (*libit) << "\n";
581 if(!project->isEmpty("DESTDIR")) 582 if(!project->isEmpty("DESTDIR"))
582 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" 583 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n"
583 << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; 584 << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n";
584 } 585 }
585 } 586 }
586 t << endl << endl; 587 t << endl << endl;
587 } 588 }
588 589
589 t << "mocables: $(SRCMOC)" << endl << endl; 590 t << "mocables: $(SRCMOC)" << endl << endl;
590 591
591 if(!project->isActiveConfig("no_mocdepend")) { 592 if(!project->isActiveConfig("no_mocdepend")) {
592 //this is an implicity depend on moc, so it will be built if necesary, however 593 //this is an implicity depend on moc, so it will be built if necesary, however
593 //moc itself shouldn't have this dependancy - this is a little kludgy but it is 594 //moc itself shouldn't have this dependancy - this is a little kludgy but it is
594 //better than the alternative for now. 595 //better than the alternative for now.
595 QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); 596 QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET");
596 fixEnvVariables(target); 597 fixEnvVariables(target);
597 fixEnvVariables(moc); 598 fixEnvVariables(moc);
598 if(target != moc) 599 if(target != moc)