summaryrefslogtreecommitdiff
path: root/qmake/main.cpp
Unidiff
Diffstat (limited to 'qmake/main.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/main.cpp53
1 files changed, 39 insertions, 14 deletions
diff --git a/qmake/main.cpp b/qmake/main.cpp
index cc2d08a..a731314 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -1,11 +1,9 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2**
3** 3**
4** Definition of ________ class. 4** ???
5** 5**
6** Created : 970521 6** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** This file is part of qmake.
9**
10** This file is part of the network module of the Qt GUI Toolkit.
11** 9**
@@ -38,2 +36,3 @@
38#include "project.h" 36#include "project.h"
37#include "property.h"
39#include "option.h" 38#include "option.h"
@@ -52,2 +51,6 @@
52#undef main 51#undef main
52#ifdef Q_OS_MAC
53// for qurl
54bool qt_resolve_symlinks = FALSE;
55#endif
53 56
@@ -61,11 +64,32 @@ int main(int argc, char **argv)
61 QString oldpwd = sunworkshop42workaround.currentDirPath(); 64 QString oldpwd = sunworkshop42workaround.currentDirPath();
62 Option::output_dir = oldpwd; //for now this is the output dir
63#ifdef Q_WS_WIN 65#ifdef Q_WS_WIN
64 if ( !(Option::output_dir.length() == 3 && Option::output_dir[0].isLetter() && Option::output_dir.endsWith(":/") ) ) 66 if(!(oldpwd.length() == 3 && oldpwd[0].isLetter() && oldpwd.endsWith(":/") ) )
65#endif 67#endif
66 { 68 {
67 if(Option::output_dir.right(1) != QString(QChar(QDir::separator()))) 69 if(oldpwd.right(1) != QString(QChar(QDir::separator())))
68 Option::output_dir += QDir::separator(); 70 oldpwd += QDir::separator();
71 }
72 Option::output_dir = oldpwd; //for now this is the output dir
73
74 if(Option::output.name() != "-") {
75 QFileInfo fi(Option::output);
76 QString dir;
77 if(fi.isDir()) {
78 dir = fi.filePath();
79 } else {
80 QString tmp_dir = fi.dirPath();
81 if(!tmp_dir.isEmpty() && QFile::exists(tmp_dir))
82 dir = tmp_dir;
83 }
84 if(!dir.isNull() && dir != ".")
85 Option::output_dir = dir;
86 if(QDir::isRelativePath(Option::output_dir))
87 Option::output_dir.prepend(oldpwd);
69 } 88 }
70 QMakeProject proj; 89
90 QMakeProperty prop;
91 if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || Option::qmake_mode == Option::QMAKE_SET_PROPERTY)
92 return prop.exec() ? 0 : 101;
93
94 QMakeProject proj(&prop);
71 int exit_val = 0; 95 int exit_val = 0;
@@ -79,3 +103,3 @@ int main(int argc, char **argv)
79 Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { 103 Option::qmake_mode == Option::QMAKE_GENERATE_PRL) {
80 QString fn = (*pfile); 104 QString fn = Option::fixPathToLocalOS((*pfile));
81 105
@@ -87,3 +111,3 @@ int main(int argc, char **argv)
87 debug_msg(1, "Changing dir to: %s", fn.left(di).latin1()); 111 debug_msg(1, "Changing dir to: %s", fn.left(di).latin1());
88 if(!QDir::setCurrent(fn.left(fn.findRev(Option::dir_sep)))) 112 if(!QDir::setCurrent(fn.left(di)))
89 fprintf(stderr, "Cannot find directory: %s\n", fn.left(di).latin1()); 113 fprintf(stderr, "Cannot find directory: %s\n", fn.left(di).latin1());
@@ -125,2 +149,3 @@ int main(int argc, char **argv)
125 Option::output.setName(proj.first("QMAKE_MAKEFILE")); 149 Option::output.setName(proj.first("QMAKE_MAKEFILE"));
150 Option::output_dir = oldpwd;
126 if(!mkfile->openOutput(Option::output)) { 151 if(!mkfile->openOutput(Option::output)) {
@@ -151,3 +176,3 @@ int main(int argc, char **argv)
151 for(QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) { 176 for(QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) {
152 if(it.key().left(1) != "." && !it.data().isEmpty()) 177 if(!it.key().startsWith(".") && !it.data().isEmpty())
153 debug_msg(1, "%s === %s", it.key().latin1(), it.data().join(" :: ").latin1()); 178 debug_msg(1, "%s === %s", it.key().latin1(), it.data().join(" :: ").latin1());