qmake/project.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
child 30 5dc02b23752f
--- a/qmake/project.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/qmake/project.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -44,8 +44,6 @@
 #include "option.h"
 #include "cachekeys.h"
 
-#include "epocroot.h"
-
 #include <qdatetime.h>
 #include <qfile.h>
 #include <qfileinfo.h>
@@ -64,6 +62,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+// Included from tools/shared
+#include <symbian/epocroot.h>
+
 #ifdef Q_OS_WIN32
 #define QT_POPEN _popen
 #define QT_PCLOSE _pclose
@@ -79,7 +80,7 @@
                   E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
                   E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
                   E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE,
-                  E_SIZE };
+                  E_SIZE, E_GENERATE_UID };
 QMap<QString, ExpandFunc> qmake_expandFunctions()
 {
     static QMap<QString, ExpandFunc> *qmake_expand_functions = 0;
@@ -111,6 +112,7 @@
         qmake_expand_functions->insert("prompt", E_PROMPT);
         qmake_expand_functions->insert("replace", E_REPLACE);
         qmake_expand_functions->insert("size", E_SIZE);
+        qmake_expand_functions->insert("generate_uid", E_GENERATE_UID);
     }
     return *qmake_expand_functions;
 }
@@ -1864,6 +1866,9 @@
     return doProjectExpand(func, args_list, place);
 }
 
+// defined in symbian generator
+extern QString generate_test_uid(const QString& target);
+
 QStringList
 QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
                               QMap<QString, QStringList> &place)
@@ -2301,6 +2306,14 @@
             ret += QString::number(size);
         }
         break; }
+    case E_GENERATE_UID:
+        if (args.count() != 1) {
+            fprintf(stderr, "%s:%d: generate_uid(var) requires one argument.\n",
+                    parser.file.toLatin1().constData(), parser.line_no);
+        } else {
+            ret += generate_test_uid(args.first());
+        }
+        break;
     default: {
         fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
                 parser.file.toLatin1().constData(), parser.line_no,
@@ -3055,7 +3068,7 @@
         place[var] = QStringList(pfile);
     } else if(var == QLatin1String("_PRO_FILE_PWD_")) {
         var = ".BUILTIN." + var;
-        place[var] =  QStringList(QFileInfo(pfile).absolutePath());
+        place[var] = QStringList(pfile.isEmpty() ? qmake_getpwd() : QFileInfo(pfile).absolutePath());
     } else if(var == QLatin1String("_QMAKE_CACHE_")) {
         var = ".BUILTIN." + var;
         if(Option::mkfile::do_cache)