qmake/generators/makefile.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
child 29 b72c6db6890b
--- a/qmake/generators/makefile.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/qmake/generators/makefile.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)
 **
@@ -1519,6 +1519,19 @@
                         base = fi.fileName();
                     val += base;
                 }
+            } else if(var == QLatin1String("QMAKE_FILE_EXT")) {
+                filePath = true;
+                for(int i = 0; i < in.size(); ++i) {
+                    QFileInfo fi(fileInfo(Option::fixPathToLocalOS(in.at(i))));
+                    QString ext;
+                    // Ensure complementarity with QMAKE_FILE_BASE
+                    int baseLen = fi.completeBaseName().length();
+                    if(baseLen == 0)
+                        ext = fi.fileName();
+                    else
+                        ext = fi.fileName().remove(0, baseLen);
+                    val += ext;
+                }
             } else if(var == QLatin1String("QMAKE_FILE_PATH") || var == QLatin1String("QMAKE_FILE_IN_PATH")) {
                 filePath = true;
                 for(int i = 0; i < in.size(); ++i)
@@ -1830,11 +1843,12 @@
                             cleans.append(files);
                     }
                 }
-                if(!cleans.isEmpty())
+                if(!cleans.isEmpty()) {
                     if (isForSymbian())
                         t << valGlue(cleans, "\n\t" + del_statement, " 2> NUL\n\t" + del_statement, " 2> NUL");
                     else
                         t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, "");
+                }
                 if(!wrote_clean_cmds) {
                     for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) {
                         t << "\n\t" << replaceExtraCompilerVariables(tmp_clean_cmds, (*input),
@@ -2417,16 +2431,14 @@
 
         //qmake it
         if(!subtarget->profile.isEmpty()) {
-            QString out = out_directory + subtarget->makefile,
-                     in = fileFixify(in_directory + subtarget->profile, in_directory);
-            if(in.startsWith(in_directory))
-                in = in.mid(in_directory.length());
+            QString out = subtarget->makefile;
+            QString in = fileFixify(in_directory + subtarget->profile, out_directory, QString(), FileFixifyAbsolute);
             if(out.startsWith(in_directory))
                 out = out.mid(in_directory.length());
             t << mkfile << ": " << "\n\t";
             if(!in_directory.isEmpty()) {
-                t << mkdir_p_asstring(in_directory)
-                  << in_directory_cdin
+                t << mkdir_p_asstring(out_directory)
+                  << out_directory_cdin
                   << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out
                   << in_directory_cdout << endl;
             } else {
@@ -2437,8 +2449,8 @@
                 t <<  " FORCE";
             t << "\n\t";
             if(!in_directory.isEmpty()) {
-                t << mkdir_p_asstring(in_directory)
-                  << in_directory_cdin
+                t << mkdir_p_asstring(out_directory)
+                  << out_directory_cdin
                   << "$(QMAKE) " << in << buildArgs(in_directory) << " -o " << out
                   << in_directory_cdout << endl;
             } else {
@@ -2543,6 +2555,7 @@
             QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
             if(!ofile.isEmpty())
                 t << "\t-$(DEL_FILE) " << ofile << endl;
+            t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n");
         } else if(project->isActiveConfig("no_empty_targets")) {
             t << "\t" << "@cd ." << endl;
         }