summaryrefslogtreecommitdiff
path: root/qmake/generators/mac/metrowerks_xml.cpp
Side-by-side diff
Diffstat (limited to 'qmake/generators/mac/metrowerks_xml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/mac/metrowerks_xml.cpp23
1 files changed, 10 insertions, 13 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,26 +1,24 @@
/****************************************************************************
-** $Id$
+**
**
-** Definition of ________ class.
+** Implementation of MetrowerksMakefileGenerator class.
**
-** Created : 970521
+** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
**
-** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
-**
-** This file is part of the network module of the Qt GUI Toolkit.
+** This file is part of qmake.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
** with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@@ -29,39 +27,38 @@
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "metrowerks_xml.h"
#include "option.h"
#include <qdir.h>
#include <qdict.h>
#include <qregexp.h>
#include <stdlib.h>
#include <time.h>
-#ifdef Q_OS_MAC
+#if !defined(QWS) && defined(Q_OS_MAC)
#include <Carbon/Carbon.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif
-
MetrowerksMakefileGenerator::MetrowerksMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE)
{
}
bool
MetrowerksMakefileGenerator::writeMakefile(QTextStream &t)
{
if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
/* for now just dump, I need to generated an empty xml or something.. */
fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n",
var("QMAKE_FAILED_REQUIREMENTS").latin1());
return TRUE;
}
if(project->first("TEMPLATE") == "app" ||
@@ -594,47 +591,47 @@ MetrowerksMakefileGenerator::init()
project->first("QMAKE_EXTENSION_SHLIB");
project->variables()["CODEWARRIOR_VERSION"].append(project->first("VER_MAJ") +
project->first("VER_MIN") +
project->first("VER_PAT"));
} else {
project->variables()["CODEWARRIOR_VERSION"].append("0");
if(project->isEmpty("QMAKE_ENTRYPOINT"))
project->variables()["QMAKE_ENTRYPOINT"].append("start");
project->variables()["CODEWARRIOR_ENTRYPOINT"].append(
project->first("QMAKE_ENTRYPOINT"));
}
}
QString
-MetrowerksMakefileGenerator::findTemplate(QString file)
+MetrowerksMakefileGenerator::findTemplate(const QString &file)
{
QString ret;
if(!QFile::exists(ret = file) &&
!QFile::exists((ret = Option::mkfile::qmakespec + QDir::separator() + file)) &&
!QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/mac-mwerks/" + file)) &&
!QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file))))
return "";
return ret;
}
bool
MetrowerksMakefileGenerator::createFork(const QString &f)
{
-#if defined(Q_OS_MACX)
+#if !defined(QWS) && defined(Q_OS_MACX)
FSRef fref;
FSSpec fileSpec;
if(QFile::exists(f)) {
mode_t perms = 0;
{
struct stat s;
stat(f.latin1(), &s);
if(!(s.st_mode & S_IWUSR)) {
perms = s.st_mode;
chmod(f.latin1(), perms | S_IWUSR);
}
}
FILE *o = fopen(f.latin1(), "a");
if(!o)
return FALSE;
if(FSPathMakeRef((const UInt8 *)f.latin1(), &fref, NULL) == noErr) {
@@ -651,33 +648,33 @@ MetrowerksMakefileGenerator::createFork(const QString &f)
#else
Q_UNUSED(f)
#endif
return TRUE;
}
bool
MetrowerksMakefileGenerator::fixifyToMacPath(QString &p, QString &v, bool )
{
v = "Absolute";
if(p.find(':') != -1) //guess its macish already
return TRUE;
static QString st_volume;
if(st_volume.isEmpty()) {
st_volume = var("QMAKE_VOLUMENAME");
-#ifdef Q_OS_MAC
+#if !defined(QWS) && defined(Q_OS_MACX)
if(st_volume.isEmpty()) {
uchar foo[512];
HVolumeParam pb;
memset(&pb, '\0', sizeof(pb));
pb.ioVRefNum = 0;
pb.ioNamePtr = foo;
if(PBHGetVInfoSync((HParmBlkPtr)&pb) == noErr) {
int len = foo[0];
memcpy(foo,foo+1, len);
foo[len] = '\0';
st_volume = (char *)foo;
}
}
#endif
}
QString volume = st_volume;
@@ -720,51 +717,51 @@ MetrowerksMakefileGenerator::processPrlFiles()
const QString lflags[] = { "QMAKE_LIBS", QString::null };
for(int i = 0; !lflags[i].isNull(); i++) {
for(bool ret = FALSE; TRUE; ret = FALSE) {
QStringList l_out;
QStringList &l = project->variables()[lflags[i]];
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
QString opt = (*it);
if(opt.startsWith("-")) {
if(opt.startsWith("-L")) {
QString r = opt.right(opt.length() - 2), l = r;
fixEnvVariables(l);
libdirs.append(new MakefileDependDir(r.replace( "\"", ""),
l.replace( "\"", "")));
} else if(opt.left(2) == "-l") {
QString lib = opt.right(opt.length() - 2), prl;
for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
- prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext;
+ prl = mdd->local_dir + Option::dir_sep + "lib" + lib;
if(processPrlFile(prl)) {
if(prl.startsWith(mdd->local_dir))
prl.replace(0, mdd->local_dir.length(), mdd->real_dir);
QRegExp reg("^.*lib(" + lib + "[^.]*)\\." +
project->first("QMAKE_EXTENSION_SHLIB") + "$");
if(reg.exactMatch(prl))
prl = "-l" + reg.cap(1);
opt = prl;
ret = TRUE;
break;
}
}
} else if(opt == "-framework") {
l_out.append(opt);
++it;
opt = (*it);
QString prl = "/System/Library/Frameworks/" + opt +
- ".framework/" + opt + Option::prl_ext;
+ ".framework/" + opt;
if(processPrlFile(prl))
ret = TRUE;
}
if(!opt.isEmpty())
l_out.append(opt);
} else {
if(processPrlFile(opt))
ret = TRUE;
if(!opt.isEmpty())
l_out.append(opt);
}
}
if(ret)
l = l_out;
else
break;