summaryrefslogtreecommitdiff
path: root/qmake/generators/unix
Unidiff
Diffstat (limited to 'qmake/generators/unix') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/unix/unixmake.cpp168
-rw-r--r--qmake/generators/unix/unixmake.h1
-rw-r--r--qmake/generators/unix/unixmake2.cpp185
3 files changed, 249 insertions, 105 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 7df95b2..e274481 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -1,20 +1,20 @@
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-2003 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**
@@ -63,36 +63,35 @@ UnixMakefileGenerator::init()
63 else if(project->first("TEMPLATE") == "subdirs") { 63 else if(project->first("TEMPLATE") == "subdirs") {
64 MakefileGenerator::init(); 64 MakefileGenerator::init();
65 if(project->isEmpty("MAKEFILE")) 65 if(project->isEmpty("MAKEFILE"))
66 project->variables()["MAKEFILE"].append("Makefile"); 66 project->variables()["MAKEFILE"].append("Makefile");
67 if(project->isEmpty("QMAKE")) 67 if(project->isEmpty("QMAKE"))
68 project->variables()["QMAKE"].append("qmake"); 68 project->variables()["QMAKE"].append("qmake");
69 if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) 69 if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1)
70 project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); 70 project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all");
71 return; /* subdirs is done */ 71 return; /* subdirs is done */
72 } 72 }
73 73
74 if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { 74 if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) {
75 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); 75 if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) {
76 if ( os == "cygwin" ) {
77 project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" );
78 } else {
79 project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); 76 project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" );
77 } else {
78 project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" );
80 } 79 }
81 } 80 }
82 if( project->isEmpty("QMAKE_COPY_FILE") ) 81 if( project->isEmpty("QMAKE_COPY_FILE") )
83 project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" ); 82 project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" );
84 if( project->isEmpty("QMAKE_COPY_DIR") ) 83 if( project->isEmpty("QMAKE_COPY_DIR") )
85 project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" ); 84 project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" );
86 //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET 85 //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET
87 if(!project->isEmpty("TARGET")) { 86 if(!project->isEmpty("TARGET")) {
88 QString targ = project->first("TARGET"); 87 QString targ = project->first("TARGET");
89 int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); 88 int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep));
90 if(slsh != -1) { 89 if(slsh != -1) {
91 if(project->isEmpty("DESTDIR")) 90 if(project->isEmpty("DESTDIR"))
92 project->values("DESTDIR").append(""); 91 project->values("DESTDIR").append("");
93 else if(project->first("DESTDIR").right(1) != Option::dir_sep) 92 else if(project->first("DESTDIR").right(1) != Option::dir_sep)
94 project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; 93 project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep;
95 project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); 94 project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1);
96 project->variables()["TARGET"] = targ.mid(slsh+1); 95 project->variables()["TARGET"] = targ.mid(slsh+1);
97 } 96 }
98 } 97 }
@@ -129,25 +128,25 @@ UnixMakefileGenerator::init()
129 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; 128 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"];
130 } 129 }
131 if(!project->isEmpty("QMAKE_INCREMENTAL")) 130 if(!project->isEmpty("QMAKE_INCREMENTAL"))
132 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; 131 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"];
133 else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && 132 else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") &&
134 !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && 133 !project->variables()["QMAKE_LIB_FLAG"].isEmpty() &&
135 project->isActiveConfig("dll")) 134 project->isActiveConfig("dll"))
136 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; 135 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"];
137 if(!project->isEmpty("QMAKE_INCDIR")) 136 if(!project->isEmpty("QMAKE_INCDIR"))
138 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; 137 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
139 if(!project->isEmpty("QMAKE_LIBDIR")) { 138 if(!project->isEmpty("QMAKE_LIBDIR")) {
140 if ( !project->isEmpty("QMAKE_RPATH") ) 139 if ( !project->isEmpty("QMAKE_RPATH") )
141 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), 140 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"),
142 " " + var("QMAKE_RPATH"), ""); 141 " " + var("QMAKE_RPATH"), "");
143 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); 142 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" );
144 } 143 }
145 if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { 144 if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) {
146 if(configs.findIndex("x11lib") == -1) 145 if(configs.findIndex("x11lib") == -1)
147 configs.append("x11lib"); 146 configs.append("x11lib");
148 if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) 147 if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 )
149 configs.append("x11inc"); 148 configs.append("x11inc");
150 } 149 }
151 if ( project->isActiveConfig("x11") ) { 150 if ( project->isActiveConfig("x11") ) {
152 if(configs.findIndex("x11lib") == -1) 151 if(configs.findIndex("x11lib") == -1)
153 configs.append("x11lib"); 152 configs.append("x11lib");
@@ -157,68 +156,68 @@ UnixMakefileGenerator::init()
157 if ( project->isActiveConfig("qt") ) { 156 if ( project->isActiveConfig("qt") ) {
158 if ( project->isActiveConfig("accessibility" ) ) 157 if ( project->isActiveConfig("accessibility" ) )
159 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); 158 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT");
160 if ( project->isActiveConfig("tablet") ) 159 if ( project->isActiveConfig("tablet") )
161 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); 160 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT");
162 if(configs.findIndex("moc")) configs.append("moc"); 161 if(configs.findIndex("moc")) configs.append("moc");
163 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; 162 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"];
164 if ( !project->isActiveConfig("debug") ) 163 if ( !project->isActiveConfig("debug") )
165 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); 164 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG");
166 if ( !is_qt ) { 165 if ( !is_qt ) {
167 if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) { 166 if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) {
168 if ( !project->isEmpty("QMAKE_RPATH") ) 167 if ( !project->isEmpty("QMAKE_RPATH") )
169 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), 168 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"),
170 " " + var("QMAKE_RPATH"), ""); 169 " " + var("QMAKE_RPATH"), "");
171 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); 170 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", "");
172 } 171 }
173 if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD")) 172 if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD"))
174 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; 173 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
175 else 174 else
176 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; 175 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
177 } 176 }
178 } 177 }
179 if ( project->isActiveConfig("thread") ) {
180 if(project->isActiveConfig("qt"))
181 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT");
182 if ( !project->isEmpty("QMAKE_CFLAGS_THREAD"))
183 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"];
184 if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD"))
185 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"];
186 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"];
187 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"];
188 if(!project->isEmpty("QMAKE_LFLAGS_THREAD"))
189 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"];
190 }
191 if ( project->isActiveConfig("opengl") ) { 178 if ( project->isActiveConfig("opengl") ) {
192 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; 179 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"];
193 if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) 180 if(!project->isEmpty("QMAKE_LIBDIR_OPENGL"))
194 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); 181 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", "");
195 if ( is_qt ) 182 if ( is_qt )
196 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; 183 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"];
197 else 184 else
198 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; 185 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
199 } 186 }
200 if(project->isActiveConfig("global_init_link_order")) 187 if(project->isActiveConfig("global_init_link_order"))
201 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; 188 project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
202 if ( project->isActiveConfig("x11sm") )
203 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"];
204 if ( project->isActiveConfig("dylib") )
205 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"];
206 if ( project->isActiveConfig("x11inc") ) 189 if ( project->isActiveConfig("x11inc") )
207 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; 190 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"];
208 if ( project->isActiveConfig("x11lib") ) { 191 if ( project->isActiveConfig("x11lib") ) {
209 if(!project->isEmpty("QMAKE_LIBDIR_X11")) 192 if(!project->isEmpty("QMAKE_LIBDIR_X11"))
210 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); 193 project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", "");
211 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; 194 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"];
212 } 195 }
196 if ( project->isActiveConfig("x11sm") )
197 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"];
198 if ( project->isActiveConfig("dylib") )
199 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"];
200 if ( project->isActiveConfig("thread") ) {
201 if(project->isActiveConfig("qt"))
202 project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT");
203 if ( !project->isEmpty("QMAKE_CFLAGS_THREAD"))
204 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"];
205 if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD"))
206 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"];
207 project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"];
208 project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"];
209 if(!project->isEmpty("QMAKE_LFLAGS_THREAD"))
210 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"];
211 }
213 if ( project->isActiveConfig("moc") ) 212 if ( project->isActiveConfig("moc") )
214 setMocAware(TRUE); 213 setMocAware(TRUE);
215 if ( project->isEmpty("QMAKE_RUN_CC") ) 214 if ( project->isEmpty("QMAKE_RUN_CC") )
216 project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src"); 215 project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src");
217 if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) 216 if ( project->isEmpty("QMAKE_RUN_CC_IMP") )
218 project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<"); 217 project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<");
219 if ( project->isEmpty("QMAKE_RUN_CXX") ) 218 if ( project->isEmpty("QMAKE_RUN_CXX") )
220 project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src"); 219 project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src");
221 if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) 220 if ( project->isEmpty("QMAKE_RUN_CXX_IMP") )
222 project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<"); 221 project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<");
223 project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); 222 project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " ");
224 if ( !project->isEmpty("PRECOMPH") ) { 223 if ( !project->isEmpty("PRECOMPH") ) {
@@ -331,41 +330,125 @@ UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &li
331 ret.append("-framework " + framework_in); 330 ret.append("-framework " + framework_in);
332 } else { 331 } else {
333 ret.append("-framework"); 332 ret.append("-framework");
334 ret.append(framework_in); 333 ret.append(framework_in);
335 } 334 }
336 } 335 }
337 } 336 }
338 } else { 337 } else {
339 unique = (list2.findIndex((*it)) == -1); 338 unique = (list2.findIndex((*it)) == -1);
340 } 339 }
341 } else if(QFile::exists((*it))) { 340 } else if(QFile::exists((*it))) {
342 unique = (list2.findIndex((*it)) == -1); 341 unique = (list2.findIndex((*it)) == -1);
343 } 342 }
344 if(unique) 343 if(unique)
345 ret.append((*it)); 344 ret.append((*it));
346 } 345 }
347 return ret; 346 return ret;
348} 347}
349 348
350 349
351void 350void
352UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) 351UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l)
353{ 352{
354 if(var == "QMAKE_PRL_LIBS") 353 if(var == "QMAKE_PRL_LIBS")
355 project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]); 354 project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]);
356 else 355 else
357 MakefileGenerator::processPrlVariable(var, l); 356 MakefileGenerator::processPrlVariable(var, l);
358} 357}
359 358
359bool
360UnixMakefileGenerator::findLibraries()
361{
362 QPtrList<MakefileDependDir> libdirs;
363 libdirs.setAutoDelete(TRUE);
364 const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
365 for(int i = 0; !lflags[i].isNull(); i++) {
366 QStringList &l = project->variables()[lflags[i]];
367 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
368 QString stub, dir, extn, opt = (*it).stripWhiteSpace();
369 if(opt.startsWith("-")) {
370 if(opt.startsWith("-L")) {
371 QString r = opt.right(opt.length() - 2), l = r;
372 fixEnvVariables(l);
373 libdirs.append(new MakefileDependDir(r.replace("\"",""),
374 l.replace("\"","")));
375 } else if(opt.startsWith("-l")) {
376 stub = opt.mid(2);
377 } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) {
378 if(opt.length() > 11) {
379 opt = opt.mid(11);
380 } else {
381 ++it;
382 opt = (*it);
383 }
384 extn = "";
385 dir = "/System/Library/Frameworks/" + opt + ".framework/";
386 stub = opt;
387 }
388 } else {
389 extn = dir = "";
390 stub = opt;
391 int slsh = opt.findRev(Option::dir_sep);
392 if(slsh != -1) {
393 dir = opt.left(slsh);
394 stub = opt.mid(slsh+1);
395 }
396 QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$");
397 if(stub_reg.exactMatch(stub)) {
398 stub = stub_reg.cap(1);
399 extn = stub_reg.cap(2);
400 }
401 }
402 if(!stub.isEmpty()) {
403 const QString modifs[] = { "-mt", QString::null };
404 for(int modif = 0; !modifs[modif].isNull(); modif++) {
405 bool found = FALSE;
406 QStringList extens;
407 if(!extn.isNull())
408 extens << extn;
409 else
410 extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a";
411 for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
412 if(dir.isNull()) {
413 QString lib_stub;
414 for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
415 if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub +
416 modifs[modif] + "." + (*extit))) {
417 lib_stub = stub + modifs[modif];
418 break;
419 }
420 }
421 if(!lib_stub.isNull()) {
422 (*it) = "-l" + lib_stub;
423 found = TRUE;
424 break;
425 }
426 } else {
427 if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) {
428 (*it) = "lib" + stub + modifs[modif] + "." + (*extit);
429 found = TRUE;
430 break;
431 }
432 }
433 }
434 if(found)
435 break;
436 }
437 }
438 }
439 }
440 return FALSE;
441}
442
360void 443void
361UnixMakefileGenerator::processPrlFiles() 444UnixMakefileGenerator::processPrlFiles()
362{ 445{
363 QDict<void> processed; 446 QDict<void> processed;
364 QPtrList<MakefileDependDir> libdirs; 447 QPtrList<MakefileDependDir> libdirs;
365 libdirs.setAutoDelete(TRUE); 448 libdirs.setAutoDelete(TRUE);
366 const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; 449 const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
367 for(int i = 0; !lflags[i].isNull(); i++) { 450 for(int i = 0; !lflags[i].isNull(); i++) {
368 for(bool ret = FALSE; TRUE; ret = FALSE) { 451 for(bool ret = FALSE; TRUE; ret = FALSE) {
369 QStringList l_out; 452 QStringList l_out;
370 QStringList &l = project->variables()[lflags[i]]; 453 QStringList &l = project->variables()[lflags[i]];
371 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { 454 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
@@ -393,25 +476,25 @@ UnixMakefileGenerator::processPrlFiles()
393 break; 476 break;
394 } 477 }
395 } 478 }
396 } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { 479 } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) {
397 if(opt.length() > 11) { 480 if(opt.length() > 11) {
398 opt = opt.mid(11); 481 opt = opt.mid(11);
399 } else { 482 } else {
400 ++it; 483 ++it;
401 opt = (*it); 484 opt = (*it);
402 } 485 }
403 QString prl = "/System/Library/Frameworks/" + opt + 486 QString prl = "/System/Library/Frameworks/" + opt +
404 ".framework/" + opt + Option::prl_ext; 487 ".framework/" + opt + Option::prl_ext;
405 if(processPrlFile(prl)) 488 if(processPrlFile(prl))
406 ret = TRUE; 489 ret = TRUE;
407 l_out.append("-framework"); 490 l_out.append("-framework");
408 } 491 }
409 if(!opt.isEmpty()) 492 if(!opt.isEmpty())
410 l_out.append(opt); 493 l_out.append(opt);
411 l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); 494 l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out);
412 } else { 495 } else {
413 if(!processed[opt] && processPrlFile(opt)) { 496 if(!processed[opt] && processPrlFile(opt)) {
414 processed.insert(opt, (void*)1); 497 processed.insert(opt, (void*)1);
415 ret = TRUE; 498 ret = TRUE;
416 } 499 }
417 if(!opt.isEmpty()) 500 if(!opt.isEmpty())
@@ -425,96 +508,97 @@ UnixMakefileGenerator::processPrlFiles()
425 break; 508 break;
426 } 509 }
427 } 510 }
428} 511}
429 512
430QString 513QString
431UnixMakefileGenerator::defaultInstall(const QString &t) 514UnixMakefileGenerator::defaultInstall(const QString &t)
432{ 515{
433 if(t != "target" || project->first("TEMPLATE") == "subdirs") 516 if(t != "target" || project->first("TEMPLATE") == "subdirs")
434 return QString(); 517 return QString();
435 518
436 bool resource = FALSE; 519 bool resource = FALSE;
520 const QString root = "$(INSTALL_ROOT)";
437 QStringList &uninst = project->variables()[t + ".uninstall"]; 521 QStringList &uninst = project->variables()[t + ".uninstall"];
438 QString ret, destdir=fileFixify(project->first("DESTDIR")); 522 QString ret, destdir=project->first("DESTDIR");
439 QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); 523 QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE);
440 if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) 524 if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep)
441 destdir += Option::dir_sep; 525 destdir += Option::dir_sep;
442 targetdir = "$(INSTALL_ROOT)" + Option::fixPathToTargetOS(targetdir, FALSE); 526 targetdir = fileFixify(targetdir);
443 if(targetdir.right(1) != Option::dir_sep) 527 if(targetdir.right(1) != Option::dir_sep)
444 targetdir += Option::dir_sep; 528 targetdir += Option::dir_sep;
445 529
446 QStringList links; 530 QStringList links;
447 QString target="$(TARGET)"; 531 QString target="$(TARGET)";
448 if(project->first("TEMPLATE") == "app") { 532 if(project->first("TEMPLATE") == "app") {
449 target = "$(QMAKE_TARGET)"; 533 target = "$(QMAKE_TARGET)";
450 if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { 534 if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) {
451 destdir += "../../../"; 535 destdir += "../../../";
452 target += ".app"; 536 target += ".app";
453 resource = TRUE; 537 resource = TRUE;
454 } 538 }
455 } else if(project->first("TEMPLATE") == "lib") { 539 } else if(project->first("TEMPLATE") == "lib") {
456 if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { 540 if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
457 QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); 541 QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE");
458 int slsh = dst_prl.findRev('/'); 542 int slsh = dst_prl.findRev('/');
459 if(slsh != -1) 543 if(slsh != -1)
460 dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); 544 dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
461 dst_prl = targetdir + dst_prl; 545 dst_prl = root + targetdir + dst_prl;
462 ret += "-$(COPY) " + project->first("QMAKE_INTERNAL_PRL_FILE") + " " + dst_prl; 546 ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\"";
463 if(!uninst.isEmpty()) 547 if(!uninst.isEmpty())
464 uninst.append("\n\t"); 548 uninst.append("\n\t");
465 uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); 549 uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"");
466 } 550 }
467 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); 551 if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) {
468 if ( os != "cygwin" ) {
469 if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { 552 if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) {
470 if ( os == "hpux" ) { 553 if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) {
471 links << "$(TARGET0)";
472 } else {
473 links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; 554 links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)";
555 } else {
556 links << "$(TARGET0)";
474 } 557 }
475 } 558 }
476 } 559 }
477 } 560 }
478 QString src_targ = target; 561 QString src_targ = target;
479 if(!destdir.isEmpty()) 562 if(!destdir.isEmpty())
480 src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); 563 src_targ = Option::fixPathToTargetOS(destdir + target, FALSE);
481 QString dst_targ = fileFixify(targetdir + target); 564 QString dst_targ = root + fileFixify(targetdir + target);
482 if(!ret.isEmpty()) 565 if(!ret.isEmpty())
483 ret += "\n\t"; 566 ret += "\n\t";
484 ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + 567 ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" +
485 src_targ + "\" \"" + dst_targ + "\""; 568 src_targ + "\" \"" + dst_targ + "\"";
486 if(!project->isEmpty("QMAKE_STRIP")) { 569 if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) {
487 ret += "\n\t-" + var("QMAKE_STRIP"); 570 ret += "\n\t-" + var("QMAKE_STRIP");
571 if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib")
572 ret += " " + var("QMAKE_STRIPFLAGS_LIB");
488 if(resource) 573 if(resource)
489 ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)"; 574 ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\"";
490 else 575 else
491 ret += " \"" + dst_targ + "\""; 576 ret += " \"" + dst_targ + "\"";
492 } 577 }
493 if(!uninst.isEmpty()) 578 if(!uninst.isEmpty())
494 uninst.append("\n\t"); 579 uninst.append("\n\t");
495 if(resource) 580 if(resource)
496 uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); 581 uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\"");
497 else 582 else
498 uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); 583 uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
499 if(!links.isEmpty()) { 584 if(!links.isEmpty()) {
500 for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { 585 for(QStringList::Iterator it = links.begin(); it != links.end(); it++) {
501 if(Option::target_mode == Option::TARG_WIN_MODE || 586 if(Option::target_mode == Option::TARG_WIN_MODE ||
502 Option::target_mode == Option::TARG_MAC9_MODE) { 587 Option::target_mode == Option::TARG_MAC9_MODE) {
503 } else if(Option::target_mode == Option::TARG_UNIX_MODE || 588 } else if(Option::target_mode == Option::TARG_UNIX_MODE ||
504 Option::target_mode == Option::TARG_MACX_MODE) { 589 Option::target_mode == Option::TARG_MACX_MODE) {
505 QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); 590 QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE);
506 int lslash = link.findRev(Option::dir_sep); 591 int lslash = link.findRev(Option::dir_sep);
507 if(lslash != -1) 592 if(lslash != -1)
508 link = link.right(link.length() - (lslash + 1)); 593 link = link.right(link.length() - (lslash + 1));
509 QString dst_link = fileFixify(targetdir + link); 594 QString dst_link = root + fileFixify(targetdir + link);
510 ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; 595 ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\"";
511 if(!uninst.isEmpty()) 596 if(!uninst.isEmpty())
512 uninst.append("\n\t"); 597 uninst.append("\n\t");
513 uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); 598 uninst.append("-$(DEL_FILE) \"" + dst_link + "\"");
514 } 599 }
515 } 600 }
516 } 601 }
517 return ret; 602 return ret;
518} 603}
519 604
520
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index e889dcc..3d00214 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -46,24 +46,25 @@ class UnixMakefileGenerator : public MakefileGenerator
46 QStringList uniqueSetLFlags(const QStringList &list1, QStringList &list2); 46 QStringList uniqueSetLFlags(const QStringList &list1, QStringList &list2);
47 47
48public: 48public:
49 UnixMakefileGenerator(QMakeProject *p); 49 UnixMakefileGenerator(QMakeProject *p);
50 ~UnixMakefileGenerator(); 50 ~UnixMakefileGenerator();
51 51
52protected: 52protected:
53 virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); } 53 virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); }
54 virtual QString defaultInstall(const QString &); 54 virtual QString defaultInstall(const QString &);
55 virtual void processPrlVariable(const QString &, const QStringList &); 55 virtual void processPrlVariable(const QString &, const QStringList &);
56 virtual void processPrlFiles(); 56 virtual void processPrlFiles();
57 57
58 virtual bool findLibraries();
58 virtual void init(); 59 virtual void init();
59 60
60 void writeMakeParts(QTextStream &); 61 void writeMakeParts(QTextStream &);
61 void writeSubdirs(QTextStream &, bool=TRUE); 62 void writeSubdirs(QTextStream &, bool=TRUE);
62 63
63private: 64private:
64 void init2(); 65 void init2();
65}; 66};
66 67
67inline UnixMakefileGenerator::~UnixMakefileGenerator() 68inline UnixMakefileGenerator::~UnixMakefileGenerator()
68{ } 69{ }
69 70
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 9bb6f6b..7fbb9f4 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -70,27 +70,26 @@ UnixMakefileGenerator::writeMakefile(QTextStream &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 );
85 84
86 t << "####### Compiler, tools and options" << endl << endl; 85 t << "####### Compiler, tools and options" << endl << endl;
87 t << "CC = "; 86 t << "CC = ";
88 if (project->isActiveConfig("thread") && 87 if (project->isActiveConfig("thread") &&
89 ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) 88 ! project->variables()["QMAKE_CC_THREAD"].isEmpty())
90 t << var("QMAKE_CC_THREAD") << endl; 89 t << var("QMAKE_CC_THREAD") << endl;
91 else 90 else
92 t << var("QMAKE_CC") << endl; 91 t << var("QMAKE_CC") << endl;
93 92
94 t << "CXX = "; 93 t << "CXX = ";
95 if (project->isActiveConfig("thread") && 94 if (project->isActiveConfig("thread") &&
96 ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) 95 ! project->variables()["QMAKE_CXX_THREAD"].isEmpty())
@@ -99,25 +98,32 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
99 t << var("QMAKE_CXX") << endl; 98 t << var("QMAKE_CXX") << endl;
100 99
101 t << "LEX = " << var("QMAKE_LEX") << endl; 100 t << "LEX = " << var("QMAKE_LEX") << endl;
102 t << "YACC = " << var("QMAKE_YACC") << endl; 101 t << "YACC = " << var("QMAKE_YACC") << endl;
103 t << "CFLAGS = " << var("QMAKE_CFLAGS") << " " 102 t << "CFLAGS = " << var("QMAKE_CFLAGS") << " "
104 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " 103 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
105 << varGlue("DEFINES","-D"," -D","") << endl; 104 << varGlue("DEFINES","-D"," -D","") << endl;
106 t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " " 105 t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " "
107 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " 106 << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
108 << varGlue("DEFINES","-D"," -D","") << endl; 107 << varGlue("DEFINES","-D"," -D","") << endl;
109 t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; 108 t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl;
110 t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; 109 t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl;
111 t << "INCPATH = " << varGlue("INCLUDEPATH","-I", " -I", "") << " -I" << specdir() << endl; 110 t << "INCPATH = " << "-I" << specdir();
111 if(!project->isActiveConfig("no_include_pwd")) {
112 QString pwd = fileFixify(QDir::currentDirPath());
113 if(pwd.isEmpty())
114 pwd = ".";
115 t << " -I" << pwd;
116 }
117 t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl;
112 118
113 if(!project->isActiveConfig("staticlib")) { 119 if(!project->isActiveConfig("staticlib")) {
114 t << "LINK = "; 120 t << "LINK = ";
115 if (project->isActiveConfig("thread") && 121 if (project->isActiveConfig("thread") &&
116 ! project->variables()["QMAKE_LINK_THREAD"].isEmpty()) 122 ! project->variables()["QMAKE_LINK_THREAD"].isEmpty())
117 t << var("QMAKE_LINK_THREAD") << endl; 123 t << var("QMAKE_LINK_THREAD") << endl;
118 else 124 else
119 t << var("QMAKE_LINK") << endl; 125 t << var("QMAKE_LINK") << endl;
120 126
121 t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; 127 t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl;
122 t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; 128 t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl;
123 } 129 }
@@ -127,25 +133,26 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
127 t << "MOC = " << var("QMAKE_MOC") << endl; 133 t << "MOC = " << var("QMAKE_MOC") << endl;
128 t << "UIC = "<< var("QMAKE_UIC") << endl; 134 t << "UIC = "<< var("QMAKE_UIC") << endl;
129 t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; 135 t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
130 t << "TAR = "<< var("QMAKE_TAR") << endl; 136 t << "TAR = "<< var("QMAKE_TAR") << endl;
131 t << "GZIP = " << var("QMAKE_GZIP") << endl; 137 t << "GZIP = " << var("QMAKE_GZIP") << endl;
132 t << "COPY = " << var("QMAKE_COPY") << endl; 138 t << "COPY = " << var("QMAKE_COPY") << endl;
133 t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; 139 t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl;
134 t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; 140 t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl;
135 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; 141 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
136 t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; 142 t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl;
137 t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; 143 t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
138 t << "MOVE = " << var("QMAKE_MOVE") << endl; 144 t << "MOVE = " << var("QMAKE_MOVE") << endl;
139 t << "PRO = " << fileFixify(project->projectFile() )<< endl; 145 t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
146 t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
140 t << endl; 147 t << endl;
141 148
142 t << "####### Output directory" << endl << endl; 149 t << "####### Output directory" << endl << endl;
143 if (! project->variables()["OBJECTS_DIR"].isEmpty()) 150 if (! project->variables()["OBJECTS_DIR"].isEmpty())
144 t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; 151 t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl;
145 else 152 else
146 t << "OBJECTS_DIR = ./" << endl; 153 t << "OBJECTS_DIR = ./" << endl;
147 t << endl; 154 t << endl;
148 155
149 /* files */ 156 /* files */
150 t << "####### Files" << endl << endl; 157 t << "####### Files" << endl << endl;
151 t << "HEADERS = " << varList("HEADERS") << endl; 158 t << "HEADERS = " << varList("HEADERS") << endl;
@@ -203,42 +210,40 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
203 } else if(!incrs_out.count()) { 210 } else if(!incrs_out.count()) {
204 t << endl; 211 t << endl;
205 } else { 212 } else {
206 moc_incremental = TRUE; 213 moc_incremental = TRUE;
207 t << endl; 214 t << endl;
208 t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; 215 t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl;
209 } 216 }
210 } else { 217 } else {
211 t << "OBJMOC = " << objMoc << endl; 218 t << "OBJMOC = " << objMoc << endl;
212 } 219 }
213 if(do_incremental && !moc_incremental && !src_incremental) 220 if(do_incremental && !moc_incremental && !src_incremental)
214 do_incremental = FALSE; 221 do_incremental = FALSE;
215 t << "DIST = " << varList("DISTFILES") << endl; 222 t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl;
216 t << "PRO = " << fileFixify(project->projectFile()) << endl;
217 t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; 223 t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
218 t << "DESTDIR = " << var("DESTDIR") << endl; 224 t << "DESTDIR = " << var("DESTDIR") << endl;
219 t << "TARGET = " << var("TARGET") << endl; 225 t << "TARGET = " << var("TARGET") << endl;
220 if(project->isActiveConfig("plugin") ) { 226 if(project->isActiveConfig("plugin") ) {
221 t << "TARGETD = " << var("TARGET") << endl; 227 t << "TARGETD = " << var("TARGET") << endl;
222 } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { 228 } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
223 t << "TARGETA= " << var("TARGETA") << endl; 229 t << "TARGETA= " << var("TARGETA") << endl;
224 if (os == "hpux") { 230 if (project->isEmpty("QMAKE_HPUX_SHLIB")) {
225 t << "TARGETD= " << var("TARGET_x") << endl;
226 t << "TARGET0= " << var("TARGET_") << endl;
227 }
228 else {
229 t << "TARGETD= " << var("TARGET_x.y.z") << endl; 231 t << "TARGETD= " << var("TARGET_x.y.z") << endl;
230 t << "TARGET0= " << var("TARGET_") << endl; 232 t << "TARGET0= " << var("TARGET_") << endl;
231 t << "TARGET1= " << var("TARGET_x") << endl; 233 t << "TARGET1= " << var("TARGET_x") << endl;
232 t << "TARGET2= " << var("TARGET_x.y") << endl; 234 t << "TARGET2= " << var("TARGET_x.y") << endl;
235 } else {
236 t << "TARGETD= " << var("TARGET_x") << endl;
237 t << "TARGET0= " << var("TARGET_") << endl;
233 } 238 }
234 } 239 }
235 t << endl; 240 t << endl;
236 241
237 // blasted incldues 242 // blasted incldues
238 QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; 243 QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"];
239 QStringList::Iterator it; 244 QStringList::Iterator it;
240 for( it = qeui.begin(); it != qeui.end(); ++it) 245 for( it = qeui.begin(); it != qeui.end(); ++it)
241 t << "include " << (*it) << endl; 246 t << "include " << (*it) << endl;
242 247
243 /* rules */ 248 /* rules */
244 t << "first: all" << endl; 249 t << "first: all" << endl;
@@ -252,25 +257,25 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
252 t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; 257 t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
253 t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; 258 t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
254 259
255 if(include_deps) { 260 if(include_deps) {
256 QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; 261 QString cmd=var("QMAKE_CFLAGS_DEPS") + " ";
257 cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); 262 cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D","");
258 if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) 263 if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH"))
259 cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; 264 cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " ";
260 cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); 265 cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", "");
261 QString odir; 266 QString odir;
262 if(!project->variables()["OBJECTS_DIR"].isEmpty()) 267 if(!project->variables()["OBJECTS_DIR"].isEmpty())
263 odir = project->first("OBJECTS_DIR"); 268 odir = project->first("OBJECTS_DIR");
264 t << "###### Dependancies" << endl << endl; 269 t << "###### Dependencies" << endl << endl;
265 t << odir << ".deps/%.d: %.cpp\n\t" 270 t << odir << ".deps/%.d: %.cpp\n\t"
266 << "@echo Creating depend for $<" << "\n\t" 271 << "@echo Creating depend for $<" << "\n\t"
267 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" 272 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t"
268 << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; 273 << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
269 274
270 t << odir << ".deps/%.d: %.c\n\t" 275 t << odir << ".deps/%.d: %.c\n\t"
271 << "@echo Creating depend for $<" << "\n\t" 276 << "@echo Creating depend for $<" << "\n\t"
272 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" 277 << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t"
273 << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; 278 << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
274 279
275 280
276 QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; 281 QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null };
@@ -377,38 +382,40 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
377 incr_objs += "-L" + QDir::currentDirPath(); 382 incr_objs += "-L" + QDir::currentDirPath();
378 } 383 }
379 if(!incr_objs.isEmpty()) 384 if(!incr_objs.isEmpty())
380 incr_objs += " "; 385 incr_objs += " ";
381 incr_objs += " -l" + incr_target; 386 incr_objs += " -l" + incr_target;
382 deps.prepend(incr_target_dir + " "); 387 deps.prepend(incr_target_dir + " ");
383 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 388 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
384 } 389 }
385 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" 390 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
386 << endl << endl; 391 << endl << endl;
387 392
388 //real target 393 //real target
389 t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t"; 394 t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps
395 << " " << var("POST_TARGETDEPS") << "\n\t";
390 if(!destdir.isEmpty()) 396 if(!destdir.isEmpty())
391 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 397 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
392 if(!project->isEmpty("QMAKE_PRE_LINK")) 398 if(!project->isEmpty("QMAKE_PRE_LINK"))
393 t << var("QMAKE_PRE_LINK") << "\n\t"; 399 t << var("QMAKE_PRE_LINK") << "\n\t";
394 t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; 400 t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)";
395 if(!project->isEmpty("QMAKE_POST_LINK")) 401 if(!project->isEmpty("QMAKE_POST_LINK"))
396 t << "\n\t" << var("QMAKE_POST_LINK"); 402 t << "\n\t" << var("QMAKE_POST_LINK");
397 t << endl << endl; 403 t << endl << endl;
398 } else { 404 } else {
399 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" 405 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
400 << endl << endl; 406 << endl << endl;
401 407
402 t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t"; 408 t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
409 << var("POST_TARGETDEPS") << "\n\t";
403 if(!destdir.isEmpty()) 410 if(!destdir.isEmpty())
404 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 411 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
405 if(!project->isEmpty("QMAKE_PRE_LINK")) 412 if(!project->isEmpty("QMAKE_PRE_LINK"))
406 t << var("QMAKE_PRE_LINK") << "\n\t"; 413 t << var("QMAKE_PRE_LINK") << "\n\t";
407 t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; 414 t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)";
408 if(!project->isEmpty("QMAKE_POST_LINK")) 415 if(!project->isEmpty("QMAKE_POST_LINK"))
409 t << "\n\t" << var("QMAKE_POST_LINK"); 416 t << "\n\t" << var("QMAKE_POST_LINK");
410 t << endl << endl; 417 t << endl << endl;
411 } 418 }
412 } else if(!project->isActiveConfig("staticlib")) { 419 } else if(!project->isActiveConfig("staticlib")) {
413 QString destdir = project->first("DESTDIR"), incr_deps; 420 QString destdir = project->first("DESTDIR"), incr_deps;
414 if(do_incremental) { 421 if(do_incremental) {
@@ -451,162 +458,163 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
451 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; 458 QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"];
452 if(!destdir.isEmpty()) 459 if(!destdir.isEmpty())
453 cmd.append(" -L" + destdir); 460 cmd.append(" -L" + destdir);
454 cmd.append(" -l" + incr_target); 461 cmd.append(" -l" + incr_target);
455 deps.prepend(incr_target_dir + " "); 462 deps.prepend(incr_target_dir + " ");
456 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 463 incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
457 } 464 }
458 465
459 t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") 466 t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","")
460 << " " << var("DESTDIR_TARGET") << endl << endl; 467 << " " << var("DESTDIR_TARGET") << endl << endl;
461 468
462 //real target 469 //real target
463 t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " << 470 t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " "
464 var("TARGETDEPS"); 471 << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS");
465 } else { 472 } else {
466 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << 473 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " <<
467 var("DESTDIR_TARGET") << endl << endl; 474 var("DESTDIR_TARGET") << endl << endl;
468 t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << 475 t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS")
469 var("TARGETDEPS"); 476 << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS");
470 } 477 }
471 if(!destdir.isEmpty()) 478 if(!destdir.isEmpty())
472 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; 479 t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir;
473 if(!project->isEmpty("QMAKE_PRE_LINK")) 480 if(!project->isEmpty("QMAKE_PRE_LINK"))
474 t << "\n\t" << var("QMAKE_PRE_LINK"); 481 t << "\n\t" << var("QMAKE_PRE_LINK");
475 482
476 if(project->isActiveConfig("plugin")) { 483 if(project->isActiveConfig("plugin")) {
477 t << "\n\t" 484 t << "\n\t"
478 << "-$(DEL_FILE) $(TARGET)" << "\n\t" 485 << "-$(DEL_FILE) $(TARGET)" << "\n\t"
479 << var("QMAKE_LINK_SHLIB_CMD"); 486 << var("QMAKE_LINK_SHLIB_CMD");
480 if(!destdir.isEmpty()) 487 if(!destdir.isEmpty())
481 t << "\n\t" 488 t << "\n\t"
482 << "-$(MOVE) $(TARGET) " << var("DESTDIR"); 489 << "-$(MOVE) $(TARGET) " << var("DESTDIR");
483 if(!project->isEmpty("QMAKE_POST_LINK")) 490 if(!project->isEmpty("QMAKE_POST_LINK"))
484 t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; 491 t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t";
485 t << endl << endl; 492 t << endl << endl;
486 } else if ( os == "hpux" ) { 493 } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) {
487 t << "\n\t"
488 << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t"
489 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
490 t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
491 if(!destdir.isEmpty())
492 t << "\n\t"
493 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
494 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
495 << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
496 if(!project->isEmpty("QMAKE_POST_LINK"))
497 t << "\n\t" << var("QMAKE_POST_LINK");
498 t << endl << endl;
499 } else {
500 t << "\n\t" 494 t << "\n\t"
501 << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" 495 << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t"
502 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; 496 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
503 t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" 497 t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t"
504 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" 498 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
505 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); 499 << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
506 if(!destdir.isEmpty()) 500 if(!destdir.isEmpty())
507 t << "\n\t" 501 t << "\n\t"
508 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" 502 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
509 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" 503 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
510 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" 504 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t"
511 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" 505 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t"
512 << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); 506 << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR");
513 if(!project->isEmpty("QMAKE_POST_LINK")) 507 if(!project->isEmpty("QMAKE_POST_LINK"))
514 t << "\n\t" << var("QMAKE_POST_LINK"); 508 t << "\n\t" << var("QMAKE_POST_LINK");
515 t << endl << endl; 509 t << endl << endl;
510 } else {
511 t << "\n\t"
512 << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t"
513 << var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
514 t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
515 if(!destdir.isEmpty())
516 t << "\n\t"
517 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
518 << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
519 << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
520 if(!project->isEmpty("QMAKE_POST_LINK"))
521 t << "\n\t" << var("QMAKE_POST_LINK");
522 t << endl << endl;
516 } 523 }
517 t << endl << endl; 524 t << endl << endl;
518 525
519 if (! project->isActiveConfig("plugin")) { 526 if (! project->isActiveConfig("plugin")) {
520 t << "staticlib: $(TARGETA)" << endl << endl; 527 t << "staticlib: $(TARGETA)" << endl << endl;
521 t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)"; 528 t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)";
522 if(do_incremental) 529 if(do_incremental)
523 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 530 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
524 t << var("TARGETDEPS") << "\n\t" 531 t << var("POST_TARGETDEPS") << "\n\t"
525 << "-$(DEL_FILE) $(TARGETA) " << "\n\t" 532 << "-$(DEL_FILE) $(TARGETA) " << "\n\t"
526 << var("QMAKE_AR_CMD"); 533 << var("QMAKE_AR_CMD");
527 if(do_incremental) 534 if(do_incremental)
528 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; 535 t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
529 if(!project->isEmpty("QMAKE_RANLIB")) 536 if(!project->isEmpty("QMAKE_RANLIB"))
530 t << "\n\t" << "$(RANLIB) $(TARGETA)"; 537 t << "\n\t" << "$(RANLIB) $(TARGETA)";
531 t << endl << endl; 538 t << endl << endl;
532 } 539 }
533 } else { 540 } else {
534 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " 541 t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) "
535 << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" 542 << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n"
536 << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; 543 << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n";
537 if(project->isEmpty("QMAKE_AR_SUBLIBS")) { 544 if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
538 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t"; 545 t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
546 << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t";
539 if(!project->isEmpty("DESTDIR")) { 547 if(!project->isEmpty("DESTDIR")) {
540 QString destdir = project->first("DESTDIR"); 548 QString destdir = project->first("DESTDIR");
541 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 549 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
542 } 550 }
543 t << "-$(DEL_FILE) $(TARGET)" << "\n\t" 551 t << "-$(DEL_FILE) $(TARGET)" << "\n\t"
544 << var("QMAKE_AR_CMD") << "\n"; 552 << var("QMAKE_AR_CMD") << "\n";
545 if(!project->isEmpty("QMAKE_POST_LINK")) 553 if(!project->isEmpty("QMAKE_POST_LINK"))
546 t << "\t" << var("QMAKE_POST_LINK") << "\n"; 554 t << "\t" << var("QMAKE_POST_LINK") << "\n";
547 if(!project->isEmpty("QMAKE_RANLIB")) 555 if(!project->isEmpty("QMAKE_RANLIB"))
548 t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; 556 t << "\t" << "$(RANLIB) $(TARGET)" << "\n";
549 if(!project->isEmpty("DESTDIR")) 557 if(!project->isEmpty("DESTDIR"))
550 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" 558 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n"
551 << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; 559 << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n";
552 } else { 560 } else {
553 int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); 561 int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
554 QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], 562 QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"],
555 libs = project->variables()["QMAKE_AR_SUBLIBS"]; 563 libs = project->variables()["QMAKE_AR_SUBLIBS"];
556 libs.prepend("$(TARGET)"); 564 libs.prepend("$(TARGET)");
557 for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); 565 for(QStringList::Iterator libit = libs.begin(), objit = objs.begin();
558 libit != libs.end(); ++libit) { 566 libit != libs.end(); ++libit) {
559 QStringList build; 567 QStringList build;
560 for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) 568 for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
561 build << (*objit); 569 build << (*objit);
562 QString ar; 570 QString ar;
563 if((*libit) == "$(TARGET)") { 571 if((*libit) == "$(TARGET)") {
564 t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " 572 t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
565 << valList(build) << "\n\t"; 573 << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t";
566 ar = project->variables()["QMAKE_AR_CMD"].first(); 574 ar = project->variables()["QMAKE_AR_CMD"].first();
567 ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", 575 ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)",
568 build.join(" ")); 576 build.join(" "));
569 } else { 577 } else {
570 t << (*libit) << ": " << valList(build) << "\n\t"; 578 t << (*libit) << ": " << valList(build) << "\n\t";
571 ar = "$(AR) " + (*libit) + " " + build.join(" "); 579 ar = "$(AR) " + (*libit) + " " + build.join(" ");
572 } 580 }
573 if(!project->isEmpty("DESTDIR")) { 581 if(!project->isEmpty("DESTDIR")) {
574 QString destdir = project->first("DESTDIR"); 582 QString destdir = project->first("DESTDIR");
575 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 583 t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
576 } 584 }
577 t << "-$(DEL_FILE) " << (*libit) << "\n\t" 585 t << "-$(DEL_FILE) " << (*libit) << "\n\t"
578 << ar << "\n"; 586 << ar << "\n";
579 if(!project->isEmpty("QMAKE_POST_LINK")) 587 if(!project->isEmpty("QMAKE_POST_LINK"))
580 t << "\t" << var("QMAKE_POST_LINK") << "\n"; 588 t << "\t" << var("QMAKE_POST_LINK") << "\n";
581 if(!project->isEmpty("QMAKE_RANLIB")) 589 if(!project->isEmpty("QMAKE_RANLIB"))
582 t << "\t" << "$(RANLIB) " << (*libit) << "\n"; 590 t << "\t" << "$(RANLIB) " << (*libit) << "\n";
583 if(!project->isEmpty("DESTDIR")) 591 if(!project->isEmpty("DESTDIR"))
584 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" 592 t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n"
585 << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; 593 << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n";
586 } 594 }
587 } 595 }
588 t << endl << endl; 596 t << endl << endl;
589 } 597 }
590 598
591 t << "mocables: $(SRCMOC)" << endl << endl; 599 t << "mocables: $(SRCMOC)" << endl << endl;
592 600
593 if(!project->isActiveConfig("no_mocdepend")) { 601 if(!project->isActiveConfig("no_mocdepend")) {
594 //this is an implicity depend on moc, so it will be built if necesary, however 602 //this is an implicity depend on moc, so it will be built if necesary, however
595 //moc itself shouldn't have this dependancy - this is a little kludgy but it is 603 //moc itself shouldn't have this dependency - this is a little kludgy but it is
596 //better than the alternative for now. 604 //better than the alternative for now.
597 QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); 605 QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET");
598 fixEnvVariables(target); 606 fixEnvVariables(target);
599 fixEnvVariables(moc); 607 fixEnvVariables(moc);
600 if(target != moc) 608 if(target != moc)
601 t << "$(MOC): \n\t" 609 t << "$(MOC): \n\t"
602 << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; 610 << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl;
603 } 611 }
604 612
605 writeMakeQmake(t); 613 writeMakeQmake(t);
606 614
607 if(!project->first("QMAKE_PKGINFO").isEmpty()) { 615 if(!project->first("QMAKE_PKGINFO").isEmpty()) {
608 QString pkginfo = project->first("QMAKE_PKGINFO"); 616 QString pkginfo = project->first("QMAKE_PKGINFO");
609 QString destdir = project->first("DESTDIR"); 617 QString destdir = project->first("DESTDIR");
610 t << pkginfo << ": " << "\n\t"; 618 t << pkginfo << ": " << "\n\t";
611 if(!destdir.isEmpty()) 619 if(!destdir.isEmpty())
612 t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; 620 t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
@@ -634,58 +642,97 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
634 project->first("QMAKE_DISTDIR"); 642 project->first("QMAKE_DISTDIR");
635 QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : 643 QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") :
636 project->first("OBJECTS_DIR")) + ddir); 644 project->first("OBJECTS_DIR")) + ddir);
637 t << "dist: " << "\n\t" 645 t << "dist: " << "\n\t"
638 << "@mkdir -p " << ddir_c << " && " 646 << "@mkdir -p " << ddir_c << " && "
639 << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; 647 << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && ";
640 if(!project->isEmpty("TRANSLATIONS")) 648 if(!project->isEmpty("TRANSLATIONS"))
641 t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; 649 t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && ";
642 if(!project->isEmpty("FORMS")) { 650 if(!project->isEmpty("FORMS")) {
643 QStringList &forms = project->variables()["FORMS"], ui_headers; 651 QStringList &forms = project->variables()["FORMS"], ui_headers;
644 for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { 652 for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {
645 QString ui_h = fileFixify((*formit) + Option::h_ext.first()); 653 QString ui_h = fileFixify((*formit) + Option::h_ext.first());
646 if(QFile::exists(ui_h) ) 654 if(QFile::exists(ui_h) )
647 ui_headers << ui_h; 655 ui_headers << ui_h;
648 } 656 }
649 if(!ui_headers.isEmpty()) 657 if(!ui_headers.isEmpty())
650 t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; 658 t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && ";
651 } 659 }
652 t << "( cd `dirname " << ddir_c << "` && " 660 t << "( cd `dirname " << ddir_c << "` && "
653 << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " 661 << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && "
654 << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " 662 << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && "
655 << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " 663 << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && "
656 << "$(DEL_DIR) " << ddir_c 664 << "$(DEL_FILE) -r " << ddir_c
657 << endl << endl; 665 << endl << endl;
658 666
659 QString clean_targets; 667 QString clean_targets;
660 if(mocAware()) { 668 if(mocAware()) {
661 t << "mocclean:" << "\n"; 669 t << "mocclean:" << "\n";
662 if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { 670 if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) {
663 if(!objMoc.isEmpty()) 671 if(!objMoc.isEmpty())
664 t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; 672 t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n';
665 if(!srcMoc.isEmpty()) 673 if(!srcMoc.isEmpty())
666 t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; 674 t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n';
667 if(moc_incremental) 675 if(moc_incremental)
668 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; 676 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n';
669 clean_targets += " mocclean"; 677 clean_targets += " mocclean";
670 } 678 }
671 t << endl; 679 t << endl;
672 } 680 }
673 t << "uiclean:" << "\n"; 681 t << "uiclean:" << "\n";
674 if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) { 682 if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) {
675 t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n"; 683 t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n";
676 clean_targets += " uiclean"; 684 clean_targets += " uiclean";
677 } 685 }
678 t << endl; 686 t << endl;
679 687
688 t << "yaccclean:" << "\n";
689 if(!var("YACCSOURCES").isEmpty()) {
690 QStringList clean, &l = project->variables()["YACCSOURCES"];
691 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
692 QFileInfo fi((*it));
693 QString dir;
694 if(fi.dirPath() != ".")
695 dir = fi.dirPath() + Option::dir_sep;
696 dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir);
697 if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)
698 dir += Option::dir_sep;
699 clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first();
700 clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first();
701 }
702 if(!clean.isEmpty()) {
703 t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n";
704 clean_targets += " yaccclean";
705 }
706 }
707
708 t << "lexclean:" << "\n";
709 if(!var("LEXSOURCES").isEmpty()) {
710 QStringList clean, &l = project->variables()["LEXSOURCES"];
711 for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
712 QFileInfo fi((*it));
713 QString dir;
714 if(fi.dirPath() != ".")
715 dir = fi.dirPath() + Option::dir_sep;
716 dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir);
717 if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)
718 dir += Option::dir_sep;
719 clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first();
720 }
721 if(!clean.isEmpty()) {
722 t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n";
723 clean_targets += " lexclean";
724 }
725 }
726
680 if(do_incremental) { 727 if(do_incremental) {
681 t << "incrclean:" << "\n"; 728 t << "incrclean:" << "\n";
682 if(src_incremental) 729 if(src_incremental)
683 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; 730 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n";
684 if(moc_incremental) 731 if(moc_incremental)
685 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; 732 t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n';
686 t << endl; 733 t << endl;
687 } 734 }
688 735
689 t << "clean:" << clean_targets << "\n\t"; 736 t << "clean:" << clean_targets << "\n\t";
690 if(!project->isEmpty("OBJECTS")) 737 if(!project->isEmpty("OBJECTS"))
691 t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t"; 738 t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t";
@@ -701,26 +748,30 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
701 QString libdir = "tmp/"; 748 QString libdir = "tmp/";
702 if(!project->isEmpty("SUBLIBS_DIR")) 749 if(!project->isEmpty("SUBLIBS_DIR"))
703 libdir = project->first("SUBLIBS_DIR"); 750 libdir = project->first("SUBLIBS_DIR");
704 QStringList &l = project->variables()["SUBLIBS"]; 751 QStringList &l = project->variables()["SUBLIBS"];
705 for(it = l.begin(); it != l.end(); ++it) 752 for(it = l.begin(); it != l.end(); ++it)
706 t << libdir << "lib" << (*it) << ".a" << ":\n\t" 753 t << libdir << "lib" << (*it) << ".a" << ":\n\t"
707 << var(QString("MAKELIB") + (*it)) << endl << endl; 754 << var(QString("MAKELIB") + (*it)) << endl << endl;
708 } 755 }
709 756
710 QString destdir = project->first("DESTDIR"); 757 QString destdir = project->first("DESTDIR");
711 if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) 758 if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep)
712 destdir += Option::dir_sep; 759 destdir += Option::dir_sep;
713 t << "distclean: " << "clean\n\t" 760 t << "distclean: " << "clean\n";
714 << "-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; 761 if(project->first("TEMPLATE") == "app" &&
762 project->isActiveConfig("resource_fork") && !project->isActiveConfig("console"))
763 t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n";
764 else
765 t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n";
715 if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && 766 if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() &&
716 !project->isActiveConfig("plugin")) 767 !project->isActiveConfig("plugin"))
717 t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " 768 t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) "
718 << destdir << "$(TARGET2) $(TARGETA)" << "\n"; 769 << destdir << "$(TARGET2) $(TARGETA)" << "\n";
719 t << endl << endl; 770 t << endl << endl;
720 771
721 if ( !project->isEmpty("PRECOMPH") ) { 772 if ( !project->isEmpty("PRECOMPH") ) {
722 QString outdir = project->first("MOC_DIR"); 773 QString outdir = project->first("MOC_DIR");
723 QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH")); 774 QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH"));
724 t << "###### Combined headers" << endl << endl; 775 t << "###### Combined headers" << endl << endl;
725 //XXX 776 //XXX
726 t << outdir << "allmoc.cpp: " << qt_dot_h << " " 777 t << outdir << "allmoc.cpp: " << qt_dot_h << " "
@@ -797,25 +848,25 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
797 sd->target.replace('.', '_'); 848 sd->target.replace('.', '_');
798 } 849 }
799 } 850 }
800 QPtrListIterator<SubDir> it(subdirs); 851 QPtrListIterator<SubDir> it(subdirs);
801 852
802 QString ofile = Option::output.name(); 853 QString ofile = Option::output.name();
803 if(ofile.findRev(Option::dir_sep) != -1) 854 if(ofile.findRev(Option::dir_sep) != -1)
804 ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); 855 ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1);
805 t << "MAKEFILE =" << var("MAKEFILE") << endl; 856 t << "MAKEFILE =" << var("MAKEFILE") << endl;
806 t << "QMAKE =" << var("QMAKE") << endl; 857 t << "QMAKE =" << var("QMAKE") << endl;
807 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; 858 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
808 t << "SUBTARGETS ="; // subdirectory targets are sub-directory 859 t << "SUBTARGETS ="; // subdirectory targets are sub-directory
809 for( it.toFirst(); it.current(); ++it) 860 for( it.toFirst(); it.current(); ++it)
810 t << " \\\n\t\t" << it.current()->target; 861 t << " \\\n\t\t" << it.current()->target;
811 t << endl << endl; 862 t << endl << endl;
812 t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; 863 t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl;
813 864
814 // generate target rules 865 // generate target rules
815 for( it.toFirst(); it.current(); ++it) { 866 for( it.toFirst(); it.current(); ++it) {
816 bool have_dir = !(*it)->directory.isEmpty(); 867 bool have_dir = !(*it)->directory.isEmpty();
817 QString mkfile = (*it)->makefile, out; 868 QString mkfile = (*it)->makefile, out;
818 if(have_dir) 869 if(have_dir)
819 mkfile.prepend((*it)->directory + Option::dir_sep); 870 mkfile.prepend((*it)->directory + Option::dir_sep);
820 if(direct || (*it)->makefile != "$(MAKEFILE)") 871 if(direct || (*it)->makefile != "$(MAKEFILE)")
821 out = " -o " + (*it)->makefile; 872 out = " -o " + (*it)->makefile;
@@ -826,52 +877,52 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
826 t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; 877 t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl;
827 //actually compile 878 //actually compile
828 t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; 879 t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t";
829 if(have_dir) 880 if(have_dir)
830 t << "cd " << (*it)->directory << " && "; 881 t << "cd " << (*it)->directory << " && ";
831 t << "$(MAKE) -f " << (*it)->makefile << endl << endl; 882 t << "$(MAKE) -f " << (*it)->makefile << endl << endl;
832 } 883 }
833 884
834 if (project->isActiveConfig("ordered")) { // generate dependencies 885 if (project->isActiveConfig("ordered")) { // generate dependencies
835 for( it.toFirst(); it.current(); ) { 886 for( it.toFirst(); it.current(); ) {
836 QString tar = it.current()->target; 887 QString tar = it.current()->target;
837 ++it; 888 ++it;
838 if (it.current()) 889 if (it.current())
839 t << it.current()->target << ": " << tar << endl; 890 t << it.current()->target << ": " << tar << endl;
840 } 891 }
841 t << endl; 892 t << endl;
842 } 893 }
843 894
844 writeMakeQmake(t); 895 writeMakeQmake(t);
845 896
846 if(project->isEmpty("SUBDIRS")) { 897 if(project->isEmpty("SUBDIRS")) {
847 t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl; 898 t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl;
848 } else { 899 } else {
849 t << "all: $(SUBTARGETS)" << endl; 900 t << "all: $(SUBTARGETS)" << endl;
850 t << "qmake_all:"; 901 t << "qmake_all:";
851 for( it.toFirst(); it.current(); ++it) { 902 for( it.toFirst(); it.current(); ++it) {
852 t << " "; 903 t << " ";
853 if(!(*it)->directory.isEmpty()) 904 if(!(*it)->directory.isEmpty())
854 t << (*it)->directory << Option::dir_sep; 905 t << (*it)->directory << Option::dir_sep;
855 t << (*it)->makefile; 906 t << (*it)->makefile;
856 } 907 }
857 for( it.toFirst(); it.current(); ++it) { 908 for( it.toFirst(); it.current(); ++it) {
858 t << "\n\t ( "; 909 t << "\n\t ( ";
859 if(!(*it)->directory.isEmpty()) 910 if(!(*it)->directory.isEmpty())
860 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; 911 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
861 t << "grep \"^qmake_all:\" " << (*it)->makefile 912 t << "grep \"^qmake_all:\" " << (*it)->makefile
862 << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; 913 << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true";
863 } 914 }
864 t << endl; 915 t << endl;
865 t << "clean uninstall install uiclean mocclean: qmake_all FORCE"; 916 t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE";
866 for( it.toFirst(); it.current(); ++it) { 917 for( it.toFirst(); it.current(); ++it) {
867 t << "\n\t ( "; 918 t << "\n\t ( ";
868 if(!(*it)->directory.isEmpty()) 919 if(!(*it)->directory.isEmpty())
869 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; 920 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
870 t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; 921 t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true";
871 } 922 }
872 t << endl; 923 t << endl;
873 t << "distclean: qmake_all FORCE"; 924 t << "distclean: qmake_all FORCE";
874 for( it.toFirst(); it.current(); ++it) { 925 for( it.toFirst(); it.current(); ++it) {
875 t << "\n\t ( "; 926 t << "\n\t ( ";
876 if(!(*it)->directory.isEmpty()) 927 if(!(*it)->directory.isEmpty())
877 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; 928 t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
@@ -897,61 +948,62 @@ void UnixMakefileGenerator::init2()
897 948
898 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { 949 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
899#if 0 950#if 0
900 if ( project->isActiveConfig("dll") ) { 951 if ( project->isActiveConfig("dll") ) {
901 project->variables()["TARGET"] += project->variables()["TARGET.so"]; 952 project->variables()["TARGET"] += project->variables()["TARGET.so"];
902 if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty()) 953 if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty())
903 project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; 954 project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"];
904 if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) 955 if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty())
905 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); 956 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET");
906 } 957 }
907#endif 958#endif
908 project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); 959 project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
960 if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() )
961 project->variables()["TARGET_EXT"].append(".exe");
909 } else if ( project->isActiveConfig("staticlib") ) { 962 } else if ( project->isActiveConfig("staticlib") ) {
910 project->variables()["TARGET"].first().prepend("lib"); 963 project->variables()["TARGET"].first().prepend("lib");
911 project->variables()["TARGET"].first() += ".a"; 964 project->variables()["TARGET"].first() += ".a";
912 if(project->variables()["QMAKE_AR_CMD"].isEmpty()) 965 if(project->variables()["QMAKE_AR_CMD"].isEmpty())
913 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); 966 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)");
914 } else { 967 } else {
915 project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); 968 project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a");
916 if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) 969 if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() )
917 project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); 970 project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)");
918 else 971 else
919 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); 972 project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)");
920 QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 );
921 if( project->isActiveConfig("plugin") ) { 973 if( project->isActiveConfig("plugin") ) {
922 project->variables()["TARGET_x.y.z"].append("lib" + 974 project->variables()["TARGET_x.y.z"].append("lib" +
923 project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); 975 project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB"));
924 if(project->isActiveConfig("lib_version_first")) 976 if(project->isActiveConfig("lib_version_first"))
925 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 977 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
926 project->first("VER_MAJ") + "." + 978 project->first("VER_MAJ") + "." +
927 project->first("QMAKE_EXTENSION_SHLIB")); 979 project->first("QMAKE_EXTENSION_SHLIB"));
928 else 980 else
929 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 981 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
930 project->first("QMAKE_EXTENSION_SHLIB") + 982 project->first("QMAKE_EXTENSION_SHLIB") +
931 "." + project->first("VER_MAJ")); 983 "." + project->first("VER_MAJ"));
932 984
933 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; 985 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
934 if(project->isActiveConfig("qt")) 986 if(project->isActiveConfig("qt"))
935 project->variables()["DEFINES"].append("QT_PLUGIN"); 987 project->variables()["DEFINES"].append("QT_PLUGIN");
936 } else if ( os == "hpux" ) { 988 } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) {
937 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); 989 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl");
938 if(project->isActiveConfig("lib_version_first")) 990 if(project->isActiveConfig("lib_version_first"))
939 project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + 991 project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." +
940 project->first("TARGET")); 992 project->first("TARGET"));
941 else 993 else
942 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 994 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
943 project->first("VER_MAJ")); 995 project->first("VER_MAJ"));
944 project->variables()["TARGET"] = project->variables()["TARGET_x"]; 996 project->variables()["TARGET"] = project->variables()["TARGET_x"];
945 } else if ( os == "aix" ) { 997 } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) {
946 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); 998 project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a");
947 if(project->isActiveConfig("lib_version_first")) { 999 if(project->isActiveConfig("lib_version_first")) {
948 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + 1000 project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
949 project->first("VER_MAJ") + "." + 1001 project->first("VER_MAJ") + "." +
950 project->first("QMAKE_EXTENSION_SHLIB")); 1002 project->first("QMAKE_EXTENSION_SHLIB"));
951 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + 1003 project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
952 project->first("VER_MAJ") + 1004 project->first("VER_MAJ") +
953 "." + project->first("VER_MIN") + "." + 1005 "." + project->first("VER_MIN") + "." +
954 project->first("QMAKE_EXTENSION_SHLIB")); 1006 project->first("QMAKE_EXTENSION_SHLIB"));
955 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + 1007 project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." +
956 project->first("VER_MAJ") + "." + 1008 project->first("VER_MAJ") + "." +
957 project->first("VER_MIN") + "." + 1009 project->first("VER_MIN") + "." +
@@ -1002,26 +1054,33 @@ void UnixMakefileGenerator::init2()
1002 "QMAKE_EXTENSION_SHLIB"].first() + "." + 1054 "QMAKE_EXTENSION_SHLIB"].first() + "." +
1003 project->first("VER_MAJ") + "." + 1055 project->first("VER_MAJ") + "." +
1004 project->first("VER_MIN") + "." + 1056 project->first("VER_MIN") + "." +
1005 project->first("VER_PAT")); 1057 project->first("VER_PAT"));
1006 } 1058 }
1007 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; 1059 project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
1008 } 1060 }
1009 if(project->isEmpty("QMAKE_LN_SHLIB")) 1061 if(project->isEmpty("QMAKE_LN_SHLIB"))
1010 project->variables()["QMAKE_LN_SHLIB"].append("ln -s"); 1062 project->variables()["QMAKE_LN_SHLIB"].append("ln -s");
1011 project->variables()["DESTDIR_TARGET"].append("$(TARGET)"); 1063 project->variables()["DESTDIR_TARGET"].append("$(TARGET)");
1012 if ( !project->variables()["DESTDIR"].isEmpty() ) 1064 if ( !project->variables()["DESTDIR"].isEmpty() )
1013 project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); 1065 project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR"));
1014 if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty() && !project->variables()["TARGET_x"].isEmpty() ) 1066 if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) {
1015 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); 1067 if(project->isActiveConfig("plugin")) {
1068 if(!project->variables()["TARGET"].isEmpty() )
1069 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET");
1070 } else {
1071 if(!project->variables()["TARGET_x"].isEmpty() )
1072 project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x");
1073 }
1074 }
1016 if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) 1075 if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() )
1017 project->variables()["QMAKE_LINK_SHLIB_CMD"].append( 1076 project->variables()["QMAKE_LINK_SHLIB_CMD"].append(
1018 "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"); 1077 "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)");
1019 } 1078 }
1020 if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) 1079 if(project->isEmpty("QMAKE_SYMBOLIC_LINK"))
1021 project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); 1080 project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf");
1022 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { 1081 if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
1023 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"]; 1082 project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"];
1024 } else if ( project->isActiveConfig("dll") ) { 1083 } else if ( project->isActiveConfig("dll") ) {
1025 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; 1084 project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"];
1026 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; 1085 project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"];
1027 if ( project->isActiveConfig("plugin") ) { 1086 if ( project->isActiveConfig("plugin") ) {