summaryrefslogtreecommitdiff
authorzecke <zecke>2003-04-20 18:11:49 (UTC)
committer zecke <zecke>2003-04-20 18:11:49 (UTC)
commitd32e9a7306da861786551c518525862a50154b95 (patch) (unidiff)
tree4ee2c97637b53691ea48322a200ec98cb7f13189
parentca3cd49d65353584bfe85755ef2885b049d25d33 (diff)
downloadopie-d32e9a7306da861786551c518525862a50154b95.zip
opie-d32e9a7306da861786551c518525862a50154b95.tar.gz
opie-d32e9a7306da861786551c518525862a50154b95.tar.bz2
add PRO = file.pro
to the Makefile
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/unix/unixmake2.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index cbe2014..9bb6f6b 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1,1049 +1,1050 @@
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 << "PRO = " << fileFixify(project->projectFile() )<< endl;
139 t << endl; 140 t << endl;
140 141
141 t << "####### Output directory" << endl << endl; 142 t << "####### Output directory" << endl << endl;
142 if (! project->variables()["OBJECTS_DIR"].isEmpty()) 143 if (! project->variables()["OBJECTS_DIR"].isEmpty())
143 t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; 144 t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl;
144 else 145 else
145 t << "OBJECTS_DIR = ./" << endl; 146 t << "OBJECTS_DIR = ./" << endl;
146 t << endl; 147 t << endl;
147 148
148 /* files */ 149 /* files */
149 t << "####### Files" << endl << endl; 150 t << "####### Files" << endl << endl;
150 t << "HEADERS = " << varList("HEADERS") << endl; 151 t << "HEADERS = " << varList("HEADERS") << endl;
151 t << "SOURCES = " << varList("SOURCES") << endl; 152 t << "SOURCES = " << varList("SOURCES") << endl;
152 if(do_incremental) { 153 if(do_incremental) {
153 QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; 154 QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out;
154 t << "OBJECTS = "; 155 t << "OBJECTS = ";
155 for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { 156 for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) {
156 bool increment = FALSE; 157 bool increment = FALSE;
157 for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { 158 for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {
158 if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { 159 if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) {
159 increment = TRUE; 160 increment = TRUE;
160 incrs_out.append((*objit)); 161 incrs_out.append((*objit));
161 break; 162 break;
162 } 163 }
163 } 164 }
164 if(!increment) 165 if(!increment)
165 t << "\\\n\t\t" << (*objit); 166 t << "\\\n\t\t" << (*objit);
166 } 167 }
167 if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! 168 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; 169 t << incrs_out.join(" \\\n\t\t") << endl;
169 } else if(!incrs_out.count()) { 170 } else if(!incrs_out.count()) {
170 t << endl; 171 t << endl;
171 } else { 172 } else {
172 src_incremental = TRUE; 173 src_incremental = TRUE;
173 t << endl; 174 t << endl;
174 t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl; 175 t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl;
175 } 176 }
176 } else { 177 } else {
177 t << "OBJECTS = " << varList("OBJECTS") << endl; 178 t << "OBJECTS = " << varList("OBJECTS") << endl;
178 } 179 }
179 t << "FORMS = " << varList("FORMS") << endl; 180 t << "FORMS = " << varList("FORMS") << endl;
180 t << "UICDECLS = " << varList("UICDECLS") << endl; 181 t << "UICDECLS = " << varList("UICDECLS") << endl;
181 t << "UICIMPLS = " << varList("UICIMPLS") << endl; 182 t << "UICIMPLS = " << varList("UICIMPLS") << endl;
182 QString srcMoc = varList("SRCMOC"), objMoc = varList("OBJMOC"); 183 QString srcMoc = varList("SRCMOC"), objMoc = varList("OBJMOC");
183 t << "SRCMOC = " << srcMoc << endl; 184 t << "SRCMOC = " << srcMoc << endl;
184 if(do_incremental) { 185 if(do_incremental) {
185 QStringList &objs = project->variables()["OBJMOC"], 186 QStringList &objs = project->variables()["OBJMOC"],
186 &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; 187 &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out;
187 t << "OBJMOC = "; 188 t << "OBJMOC = ";
188 for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { 189 for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) {
189 bool increment = FALSE; 190 bool increment = FALSE;
190 for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { 191 for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {
191 if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { 192 if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) {
192 increment = TRUE; 193 increment = TRUE;
193 incrs_out.append((*objit)); 194 incrs_out.append((*objit));
194 break; 195 break;
195 } 196 }
196 } 197 }
197 if(!increment) 198 if(!increment)
198 t << "\\\n\t\t" << (*objit); 199 t << "\\\n\t\t" << (*objit);
199 } 200 }
200 if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! 201 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; 202 t << incrs_out.join(" \\\n\t\t") << endl;
202 } else if(!incrs_out.count()) { 203 } else if(!incrs_out.count()) {
203 t << endl; 204 t << endl;
204 } else { 205 } else {
205 moc_incremental = TRUE; 206 moc_incremental = TRUE;
206 t << endl; 207 t << endl;
207 t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; 208 t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl;
208 } 209 }
209 } else { 210 } else {
210 t << "OBJMOC = " << objMoc << endl; 211 t << "OBJMOC = " << objMoc << endl;
211 } 212 }
212 if(do_incremental && !moc_incremental && !src_incremental) 213 if(do_incremental && !moc_incremental && !src_incremental)
213 do_incremental = FALSE; 214 do_incremental = FALSE;
214 t << "DIST = " << varList("DISTFILES") << endl; 215 t << "DIST = " << varList("DISTFILES") << endl;
215 t << "PRO = " << fileFixify(project->projectFile()) << endl; 216 t << "PRO = " << fileFixify(project->projectFile()) << endl;
216 t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; 217 t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
217 t << "DESTDIR = " << var("DESTDIR") << endl; 218 t << "DESTDIR = " << var("DESTDIR") << endl;
218 t << "TARGET = " << var("TARGET") << endl; 219 t << "TARGET = " << var("TARGET") << endl;
219 if(project->isActiveConfig("plugin") ) { 220 if(project->isActiveConfig("plugin") ) {
220 t << "TARGETD = " << var("TARGET") << endl; 221 t << "TARGETD = " << var("TARGET") << endl;
221 } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { 222 } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
222 t << "TARGETA= " << var("TARGETA") << endl; 223 t << "TARGETA= " << var("TARGETA") << endl;
223 if (os == "hpux") { 224 if (os == "hpux") {
224 t << "TARGETD= " << var("TARGET_x") << endl; 225 t << "TARGETD= " << var("TARGET_x") << endl;
225 t << "TARGET0= " << var("TARGET_") << endl; 226 t << "TARGET0= " << var("TARGET_") << endl;
226 } 227 }
227 else { 228 else {
228 t << "TARGETD= " << var("TARGET_x.y.z") << endl; 229 t << "TARGETD= " << var("TARGET_x.y.z") << endl;
229 t << "TARGET0= " << var("TARGET_") << endl; 230 t << "TARGET0= " << var("TARGET_") << endl;
230 t << "TARGET1= " << var("TARGET_x") << endl; 231 t << "TARGET1= " << var("TARGET_x") << endl;
231 t << "TARGET2= " << var("TARGET_x.y") << endl; 232 t << "TARGET2= " << var("TARGET_x.y") << endl;
232 } 233 }
233 } 234 }
234 t << endl; 235 t << endl;
235 236
236 // blasted incldues 237 // blasted incldues
237 QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; 238 QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"];
238 QStringList::Iterator it; 239 QStringList::Iterator it;
239 for( it = qeui.begin(); it != qeui.end(); ++it) 240 for( it = qeui.begin(); it != qeui.end(); ++it)
240 t << "include " << (*it) << endl; 241 t << "include " << (*it) << endl;
241 242
242 /* rules */ 243 /* rules */
243 t << "first: all" << endl; 244 t << "first: all" << endl;
244 t << "####### Implicit rules" << endl << endl; 245 t << "####### Implicit rules" << endl << endl;
245 t << ".SUFFIXES: .c"; 246 t << ".SUFFIXES: .c";
246 QStringList::Iterator cppit; 247 QStringList::Iterator cppit;
247 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) 248 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
248 t << " " << (*cppit); 249 t << " " << (*cppit);
249 t << endl << endl; 250 t << endl << endl;
250 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) 251 for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
251 t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 252 t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
252 t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; 253 t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
253 254
254 if(include_deps) { 255 if(include_deps) {
255 QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; 256 QString cmd=var("QMAKE_CFLAGS_DEPS") + " ";
256 cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); 257 cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D","");
257 if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) 258 if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH"))
258 cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; 259 cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " ";
259 cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); 260 cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", "");
260 QString odir; 261 QString odir;
261 if(!project->variables()["OBJECTS_DIR"].isEmpty()) 262 if(!project->variables()["OBJECTS_DIR"].isEmpty())
262 odir = project->first("OBJECTS_DIR"); 263 odir = project->first("OBJECTS_DIR");
263 t << "###### Dependancies" << endl << endl; 264 t << "###### Dependancies" << endl << endl;
264 t << odir << ".deps/%.d: %.cpp\n\t" 265 t << odir << ".deps/%.d: %.cpp\n\t"
265 << "@echo Creating depend for $<" << "\n\t" 266 << "@echo Creating depend for $<" << "\n\t"
266 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" 267 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t"
267 << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; 268 << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
268 269
269 t << odir << ".deps/%.d: %.c\n\t" 270 t << odir << ".deps/%.d: %.c\n\t"
270 << "@echo Creating depend for $<" << "\n\t" 271 << "@echo Creating depend for $<" << "\n\t"
271 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" 272 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t"
272 << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; 273 << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
273 274
274 275
275 QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; 276 QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null };
276 for(int x = 0; !src[x].isNull(); x++) { 277 for(int x = 0; !src[x].isNull(); x++) {
277 QStringList &l = project->variables()[src[x]]; 278 QStringList &l = project->variables()[src[x]];
278 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { 279 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
279 if(!(*it).isEmpty()) { 280 if(!(*it).isEmpty()) {
280 QString d_file; 281 QString d_file;
281 if((*it).endsWith(".c")) { 282 if((*it).endsWith(".c")) {
282 d_file = (*it).left((*it).length() - 2); 283 d_file = (*it).left((*it).length() - 2);
283 } else { 284 } else {
284 for(QStringList::Iterator cppit = Option::cpp_ext.begin(); 285 for(QStringList::Iterator cppit = Option::cpp_ext.begin();
285 cppit != Option::cpp_ext.end(); ++cppit) { 286 cppit != Option::cpp_ext.end(); ++cppit) {
286 if((*it).endsWith((*cppit))) { 287 if((*it).endsWith((*cppit))) {
287 d_file = (*it).left((*it).length() - (*cppit).length()); 288 d_file = (*it).left((*it).length() - (*cppit).length());
288 break; 289 break;
289 } 290 }
290 } 291 }
291 } 292 }
292 if(!d_file.isEmpty()) { 293 if(!d_file.isEmpty()) {
293 d_file = odir + ".deps/" + d_file + ".d"; 294 d_file = odir + ".deps/" + d_file + ".d";
294 QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$")); 295 QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$"));
295 if(!deps.isEmpty()) 296 if(!deps.isEmpty())
296 t << d_file << ": " << deps.join(" ") << endl; 297 t << d_file << ": " << deps.join(" ") << endl;
297 t << "-include " << d_file << endl; 298 t << "-include " << d_file << endl;
298 } 299 }
299 } 300 }
300 } 301 }
301 } 302 }
302 } 303 }
303 304
304 t << "####### Build rules" << endl << endl; 305 t << "####### Build rules" << endl << endl;
305 if(!project->variables()["SUBLIBS"].isEmpty()) { 306 if(!project->variables()["SUBLIBS"].isEmpty()) {
306 QString libdir = "tmp/"; 307 QString libdir = "tmp/";
307 if(!project->isEmpty("SUBLIBS_DIR")) 308 if(!project->isEmpty("SUBLIBS_DIR"))
308 libdir = project->first("SUBLIBS_DIR"); 309 libdir = project->first("SUBLIBS_DIR");
309 t << "SUBLIBS= "; 310 t << "SUBLIBS= ";
310 QStringList &l = project->variables()["SUBLIBS"]; 311 QStringList &l = project->variables()["SUBLIBS"];
311 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) 312 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it)
312 t << libdir << "lib" << (*it) << ".a "; 313 t << libdir << "lib" << (*it) << ".a ";
313 t << endl << endl; 314 t << endl << endl;
314 } 315 }
315 if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { 316 if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) {
316 QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; 317 QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"];
317 QStringList::Iterator it; 318 QStringList::Iterator it;
318 for(it = l.begin(); it != l.end(); ++it) { 319 for(it = l.begin(); it != l.end(); ++it) {
319 QMakeProject proj; 320 QMakeProject proj;
320 if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) { 321 if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) {
321 QString dir; 322 QString dir;
322 int slsh = (*it).findRev(Option::dir_sep); 323 int slsh = (*it).findRev(Option::dir_sep);
323 if(slsh != -1) 324 if(slsh != -1)
324 dir = (*it).left(slsh + 1); 325 dir = (*it).left(slsh + 1);
325 QString targ = dir + proj.first("QMAKE_PRL_TARGET"); 326 QString targ = dir + proj.first("QMAKE_PRL_TARGET");
326 deps += " " + targ; 327 deps += " " + targ;
327 t << targ << ":" << "\n\t" 328 t << targ << ":" << "\n\t"
328 << "@echo \"Creating '" << targ << "'\"" << "\n\t" 329 << "@echo \"Creating '" << targ << "'\"" << "\n\t"
329 << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";" 330 << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";"
330 << "$(MAKE) )" << endl; 331 << "$(MAKE) )" << endl;
331 } 332 }
332 } 333 }
333 } 334 }
334 if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { 335 if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
335 QString destdir = project->first("DESTDIR"); 336 QString destdir = project->first("DESTDIR");
336 if(do_incremental) { 337 if(do_incremental) {
337 //incremental target 338 //incremental target
338 QString incr_target = var("TARGET") + "_incremental"; 339 QString incr_target = var("TARGET") + "_incremental";
339 if(incr_target.find(Option::dir_sep) != -1) 340 if(incr_target.find(Option::dir_sep) != -1)
340 incr_target = incr_target.right(incr_target.length() - 341 incr_target = incr_target.right(incr_target.length() -
341 (incr_target.findRev(Option::dir_sep) + 1)); 342 (incr_target.findRev(Option::dir_sep) + 1));
342 QString incr_deps, incr_objs; 343 QString incr_deps, incr_objs;
343 if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { 344 if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
344 QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; 345 QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext;
345 //actual target 346 //actual target
346 t << incr_target_dir << ": $(OBJECTS)" << "\n\t" 347 t << incr_target_dir << ": $(OBJECTS)" << "\n\t"
347 << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl; 348 << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl;
348 //communicated below 349 //communicated below
349 deps.prepend(incr_target_dir + " "); 350 deps.prepend(incr_target_dir + " ");
350 incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)"; 351 incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)";
351 if(!incr_objs.isEmpty()) 352 if(!incr_objs.isEmpty())
352 incr_objs += " "; 353 incr_objs += " ";
353 incr_objs += incr_target_dir; 354 incr_objs += incr_target_dir;
354 } else { 355 } else {
355 //actual target 356 //actual target
356 QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + 357 QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." +
357 project->variables()["QMAKE_EXTENSION_SHLIB"].first(); 358 project->variables()["QMAKE_EXTENSION_SHLIB"].first();
358 QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; 359 QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " ";
359 if(project->isActiveConfig("debug")) 360 if(project->isActiveConfig("debug"))
360 incr_lflags += var("QMAKE_LFLAGS_DEBUG"); 361 incr_lflags += var("QMAKE_LFLAGS_DEBUG");
361 else 362 else
362 incr_lflags += var("QMAKE_LFLAGS_RELEASE"); 363 incr_lflags += var("QMAKE_LFLAGS_RELEASE");
363 t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; 364 t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t";
364 if(!destdir.isEmpty()) 365 if(!destdir.isEmpty())
365 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 366 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
366 t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << 367 t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir <<
367 " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; 368 " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl;
368 //communicated below 369 //communicated below
369 if(!destdir.isEmpty()) { 370 if(!destdir.isEmpty()) {
370 if(!incr_objs.isEmpty()) 371 if(!incr_objs.isEmpty())
371 incr_objs += " "; 372 incr_objs += " ";
372 incr_objs += "-L" + destdir; 373 incr_objs += "-L" + destdir;
373 } else { 374 } else {
374 if(!incr_objs.isEmpty()) 375 if(!incr_objs.isEmpty())
375 incr_objs += " "; 376 incr_objs += " ";
376 incr_objs += "-L" + QDir::currentDirPath(); 377 incr_objs += "-L" + QDir::currentDirPath();
377 } 378 }
378 if(!incr_objs.isEmpty()) 379 if(!incr_objs.isEmpty())
379 incr_objs += " "; 380 incr_objs += " ";
380 incr_objs += " -l" + incr_target; 381 incr_objs += " -l" + incr_target;
381 deps.prepend(incr_target_dir + " "); 382 deps.prepend(incr_target_dir + " ");
382 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 383 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
383 } 384 }
384 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" 385 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
385 << endl << endl; 386 << endl << endl;
386 387
387 //real target 388 //real target
388 t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t"; 389 t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t";
389 if(!destdir.isEmpty()) 390 if(!destdir.isEmpty())
390 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 391 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
391 if(!project->isEmpty("QMAKE_PRE_LINK")) 392 if(!project->isEmpty("QMAKE_PRE_LINK"))
392 t << var("QMAKE_PRE_LINK") << "\n\t"; 393 t << var("QMAKE_PRE_LINK") << "\n\t";
393 t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; 394 t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)";
394 if(!project->isEmpty("QMAKE_POST_LINK")) 395 if(!project->isEmpty("QMAKE_POST_LINK"))
395 t << "\n\t" << var("QMAKE_POST_LINK"); 396 t << "\n\t" << var("QMAKE_POST_LINK");
396 t << endl << endl; 397 t << endl << endl;
397 } else { 398 } else {
398 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" 399 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
399 << endl << endl; 400 << endl << endl;
400 401
401 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t"; 402 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t";
402 if(!destdir.isEmpty()) 403 if(!destdir.isEmpty())
403 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 404 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
404 if(!project->isEmpty("QMAKE_PRE_LINK")) 405 if(!project->isEmpty("QMAKE_PRE_LINK"))
405 t << var("QMAKE_PRE_LINK") << "\n\t"; 406 t << var("QMAKE_PRE_LINK") << "\n\t";
406 t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; 407 t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)";
407 if(!project->isEmpty("QMAKE_POST_LINK")) 408 if(!project->isEmpty("QMAKE_POST_LINK"))
408 t << "\n\t" << var("QMAKE_POST_LINK"); 409 t << "\n\t" << var("QMAKE_POST_LINK");
409 t << endl << endl; 410 t << endl << endl;
410 } 411 }
411 } else if(!project->isActiveConfig("staticlib")) { 412 } else if(!project->isActiveConfig("staticlib")) {
412 QString destdir = project->first("DESTDIR"), incr_deps; 413 QString destdir = project->first("DESTDIR"), incr_deps;
413 if(do_incremental) { 414 if(do_incremental) {
414 QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); 415 QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first();
415 QString incr_target = var("QMAKE_ORIG_TARGET").replace( 416 QString incr_target = var("QMAKE_ORIG_TARGET").replace(
416 QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; 417 QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental";
417 if(incr_target.find(Option::dir_sep) != -1) 418 if(incr_target.find(Option::dir_sep) != -1)
418 incr_target = incr_target.right(incr_target.length() - 419 incr_target = incr_target.right(incr_target.length() -
419 (incr_target.findRev(Option::dir_sep) + 1)); 420 (incr_target.findRev(Option::dir_sep) + 1));
420 421
421 if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { 422 if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
422 QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; 423 QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext;
423 //actual target 424 //actual target
424 const QString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 425 const QString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
425 t << incr_target_dir << ": " << link_deps << "\n\t" 426 t << incr_target_dir << ": " << link_deps << "\n\t"
426 << "ld -r -o " << incr_target_dir << " " << link_deps << endl; 427 << "ld -r -o " << incr_target_dir << " " << link_deps << endl;
427 //communicated below 428 //communicated below
428 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; 429 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"];
429 cmd.first().replace("$(OBJECTS) $(OBJMOC)", 430 cmd.first().replace("$(OBJECTS) $(OBJMOC)",
430 "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick 431 "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick
431 cmd.append(incr_target_dir); 432 cmd.append(incr_target_dir);
432 deps.prepend(incr_target_dir + " "); 433 deps.prepend(incr_target_dir + " ");
433 incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 434 incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
434 } else { 435 } else {
435 //actual target 436 //actual target
436 QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext; 437 QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext;
437 QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; 438 QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " ";
438 if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL")) 439 if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL"))
439 incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " "; 440 incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " ";
440 if(project->isActiveConfig("debug")) 441 if(project->isActiveConfig("debug"))
441 incr_lflags += var("QMAKE_LFLAGS_DEBUG"); 442 incr_lflags += var("QMAKE_LFLAGS_DEBUG");
442 else 443 else
443 incr_lflags += var("QMAKE_LFLAGS_RELEASE"); 444 incr_lflags += var("QMAKE_LFLAGS_RELEASE");
444 t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; 445 t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t";
445 if(!destdir.isEmpty()) 446 if(!destdir.isEmpty())
446 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 447 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
447 t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << 448 t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir <<
448 " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; 449 " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl;
449 //communicated below 450 //communicated below
450 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; 451 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"];
451 if(!destdir.isEmpty()) 452 if(!destdir.isEmpty())
452 cmd.append(" -L" + destdir); 453 cmd.append(" -L" + destdir);
453 cmd.append(" -l" + incr_target); 454 cmd.append(" -l" + incr_target);
454 deps.prepend(incr_target_dir + " "); 455 deps.prepend(incr_target_dir + " ");
455 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 456 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
456 } 457 }
457 458
458 t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") 459 t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","")
459 << " " << var("DESTDIR_TARGET") << endl << endl; 460 << " " << var("DESTDIR_TARGET") << endl << endl;
460 461
461 //real target 462 //real target
462 t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " << 463 t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " <<
463 var("TARGETDEPS"); 464 var("TARGETDEPS");
464 } else { 465 } else {
465 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << 466 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " <<
466 var("DESTDIR_TARGET") << endl << endl; 467 var("DESTDIR_TARGET") << endl << endl;
467 t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << 468 t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " <<
468 var("TARGETDEPS"); 469 var("TARGETDEPS");
469 } 470 }
470 if(!destdir.isEmpty()) 471 if(!destdir.isEmpty())
471 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; 472 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir;
472 if(!project->isEmpty("QMAKE_PRE_LINK")) 473 if(!project->isEmpty("QMAKE_PRE_LINK"))
473 t << "\n\t" << var("QMAKE_PRE_LINK"); 474 t << "\n\t" << var("QMAKE_PRE_LINK");
474 475
475 if(project->isActiveConfig("plugin")) { 476 if(project->isActiveConfig("plugin")) {
476 t << "\n\t" 477 t << "\n\t"
477 << "-$(DEL_FILE) $(TARGET)" << "\n\t" 478 << "-$(DEL_FILE) $(TARGET)" << "\n\t"
478 << var("QMAKE_LINK_SHLIB_CMD"); 479 << var("QMAKE_LINK_SHLIB_CMD");
479 if(!destdir.isEmpty()) 480 if(!destdir.isEmpty())
480 t << "\n\t" 481 t << "\n\t"
481 << "-$(MOVE) $(TARGET) " << var("DESTDIR"); 482 << "-$(MOVE) $(TARGET) " << var("DESTDIR");
482 if(!project->isEmpty("QMAKE_POST_LINK")) 483 if(!project->isEmpty("QMAKE_POST_LINK"))
483 t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; 484 t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t";
484 t << endl << endl; 485 t << endl << endl;
485 } else if ( os == "hpux" ) { 486 } else if ( os == "hpux" ) {
486 t << "\n\t" 487 t << "\n\t"
487 << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" 488 << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t"
488 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; 489 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
489 t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); 490 t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
490 if(!destdir.isEmpty()) 491 if(!destdir.isEmpty())
491 t << "\n\t" 492 t << "\n\t"
492 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" 493 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
493 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" 494 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
494 << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); 495 << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
495 if(!project->isEmpty("QMAKE_POST_LINK")) 496 if(!project->isEmpty("QMAKE_POST_LINK"))
496 t << "\n\t" << var("QMAKE_POST_LINK"); 497 t << "\n\t" << var("QMAKE_POST_LINK");
497 t << endl << endl; 498 t << endl << endl;
498 } else { 499 } else {
499 t << "\n\t" 500 t << "\n\t"
500 << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" 501 << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t"
501 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; 502 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
502 t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" 503 t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t"
503 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" 504 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
504 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); 505 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
505 if(!destdir.isEmpty()) 506 if(!destdir.isEmpty())
506 t << "\n\t" 507 t << "\n\t"
507 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" 508 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
508 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" 509 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
509 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" 510 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t"
510 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" 511 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t"
511 << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); 512 << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR");
512 if(!project->isEmpty("QMAKE_POST_LINK")) 513 if(!project->isEmpty("QMAKE_POST_LINK"))
513 t << "\n\t" << var("QMAKE_POST_LINK"); 514 t << "\n\t" << var("QMAKE_POST_LINK");
514 t << endl << endl; 515 t << endl << endl;
515 } 516 }
516 t << endl << endl; 517 t << endl << endl;
517 518
518 if (! project->isActiveConfig("plugin")) { 519 if (! project->isActiveConfig("plugin")) {
519 t << "staticlib: $(TARGETA)" << endl << endl; 520 t << "staticlib: $(TARGETA)" << endl << endl;
520 t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)"; 521 t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)";
521 if(do_incremental) 522 if(do_incremental)
522 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 523 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
523 t << var("TARGETDEPS") << "\n\t" 524 t << var("TARGETDEPS") << "\n\t"
524 << "-$(DEL_FILE) $(TARGETA) " << "\n\t" 525 << "-$(DEL_FILE) $(TARGETA) " << "\n\t"
525 << var("QMAKE_AR_CMD"); 526 << var("QMAKE_AR_CMD");
526 if(do_incremental) 527 if(do_incremental)
527 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 528 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
528 if(!project->isEmpty("QMAKE_RANLIB")) 529 if(!project->isEmpty("QMAKE_RANLIB"))
529 t << "\n\t" << "$(RANLIB) $(TARGETA)"; 530 t << "\n\t" << "$(RANLIB) $(TARGETA)";
530 t << endl << endl; 531 t << endl << endl;
531 } 532 }
532 } else { 533 } else {
533 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " 534 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) "
534 << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" 535 << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n"
535 << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; 536 << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n";
536 if(project->isEmpty("QMAKE_AR_SUBLIBS")) { 537 if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
537 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t"; 538 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t";
538 if(!project->isEmpty("DESTDIR")) { 539 if(!project->isEmpty("DESTDIR")) {
539 QString destdir = project->first("DESTDIR"); 540 QString destdir = project->first("DESTDIR");
540 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 541 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
541 } 542 }
542 t << "-$(DEL_FILE) $(TARGET)" << "\n\t" 543 t << "-$(DEL_FILE) $(TARGET)" << "\n\t"
543 << var("QMAKE_AR_CMD") << "\n"; 544 << var("QMAKE_AR_CMD") << "\n";
544 if(!project->isEmpty("QMAKE_POST_LINK")) 545 if(!project->isEmpty("QMAKE_POST_LINK"))
545 t << "\t" << var("QMAKE_POST_LINK") << "\n"; 546 t << "\t" << var("QMAKE_POST_LINK") << "\n";
546 if(!project->isEmpty("QMAKE_RANLIB")) 547 if(!project->isEmpty("QMAKE_RANLIB"))
547 t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; 548 t << "\t" << "$(RANLIB) $(TARGET)" << "\n";
548 if(!project->isEmpty("DESTDIR")) 549 if(!project->isEmpty("DESTDIR"))
549 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" 550 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n"
550 << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; 551 << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n";
551 } else { 552 } else {
552 int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); 553 int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
553 QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], 554 QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"],
554 libs = project->variables()["QMAKE_AR_SUBLIBS"]; 555 libs = project->variables()["QMAKE_AR_SUBLIBS"];
555 libs.prepend("$(TARGET)"); 556 libs.prepend("$(TARGET)");
556 for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); 557 for(QStringList::Iterator libit = libs.begin(), objit = objs.begin();
557 libit != libs.end(); ++libit) { 558 libit != libs.end(); ++libit) {
558 QStringList build; 559 QStringList build;
559 for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) 560 for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
560 build << (*objit); 561 build << (*objit);
561 QString ar; 562 QString ar;
562 if((*libit) == "$(TARGET)") { 563 if((*libit) == "$(TARGET)") {
563 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " 564 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) "
564 << valList(build) << "\n\t"; 565 << valList(build) << "\n\t";
565 ar = project->variables()["QMAKE_AR_CMD"].first(); 566 ar = project->variables()["QMAKE_AR_CMD"].first();
566 ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", 567 ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)",
567 build.join(" ")); 568 build.join(" "));
568 } else { 569 } else {
569 t << (*libit) << ": " << valList(build) << "\n\t"; 570 t << (*libit) << ": " << valList(build) << "\n\t";
570 ar = "$(AR) " + (*libit) + " " + build.join(" "); 571 ar = "$(AR) " + (*libit) + " " + build.join(" ");
571 } 572 }
572 if(!project->isEmpty("DESTDIR")) { 573 if(!project->isEmpty("DESTDIR")) {
573 QString destdir = project->first("DESTDIR"); 574 QString destdir = project->first("DESTDIR");
574 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 575 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
575 } 576 }
576 t << "-$(DEL_FILE) " << (*libit) << "\n\t" 577 t << "-$(DEL_FILE) " << (*libit) << "\n\t"
577 << ar << "\n"; 578 << ar << "\n";
578 if(!project->isEmpty("QMAKE_POST_LINK")) 579 if(!project->isEmpty("QMAKE_POST_LINK"))
579 t << "\t" << var("QMAKE_POST_LINK") << "\n"; 580 t << "\t" << var("QMAKE_POST_LINK") << "\n";
580 if(!project->isEmpty("QMAKE_RANLIB")) 581 if(!project->isEmpty("QMAKE_RANLIB"))
581 t << "\t" << "$(RANLIB) " << (*libit) << "\n"; 582 t << "\t" << "$(RANLIB) " << (*libit) << "\n";
582 if(!project->isEmpty("DESTDIR")) 583 if(!project->isEmpty("DESTDIR"))
583 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" 584 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n"
584 << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; 585 << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n";
585 } 586 }
586 } 587 }
587 t << endl << endl; 588 t << endl << endl;
588 } 589 }
589 590
590 t << "mocables: $(SRCMOC)" << endl << endl; 591 t << "mocables: $(SRCMOC)" << endl << endl;
591 592
592 if(!project->isActiveConfig("no_mocdepend")) { 593 if(!project->isActiveConfig("no_mocdepend")) {
593 //this is an implicity depend on moc, so it will be built if necesary, however 594 //this is an implicity depend on moc, so it will be built if necesary, however
594 //moc itself shouldn't have this dependancy - this is a little kludgy but it is 595 //moc itself shouldn't have this dependancy - this is a little kludgy but it is
595 //better than the alternative for now. 596 //better than the alternative for now.
596 QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); 597 QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET");
597 fixEnvVariables(target); 598 fixEnvVariables(target);
598 fixEnvVariables(moc); 599 fixEnvVariables(moc);
599 if(target != moc) 600 if(target != moc)
600 t << "$(MOC): \n\t" 601 t << "$(MOC): \n\t"
601 << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; 602 << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl;
602 } 603 }
603 604
604 writeMakeQmake(t); 605 writeMakeQmake(t);
605 606
606 if(!project->first("QMAKE_PKGINFO").isEmpty()) { 607 if(!project->first("QMAKE_PKGINFO").isEmpty()) {
607 QString pkginfo = project->first("QMAKE_PKGINFO"); 608 QString pkginfo = project->first("QMAKE_PKGINFO");
608 QString destdir = project->first("DESTDIR"); 609 QString destdir = project->first("DESTDIR");
609 t << pkginfo << ": " << "\n\t"; 610 t << pkginfo << ": " << "\n\t";
610 if(!destdir.isEmpty()) 611 if(!destdir.isEmpty())
611 t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 612 t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
612 t << "@$(DEL_FILE) " << pkginfo << "\n\t" 613 t << "@$(DEL_FILE) " << pkginfo << "\n\t"
613 << "@echo \"APPL????\" >" << pkginfo << endl; 614 << "@echo \"APPL????\" >" << pkginfo << endl;
614 } 615 }
615 if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { 616 if(!project->first("QMAKE_INFO_PLIST").isEmpty()) {
616 QString info_plist = project->first("QMAKE_INFO_PLIST"), 617 QString info_plist = project->first("QMAKE_INFO_PLIST"),
617 info_plist_out = project->first("QMAKE_INFO_PLIST_OUT"); 618 info_plist_out = project->first("QMAKE_INFO_PLIST_OUT");
618 QString destdir = project->first("DESTDIR"); 619 QString destdir = project->first("DESTDIR");
619 t << info_plist_out << ": " << "\n\t"; 620 t << info_plist_out << ": " << "\n\t";
620 if(!destdir.isEmpty()) 621 if(!destdir.isEmpty())
621 t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 622 t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
622 t << "@$(DEL_FILE) " << info_plist_out << "\n\t" 623 t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
623 << "@cp \"" << info_plist << "\" \"" << info_plist_out << "\"" << endl; 624 << "@cp \"" << info_plist << "\" \"" << info_plist_out << "\"" << endl;
624 if(!project->first("RC_FILE").isEmpty()) { 625 if(!project->first("RC_FILE").isEmpty()) {
625 QString dir = destdir + "../Resources/"; 626 QString dir = destdir + "../Resources/";
626 t << dir << "application.icns:" << "\n\t" 627 t << dir << "application.icns:" << "\n\t"
627 << "@test -d " << dir << " || mkdir -p " << dir << "\n\t" 628 << "@test -d " << dir << " || mkdir -p " << dir << "\n\t"
628 << "@cp " << var("RC_FILE") << " " << dir << "application.icns" << endl; 629 << "@cp " << var("RC_FILE") << " " << dir << "application.icns" << endl;
629 } 630 }
630 } 631 }
631 632
632 QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : 633 QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") :
633 project->first("QMAKE_DISTDIR"); 634 project->first("QMAKE_DISTDIR");
634 QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : 635 QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") :
635 project->first("OBJECTS_DIR")) + ddir); 636 project->first("OBJECTS_DIR")) + ddir);
636 t << "dist: " << "\n\t" 637 t << "dist: " << "\n\t"
637 << "@mkdir -p " << ddir_c << " && " 638 << "@mkdir -p " << ddir_c << " && "
638 << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; 639 << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && ";
639 if(!project->isEmpty("TRANSLATIONS")) 640 if(!project->isEmpty("TRANSLATIONS"))
640 t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; 641 t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && ";
641 if(!project->isEmpty("FORMS")) { 642 if(!project->isEmpty("FORMS")) {
642 QStringList &forms = project->variables()["FORMS"], ui_headers; 643 QStringList &forms = project->variables()["FORMS"], ui_headers;
643 for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { 644 for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {
644 QString ui_h = fileFixify((*formit) + Option::h_ext.first()); 645 QString ui_h = fileFixify((*formit) + Option::h_ext.first());
645 if(QFile::exists(ui_h) ) 646 if(QFile::exists(ui_h) )
646 ui_headers << ui_h; 647 ui_headers << ui_h;
647 } 648 }
648 if(!ui_headers.isEmpty()) 649 if(!ui_headers.isEmpty())
649 t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; 650 t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && ";
650 } 651 }
651 t << "( cd `dirname " << ddir_c << "` && " 652 t << "( cd `dirname " << ddir_c << "` && "
652 << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " 653 << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && "
653 << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " 654 << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && "
654 << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " 655 << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && "
655 << "$(DEL_DIR) " << ddir_c 656 << "$(DEL_DIR) " << ddir_c
656 << endl << endl; 657 << endl << endl;
657 658
658 QString clean_targets; 659 QString clean_targets;
659 if(mocAware()) { 660 if(mocAware()) {
660 t << "mocclean:" << "\n"; 661 t << "mocclean:" << "\n";
661 if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { 662 if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) {
662 if(!objMoc.isEmpty()) 663 if(!objMoc.isEmpty())
663 t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; 664 t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n';
664 if(!srcMoc.isEmpty()) 665 if(!srcMoc.isEmpty())
665 t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; 666 t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n';
666 if(moc_incremental) 667 if(moc_incremental)
667 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; 668 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n';
668 clean_targets += " mocclean"; 669 clean_targets += " mocclean";
669 } 670 }
670 t << endl; 671 t << endl;
671 } 672 }
672 t << "uiclean:" << "\n"; 673 t << "uiclean:" << "\n";
673 if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) { 674 if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) {
674 t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n"; 675 t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n";
675 clean_targets += " uiclean"; 676 clean_targets += " uiclean";
676 } 677 }
677 t << endl; 678 t << endl;
678 679
679 if(do_incremental) { 680 if(do_incremental) {
680 t << "incrclean:" << "\n"; 681 t << "incrclean:" << "\n";
681 if(src_incremental) 682 if(src_incremental)
682 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; 683 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n";
683 if(moc_incremental) 684 if(moc_incremental)
684 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; 685 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n';
685 t << endl; 686 t << endl;
686 } 687 }
687 688
688 t << "clean:" << clean_targets << "\n\t"; 689 t << "clean:" << clean_targets << "\n\t";
689 if(!project->isEmpty("OBJECTS")) 690 if(!project->isEmpty("OBJECTS"))
690 t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t"; 691 t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t";
691 if(!project->isEmpty("IMAGES")) 692 if(!project->isEmpty("IMAGES"))
692 t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; 693 t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t";
693 if(src_incremental) 694 if(src_incremental)
694 t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; 695 t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t";
695 t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") 696 t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t")
696 << "-$(DEL_FILE) *~ core *.core" << "\n" 697 << "-$(DEL_FILE) *~ core *.core" << "\n"
697 << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; 698 << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl;
698 t << "####### Sub-libraries" << endl << endl; 699 t << "####### Sub-libraries" << endl << endl;
699 if ( !project->variables()["SUBLIBS"].isEmpty() ) { 700 if ( !project->variables()["SUBLIBS"].isEmpty() ) {
700 QString libdir = "tmp/"; 701 QString libdir = "tmp/";
701 if(!project->isEmpty("SUBLIBS_DIR")) 702 if(!project->isEmpty("SUBLIBS_DIR"))
702 libdir = project->first("SUBLIBS_DIR"); 703 libdir = project->first("SUBLIBS_DIR");
703 QStringList &l = project->variables()["SUBLIBS"]; 704 QStringList &l = project->variables()["SUBLIBS"];
704 for(it = l.begin(); it != l.end(); ++it) 705 for(it = l.begin(); it != l.end(); ++it)
705 t << libdir << "lib" << (*it) << ".a" << ":\n\t" 706 t << libdir << "lib" << (*it) << ".a" << ":\n\t"
706 << var(QString("MAKELIB") + (*it)) << endl << endl; 707 << var(QString("MAKELIB") + (*it)) << endl << endl;
707 } 708 }
708 709
709 QString destdir = project->first("DESTDIR"); 710 QString destdir = project->first("DESTDIR");
710 if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) 711 if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep)
711 destdir += Option::dir_sep; 712 destdir += Option::dir_sep;
712 t << "distclean: " << "clean\n\t" 713 t << "distclean: " << "clean\n\t"
713 << "-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; 714 << "-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n";
714 if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && 715 if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() &&
715 !project->isActiveConfig("plugin")) 716 !project->isActiveConfig("plugin"))
716 t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " 717 t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) "
717 << destdir << "$(TARGET2) $(TARGETA)" << "\n"; 718 << destdir << "$(TARGET2) $(TARGETA)" << "\n";
718 t << endl << endl; 719 t << endl << endl;
719 720
720 if ( !project->isEmpty("PRECOMPH") ) { 721 if ( !project->isEmpty("PRECOMPH") ) {
721 QString outdir = project->first("MOC_DIR"); 722 QString outdir = project->first("MOC_DIR");
722 QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH")); 723 QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH"));
723 t << "###### Combined headers" << endl << endl; 724 t << "###### Combined headers" << endl << endl;
724 //XXX 725 //XXX
725 t << outdir << "allmoc.cpp: " << qt_dot_h << " " 726 t << outdir << "allmoc.cpp: " << qt_dot_h << " "
726 << varList("HEADERS_ORIG") << "\n\t" 727 << varList("HEADERS_ORIG") << "\n\t"
727 << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t" 728 << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t"
728 << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " 729 << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h "
729 << outdir << "allmoc.cpp" << "\n\t" 730 << outdir << "allmoc.cpp" << "\n\t"
730 << "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t" 731 << "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t"
731 << "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \"" 732 << "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \""
732 << qt_dot_h << "\"}' " << outdir << "allmoc.cpp" << "\n\t" 733 << qt_dot_h << "\"}' " << outdir << "allmoc.cpp" << "\n\t"
733 << "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl; 734 << "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl;
734 } 735 }
735 736
736 // blasted user defined targets 737 // blasted user defined targets
737 QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; 738 QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"];
738 for(it = qut.begin(); it != qut.end(); ++it) { 739 for(it = qut.begin(); it != qut.end(); ++it) {
739 QString targ = var((*it) + ".target"), 740 QString targ = var((*it) + ".target"),
740 cmd = var((*it) + ".commands"), deps; 741 cmd = var((*it) + ".commands"), deps;
741 if(targ.isEmpty()) 742 if(targ.isEmpty())
742 targ = (*it); 743 targ = (*it);
743 QStringList &deplist = project->variables()[(*it) + ".depends"]; 744 QStringList &deplist = project->variables()[(*it) + ".depends"];
744 for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { 745 for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
745 QString dep = var((*dep_it) + ".target"); 746 QString dep = var((*dep_it) + ".target");
746 if(dep.isEmpty()) 747 if(dep.isEmpty())
747 dep = (*dep_it); 748 dep = (*dep_it);
748 deps += " " + dep; 749 deps += " " + dep;
749 } 750 }
750 t << targ << ":" << deps << "\n\t" 751 t << targ << ":" << deps << "\n\t"
751 << cmd << endl << endl; 752 << cmd << endl << endl;
752 } 753 }
753 t <<"FORCE:" << endl << endl; 754 t <<"FORCE:" << endl << endl;
754} 755}
755 756
756struct SubDir 757struct SubDir
757{ 758{
758 QString directory, profile, target, makefile; 759 QString directory, profile, target, makefile;
759}; 760};
760 761
761void 762void
762UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) 763UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
763{ 764{
764 QPtrList<SubDir> subdirs; 765 QPtrList<SubDir> subdirs;
765 { 766 {
766 QStringList subdirs_in = project->variables()["SUBDIRS"]; 767 QStringList subdirs_in = project->variables()["SUBDIRS"];
767 for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { 768 for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) {
768 QString file = (*it); 769 QString file = (*it);
769 fileFixify(file); 770 fileFixify(file);
770 SubDir *sd = new SubDir; 771 SubDir *sd = new SubDir;
771 subdirs.append(sd); 772 subdirs.append(sd);
772 sd->makefile = "$(MAKEFILE)"; 773 sd->makefile = "$(MAKEFILE)";
773 if((*it).right(4) == ".pro") { 774 if((*it).right(4) == ".pro") {
774 int slsh = file.findRev(Option::dir_sep); 775 int slsh = file.findRev(Option::dir_sep);
775 if(slsh != -1) { 776 if(slsh != -1) {
776 sd->directory = file.left(slsh+1); 777 sd->directory = file.left(slsh+1);
777 sd->profile = file.mid(slsh+1); 778 sd->profile = file.mid(slsh+1);
778 } else { 779 } else {
779 sd->profile = file; 780 sd->profile = file;
780 } 781 }
781 } else { 782 } else {
782 sd->directory = file; 783 sd->directory = file;
783 } 784 }
784 while(sd->directory.right(1) == Option::dir_sep) 785 while(sd->directory.right(1) == Option::dir_sep)
785 sd->directory = sd->directory.left(sd->directory.length() - 1); 786 sd->directory = sd->directory.left(sd->directory.length() - 1);
786 if(!sd->profile.isEmpty()) { 787 if(!sd->profile.isEmpty()) {
787 QString basename = sd->directory; 788 QString basename = sd->directory;
788 int new_slsh = basename.findRev(Option::dir_sep); 789 int new_slsh = basename.findRev(Option::dir_sep);
789 if(new_slsh != -1) 790 if(new_slsh != -1)
790 basename = basename.mid(new_slsh+1); 791 basename = basename.mid(new_slsh+1);
791 if(sd->profile != basename + ".pro") 792 if(sd->profile != basename + ".pro")
792 sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro 793 sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro
793 } 794 }
794 sd->target = "sub-" + (*it); 795 sd->target = "sub-" + (*it);
795 sd->target.replace('/', '-'); 796 sd->target.replace('/', '-');
796 sd->target.replace('.', '_'); 797 sd->target.replace('.', '_');
797 } 798 }
798 } 799 }
799 QPtrListIterator<SubDir> it(subdirs); 800 QPtrListIterator<SubDir> it(subdirs);
800 801
801 QString ofile = Option::output.name(); 802 QString ofile = Option::output.name();
802 if(ofile.findRev(Option::dir_sep) != -1) 803 if(ofile.findRev(Option::dir_sep) != -1)
803 ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); 804 ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1);
804 t << "MAKEFILE =" << var("MAKEFILE") << endl; 805 t << "MAKEFILE =" << var("MAKEFILE") << endl;
805 t << "QMAKE =" << var("QMAKE") << endl; 806 t << "QMAKE =" << var("QMAKE") << endl;
806 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; 807 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
807 t << "SUBTARGETS ="; // subdirectory targets are sub-directory 808 t << "SUBTARGETS ="; // subdirectory targets are sub-directory
808 for( it.toFirst(); it.current(); ++it) 809 for( it.toFirst(); it.current(); ++it)
809 t << " \\\n\t\t" << it.current()->target; 810 t << " \\\n\t\t" << it.current()->target;
810 t << endl << endl; 811 t << endl << endl;
811 t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; 812 t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl;
812 813
813 // generate target rules 814 // generate target rules
814 for( it.toFirst(); it.current(); ++it) { 815 for( it.toFirst(); it.current(); ++it) {
815 bool have_dir = !(*it)->directory.isEmpty(); 816 bool have_dir = !(*it)->directory.isEmpty();
816 QString mkfile = (*it)->makefile, out; 817 QString mkfile = (*it)->makefile, out;
817 if(have_dir) 818 if(have_dir)
818 mkfile.prepend((*it)->directory + Option::dir_sep); 819 mkfile.prepend((*it)->directory + Option::dir_sep);
819 if(direct || (*it)->makefile != "$(MAKEFILE)") 820 if(direct || (*it)->makefile != "$(MAKEFILE)")
820 out = " -o " + (*it)->makefile; 821 out = " -o " + (*it)->makefile;
821 //qmake it 822 //qmake it
822 t << mkfile << ": " << "\n\t"; 823 t << mkfile << ": " << "\n\t";
823 if(have_dir) 824 if(have_dir)
824 t << "cd " << (*it)->directory << " && "; 825 t << "cd " << (*it)->directory << " && ";
825 t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; 826 t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl;
826 //actually compile 827 //actually compile
827 t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; 828 t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t";
828 if(have_dir) 829 if(have_dir)
829 t << "cd " << (*it)->directory << " && "; 830 t << "cd " << (*it)->directory << " && ";
830 t << "$(MAKE) -f " << (*it)->makefile << endl << endl; 831 t << "$(MAKE) -f " << (*it)->makefile << endl << endl;
831 } 832 }
832 833
833 if (project->isActiveConfig("ordered")) { // generate dependencies 834 if (project->isActiveConfig("ordered")) { // generate dependencies
834 for( it.toFirst(); it.current(); ) { 835 for( it.toFirst(); it.current(); ) {
835 QString tar = it.current()->target; 836 QString tar = it.current()->target;
836 ++it; 837 ++it;
837 if (it.current()) 838 if (it.current())
838 t << it.current()->target << ": " << tar << endl; 839 t << it.current()->target << ": " << tar << endl;
839 } 840 }
840 t << endl; 841 t << endl;
841 } 842 }
842 843
843 writeMakeQmake(t); 844 writeMakeQmake(t);
844 845
845 if(project->isEmpty("SUBDIRS")) { 846 if(project->isEmpty("SUBDIRS")) {
846 t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl; 847 t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl;
847 } else { 848 } else {
848 t << "all: $(SUBTARGETS)" << endl; 849 t << "all: $(SUBTARGETS)" << endl;
849 t << "qmake_all:"; 850 t << "qmake_all:";
850 for( it.toFirst(); it.current(); ++it) { 851 for( it.toFirst(); it.current(); ++it) {
851 t << " "; 852 t << " ";
852 if(!(*it)->directory.isEmpty()) 853 if(!(*it)->directory.isEmpty())
853 t << (*it)->directory << Option::dir_sep; 854 t << (*it)->directory << Option::dir_sep;
854 t << (*it)->makefile; 855 t << (*it)->makefile;
855 } 856 }
856 for( it.toFirst(); it.current(); ++it) { 857 for( it.toFirst(); it.current(); ++it) {
857 t << "\n\t ( "; 858 t << "\n\t ( ";
858 if(!(*it)->directory.isEmpty()) 859 if(!(*it)->directory.isEmpty())
859 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; 860 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
860 t << "grep \"^qmake_all:\" " << (*it)->makefile 861 t << "grep \"^qmake_all:\" " << (*it)->makefile
861 << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; 862 << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true";
862 } 863 }
863 t << endl; 864 t << endl;
864 t << "clean uninstall install uiclean mocclean: qmake_all FORCE"; 865 t << "clean uninstall install uiclean mocclean: qmake_all FORCE";
865 for( it.toFirst(); it.current(); ++it) { 866 for( it.toFirst(); it.current(); ++it) {
866 t << "\n\t ( "; 867 t << "\n\t ( ";
867 if(!(*it)->directory.isEmpty()) 868 if(!(*it)->directory.isEmpty())
868 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; 869 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
869 t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; 870 t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true";
870 } 871 }
871 t << endl; 872 t << endl;
872 t << "distclean: qmake_all FORCE"; 873 t << "distclean: qmake_all FORCE";
873 for( it.toFirst(); it.current(); ++it) { 874 for( it.toFirst(); it.current(); ++it) {
874 t << "\n\t ( "; 875 t << "\n\t ( ";
875 if(!(*it)->directory.isEmpty()) 876 if(!(*it)->directory.isEmpty())
876 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; 877 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
877 t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; 878 t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true";
878 } 879 }
879 t << endl << endl; 880 t << endl << endl;
880 } 881 }
881 t <<"FORCE:" << endl << endl; 882 t <<"FORCE:" << endl << endl;
882} 883}
883 884
884void UnixMakefileGenerator::init2() 885void UnixMakefileGenerator::init2()
885{ 886{
886 //version handling 887 //version handling
887 if(project->variables()["VERSION"].isEmpty()) 888 if(project->variables()["VERSION"].isEmpty())
888 project->variables()["VERSION"].append("1.0." + 889 project->variables()["VERSION"].append("1.0." +
889 (project->isEmpty("VER_PAT") ? QString("0") : 890 (project->isEmpty("VER_PAT") ? QString("0") :
890 project->first("VER_PAT")) ); 891 project->first("VER_PAT")) );
891 QStringList l = QStringList::split('.', project->first("VERSION")); 892 QStringList l = QStringList::split('.', project->first("VERSION"));
892 l << "0" << "0"; //make sure there are three 893 l << "0" << "0"; //make sure there are three
893 project->variables()["VER_MAJ"].append(l[0]); 894 project->variables()["VER_MAJ"].append(l[0]);
894 project->variables()["VER_MIN"].append(l[1]); 895 project->variables()["VER_MIN"].append(l[1]);
895 project->variables()["VER_PAT"].append(l[2]); 896 project->variables()["VER_PAT"].append(l[2]);
896 897
897 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { 898 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
898#if 0 899#if 0
899 if ( project->isActiveConfig("dll") ) { 900 if ( project->isActiveConfig("dll") ) {
900 project->variables()["TARGET"] += project->variables()["TARGET.so"]; 901 project->variables()["TARGET"] += project->variables()["TARGET.so"];
901 if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty()) 902 if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty())
902 project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; 903 project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"];
903 if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) 904 if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty())
904 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); 905 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET");
905 } 906 }
906#endif 907#endif
907 project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); 908 project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
908 } else if ( project->isActiveConfig("staticlib") ) { 909 } else if ( project->isActiveConfig("staticlib") ) {
909 project->variables()["TARGET"].first().prepend("lib"); 910 project->variables()["TARGET"].first().prepend("lib");
910 project->variables()["TARGET"].first() += ".a"; 911 project->variables()["TARGET"].first() += ".a";
911 if(project->variables()["QMAKE_AR_CMD"].isEmpty()) 912 if(project->variables()["QMAKE_AR_CMD"].isEmpty())
912 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); 913 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)");
913 } else { 914 } else {
914 project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); 915 project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a");
915 if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) 916 if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() )
916 project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); 917 project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)");
917 else 918 else
918 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); 919 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)");
919 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); 920 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 );
920 if( project->isActiveConfig("plugin") ) { 921 if( project->isActiveConfig("plugin") ) {
921 project->variables()["TARGET_x.y.z"].append("lib" + 922 project->variables()["TARGET_x.y.z"].append("lib" +
922 project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); 923 project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB"));
923 if(project->isActiveConfig("lib_version_first")) 924 if(project->isActiveConfig("lib_version_first"))
924 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 925 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
925 project->first("VER_MAJ") + "." + 926 project->first("VER_MAJ") + "." +
926 project->first("QMAKE_EXTENSION_SHLIB")); 927 project->first("QMAKE_EXTENSION_SHLIB"));
927 else 928 else
928 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 929 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
929 project->first("QMAKE_EXTENSION_SHLIB") + 930 project->first("QMAKE_EXTENSION_SHLIB") +
930 "." + project->first("VER_MAJ")); 931 "." + project->first("VER_MAJ"));
931 932
932 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; 933 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
933 if(project->isActiveConfig("qt")) 934 if(project->isActiveConfig("qt"))
934 project->variables()["DEFINES"].append("QT_PLUGIN"); 935 project->variables()["DEFINES"].append("QT_PLUGIN");
935 } else if ( os == "hpux" ) { 936 } else if ( os == "hpux" ) {
936 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); 937 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl");
937 if(project->isActiveConfig("lib_version_first")) 938 if(project->isActiveConfig("lib_version_first"))
938 project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + 939 project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." +
939 project->first("TARGET")); 940 project->first("TARGET"));
940 else 941 else
941 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 942 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
942 project->first("VER_MAJ")); 943 project->first("VER_MAJ"));
943 project->variables()["TARGET"] = project->variables()["TARGET_x"]; 944 project->variables()["TARGET"] = project->variables()["TARGET_x"];
944 } else if ( os == "aix" ) { 945 } else if ( os == "aix" ) {
945 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); 946 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a");
946 if(project->isActiveConfig("lib_version_first")) { 947 if(project->isActiveConfig("lib_version_first")) {
947 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 948 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
948 project->first("VER_MAJ") + "." + 949 project->first("VER_MAJ") + "." +
949 project->first("QMAKE_EXTENSION_SHLIB")); 950 project->first("QMAKE_EXTENSION_SHLIB"));
950 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + 951 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
951 project->first("VER_MAJ") + 952 project->first("VER_MAJ") +
952 "." + project->first("VER_MIN") + "." + 953 "." + project->first("VER_MIN") + "." +
953 project->first("QMAKE_EXTENSION_SHLIB")); 954 project->first("QMAKE_EXTENSION_SHLIB"));
954 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + 955 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." +
955 project->first("VER_MAJ") + "." + 956 project->first("VER_MAJ") + "." +
956 project->first("VER_MIN") + "." + 957 project->first("VER_MIN") + "." +
957 project->first("VER_PAT") + "." + 958 project->first("VER_PAT") + "." +
958 project->first("QMAKE_EXTENSION_SHLIB")); 959 project->first("QMAKE_EXTENSION_SHLIB"));
959 } else { 960 } else {
960 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 961 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
961 project->first("QMAKE_EXTENSION_SHLIB") + 962 project->first("QMAKE_EXTENSION_SHLIB") +
962 "." + project->first("VER_MAJ")); 963 "." + project->first("VER_MAJ"));
963 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + 964 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
964 project->first("QMAKE_EXTENSION_SHLIB") + 965 project->first("QMAKE_EXTENSION_SHLIB") +
965 "." + project->first("VER_MAJ") + 966 "." + project->first("VER_MAJ") +
966 "." + project->first("VER_MIN")); 967 "." + project->first("VER_MIN"));
967 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + 968 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." +
968 project->first("QMAKE_EXTENSION_SHLIB") + "." + 969 project->first("QMAKE_EXTENSION_SHLIB") + "." +
969 project->first("VER_MAJ") + "." + 970 project->first("VER_MAJ") + "." +
970 project->first("VER_MIN") + "." + 971 project->first("VER_MIN") + "." +
971 project->first("VER_PAT")); 972 project->first("VER_PAT"));
972 } 973 }
973 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; 974 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
974 } else { 975 } else {
975 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + "." + 976 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + "." +
976 project->first("QMAKE_EXTENSION_SHLIB")); 977 project->first("QMAKE_EXTENSION_SHLIB"));
977 if(project->isActiveConfig("lib_version_first")) { 978 if(project->isActiveConfig("lib_version_first")) {
978 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 979 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
979 project->first("VER_MAJ") + "." + 980 project->first("VER_MAJ") + "." +
980 project->first("QMAKE_EXTENSION_SHLIB")); 981 project->first("QMAKE_EXTENSION_SHLIB"));
981 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + 982 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
982 project->first("VER_MAJ") + 983 project->first("VER_MAJ") +
983 "." + project->first("VER_MIN") + "." + 984 "." + project->first("VER_MIN") + "." +
984 project->first("QMAKE_EXTENSION_SHLIB")); 985 project->first("QMAKE_EXTENSION_SHLIB"));
985 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + 986 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." +
986 project->first("VER_MAJ") + "." + 987 project->first("VER_MAJ") + "." +
987 project->first("VER_MIN") + "." + 988 project->first("VER_MIN") + "." +
988 project->first("VER_PAT") + "." + 989 project->first("VER_PAT") + "." +
989 project->variables()["QMAKE_EXTENSION_SHLIB"].first()); 990 project->variables()["QMAKE_EXTENSION_SHLIB"].first());
990 } else { 991 } else {
991 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 992 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
992 project->first("QMAKE_EXTENSION_SHLIB") + 993 project->first("QMAKE_EXTENSION_SHLIB") +
993 "." + project->first("VER_MAJ")); 994 "." + project->first("VER_MAJ"));
994 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + 995 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
995 project->first("QMAKE_EXTENSION_SHLIB") 996 project->first("QMAKE_EXTENSION_SHLIB")
996 + "." + project->first("VER_MAJ") + 997 + "." + project->first("VER_MAJ") +
997 "." + project->first("VER_MIN")); 998 "." + project->first("VER_MIN"));
998 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + 999 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") +
999 "." + 1000 "." +
1000 project->variables()[ 1001 project->variables()[
1001 "QMAKE_EXTENSION_SHLIB"].first() + "." + 1002 "QMAKE_EXTENSION_SHLIB"].first() + "." +
1002 project->first("VER_MAJ") + "." + 1003 project->first("VER_MAJ") + "." +
1003 project->first("VER_MIN") + "." + 1004 project->first("VER_MIN") + "." +
1004 project->first("VER_PAT")); 1005 project->first("VER_PAT"));
1005 } 1006 }
1006 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; 1007 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
1007 } 1008 }
1008 if(project->isEmpty("QMAKE_LN_SHLIB")) 1009 if(project->isEmpty("QMAKE_LN_SHLIB"))
1009 project->variables()["QMAKE_LN_SHLIB"].append("ln -s"); 1010 project->variables()["QMAKE_LN_SHLIB"].append("ln -s");
1010 project->variables()["DESTDIR_TARGET"].append("$(TARGET)"); 1011 project->variables()["DESTDIR_TARGET"].append("$(TARGET)");
1011 if ( !project->variables()["DESTDIR"].isEmpty() ) 1012 if ( !project->variables()["DESTDIR"].isEmpty() )
1012 project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); 1013 project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR"));
1013 if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty() && !project->variables()["TARGET_x"].isEmpty() ) 1014 if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty() && !project->variables()["TARGET_x"].isEmpty() )
1014 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); 1015 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x");
1015 if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) 1016 if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() )
1016 project->variables()["QMAKE_LINK_SHLIB_CMD"].append( 1017 project->variables()["QMAKE_LINK_SHLIB_CMD"].append(
1017 "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"); 1018 "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)");
1018 } 1019 }
1019 if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) 1020 if(project->isEmpty("QMAKE_SYMBOLIC_LINK"))
1020 project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); 1021 project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf");
1021 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { 1022 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
1022 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"]; 1023 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"];
1023 } else if ( project->isActiveConfig("dll") ) { 1024 } else if ( project->isActiveConfig("dll") ) {
1024 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; 1025 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"];
1025 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; 1026 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"];
1026 if ( project->isActiveConfig("plugin") ) { 1027 if ( project->isActiveConfig("plugin") ) {
1027 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; 1028 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"];
1028 if( !project->isActiveConfig("plugin_no_soname") ) 1029 if( !project->isActiveConfig("plugin_no_soname") )
1029 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; 1030 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"];
1030 } else { 1031 } else {
1031 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; 1032 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"];
1032 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; 1033 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"];
1033 } 1034 }
1034 QString destdir = project->first("DESTDIR"); 1035 QString destdir = project->first("DESTDIR");
1035 if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) { 1036 if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) {
1036 QString rpath_destdir = destdir; 1037 QString rpath_destdir = destdir;
1037 if(QDir::isRelativePath(rpath_destdir)) { 1038 if(QDir::isRelativePath(rpath_destdir)) {
1038 QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir)); 1039 QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir));
1039 if(fi.convertToAbs()) //strange, shouldn't really happen 1040 if(fi.convertToAbs()) //strange, shouldn't really happen
1040 rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); 1041 rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE);
1041 else 1042 else
1042 rpath_destdir = fi.filePath(); 1043 rpath_destdir = fi.filePath();
1043 } else { 1044 } else {
1044 rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); 1045 rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE);
1045 } 1046 }
1046 project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir; 1047 project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir;
1047 } 1048 }
1048 } 1049 }
1049} 1050}