Changeset 846 for trunk/qmake/generators/makefile.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/qmake/generators/makefile.cpp
r773 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 467 467 const QStringList &subs = v["QMAKE_SUBSTITUTES"]; 468 468 for(int i = 0; i < subs.size(); ++i) { 469 if(!subs.at(i).endsWith(".in")) { 470 warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'", 471 subs.at(i).toLatin1().constData()); 472 continue; 473 } 474 QFile in(fileFixify(subs.at(i))), out(fileInfo(subs.at(i)).fileName()); 475 if(out.fileName().endsWith(".in")) 476 out.setFileName(out.fileName().left(out.fileName().length()-3)); 469 QString inn = subs.at(i) + ".input", outn = subs.at(i) + ".output"; 470 if (v.contains(inn) || v.contains(outn)) { 471 if (!v.contains(inn) || !v.contains(outn)) { 472 warn_msg(WarnLogic, "Substitute '%s' has only one of .input and .output", 473 subs.at(i).toLatin1().constData()); 474 continue; 475 } 476 const QStringList &tinn = v[inn], &toutn = v[outn]; 477 if (tinn.length() != 1) { 478 warn_msg(WarnLogic, "Substitute '%s.input' does not have exactly one value", 479 subs.at(i).toLatin1().constData()); 480 continue; 481 } 482 if (toutn.length() != 1) { 483 warn_msg(WarnLogic, "Substitute '%s.output' does not have exactly one value", 484 subs.at(i).toLatin1().constData()); 485 continue; 486 } 487 inn = tinn.first(); 488 outn = toutn.first(); 489 } else { 490 inn = subs.at(i); 491 if(!inn.endsWith(".in")) { 492 warn_msg(WarnLogic, "Substitute '%s' does not end with '.in'", 493 inn.toLatin1().constData()); 494 continue; 495 } 496 outn = inn.left(inn.length()-3); 497 } 498 QFile in(fileFixify(inn)); 499 QFile out(fileFixify(outn, qmake_getpwd(), Option::output_dir)); 477 500 if(in.open(QFile::ReadOnly)) { 478 501 QString contents; … … 529 552 QString old = QString::fromUtf8(out.readAll()); 530 553 if(contents == old) { 531 v["QMAKE_INTERNAL_INCLUDED_FILES"].append( subs.at(i));554 v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName()); 532 555 continue; 533 556 } … … 539 562 } 540 563 } 564 mkdir(QFileInfo(out).absolutePath()); 541 565 if(out.open(QFile::WriteOnly)) { 542 v["QMAKE_INTERNAL_INCLUDED_FILES"].append( subs.at(i));566 v["QMAKE_INTERNAL_INCLUDED_FILES"].append(in.fileName()); 543 567 out.write(contents.toUtf8()); 544 568 } else { … … 807 831 808 832 // escape qmake command 809 if (!project->isEmpty("QMAKE_QMAKE")) { 810 project->values("QMAKE_QMAKE") = escapeFilePaths(project->values("QMAKE_QMAKE")); 811 } 833 QStringList &qmk = project->values("QMAKE_QMAKE"); 834 qmk = escapeFilePaths(qmk); 812 835 } 813 836 … … 982 1005 libs << "QMAKE_LIBS_PRIVATE"; 983 1006 for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) 984 t << project->values((*it)).join(" ") << " ";1007 t << project->values((*it)).join(" ").replace('\\', "\\\\") << " "; 985 1008 } 986 1009 t << endl; … … 1276 1299 if(!dirstr.endsWith(Option::dir_sep)) 1277 1300 dirstr += Option::dir_sep; 1278 if(exists(wild)) { //real file 1301 bool is_target = (wild == fileFixify(var("TARGET"), FileFixifyAbsolute)); 1302 if(is_target || exists(wild)) { //real file or target 1279 1303 QString file = wild; 1280 1304 QFileInfo fi(fileInfo(wild)); … … 1290 1314 if (fi.isDir()) 1291 1315 cmd = inst_prefix + "$(INSTALL_DIR)"; 1292 else if ( fi.isExecutable())1316 else if (is_target || fi.isExecutable()) 1293 1317 cmd = inst_prefix + "$(INSTALL_PROGRAM)"; 1294 1318 else … … 1786 1810 QStringList tmp_dep = project->values((*it) + ".depends"); 1787 1811 QString tmp_dep_cmd; 1812 QString dep_cd_cmd; 1788 1813 if(!project->isEmpty((*it) + ".depend_command")) { 1789 1814 int argv0 = -1; … … 1799 1824 if(exists(c)) { 1800 1825 cmdline[argv0] = escapeFilePath(Option::fixPathToLocalOS(cmdline.at(argv0), false)); 1801 tmp_dep_cmd = cmdline.join(" ");1802 1826 } else { 1803 1827 cmdline[argv0] = escapeFilePath(cmdline.at(argv0)); 1804 1828 } 1805 } 1829 QFileInfo cmdFileInfo(cmdline[argv0]); 1830 if (!cmdFileInfo.isAbsolute() || cmdFileInfo.exists()) 1831 tmp_dep_cmd = cmdline.join(" "); 1832 } 1833 dep_cd_cmd = QLatin1String("cd ") 1834 + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) 1835 + QLatin1String(" && "); 1806 1836 } 1807 1837 QStringList &vars = project->values((*it) + ".variables"); … … 1860 1890 if(tmp_clean.indexOf("${QMAKE_") == -1) { 1861 1891 t << "\n\t" << del_statement << " " << tmp_clean << del_suffix; 1862 if (isForSymbian())1863 t << " 2> NUL"; // Eliminate unnecessary warnings1864 1892 wrote_clean = true; 1865 1893 } … … 1919 1947 QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input), 1920 1948 tmp_out); 1921 dep_cmd = fixEnvVariables(dep_cmd);1949 dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); 1922 1950 if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { 1923 1951 QString indeps; … … 2017 2045 char buff[256]; 2018 2046 QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, (*input), out); 2019 dep_cmd = fixEnvVariables(dep_cmd);2047 dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd); 2020 2048 if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { 2021 2049 QString indeps; … … 2154 2182 MakefileGenerator::writeStubMakefile(QTextStream &t) 2155 2183 { 2156 t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;2184 t << "QMAKE = " << var("QMAKE_QMAKE") << endl; 2157 2185 QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); 2158 2186 for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) … … 2209 2237 if(!Option::mkfile::qmakespec_commandline.isEmpty()) 2210 2238 ret += " -spec " + specdir(outdir); 2211 if (Option::target_mode == Option::TARG_MAC9_MODE)2212 ret += " -mac9";2213 else if(Option::target_mode == Option::TARG_MACX_MODE)2214 ret += " -macx";2215 else if(Option::target_mode == Option::TARG_UNIX_MODE)2216 ret += " -unix";2217 else if(Option::target_mode == Option::TARG_WIN_MODE)2218 ret += " -win32";2239 if (Option::target_mode_overridden) { 2240 if (Option::target_mode == Option::TARG_MACX_MODE) 2241 ret += " -macx"; 2242 else if (Option::target_mode == Option::TARG_UNIX_MODE) 2243 ret += " -unix"; 2244 else if (Option::target_mode == Option::TARG_WIN_MODE) 2245 ret += " -win32"; 2246 } 2219 2247 else if(Option::target_mode == Option::TARG_OS2_MODE) 2220 2248 ret += " -os2"; … … 2271 2299 t << "# Template: " << var("TEMPLATE") << endl; 2272 2300 if(!project->isActiveConfig("build_pass")) 2273 t << "# Command: " << build_args().replace("$(QMAKE)", 2274 (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE"))) << endl; 2301 t << "# Command: " << build_args().replace("$(QMAKE)", var("QMAKE_QMAKE")) << endl; 2275 2302 t << "#############################################################################" << endl; 2276 2303 t << endl; … … 2405 2432 /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires 2406 2433 * back-slashes to be turned into slashes. */ 2407 t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl;2434 t << "QMAKE = " << var("QMAKE_QMAKE") << endl; 2408 2435 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; 2409 2436 t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; … … 2733 2760 if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf"))) 2734 2761 t << escapeDependencyPath(specdir() + Option::dir_sep + "qmake.conf") << " "; 2735 else if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"tmake.conf")))2736 t << escapeDependencyPath(specdir() + Option::dir_sep + "tmake.conf") << " ";2737 2762 } 2738 2763 const QStringList &included = project->values("QMAKE_INTERNAL_INCLUDED_FILES");
Note:
See TracChangeset
for help on using the changeset viewer.