summaryrefslogtreecommitdiff
path: root/qmake/generators/mac
Unidiff
Diffstat (limited to 'qmake/generators/mac') (more/less context) (show whitespace changes)
-rw-r--r--qmake/generators/mac/metrowerks_xml.cpp21
-rw-r--r--qmake/generators/mac/metrowerks_xml.h17
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp801
-rw-r--r--qmake/generators/mac/pbuilder_pbx.h31
4 files changed, 643 insertions, 227 deletions
diff --git a/qmake/generators/mac/metrowerks_xml.cpp b/qmake/generators/mac/metrowerks_xml.cpp
index 125749d..baaeeec 100644
--- a/qmake/generators/mac/metrowerks_xml.cpp
+++ b/qmake/generators/mac/metrowerks_xml.cpp
@@ -1,11 +1,9 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$
3** 2**
4** Definition of ________ class.
5** 3**
6** Created : 970521 4** Implementation of MetrowerksMakefileGenerator class.
7** 5**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 6** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 7**
10** This file is part of the network module of the Qt GUI Toolkit. 8** This file is part of qmake.
11** 9**
@@ -44,3 +42,3 @@
44#include <time.h> 42#include <time.h>
45#ifdef Q_OS_MAC 43#if !defined(QWS) && defined(Q_OS_MAC)
46#include <Carbon/Carbon.h> 44#include <Carbon/Carbon.h>
@@ -50,3 +48,2 @@
50 48
51
52MetrowerksMakefileGenerator::MetrowerksMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE) 49MetrowerksMakefileGenerator::MetrowerksMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE)
@@ -609,3 +606,3 @@ MetrowerksMakefileGenerator::init()
609QString 606QString
610MetrowerksMakefileGenerator::findTemplate(QString file) 607MetrowerksMakefileGenerator::findTemplate(const QString &file)
611{ 608{
@@ -623,3 +620,3 @@ MetrowerksMakefileGenerator::createFork(const QString &f)
623{ 620{
624#if defined(Q_OS_MACX) 621#if !defined(QWS) && defined(Q_OS_MACX)
625 FSRef fref; 622 FSRef fref;
@@ -666,3 +663,3 @@ MetrowerksMakefileGenerator::fixifyToMacPath(QString &p, QString &v, bool )
666 st_volume = var("QMAKE_VOLUMENAME"); 663 st_volume = var("QMAKE_VOLUMENAME");
667#ifdef Q_OS_MAC 664#if !defined(QWS) && defined(Q_OS_MACX)
668 if(st_volume.isEmpty()) { 665 if(st_volume.isEmpty()) {
@@ -735,3 +732,3 @@ MetrowerksMakefileGenerator::processPrlFiles()
735 for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { 732 for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
736 prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext; 733 prl = mdd->local_dir + Option::dir_sep + "lib" + lib;
737 if(processPrlFile(prl)) { 734 if(processPrlFile(prl)) {
@@ -753,3 +750,3 @@ MetrowerksMakefileGenerator::processPrlFiles()
753 QString prl = "/System/Library/Frameworks/" + opt + 750 QString prl = "/System/Library/Frameworks/" + opt +
754 ".framework/" + opt + Option::prl_ext; 751 ".framework/" + opt;
755 if(processPrlFile(prl)) 752 if(processPrlFile(prl))
diff --git a/qmake/generators/mac/metrowerks_xml.h b/qmake/generators/mac/metrowerks_xml.h
index ae3cfae..0aa3615 100644
--- a/qmake/generators/mac/metrowerks_xml.h
+++ b/qmake/generators/mac/metrowerks_xml.h
@@ -1,11 +1,9 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$
3** 2**
4** Definition of ________ class.
5** 3**
6** Created : 970521 4** Definition of MetrowerksMakefileGenerator class.
7** 5**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 6** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 7**
10** This file is part of the network module of the Qt GUI Toolkit. 8** This file is part of qmake.
11** 9**
@@ -36,4 +34,5 @@
36**********************************************************************/ 34**********************************************************************/
37#ifndef __METROWERKSMAKE_H__ 35
38#define __METROWERKSMAKE_H__ 36#ifndef __METROWERKS_XML_H__
37#define __METROWERKS_XML_H__
39 38
@@ -52,3 +51,3 @@ class MetrowerksMakefileGenerator : public MakefileGenerator
52 bool writeMakefile(QTextStream &); 51 bool writeMakefile(QTextStream &);
53 QString findTemplate(QString file); 52 QString findTemplate(const QString &file);
54 void init(); 53 void init();
@@ -68,2 +67,2 @@ inline MetrowerksMakefileGenerator::~MetrowerksMakefileGenerator()
68 67
69#endif /* __METROWERKSMAKE_H__ */ 68#endif /* __METROWERKS_XML_H__ */
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index b46005b..9d1286e 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -1,11 +1,9 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$
3** 2**
4** Definition of ________ class.
5** 3**
6** Created : 970521 4** Implementation of ProjectBuilderMakefileGenerator class.
7** 5**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 6** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 7**
10** This file is part of the network module of the Qt GUI Toolkit. 8** This file is part of qmake.
11** 9**
@@ -39,2 +37,3 @@
39#include "option.h" 37#include "option.h"
38#include "meta.h"
40#include <qdir.h> 39#include <qdir.h>
@@ -44,2 +43,3 @@
44#include <time.h> 43#include <time.h>
44#include "qtmd5.h"
45#ifdef Q_OS_UNIX 45#ifdef Q_OS_UNIX
@@ -51,3 +51,2 @@
51 51
52
53ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator(QMakeProject *p) : UnixMakefileGenerator(p) 52ProjectBuilderMakefileGenerator::ProjectBuilderMakefileGenerator(QMakeProject *p) : UnixMakefileGenerator(p)
@@ -69,8 +68,6 @@ ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t)
69 project->variables()["MAKEFILE"].append("Makefile"); 68 project->variables()["MAKEFILE"].append("Makefile");
70 if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib") { 69 if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib")
71 return writeMakeParts(t); 70 return writeMakeParts(t);
72 } else if(project->first("TEMPLATE") == "subdirs") { 71 else if(project->first("TEMPLATE") == "subdirs")
73 writeSubdirs(t, FALSE); 72 return writeSubdirs(t, FALSE);
74 return TRUE;
75 }
76 return FALSE; 73 return FALSE;
@@ -79,2 +76,198 @@ ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t)
79bool 76bool
77ProjectBuilderMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
78{
79 QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"),
80 QDir::currentDirPath());
81 QFile mkwrapf(mkwrap);
82 if(mkwrapf.open(IO_WriteOnly | IO_Translate)) {
83 debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1());
84 QTextStream mkwrapt(&mkwrapf);
85 UnixMakefileGenerator::writeSubdirs(mkwrapt, direct);
86 }
87
88 //HEADER
89 t << "// !$*UTF8*$!" << "\n"
90 << "{" << "\n"
91 << "\t" << "archiveVersion = 1;" << "\n"
92 << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n"
93 << "\t" << "objectVersion = " << pbuilderVersion() << ";" << "\n"
94 << "\t" << "objects = {" << endl;
95
96 //SUBDIRS
97 QStringList subdirs = project->variables()["SUBDIRS"];
98 QString oldpwd = QDir::currentDirPath();
99 QMap<QString, QStringList> groups;
100 for(QStringList::Iterator it = subdirs.begin(); it != subdirs.end(); ++it) {
101 QFileInfo fi(Option::fixPathToLocalOS((*it), TRUE));
102 if(fi.exists()) {
103 if(fi.isDir()) {
104 QString profile = (*it);
105 if(!profile.endsWith(Option::dir_sep))
106 profile += Option::dir_sep;
107 profile += fi.baseName() + ".pro";
108 subdirs.append(profile);
109 } else {
110 QMakeProject tmp_proj;
111 QString dir = fi.dirPath(), fn = fi.fileName();
112 if(!dir.isEmpty()) {
113 if(!QDir::setCurrent(dir))
114 fprintf(stderr, "Cannot find directory: %s\n", dir.latin1());
115 }
116 if(tmp_proj.read(fn, oldpwd)) {
117 if(Option::debug_level) {
118 QMap<QString, QStringList> &vars = tmp_proj.variables();
119 for(QMap<QString, QStringList>::Iterator it = vars.begin();
120 it != vars.end(); ++it) {
121 if(it.key().left(1) != "." && !it.data().isEmpty())
122 debug_msg(1, "%s: %s === %s", fn.latin1(), it.key().latin1(),
123 it.data().join(" :: ").latin1());
124 }
125 }
126 if(tmp_proj.first("TEMPLATE") == "subdirs") {
127 subdirs += fileFixify(tmp_proj.variables()["SUBDIRS"]);
128 } else if(tmp_proj.first("TEMPLATE") == "app" || tmp_proj.first("TEMPLATE") == "lib") {
129 QString pbxproj = QDir::currentDirPath() + Option::dir_sep + tmp_proj.first("TARGET") + projectSuffix();
130 if(!QFile::exists(pbxproj)) {
131 warn_msg(WarnLogic, "Ignored (not found) '%s'", pbxproj.latin1());
132 goto nextfile; // # Dirty!
133 }
134 project->variables()["QMAKE_PBX_SUBDIRS"] += pbxproj;
135 //PROJECTREF
136 {
137 bool in_root = TRUE;
138 QString name = QDir::currentDirPath();
139 QString project_key = keyFor(pbxproj + "_PROJECTREF");
140 if(project->isActiveConfig("flat")) {
141 QString flat_file = fileFixify(name, oldpwd, Option::output_dir, TRUE);
142 if(flat_file.find(Option::dir_sep) != -1) {
143 QStringList dirs = QStringList::split(Option::dir_sep, flat_file);
144 name = dirs.back();
145 }
146 } else {
147 QString flat_file = fileFixify(name, oldpwd, Option::output_dir, TRUE);
148 if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) {
149 QString last_grp("QMAKE_PBX_HEIR_GROUP");
150 QStringList dirs = QStringList::split(Option::dir_sep, flat_file);
151 name = dirs.back();
152 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
153 QString new_grp(last_grp + Option::dir_sep + (*dir_it)), new_grp_key(keyFor(new_grp));
154 if(dir_it == dirs.begin()) {
155 if(!groups.contains(new_grp))
156 project->variables()["QMAKE_PBX_GROUPS"].append(new_grp_key);
157 } else {
158 if(!groups[last_grp].contains(new_grp_key))
159 groups[last_grp] += new_grp_key;
160 }
161 last_grp = new_grp;
162 }
163 groups[last_grp] += project_key;
164 in_root = FALSE;
165 }
166 }
167 if(in_root)
168 project->variables()["QMAKE_PBX_GROUPS"] += project_key;
169 t << "\t\t" << project_key << " = {" << "\n"
170 << "\t\t\t" << "isa = PBXFileReference;" << "\n"
171 << "\t\t\t" << "name = " << tmp_proj.first("TARGET") << ";" << "\n"
172 << "\t\t\t" << "path = " << pbxproj << ";" << "\n"
173 << "\t\t\t" << "refType = 0;" << "\n"
174 << "\t\t\t" << "sourceTree = \"<absolute>\";" << "\n"
175 << "\t\t" << "};" << "\n";
176 //PRODUCTGROUP
177 t << "\t\t" << keyFor(pbxproj + "_PRODUCTGROUP") << " = {" << "\n"
178 << "\t\t\t" << "children = (" << "\n"
179 << "\t\t\t" << ");" << "\n"
180 << "\t\t\t" << "isa = PBXGroup;" << "\n"
181 << "\t\t\t" << "name = Products;" << "\n"
182 << "\t\t\t" << "refType = 4;" << "\n"
183 << "\t\t\t" << "sourceTree = \"<group>\";" << "\n"
184 << "\t\t" << "};" << "\n";
185 }
186 }
187 }
188nextfile:
189 QDir::setCurrent(oldpwd);
190 }
191 }
192 }
193 for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) {
194 t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n"
195 << "\t\t\t" << "isa = PBXGroup;" << "\n"
196 << "\t\t\t" << "children = (" << "\n"
197 << valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n")
198 << "\t\t\t" << ");" << "\n"
199 << "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n"
200 << "\t\t\t" << "refType = 4;" << "\n"
201 << "\t\t" << "};" << "\n";
202 }
203
204 //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER
205 //BUILDSTYLE
206 QString active_buildstyle;
207#if 0
208 for(int as_release = 0; as_release < 2; as_release++)
209#else
210 bool as_release = !project->isActiveConfig("debug");
211#endif
212 {
213 QString key = keyFor("QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG"));
214 if(project->isActiveConfig("debug") != as_release)
215 active_buildstyle = key;
216 project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key);
217 t << "\t\t" << key << " = {" << "\n"
218 << "\t\t\t" << "buildRules = (" << "\n"
219 << "\t\t\t" << ");" << "\n"
220 << "\t\t\t" << "buildSettings = {" << "\n"
221 << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n";
222 if(as_release)
223 t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n";
224 t << "\t\t\t" << "};" << "\n"
225 << "\t\t\t" << "isa = PBXBuildStyle;" << "\n"
226 << "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n"
227 << "\t\t" << "};" << "\n";
228 }
229
230 //ROOT_GROUP
231 t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n"
232 << "\t\t\t" << "children = (" << "\n"
233 << varGlue("QMAKE_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n")
234 << "\t\t\t" << ");" << "\n"
235 << "\t\t\t" << "isa = PBXGroup;" << "\n"
236 << "\t\t\t" << "refType = 4;" << "\n"
237 << "\t\t\t" << "sourceTree = \"<group>\";" << "\n"
238 << "\t\t" << "};" << "\n";
239
240 //ROOT
241 t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n"
242 << "\t\t\t" << "buildSettings = {" << "\n"
243 << "\t\t\t" << "};" << "\n"
244 << "\t\t\t" << "buildStyles = (" << "\n"
245 << varGlue("QMAKE_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
246 << "\t\t\t" << ");" << "\n"
247 << "\t\t\t" << "isa = PBXProject;" << "\n"
248 << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n"
249 << "\t\t\t" << "projectDirPath = \"\";" << "\n"
250 << "\t\t\t" << "projectReferences = (" << "\n";
251 {
252 QStringList &libdirs = project->variables()["QMAKE_PBX_SUBDIRS"];
253 for(QStringList::Iterator it = libdirs.begin(); it != libdirs.end(); ++it)
254 t << "\t\t\t\t" << "{" << "\n"
255 << "\t\t\t\t\t" << "ProductGroup = " << keyFor((*it) + "_PRODUCTGROUP") << ";" << "\n"
256 << "\t\t\t\t\t" << "ProjectRef = " << keyFor((*it) + "_PROJECTREF") << ";" << "\n"
257 << "\t\t\t\t" << "}," << "\n";
258 }
259 t << "\t\t\t" << ");" << "\n"
260 << "\t\t\t" << "targets = (" << "\n"
261 << "\t\t\t" << ");" << "\n"
262 << "\t\t" << "};" << "\n";
263
264 //FOOTER
265 t << "\t" << "};" << "\n"
266 << "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n"
267 << "}" << endl;
268
269 return TRUE;
270}
271
272bool
80ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) 273ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
@@ -109,3 +302,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
109 mkfile = fileFixify(mkfile, QDir::currentDirPath()); 302 mkfile = fileFixify(mkfile, QDir::currentDirPath());
110 project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); 303 project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key);
111 t << "\t\t" << phase_key << " = {" << "\n" 304 t << "\t\t" << phase_key << " = {" << "\n"
@@ -128,25 +321,70 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
128 QMap<QString, QStringList> groups; 321 QMap<QString, QStringList> groups;
129 QString srcs[] = { "SOURCES", "SRCMOC", "UICIMPLS", QString::null }; 322 QString srcs[] = { "HEADERS", "SOURCES", "SRCMOC", "UICIMPLS", "QMAKE_IMAGE_COLLECTION",
323 "FORMS", "QMAKE_INTERNAL_INCLUDED_FILES", QString::null };
130 for(i = 0; !srcs[i].isNull(); i++) { 324 for(i = 0; !srcs[i].isNull(); i++) {
131 tmp = project->variables()[srcs[i]]; 325 tmp = project->variables()[srcs[i]];
326 if(srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES") {
327 QString pfile = project->projectFile();
328 if(pfile != "(stdin)")
329 tmp.prepend(pfile);
330 }
132 QStringList &src_list = project->variables()["QMAKE_PBX_" + srcs[i]]; 331 QStringList &src_list = project->variables()["QMAKE_PBX_" + srcs[i]];
332 QStringList &root_group_list = project->variables()["QMAKE_PBX_GROUPS"];
333
334 //hard coded groups..
335 QString src_group;
336 if(srcs[i] == "SOURCES")
337 src_group = "Sources";
338 else if(srcs[i] == "HEADERS")
339 src_group = "Headers";
340 else if(srcs[i] == "SRCMOC")
341 src_group = "Sources [moc]";
342 else if(srcs[i] == "UICIMPLS" || srcs[i] == "FORMS")
343 src_group = "Sources [uic]";
344 else if(srcs[i] == "QMAKE_IMAGE_COLLECTION")
345 src_group = "Sources [images]";
346 else if(srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES")
347 src_group = "Sources [qmake]";
348
133 for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { 349 for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) {
134 QString file = fileFixify((*it)); 350 QStringList files = (*it);
135 if(file.endsWith(Option::moc_ext)) 351 bool buildable = TRUE;
352 if(srcs[i] == "FORMS") {
353 QString form_dot_h = (*it) + Option::h_ext.first();
354 if(QFile::exists(form_dot_h))
355 files += form_dot_h;
356 buildable = FALSE;
357 } else if(srcs[i] == "HEADERS" || srcs[i] == "QMAKE_INTERNAL_INCLUDED_FILES") {
358 buildable = FALSE;
359 }
360
361 files = fileFixify(files);
362 for(QStringList::Iterator file_it = files.begin(); file_it != files.end(); ++file_it) {
363 QString file = (*file_it);
364 if(file.length() >= 2 && (file[0] == '"' || file[0] == '\'') && file[(int) file.length()-1] == file[0])
365 file = file.mid(1, file.length()-2);
366 if(file.endsWith(Option::cpp_moc_ext) || file.endsWith(Option::prl_ext))
136 continue; 367 continue;
137 bool in_root = TRUE; 368 bool in_root = TRUE;
138 QString src_key = keyFor(file); 369 QString src_key = keyFor(file), name = file;
139 if(!project->isActiveConfig("flat")) { 370 if(project->isActiveConfig("flat")) {
371 QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE);
372 if(flat_file.find(Option::dir_sep) != -1) {
373 QStringList dirs = QStringList::split(Option::dir_sep, flat_file);
374 name = dirs.back();
375 }
376 } else {
140 QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE); 377 QString flat_file = fileFixify(file, QDir::currentDirPath(), Option::output_dir, TRUE);
141 if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) { 378 if(QDir::isRelativePath(flat_file) && flat_file.find(Option::dir_sep) != -1) {
142 QString last_grp("QMAKE_PBX_" + srcs[i] + "_HEIR_GROUP"); 379 QString last_grp("QMAKE_PBX_" + src_group + "_HEIR_GROUP");
143 QStringList dirs = QStringList::split(Option::dir_sep, flat_file); 380 QStringList dirs = QStringList::split(Option::dir_sep, flat_file);
381 name = dirs.back();
144 dirs.pop_back(); //remove the file portion as it will be added via src_key 382 dirs.pop_back(); //remove the file portion as it will be added via src_key
145 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { 383 for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
146 QString new_grp(last_grp + Option::dir_sep + (*dir_it)), 384 QString new_grp(last_grp + Option::dir_sep + (*dir_it)), new_grp_key(keyFor(new_grp));
147 new_grp_key(keyFor(new_grp)), last_grp_key(keyFor(last_grp));
148 if(dir_it == dirs.begin()) { 385 if(dir_it == dirs.begin()) {
149 if(!groups.contains(new_grp)) 386 if(!src_list.contains(new_grp_key))
150 project->variables()["QMAKE_PBX_" + srcs[i]].append(new_grp_key); 387 src_list.append(new_grp_key);
151 } else { 388 } else {
389 if(!groups[last_grp].contains(new_grp_key))
152 groups[last_grp] += new_grp_key; 390 groups[last_grp] += new_grp_key;
@@ -164,6 +402,18 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
164 << "\t\t\t" << "isa = PBXFileReference;" << "\n" 402 << "\t\t\t" << "isa = PBXFileReference;" << "\n"
403 << "\t\t\t" << "name = \"" << name << "\";" << "\n"
165 << "\t\t\t" << "path = \"" << file << "\";" << "\n" 404 << "\t\t\t" << "path = \"" << file << "\";" << "\n"
166 << "\t\t\t" << "refType = " << reftypeForFile(file) << ";" << "\n" 405 << "\t\t\t" << "refType = " << reftypeForFile(file) << ";" << "\n";
167 << "\t\t" << "};" << "\n"; 406 if (ideType() == MAC_XCODE) {
168 //build reference 407 QString filetype;
408 for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) {
409 if(file.endsWith((*cppit))) {
410 filetype = "sourcecode.cpp.cpp";
411 break;
412 }
413 }
414 if(!filetype.isNull())
415 t << "\t\t\t" << "lastKnownFileType = " << filetype << ";" << "\n";
416 }
417 t << "\t\t" << "};" << "\n";
418 if(buildable) { //build reference
169 QString obj_key = file + ".o"; 419 QString obj_key = file + ".o";
@@ -180,4 +430,5 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
180 } 430 }
431 }
432 }
181 if(!src_list.isEmpty()) { 433 if(!src_list.isEmpty()) {
182 QString grp;
183 if(srcs[i] == "SOURCES") { 434 if(srcs[i] == "SOURCES") {
@@ -198,22 +449,11 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
198 } 449 }
199 grp = "Sources";
200 } else if(srcs[i] == "SRCMOC") {
201 grp = "Mocables";
202 } else if(srcs[i] == "UICIMPLS") {
203 grp = "UICables";
204 } 450 }
205 QString grp_key = keyFor(grp); 451
206 project->variables()["QMAKE_PBX_GROUPS"].append(grp_key); 452 QString src_group_key = keyFor(src_group);
207 t << "\t\t" << grp_key << " = {" << "\n" 453 if(root_group_list.findIndex(src_group_key) == -1)
208 << "\t\t\t" << "children = (" << "\n" 454 root_group_list += src_group_key;
209 << varGlue("QMAKE_PBX_" + srcs[i], "\t\t\t\t", ",\n\t\t\t\t", "\n") 455 groups[src_group] += src_list;
210 << "\t\t\t" << ");" << "\n"
211 << "\t\t\t" << "isa = PBXGroup;" << "\n"
212 << "\t\t\t" << "name = " << grp << ";" << "\n"
213 << "\t\t\t" << "refType = 4;" << "\n"
214 << "\t\t" << "};" << "\n";
215 } 456 }
216 } 457 }
217 for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); 458 for(QMap<QString, QStringList>::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) {
218 grp_it != groups.end(); ++grp_it) {
219 t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n" 459 t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n"
@@ -238,4 +478,4 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
238 writeHeader(mkt); 478 writeHeader(mkt);
239 mkt << "MOC = " << var("QMAKE_MOC") << endl; 479 mkt << "MOC = " << Option::fixPathToTargetOS(var("QMAKE_MOC")) << endl;
240 mkt << "UIC = " << var("QMAKE_UIC") << endl; 480 mkt << "UIC = " << Option::fixPathToTargetOS(var("QMAKE_UIC")) << endl;
241 mkt << "LEX = " << var("QMAKE_LEX") << endl; 481 mkt << "LEX = " << var("QMAKE_LEX") << endl;
@@ -247,2 +487,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
247 mkt << "FORMS = " << varList("UICIMPLS") << endl; 487 mkt << "FORMS = " << varList("UICIMPLS") << endl;
488 mkt << "IMAGES = " << varList("QMAKE_IMAGE_COLLECTION") << endl;
248 mkt << "MOCS = " << varList("SRCMOC") << endl; 489 mkt << "MOCS = " << varList("SRCMOC") << endl;
@@ -266,4 +507,4 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
266 mkt << "\n"; 507 mkt << "\n";
267 mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS)" << endl; 508 mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS) $(IMAGES)" << endl;
268 mkt << "preprocess_clean: mocclean uiclean parser_clean" << endl << endl; 509 mkt << "clean preprocess_clean: mocclean uiclean parser_clean" << endl << endl;
269 mkt << "mocclean:" << "\n"; 510 mkt << "mocclean:" << "\n";
@@ -274,2 +515,4 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
274 mkt << "\t-rm -f $(FORMS)" << "\n"; 515 mkt << "\t-rm -f $(FORMS)" << "\n";
516 if(!project->isEmpty("QMAKE_IMAGE_COLLECTION"))
517 mkt << "\t-rm -f $(IMAGES)" << "\n";
275 mkt << "parser_clean:" << "\n"; 518 mkt << "parser_clean:" << "\n";
@@ -283,32 +526,27 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
283 writeLexSrc(mkt, "LEXSOURCES"); 526 writeLexSrc(mkt, "LEXSOURCES");
527 writeImageSrc(mkt, "QMAKE_IMAGE_COLLECTION");
284 mkf.close(); 528 mkf.close();
285 } 529 }
286 QString target_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET");
287 mkfile = fileFixify(mkfile, QDir::currentDirPath()); 530 mkfile = fileFixify(mkfile, QDir::currentDirPath());
288 t << "\t\t" << target_key << " = {" << "\n" 531 QString phase_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET");
289 << "\t\t\t" << "buildArgumentsString = \"-f " << mkfile << "\";" << "\n" 532 //project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key);
290 << "\t\t\t" << "buildPhases = (" << "\n" 533 project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key);
534 t << "\t\t" << phase_key << " = {" << "\n"
535 << "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
536 << "\t\t\t" << "files = (" << "\n"
291 << "\t\t\t" << ");" << "\n" 537 << "\t\t\t" << ");" << "\n"
292 << "\t\t\t" << "buildSettings = {" << "\n" 538 << "\t\t\t" << "generatedFileNames = (" << "\n"
293 << "\t\t\t" << "};" << "\n" 539 << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n")
294 << "\t\t\t" << "buildToolPath = \"/usr/bin/gnumake\";"<< "\n"
295 << "\t\t\t" << "buildWorkingDirectory = \"" << QDir::currentDirPath() << "\";" << "\n"
296 << "\t\t\t" << "dependencies = (" << "\n"
297 << "\t\t\t" << ");" << "\n" 540 << "\t\t\t" << ");" << "\n"
298 << "\t\t\t" << "isa = PBXLegacyTarget;" << "\n" 541 << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n"
299 << "\t\t\t" << "name = QtPreprocessors;" << "\n" 542 << "\t\t\t" << "name = \"Qt Preprocessors\";" << "\n"
300 << "\t\t\t" << "productName = QtPreprocessors;" << "\n" 543 << "\t\t\t" << "neededFileNames = (" << "\n"
301 << "\t\t\t" << "settingsToExpand = 6;" << "\n" 544 << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n")
302 << "\t\t\t" << "settingsToPassInEnvironment = 287;" << "\n" 545 << "\t\t\t" << ");" << "\n"
303 << "\t\t\t" << "settingsToPassOnCommandLine = 280;" << "\n" 546 << "\t\t\t" << "shellPath = /bin/sh;" << "\n"
304 << "\t\t\t" << "shouldsUseHeadermap = 0;" << "\n" 547 << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() <<
305 << "\t\t" << "};" << "\n"; 548 " -f " << mkfile << "\";" << "\n"
306
307 QString target_depend_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET_DEPEND");
308 project->variables()["QMAKE_PBX_TARGETDEPENDS"].append(target_depend_key);
309 t << "\t\t" << target_depend_key << " = {" << "\n"
310 << "\t\t\t" << "isa = PBXTargetDependency;" << "\n"
311 << "\t\t\t" << "target = " << target_key << ";" << "\n"
312 << "\t\t" << "};" << "\n"; 549 << "\t\t" << "};" << "\n";
313 } 550 }
551
314 //SOURCE BUILDPHASE 552 //SOURCE BUILDPHASE
@@ -329,3 +567,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
329 QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"]; 567 QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"];
330 QString libs[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; 568 QString libs[] = { "QMAKE_LFLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
331 for(i = 0; !libs[i].isNull(); i++) { 569 for(i = 0; !libs[i].isNull(); i++) {
@@ -335,2 +573,4 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
335 QString library, name, opt = (*it).stripWhiteSpace(); 573 QString library, name, opt = (*it).stripWhiteSpace();
574 if(opt.length() >= 2 && (opt[0] == '"' || opt[0] == '\'') && opt[(int) opt.length()-1] == opt[0])
575 opt = opt.mid(1, opt.length()-2);
336 if(opt.startsWith("-L")) { 576 if(opt.startsWith("-L")) {
@@ -339,2 +579,5 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
339 libdirs.append(r); 579 libdirs.append(r);
580 } else if(opt == "-prebind") {
581 project->variables()["QMAKE_DO_PREBINDING"].append("TRUE");
582 remove = TRUE;
340 } else if(opt.startsWith("-l")) { 583 } else if(opt.startsWith("-l")) {
@@ -344,3 +587,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
344 if(project->isActiveConfig("link_prl")) { 587 if(project->isActiveConfig("link_prl")) {
345 /* This isn't real nice, but it is real useful. This looks in a prl 588 /* This isn't real nice, but it is real usefull. This looks in a prl
346 for what the library will ultimately be called so we can stick it 589 for what the library will ultimately be called so we can stick it
@@ -351,10 +594,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
351 */ 594 */
352 QString prl_file = (*lit) + Option::dir_sep + lib + Option::prl_ext; 595 QString lib_file = (*lit) + Option::dir_sep + lib;
353 if(QFile::exists(prl_file)) { 596 if(QMakeMetaInfo::libExists(lib_file)) {
354 QMakeProject proj; 597 QMakeMetaInfo libinfo;
355 if(proj.read(prl_file, QDir::currentDirPath())) { 598 if(libinfo.readLib(lib_file)) {
356 if(!proj.isEmpty("QMAKE_PRL_TARGET")) { 599 if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {
357 library = (*lit) + Option::dir_sep + proj.first("QMAKE_PRL_TARGET"); 600 library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");
358 debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)", 601 debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",
359 opt.latin1(), prl_file.latin1(), library.latin1()); 602 opt.latin1(), lib_file.latin1(), library.latin1());
360 remove = TRUE; 603 remove = TRUE;
@@ -362,3 +605,2 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
362 } 605 }
363
364 } 606 }
@@ -394,2 +636,4 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
394 } 636 }
637 } else if(opt == "-undefined") {
638 ++it; //the next option is not a library..
395 } else if(opt.left(1) != "-") { 639 } else if(opt.left(1) != "-") {
@@ -455,3 +699,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
455 mkfile = fileFixify(mkfile, QDir::currentDirPath()); 699 mkfile = fileFixify(mkfile, QDir::currentDirPath());
456 project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key); 700 project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key);
457 t << "\t\t" << phase_key << " = {" << "\n" 701 t << "\t\t" << phase_key << " = {" << "\n"
@@ -500,4 +744,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
500 } 744 }
501 if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console") && 745 if(!project->isActiveConfig("console") && project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES
502 project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES
503 QString grp("Bundle Resources"), key = keyFor(grp); 746 QString grp("Bundle Resources"), key = keyFor(grp);
@@ -513,17 +756,2 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
513 } 756 }
514
515 //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER
516 //PRODUCTS
517 {
518 QString grp("Products"), key = keyFor(grp);
519 project->variables()["QMAKE_PBX_GROUPS"].append(key);
520 t << "\t\t" << key << " = {" << "\n"
521 << "\t\t\t" << "children = (" << "\n"
522 << "\t\t\t\t" << keyFor("QMAKE_PBX_REFERENCE") << "\n"
523 << "\t\t\t" << ");" << "\n"
524 << "\t\t\t" << "isa = PBXGroup;" << "\n"
525 << "\t\t\t" << "name = Products;" << "\n"
526 << "\t\t\t" << "refType = 4;" << "\n"
527 << "\t\t" << "};" << "\n";
528 }
529 { //INSTALL BUILDPHASE (sh script) 757 { //INSTALL BUILDPHASE (sh script)
@@ -542,3 +770,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
542 targ += ".app"; 770 targ += ".app";
543 } else if(!project->isActiveConfig("staticlib") && 771 } else if(!project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") &&
544 !project->isActiveConfig("frameworklib")) { 772 !project->isActiveConfig("frameworklib")) {
@@ -561,3 +789,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
561 targ = project->first("TARGET"); 789 targ = project->first("TARGET");
562 if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { 790 if(!project->isActiveConfig("console")) {
563 targ += ".app"; 791 targ += ".app";
@@ -570,2 +798,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
570 targ = project->first("TARGET_"); 798 targ = project->first("TARGET_");
799 }
571 int slsh = targ.findRev(Option::dir_sep); 800 int slsh = targ.findRev(Option::dir_sep);
@@ -573,4 +802,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
573 targ = targ.right(targ.length() - slsh - 1); 802 targ = targ.right(targ.length() - slsh - 1);
574 } 803
575 QTextStream sht(&shf);
576 QString dstdir = project->first("DESTDIR"); 804 QString dstdir = project->first("DESTDIR");
@@ -578,12 +806,14 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
578 806
807 QTextStream sht(&shf);
579 sht << "#!/bin/sh" << endl; 808 sht << "#!/bin/sh" << endl;
580 //copy the actual target 809 //copy the actual target
581 sht << "OUT_TARG=\"" << targ << "\"\n" 810 sht << "OUT_TARG=\"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"\n"
582 << "[ -z \"$BUILD_ROOT\" ] || OUT_TARG=\"${BUILD_ROOT}/${OUT_TARG}\"" << endl; 811 << "if [ -e \"$OUT_TARG\" ]; then" << "\n"
583 sht << "[ \"$OUT_TARG\" = \"" 812 << " [ \"$OUT_TARG\" = \""
584 << (dstdir.isEmpty() ? QDir::currentDirPath() + QDir::separator(): dstdir) << targ << "\" ] || " 813 << (dstdir.isEmpty() ? QDir::currentDirPath() + QDir::separator(): dstdir) << targ << "\" ] || "
585 << "[ \"$OUT_TARG\" = \"" << targ << "\" ] || " 814 << "[ \"$OUT_TARG\" = \"" << targ << "\" ] || "
586 << "cp -r \"$OUT_TARG\" " << "\"" << dstdir << targ << "\"" << endl; 815 << "cp -r \"$OUT_TARG\" " << "\"" << dstdir << targ << "\"" << "\n"
816 << "fi" << endl;
587 //rename as a framework 817 //rename as a framework
588 if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("frameworklib")) 818 if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("frameworklib") && !project->isActiveConfig("plugin"))
589 sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << targ << "\"" << endl; 819 sht << "ln -sf \"" << targ << "\" " << "\"" << dstdir << targ << "\"" << endl;
@@ -602,3 +832,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
602 t << "\t\t" << phase_key << " = {" << "\n" 832 t << "\t\t" << phase_key << " = {" << "\n"
603 << "\t\t\t" << "buildActionMask = 8;" << "\n" //only on install! 833 << "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
604 << "\t\t\t" << "files = (" << "\n" 834 << "\t\t\t" << "files = (" << "\n"
@@ -616,2 +846,41 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
616 } 846 }
847 if(/*ideType() == MAC_XCODE &&*/ !project->isEmpty("QMAKE_PBX_PRESCRIPT_BUILDPHASES") && 0) {
848 // build reference
849 t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPT_BUILDREFERENCE") << " = {" << "\n"
850 << "\t\t\t" << "includeInIndex = 0;" << "\n"
851 << "\t\t\t" << "isa = PBXFileReference;" << "\n"
852 << "\t\t\t" << "path = preprocessor.out;" << "\n"
853 << "\t\t\t" << "refType = 3;" << "\n"
854 << "\t\t\t" << "sourceTree = BUILT_PRODUCTS_DIR;" << "\n"
855 << "\t\t" << "};" << "\n";
856 project->variables()["QMAKE_PBX_PRODUCTS"].append(keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE"));
857 //build phase
858 QString prescript_key = keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE");
859 project->variables()["QMAKE_PBX_TARGETS"].append(prescript_key);
860 t << "\t\t" << prescript_key << " = {" << "\n"
861 << "\t\t\t" << "buildPhases = (" << "\n"
862 << varGlue("QMAKE_PBX_PRESCRIPT_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
863 << "\t\t\t" << ");" << "\n"
864 << "\t\t\t" << "buildRules = (" << "\n"
865 << "\t\t\t" << ");" << "\n"
866 << "\t\t\t" << "buildSettings = {" << "\n"
867 << "\t\t\t" << "};" << "\n"
868 << "\t\t\t" << "dependencies = (" << "\n"
869 << "\t\t\t" << ");" << "\n"
870 << "\t\t\t" << "isa = PBXNativeTarget;" << "\n"
871 << "\t\t\t" << "name = \"Qt Preprocessor Steps\";" << "\n"
872 << "\t\t\t" << "productName = \"Qt Preprocessor Steps\";" << "\n"
873 << "\t\t\t" << "productReference = " << keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE") << ";" << "\n"
874 << "\t\t\t" << "productType = \"com.apple.product-type.tool\";" << "\n"
875 << "\t\t" << "};" << "\n";
876 //dependency
877 t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY") << " = {" << "\n"
878 << "\t\t\t" << "isa = PBXTargetDependency;" << "\n"
879 << "\t\t\t" << "target = " << keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE") << ";" << "\n"
880 << "\t\t" << "};" << "\n";
881 project->variables()["QMAKE_PBX_TARGET_DEPENDS"].append(keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY"));
882 project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].clear(); //these are already consumed above
883 }
884
885 //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER
617 //ROOT_GROUP 886 //ROOT_GROUP
@@ -627,3 +896,5 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
627 //REFERENCE 896 //REFERENCE
628 t << "\t\t" << keyFor("QMAKE_PBX_REFERENCE") << " = {" << "\n"; 897 project->variables()["QMAKE_PBX_PRODUCTS"].append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE"));
898 t << "\t\t" << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << " = {" << "\n"
899 << "\t\t\t" << "fallbackIsa = PBXFileReference;" << "\n";
629 if(project->first("TEMPLATE") == "app") { 900 if(project->first("TEMPLATE") == "app") {
@@ -655,9 +926,26 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
655 t << "\t\t\t" << "isa = PBXLibraryReference;" << "\n" 926 t << "\t\t\t" << "isa = PBXLibraryReference;" << "\n"
927 << "\t\t\t" << "expectedFileType = \"compiled.mach-o.dylib\";" << "\n"
656 << "\t\t\t" << "path = " << lib << ";\n" 928 << "\t\t\t" << "path = " << lib << ";\n"
657 << "\t\t\t" << "refType = " << reftypeForFile(lib) << ";" << "\n"; 929 << "\t\t\t" << "refType = " << 3/*reftypeForFile(lib)*/ << ";" << "\n"
930 << "\t\t\t" << "sourceTree = BUILT_PRODUCTS_DIR" << ";" << "\n";
658 } 931 }
659 t << "\t\t" << "};" << "\n"; 932 t << "\t\t" << "};" << "\n";
933 { //Products group
934 QString grp("Products"), key = keyFor(grp);
935 project->variables()["QMAKE_PBX_GROUPS"].append(key);
936 t << "\t\t" << key << " = {" << "\n"
937 << "\t\t\t" << "children = (" << "\n"
938 << varGlue("QMAKE_PBX_PRODUCTS", "\t\t\t\t", ",\n\t\t\t\t", "\n")
939 << "\t\t\t" << ");" << "\n"
940 << "\t\t\t" << "isa = PBXGroup;" << "\n"
941 << "\t\t\t" << "name = Products;" << "\n"
942 << "\t\t\t" << "refType = 4;" << "\n"
943 << "\t\t" << "};" << "\n";
944 }
660 //TARGET 945 //TARGET
661 t << "\t\t" << keyFor("QMAKE_PBX_TARGET") << " = {" << "\n" 946 QString target_key = keyFor("QMAKE_PBX_TARGET");
947 project->variables()["QMAKE_PBX_TARGETS"].append(target_key);
948 t << "\t\t" << target_key << " = {" << "\n"
662 << "\t\t\t" << "buildPhases = (" << "\n" 949 << "\t\t\t" << "buildPhases = (" << "\n"
950 << varGlue("QMAKE_PBX_PRESCRIPT_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", ",\n")
663 << varGlue("QMAKE_PBX_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n") 951 << varGlue("QMAKE_PBX_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
@@ -665,2 +953,4 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
665 << "\t\t\t" << "buildSettings = {" << "\n" 953 << "\t\t\t" << "buildSettings = {" << "\n"
954 << "\t\t\t\t" << "CC = \"" << fixEnvsList("QMAKE_CC") << "\";" << "\n"
955 << "\t\t\t\t" << "CPLUSPLUS = \"" << fixEnvsList("QMAKE_CXX") << "\";" << "\n"
666 << "\t\t\t\t" << "FRAMEWORK_SEARCH_PATHS = \"\";" << "\n" 956 << "\t\t\t\t" << "FRAMEWORK_SEARCH_PATHS = \"\";" << "\n"
@@ -670,4 +960,4 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
670 << "\t\t\t\t" << "OTHER_CFLAGS = \"" << 960 << "\t\t\t\t" << "OTHER_CFLAGS = \"" <<
671 fixEnvsList("QMAKE_CFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") << 961 fixEnvsList("QMAKE_CFLAGS") << fixQuotes(varGlue("PRL_EXPORT_DEFINES"," -D"," -D","")) <<
672 varGlue("DEFINES"," -D"," -D","") << "\";" << "\n" 962 fixQuotes(varGlue("DEFINES"," -D"," -D","")) << "\";" << "\n"
673 << "\t\t\t\t" << "LEXFLAGS = \"" << var("QMAKE_LEXFLAGS") << "\";" << "\n" 963 << "\t\t\t\t" << "LEXFLAGS = \"" << var("QMAKE_LEXFLAGS") << "\";" << "\n"
@@ -675,7 +965,37 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
675 << "\t\t\t\t" << "OTHER_CPLUSPLUSFLAGS = \"" << 965 << "\t\t\t\t" << "OTHER_CPLUSPLUSFLAGS = \"" <<
676 fixEnvsList("QMAKE_CXXFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") << 966 fixEnvsList("QMAKE_CXXFLAGS") << fixQuotes(varGlue("PRL_EXPORT_DEFINES"," -D"," -D","")) <<
677 varGlue("DEFINES"," -D"," -D","") << "\";" << "\n" 967 fixQuotes(varGlue("DEFINES"," -D"," -D","")) << "\";" << "\n"
678 << "\t\t\t\t" << "OTHER_REZFLAGS = \"\";" << "\n" 968 << "\t\t\t\t" << "OTHER_REZFLAGS = \"\";" << "\n"
679 << "\t\t\t\t" << "SECTORDER_FLAGS = \"\";" << "\n" 969 << "\t\t\t\t" << "SECTORDER_FLAGS = \"\";" << "\n"
680 << "\t\t\t\t" << "WARNING_CFLAGS = \"\";" << "\n"; 970 << "\t\t\t\t" << "WARNING_CFLAGS = \"\";" << "\n"
971 << "\t\t\t\t" << "PREBINDING = " << (project->isEmpty("QMAKE_DO_PREBINDING") ? "NO" : "YES") << ";" << "\n";
972 if(!project->isEmpty("PRECOMPILED_HEADER")) {
973 if (ideType() == MAC_XCODE) {
974 t << "\t\t\t\t" << "GCC_PRECOMPILE_PREFIX_HEADER = \"YES\";" << "\n"
975 << "\t\t\t\t" << "GCC_PREFIX_HEADER = \"" << project->first("PRECOMPILED_HEADER") << "\";" << "\n";
976 } else {
977 t << "\t\t\t\t" << "PRECOMPILE_PREFIX_HEADER = \"YES\";" << "\n"
978 << "\t\t\t\t" << "PREFIX_HEADER = \"" << project->first("PRECOMPILED_HEADER") << "\";" << "\n";
979 }
980 }
981 if(project->first("TEMPLATE") == "app") {
982 QString plist = fileFixify(project->first("QMAKE_INFO_PLIST"));
983 if(plist.isEmpty())
984 plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
985 if(QFile::exists(plist)) {
986 QFile plist_in_file(plist);
987 if(plist_in_file.open(IO_ReadOnly)) {
988 QTextStream plist_in(&plist_in_file);
989 QString plist_in_text = plist_in.read();
990 plist_in_text = plist_in_text.replace("@ICON@", (project->isEmpty("RC_FILE") ? QString("") : project->first("RC_FILE").section(Option::dir_sep, -1)));
991 plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET"));
992 QFile plist_out_file("Info.plist");
993 if(plist_out_file.open(IO_WriteOnly | IO_Translate)) {
994 QTextStream plist_out(&plist_out_file);
995 plist_out << plist_in_text;
996 t << "\t\t\t\t" << "INFOPLIST_FILE = \"Info.plist\";" << "\n";
997 }
998 }
999 }
1000 }
681#if 1 1001#if 1
@@ -687,10 +1007,33 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
687 " " << fixEnvsList("QMAKE_LIBS") << "\";" << "\n"; 1007 " " << fixEnvsList("QMAKE_LIBS") << "\";" << "\n";
688 if(!project->isEmpty("DESTDIR")) 1008 if(!project->isEmpty("DESTDIR")) {
689 t << "\t\t\t\t" << "INSTALL_PATH = \"" << project->first("DESTDIR") << "\";" << "\n"; 1009 QString dir = project->first("DESTDIR");
690 if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") 1010 if (QDir::isRelativePath(dir))
691 t << "\t\t\t\t" << "DYLIB_CURRENT_VERSION = \"" << project->first("VERSION") << "\";" << "\n"; 1011 dir.prepend(QDir::currentDirPath() + Option::dir_sep);
1012 t << "\t\t\t\t" << "INSTALL_DIR = \"" << dir << "\";" << "\n";
1013 }
1014 if ( project->first("TEMPLATE") == "lib") {
1015 t << "\t\t\t\t" << "INSTALL_PATH = \"" << "\";" << "\n";
1016 }
1017 if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") {
1018 t << "\t\t\t\t" << "DYLIB_CURRENT_VERSION = \"" << project->first("VER_MAJ") << "."
1019 << project->first("VER_MIN") << "." << project->first("VER_PAT") << "\";" << "\n";
1020 if(project->isEmpty("COMPAT_VERSION"))
1021 t << "\t\t\t\t" << "DYLIB_COMPATIBILITY_VERSION = \"" << project->first("VER_MAJ") << "."
1022 << project->first("VER_MIN") << "\";" << "\n";
1023 }
1024 if(!project->isEmpty("COMPAT_VERSION"))
1025 t << "\t\t\t\t" << "DYLIB_COMPATIBILITY_VERSION = \"" << project->first("COMPAT_VERSION") << "\";" << "\n";
1026
1027 if(ideType() == MAC_XCODE) {
692 if(!project->isEmpty("OBJECTS_DIR")) 1028 if(!project->isEmpty("OBJECTS_DIR"))
693 t << "\t\t\t\t" << "OBJECT_FILE_DIR = \"" << project->first("OBJECTS_DIR") << "\";" << "\n"; 1029 t << "\t\t\t\t" << "OBJROOT = \"" << project->first("OBJECTS_DIR") << "\";" << "\n";
1030 }
1031#if 0
1032 if(!project->isEmpty("DESTDIR"))
1033 t << "\t\t\t\t" << "SYMROOT = \"" << project->first("DESTDIR") << "\";" << "\n";
1034 else
1035 t << "\t\t\t\t" << "SYMROOT = \"" << QDir::currentDirPath() << "\";" << "\n";
1036#endif
694 if(project->first("TEMPLATE") == "app") { 1037 if(project->first("TEMPLATE") == "app") {
695 if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) 1038 if(ideType() == MAC_PBUILDER && !project->isActiveConfig("console"))
696 t << "\t\t\t\t" << "WRAPPER_EXTENSION = app;" << "\n"; 1039 t << "\t\t\t\t" << "WRAPPER_EXTENSION = app;" << "\n";
@@ -698,18 +1041,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
698 } else { 1041 } else {
699 QString lib = project->first("QMAKE_ORIG_TARGET");
700 if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) { 1042 if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) {
701 t << "\t\t\t\t" << "LIBRARY_STYLE = STATIC;" << "\n"; 1043 t << "\t\t\t\t" << "LIBRARY_STYLE = STATIC;" << "\n";
702 lib = project->first("TARGET");
703 } else { 1044 } else {
704 t << "\t\t\t\t" << "LIBRARY_STYLE = DYNAMIC;" << "\n"; 1045 t << "\t\t\t\t" << "LIBRARY_STYLE = DYNAMIC;" << "\n";
705 if(!project->isActiveConfig("frameworklib")) {
706 if(project->isActiveConfig("plugin"))
707 lib = project->first("TARGET");
708 else
709 lib = project->first("TARGET_");
710 } 1046 }
711 } 1047 QString lib = project->first("QMAKE_ORIG_TARGET");
712 int slsh = lib.findRev(Option::dir_sep); 1048 if (!project->isActiveConfig("frameworklib") && !project->isActiveConfig("staticlib"))
713 if(slsh != -1) 1049 lib.prepend("lib");
714 lib = lib.right(lib.length() - slsh - 1);
715 t << "\t\t\t\t" << "PRODUCT_NAME = " << lib << ";" << "\n"; 1050 t << "\t\t\t\t" << "PRODUCT_NAME = " << lib << ";" << "\n";
@@ -717,4 +1052,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
717 tmp = project->variables()["QMAKE_PBX_VARS"]; 1052 tmp = project->variables()["QMAKE_PBX_VARS"];
718 for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) 1053 for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) {
719 t << "\t\t\t\t" << (*it) << " = \"" << getenv((*it)) << "\";" << "\n"; 1054 QString var = (*it), val = getenv(var);
1055 if(!val && var == "TB")
1056 val = "/usr/bin/";
1057 t << "\t\t\t\t" << var << " = \"" << val << "\";" << "\n";
1058 }
720 t << "\t\t\t" << "};" << "\n" 1059 t << "\t\t\t" << "};" << "\n"
@@ -723,10 +1062,32 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
723 << "\t\t\t" << "dependencies = (" << "\n" 1062 << "\t\t\t" << "dependencies = (" << "\n"
724 << varGlue("QMAKE_PBX_TARGETDEPENDS", "\t\t\t\t", ",\n\t\t\t\t", "\n") 1063 << varGlue("QMAKE_PBX_TARGET_DEPENDS", "\t\t\t\t", ",\n\t\t\t\t", "\n")
725 << "\t\t\t" << ");" << "\n" 1064 << "\t\t\t" << ");" << "\n"
726 << "\t\t\t" << "productReference = " << keyFor("QMAKE_PBX_REFERENCE") << ";" << "\n" 1065 << "\t\t\t" << "productReference = " << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << ";" << "\n"
727 << "\t\t\t" << "shouldUseHeadermap = 1;" << "\n"; 1066 << "\t\t\t" << "shouldUseHeadermap = 1;" << "\n";
1067 if(ideType() == MAC_XCODE)
1068 t << "\t\t\t" << "isa = PBXNativeTarget;" << "\n";
728 if(project->first("TEMPLATE") == "app") { 1069 if(project->first("TEMPLATE") == "app") {
729 if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { 1070 if(project->isActiveConfig("console")) {
730 t << "\t\t\t" << "isa = PBXApplicationTarget;" << "\n" 1071 if(ideType() == MAC_XCODE)
731 << "\t\t\t" << "productSettingsXML = " << "\"" << "<?xml version=" 1072 t << "\t\t\t" << "productType = \"com.apple.product-type.tool\";" << "\n";
1073 else
1074 t << "\t\t\t" << "isa = PBXToolTarget;" << "\n";
1075 } else {
1076 if(ideType() == MAC_XCODE)
1077 t << "\t\t\t" << "productType = \"com.apple.product-type.application\";" << "\n";
1078 else
1079 t << "\t\t\t" << "isa = PBXApplicationReference;" << "\n";
1080 t << "\t\t\t" << "productSettingsXML = \"";
1081 bool read_plist = false;
1082 if(QFile::exists("Info.plist")) {
1083 QFile plist("Info.plist");
1084 if(plist.open(IO_ReadOnly)) {
1085 read_plist = true;
1086 QTextStream stream(&plist);
1087 while(!stream.eof())
1088 t << stream.readLine().replace('"', "\\\"") << endl;
1089 }
1090 }
1091 if(!read_plist) {
1092 t << "<?xml version="
732 << "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n" 1093 << "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n"
@@ -747,3 +1108,4 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
747 << "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n" 1108 << "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n"
748 << "\t\t\t\t\t" << "<string>????</string>" << "\n" 1109 //Although the output below looks strange it is to avoid the trigraph ??<
1110 << "\t\t\t\t\t" << "<string>????" << "</string>" << "\n"
749 << "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n" 1111 << "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n"
@@ -753,6 +1115,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
753 << "\t\t\t\t" << "</dict>" << "\n" 1115 << "\t\t\t\t" << "</dict>" << "\n"
754 << "\t\t\t\t" << "</plist>" << "\";" << "\n"; 1116 << "\t\t\t\t" << "</plist>";
755 } else {
756 t << "\t\t\t" << "isa = PBXToolTarget;" << "\n";
757 } 1117 }
1118 }
1119 t << "\";" << "\n";
758 t << "\t\t\t" << "name = \"" << project->first("QMAKE_ORIG_TARGET") << "\";" << "\n" 1120 t << "\t\t\t" << "name = \"" << project->first("QMAKE_ORIG_TARGET") << "\";" << "\n"
@@ -761,8 +1123,16 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
761 QString lib = project->first("QMAKE_ORIG_TARGET"); 1123 QString lib = project->first("QMAKE_ORIG_TARGET");
762 if(!project->isActiveConfig("frameworklib")) 1124 if(!project->isActiveConfig("frameworklib") && !project->isActiveConfig("staticlib"))
763 lib.prepend("lib"); 1125 lib.prepend("lib");
764 t << "\t\t\t" << "isa = PBXLibraryTarget;" << "\n" 1126 t << "\t\t\t" << "name = \"" << lib << "\";" << "\n"
765 << "\t\t\t" << "name = \"" << lib << "\";" << "\n"
766 << "\t\t\t" << "productName = " << lib << ";" << "\n"; 1127 << "\t\t\t" << "productName = " << lib << ";" << "\n";
1128 if(ideType() == MAC_XCODE) {
1129 if(project->isActiveConfig("staticlib"))
1130 t << "\t\t\t" << "productType = \"com.apple.product-type.library.static\";" << "\n";
1131 else
1132 t << "\t\t\t" << "productType = \"com.apple.product-type.library.dynamic\";" << "\n";
1133 } else {
1134 t << "\t\t\t" << "isa = PBXLibraryTarget;" << "\n";
767 } 1135 }
1136 }
1137 t << "\t\t\t" << "startupPath = \"<<ProjectDirectory>>\";" << "\n";
768 if(!project->isEmpty("DESTDIR")) 1138 if(!project->isEmpty("DESTDIR"))
@@ -771,8 +1141,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
771 //DEBUG/RELEASE 1141 //DEBUG/RELEASE
772 for(i = 0; i < 2; i++) { 1142 QString active_buildstyle;
773 bool as_release = !i; 1143#if 0
774 if(project->isActiveConfig("debug")) 1144 for(int as_release = 0; as_release < 2; as_release++)
775 as_release = i; 1145#else
776 QString key = "QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG"); 1146 bool as_release = !project->isActiveConfig("debug");
777 key = keyFor(key); 1147#endif
1148 {
1149 QString key = keyFor("QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG"));
1150 if(project->isActiveConfig("debug") != as_release)
1151 active_buildstyle = key;
778 project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key); 1152 project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key);
@@ -783,4 +1157,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
783 << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n"; 1157 << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n";
784 if(as_release) 1158 if(as_release) {
785 t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n"; 1159 t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n";
1160 } else {
1161 t << "\t\t\t\t" << "GCC_ENABLE_FIX_AND_CONTINUE = "
1162 << (project->isActiveConfig("no_fix_and_continue") ? "NO" : "YES") << ";" << "\n"
1163 << "\t\t\t\t" << "GCC_GENERATE_DEBUGGING_SYMBOLS = YES;" << "\n"
1164 << "\t\t\t\t" << "GCC_OPTIMIZATION_LEVEL = 0;" << "\n"
1165 << "\t\t\t\t" << "ZERO_LINK ="
1166 << (project->isActiveConfig("no_zero_link") ? "NO" : "YES") << ";" << "\n";
1167 }
786 t << "\t\t\t" << "};" << "\n" 1168 t << "\t\t\t" << "};" << "\n"
@@ -795,6 +1177,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
795 << "\t\t\t" << ");" << "\n" 1177 << "\t\t\t" << ");" << "\n"
1178 << "\t\t\t" << "hasScannedForEncodings = 1;" << "\n"
796 << "\t\t\t" << "isa = PBXProject;" << "\n" 1179 << "\t\t\t" << "isa = PBXProject;" << "\n"
797 << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n" 1180 << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_PBX_ROOT_GROUP") << ";" << "\n"
1181 << "\t\t\t" << "projectDirPath = \"\";" << "\n"
798 << "\t\t\t" << "targets = (" << "\n" 1182 << "\t\t\t" << "targets = (" << "\n"
799 << "\t\t\t\t" << keyFor("QMAKE_PBX_TARGET") << "\n" 1183 << varGlue("QMAKE_PBX_TARGETS", "\t\t\t\t", ",\n\t\t\t\t", "\n")
800 << "\t\t\t" << ");" << "\n" 1184 << "\t\t\t" << ");" << "\n"
@@ -807,2 +1191,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
807 1191
1192 if(project->isActiveConfig("generate_pbxbuild_makefile")) {
808 QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), 1193 QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"),
@@ -817,7 +1202,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
817 << "all:" << "\n\t" 1202 << "all:" << "\n\t"
818 << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild") << "\n" 1203 << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << "\n"
819 << "install: all" << "\n\t" 1204 << "install: all" << "\n\t"
820 << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild install") << "\n" 1205 << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " install\n"
821 << "distclean clean: preprocess_clean" << "\n\t" 1206 << "distclean clean: preprocess_clean" << "\n\t"
822 << "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild clean") << "\n" 1207 << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " clean" << "\n"
823 << (!did_preprocess ? cleans : "") << ":" << "\n"; 1208 << (!did_preprocess ? cleans : "") << ":" << "\n";
@@ -828,2 +1213,3 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
828 } 1213 }
1214 }
829 return TRUE; 1215 return TRUE;
@@ -832,3 +1218,11 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
832QString 1218QString
833ProjectBuilderMakefileGenerator::fixEnvs(QString file) 1219ProjectBuilderMakefileGenerator::fixQuotes(const QString &val)
1220{
1221 QString ret(val);
1222 ret = ret.replace(QRegExp("('|\")"), "\\\\1");
1223 return ret;
1224}
1225
1226QString
1227ProjectBuilderMakefileGenerator::fixEnvs(const QString &file)
834{ 1228{
@@ -844,3 +1238,3 @@ ProjectBuilderMakefileGenerator::fixEnvs(QString file)
844QString 1238QString
845ProjectBuilderMakefileGenerator::fixEnvsList(QString where) 1239ProjectBuilderMakefileGenerator::fixEnvsList(const QString &where)
846{ 1240{
@@ -858,28 +1252,11 @@ ProjectBuilderMakefileGenerator::fixEnvsList(QString where)
858QString 1252QString
859ProjectBuilderMakefileGenerator::keyFor(QString block) 1253ProjectBuilderMakefileGenerator::keyFor(const QString &block)
860{ 1254{
861#if 0 //This make this code much easier to debug.. 1255#if 1 //This make this code much easier to debug..
1256 if(project->isActiveConfig("no_pb_munge_key"))
862 return block; 1257 return block;
863#endif 1258#endif
864
865 QString ret; 1259 QString ret;
866 if(!keys.contains(block)) { 1260 if(!keys.contains(block)) {
867#if 0 1261 ret = qtMD5(block.utf8()).left(24).upper();
868 static unsigned int r = 0;
869 ret.sprintf("%024x", ++r);
870#else //not really necesary, but makes it look more interesting..
871 static struct { unsigned int a1, a2, a3; } r = { 0, 0, 0 };
872 if(!r.a1 && !r.a2 && !r.a3) {
873 r.a1 = rand();
874 r.a2 = rand();
875 r.a3 = rand();
876 }
877 switch(rand() % 3) {
878 case 0: ++r.a1; break;
879 case 1: ++r.a2; break;
880 case 2: ++r.a3; break;
881 }
882 ret.sprintf("%08x%08x%08x", r.a1, r.a2, r.a3);
883#endif
884 ret = ret.upper();
885 keys.insert(block, ret); 1262 keys.insert(block, ret);
@@ -894,3 +1271,4 @@ ProjectBuilderMakefileGenerator::openOutput(QFile &file) const
894{ 1271{
895 if(project->first("TEMPLATE") != "subdirs") { 1272 if(QDir::isRelativePath(file.name()))
1273 file.setName(Option::output_dir + file.name()); //pwd when qmake was run
896 QFileInfo fi(file); 1274 QFileInfo fi(file);
@@ -900,6 +1278,6 @@ ProjectBuilderMakefileGenerator::openOutput(QFile &file) const
900 output += QDir::separator(); 1278 output += QDir::separator();
901 if(fi.extension() != "pbproj") { 1279 if(!output.endsWith(projectSuffix())) {
902 if(file.name().isEmpty() || fi.isDir()) 1280 if(file.name().isEmpty() || fi.isDir())
903 output += project->first("TARGET"); 1281 output += project->first("TARGET");
904 output += QString(".pbproj") + QDir::separator(); 1282 output += projectSuffix() + QDir::separator();
905 } else if(output[(int)output.length() - 1] != QDir::separator()) { 1283 } else if(output[(int)output.length() - 1] != QDir::separator()) {
@@ -915,4 +1293,2 @@ ProjectBuilderMakefileGenerator::openOutput(QFile &file) const
915 } 1293 }
916 return UnixMakefileGenerator::openOutput(file);
917}
918 1294
@@ -930,6 +1306,10 @@ ProjectBuilderMakefileGenerator::pbuilderVersion() const
930 QString version, version_plist = project->first("QMAKE_PBUILDER_VERSION_PLIST"); 1306 QString version, version_plist = project->first("QMAKE_PBUILDER_VERSION_PLIST");
931 if(version_plist.isEmpty()) 1307 if(version_plist.isEmpty()) {
932 version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist"; 1308 if(ideType() == MAC_XCODE && QFile::exists("/Developer/Applications/Xcode.app/Contents/version.plist"))
1309 version_plist = "/Developer/Applications/Xcode.app/Contents/version.plist";
933 else 1310 else
1311 version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist";
1312 } else {
934 version_plist = version_plist.replace(QRegExp("\""), ""); 1313 version_plist = version_plist.replace(QRegExp("\""), "");
1314 }
935 QFile version_file(version_plist); 1315 QFile version_file(version_plist);
@@ -956,4 +1336,7 @@ ProjectBuilderMakefileGenerator::pbuilderVersion() const
956 version_file.close(); 1336 version_file.close();
957 } else debug_msg(1, "pbuilder: version.plist: Failure to open %s", version_plist.latin1()); 1337 } else { debug_msg(1, "pbuilder: version.plist: Failure to open %s", version_plist.latin1()); }
958 if(version.startsWith("2.0")) 1338 if(version_plist.contains("Xcode")) {
1339 ret = "39";
1340 } else {
1341 if(version.startsWith("2."))
959 ret = "38"; 1342 ret = "38";
@@ -961,2 +1344,3 @@ ProjectBuilderMakefileGenerator::pbuilderVersion() const
961 ret = "34"; 1344 ret = "34";
1345 }
962 } else { 1346 } else {
@@ -976,8 +1360,37 @@ ProjectBuilderMakefileGenerator::pbuilderVersion() const
976 1360
977QString 1361int
978ProjectBuilderMakefileGenerator::reftypeForFile(QString where) 1362ProjectBuilderMakefileGenerator::reftypeForFile(const QString &where)
979{ 1363{
1364 int ret = 0; //absolute is the default..
980 if(QDir::isRelativePath(where)) 1365 if(QDir::isRelativePath(where))
981 return "4"; //relative 1366 ret = 4; //relative
982 return "0"; //absolute 1367 return ret;
1368}
1369
1370ProjectBuilderMakefileGenerator::IDE_TYPE
1371ProjectBuilderMakefileGenerator::ideType() const
1372{
1373 if(!project->isActiveConfig("no_pbx_xcode") &&
1374 (QFile::exists("/Developer/Applications/Xcode.app") || project->isActiveConfig("pbx_xcode")))
1375 return ProjectBuilderMakefileGenerator::MAC_XCODE;
1376 return ProjectBuilderMakefileGenerator::MAC_PBUILDER;
983} 1377}
1378
1379QString
1380ProjectBuilderMakefileGenerator::projectSuffix() const
1381{
1382 if(ideType() == MAC_XCODE)
1383 return ".xcode";
1384 return ".pbproj";
1385}
1386
1387QString
1388ProjectBuilderMakefileGenerator::pbxbuild()
1389{
1390 if(QFile::exists("/usr/bin/pbbuild"))
1391 return "pbbuild";
1392 if(QFile::exists("/usr/bin/xcodebuild"))
1393 return "xcodebuild";
1394 return (ideType() == MAC_XCODE ? "xcodebuild" : "pbxbuild");
1395}
1396
diff --git a/qmake/generators/mac/pbuilder_pbx.h b/qmake/generators/mac/pbuilder_pbx.h
index ec2e1be..4ffb9a8 100644
--- a/qmake/generators/mac/pbuilder_pbx.h
+++ b/qmake/generators/mac/pbuilder_pbx.h
@@ -1,11 +1,9 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$
3** 2**
4** Definition of ________ class.
5** 3**
6** Created : 970521 4** Definition of ProjectBuilderMakefileGenerator class.
7** 5**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 6** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 7**
10** This file is part of the network module of the Qt GUI Toolkit. 8** This file is part of qmake.
11** 9**
@@ -36,4 +34,5 @@
36**********************************************************************/ 34**********************************************************************/
37#ifndef __PBUILDERMAKE_H__ 35
38#define __PBUILDERMAKE_H__ 36#ifndef __PBUILDER_PBX_H__
37#define __PBUILDER_PBX_H__
39 38
@@ -45,2 +44,3 @@ class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator
45 int pbuilderVersion() const; 44 int pbuilderVersion() const;
45 bool writeSubdirs(QTextStream &, bool);
46 bool writeMakeParts(QTextStream &); 46 bool writeMakeParts(QTextStream &);
@@ -48,7 +48,13 @@ class ProjectBuilderMakefileGenerator : public UnixMakefileGenerator
48 48
49 QString pbxbuild();
49 QMap<QString, QString> keys; 50 QMap<QString, QString> keys;
50 QString keyFor(QString file); 51 QString keyFor(const QString &file);
51 QString fixEnvs(QString file); 52 QString fixQuotes(const QString &val);
52 QString fixEnvsList(QString where); 53 QString fixEnvs(const QString &file);
53 QString reftypeForFile(QString file); 54 QString fixEnvsList(const QString &where);
55 int reftypeForFile(const QString &where);
56 QString projectSuffix() const;
57
58 enum IDE_TYPE { MAC_XCODE, MAC_PBUILDER };
59 IDE_TYPE ideType() const;
54 60
@@ -60,2 +66,3 @@ public:
60protected: 66protected:
67 bool doPrecompiledHeaders() const { return FALSE; }
61 virtual bool doDepends() const { return FALSE; } //never necesary 68 virtual bool doDepends() const { return FALSE; } //never necesary
@@ -67,2 +74,2 @@ inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator()
67 74
68#endif /* __PBUILDERMAKE_H__ */ 75#endif /* __PBUILDER_PBX_H__ */