1235 if(!tmp.isEmpty()) { |
1234 if(!tmp.isEmpty()) { |
1236 if(!target.isEmpty()) |
1235 if(!target.isEmpty()) |
1237 target += "\n"; |
1236 target += "\n"; |
1238 do_default = false; |
1237 do_default = false; |
1239 for(QStringList::Iterator wild_it = tmp.begin(); wild_it != tmp.end(); ++wild_it) { |
1238 for(QStringList::Iterator wild_it = tmp.begin(); wild_it != tmp.end(); ++wild_it) { |
1240 QString wild = Option::fixPathToLocalOS((*wild_it), false, false); |
1239 QString wild = Option::fixPathToTargetOS((*wild_it), false, false); |
1241 QString dirstr = qmake_getpwd(), filestr = wild; |
1240 QString dirstr = qmake_getpwd(), filestr = wild; |
1242 int slsh = filestr.lastIndexOf(Option::dir_sep); |
1241 int slsh = filestr.lastIndexOf(Option::dir_sep); |
1243 if(slsh != -1) { |
1242 if(slsh != -1) { |
1244 dirstr = filestr.left(slsh+1); |
1243 dirstr = filestr.left(slsh+1); |
1245 filestr.remove(0, slsh+1); |
1244 filestr.remove(0, slsh+1); |
1246 } |
1245 } |
1247 if(!dirstr.endsWith(Option::dir_sep)) |
1246 if(!dirstr.endsWith(Option::dir_sep)) |
1248 dirstr += Option::dir_sep; |
1247 dirstr += Option::dir_sep; |
1249 if(exists(wild)) { //real file |
1248 bool is_target = (wild == fileFixify(var("TARGET"), FileFixifyAbsolute)); |
|
1249 if(is_target || exists(wild)) { //real file or target |
1250 QString file = wild; |
1250 QString file = wild; |
1251 QFileInfo fi(fileInfo(wild)); |
1251 QFileInfo fi(fileInfo(wild)); |
1252 if(!target.isEmpty()) |
1252 if(!target.isEmpty()) |
1253 target += "\t"; |
1253 target += "\t"; |
1254 QString dst_file = filePrefixRoot(root, dst); |
1254 QString dst_file = filePrefixRoot(root, dst); |
1258 dst_file += fi.fileName(); |
1258 dst_file += fi.fileName(); |
1259 } |
1259 } |
1260 QString cmd; |
1260 QString cmd; |
1261 if (fi.isDir()) |
1261 if (fi.isDir()) |
1262 cmd = "-$(INSTALL_DIR)"; |
1262 cmd = "-$(INSTALL_DIR)"; |
1263 else if (fi.isExecutable()) |
1263 else if (is_target || fi.isExecutable()) |
1264 cmd = "-$(INSTALL_PROGRAM)"; |
1264 cmd = "-$(INSTALL_PROGRAM)"; |
1265 else |
1265 else |
1266 cmd = "-$(INSTALL_FILE)"; |
1266 cmd = "-$(INSTALL_FILE)"; |
1267 cmd += " " + escapeFilePath(wild) + " " + dst_file + "\n"; |
1267 cmd += " " + escapeFilePath(wild) + " " + dst_file + "\n"; |
1268 target += cmd; |
1268 target += cmd; |
1275 uninst.append(rm_dir_contents + " " + filePrefixRoot(root, fileFixify(dst + filestr, FileFixifyAbsolute, false))); |
1275 uninst.append(rm_dir_contents + " " + filePrefixRoot(root, fileFixify(dst + filestr, FileFixifyAbsolute, false))); |
1276 continue; |
1276 continue; |
1277 } |
1277 } |
1278 QString local_dirstr = Option::fixPathToLocalOS(dirstr, true); |
1278 QString local_dirstr = Option::fixPathToLocalOS(dirstr, true); |
1279 QStringList files = QDir(local_dirstr).entryList(QStringList(filestr)); |
1279 QStringList files = QDir(local_dirstr).entryList(QStringList(filestr)); |
1280 if(project->values((*it) + ".CONFIG").indexOf("no_check_exist") != -1 && files.isEmpty()) { |
1280 const QStringList &installConfigValues = project->values((*it) + ".CONFIG"); |
|
1281 if (installConfigValues.contains("no_check_exist") && files.isEmpty()) { |
1281 if(!target.isEmpty()) |
1282 if(!target.isEmpty()) |
1282 target += "\t"; |
1283 target += "\t"; |
1283 QString dst_file = filePrefixRoot(root, dst); |
1284 QString dst_file = filePrefixRoot(root, dst); |
1284 QFileInfo fi(fileInfo(wild)); |
1285 QFileInfo fi(fileInfo(wild)); |
1285 QString cmd = QString(fi.isExecutable() ? "-$(INSTALL_PROGRAM)" : "-$(INSTALL_FILE)") + " " + |
1286 QString cmd; |
1286 wild + " " + dst_file + "\n"; |
1287 if (installConfigValues.contains("directory")) { |
|
1288 cmd = QLatin1String("-$(INSTALL_DIR)"); |
|
1289 if (!dst_file.endsWith(Option::dir_sep)) |
|
1290 dst_file += Option::dir_sep; |
|
1291 dst_file += fi.fileName(); |
|
1292 } else if (installConfigValues.contains("executable")) { |
|
1293 cmd = QLatin1String("-$(INSTALL_PROGRAM)"); |
|
1294 } else if (installConfigValues.contains("data")) { |
|
1295 cmd = QLatin1String("-$(INSTALL_FILE)"); |
|
1296 } else { |
|
1297 cmd = QString(fi.isExecutable() ? "-$(INSTALL_PROGRAM)" : "-$(INSTALL_FILE)"); |
|
1298 } |
|
1299 cmd += " " + wild + " " + dst_file + "\n"; |
1287 target += cmd; |
1300 target += cmd; |
1288 if(!uninst.isEmpty()) |
1301 if(!uninst.isEmpty()) |
1289 uninst.append("\n\t"); |
1302 uninst.append("\n\t"); |
1290 uninst.append(rm_dir_contents + " " + filePrefixRoot(root, fileFixify(dst + filestr, FileFixifyAbsolute, false))); |
1303 uninst.append(rm_dir_contents + " " + filePrefixRoot(root, fileFixify(dst + filestr, FileFixifyAbsolute, false))); |
1291 } |
1304 } |
1812 } |
1825 } |
1813 if(tmp_clean.isEmpty()) |
1826 if(tmp_clean.isEmpty()) |
1814 tmp_clean = tmp_out; |
1827 tmp_clean = tmp_out; |
1815 if(tmp_clean.indexOf("${QMAKE_") == -1) { |
1828 if(tmp_clean.indexOf("${QMAKE_") == -1) { |
1816 t << "\n\t" << "-$(DEL_FILE) " << tmp_clean; |
1829 t << "\n\t" << "-$(DEL_FILE) " << tmp_clean; |
1817 if (isForSymbian()) |
|
1818 t << " 2> NUL"; // Eliminate unnecessary warnings |
|
1819 wrote_clean = true; |
1830 wrote_clean = true; |
1820 } |
1831 } |
1821 if(!wrote_clean_cmds || !wrote_clean) { |
1832 if(!wrote_clean_cmds || !wrote_clean) { |
1822 QStringList cleans; |
1833 QStringList cleans; |
1823 const QString del_statement("-$(DEL_FILE)"); |
1834 const QString del_statement("-$(DEL_FILE)"); |
1841 } |
1852 } |
1842 if(!files.isEmpty()) |
1853 if(!files.isEmpty()) |
1843 cleans.append(files); |
1854 cleans.append(files); |
1844 } |
1855 } |
1845 } |
1856 } |
1846 if(!cleans.isEmpty()) { |
1857 if(!cleans.isEmpty()) |
1847 if (isForSymbian()) |
1858 t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, ""); |
1848 t << valGlue(cleans, "\n\t" + del_statement, " 2> NUL\n\t" + del_statement, " 2> NUL"); |
|
1849 else |
|
1850 t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, ""); |
|
1851 } |
|
1852 if(!wrote_clean_cmds) { |
1859 if(!wrote_clean_cmds) { |
1853 for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) { |
1860 for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) { |
1854 t << "\n\t" << replaceExtraCompilerVariables(tmp_clean_cmds, (*input), |
1861 t << "\n\t" << replaceExtraCompilerVariables(tmp_clean_cmds, (*input), |
1855 replaceExtraCompilerVariables(tmp_out, (*input), QString())); |
1862 replaceExtraCompilerVariables(tmp_out, (*input), QString())); |
1856 } |
1863 } |
2107 } |
2114 } |
2108 |
2115 |
2109 bool |
2116 bool |
2110 MakefileGenerator::writeStubMakefile(QTextStream &t) |
2117 MakefileGenerator::writeStubMakefile(QTextStream &t) |
2111 { |
2118 { |
2112 t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
2119 t << "QMAKE = " << var("QMAKE_QMAKE") << endl; |
2113 QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); |
2120 QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); |
2114 for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) |
2121 for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) |
2115 t << *it << " "; |
2122 t << *it << " "; |
2116 //const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName())); |
2123 //const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName())); |
2117 t << "first all clean install distclean uninstall: " << "qmake" << endl |
2124 t << "first all clean install distclean uninstall: " << "qmake" << endl |
2162 ret += " -nodepend"; |
2169 ret += " -nodepend"; |
2163 if(!Option::mkfile::do_dep_heuristics) |
2170 if(!Option::mkfile::do_dep_heuristics) |
2164 ret += " -nodependheuristics"; |
2171 ret += " -nodependheuristics"; |
2165 if(!Option::mkfile::qmakespec_commandline.isEmpty()) |
2172 if(!Option::mkfile::qmakespec_commandline.isEmpty()) |
2166 ret += " -spec " + specdir(outdir); |
2173 ret += " -spec " + specdir(outdir); |
2167 if(Option::target_mode == Option::TARG_MAC9_MODE) |
2174 if (Option::target_mode_overridden) { |
2168 ret += " -mac9"; |
2175 if (Option::target_mode == Option::TARG_MACX_MODE) |
2169 else if(Option::target_mode == Option::TARG_MACX_MODE) |
2176 ret += " -macx"; |
2170 ret += " -macx"; |
2177 else if (Option::target_mode == Option::TARG_UNIX_MODE) |
2171 else if(Option::target_mode == Option::TARG_UNIX_MODE) |
2178 ret += " -unix"; |
2172 ret += " -unix"; |
2179 else if (Option::target_mode == Option::TARG_WIN_MODE) |
2173 else if(Option::target_mode == Option::TARG_WIN_MODE) |
2180 ret += " -win32"; |
2174 ret += " -win32"; |
2181 } |
2175 |
2182 |
2176 //configs |
2183 //configs |
2177 for(QStringList::Iterator it = Option::user_configs.begin(); |
2184 for(QStringList::Iterator it = Option::user_configs.begin(); |
2178 it != Option::user_configs.end(); ++it) |
2185 it != Option::user_configs.end(); ++it) |
2179 ret += " -config " + (*it); |
2186 ret += " -config " + (*it); |
2222 t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
2229 t << "# Generated by qmake (" << qmake_version() << ") (Qt " << QT_VERSION_STR << ") on: "; |
2223 t << QDateTime::currentDateTime().toString() << endl; |
2230 t << QDateTime::currentDateTime().toString() << endl; |
2224 t << "# Project: " << fileFixify(project->projectFile()) << endl; |
2231 t << "# Project: " << fileFixify(project->projectFile()) << endl; |
2225 t << "# Template: " << var("TEMPLATE") << endl; |
2232 t << "# Template: " << var("TEMPLATE") << endl; |
2226 if(!project->isActiveConfig("build_pass")) |
2233 if(!project->isActiveConfig("build_pass")) |
2227 t << "# Command: " << build_args().replace("$(QMAKE)", |
2234 t << "# Command: " << build_args().replace("$(QMAKE)", var("QMAKE_QMAKE")) << endl; |
2228 (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE"))) << endl; |
|
2229 t << "#############################################################################" << endl; |
2235 t << "#############################################################################" << endl; |
2230 t << endl; |
2236 t << endl; |
2231 } |
2237 } |
2232 |
2238 |
2233 QList<MakefileGenerator::SubTarget*> |
2239 QList<MakefileGenerator::SubTarget*> |
2356 if(ofile.lastIndexOf(Option::dir_sep) != -1) |
2362 if(ofile.lastIndexOf(Option::dir_sep) != -1) |
2357 ofile.remove(0, ofile.lastIndexOf(Option::dir_sep) +1); |
2363 ofile.remove(0, ofile.lastIndexOf(Option::dir_sep) +1); |
2358 t << "MAKEFILE = " << ofile << endl; |
2364 t << "MAKEFILE = " << ofile << endl; |
2359 /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires |
2365 /* Calling Option::fixPathToTargetOS() is necessary for MinGW/MSYS, which requires |
2360 * back-slashes to be turned into slashes. */ |
2366 * back-slashes to be turned into slashes. */ |
2361 t << "QMAKE = " << Option::fixPathToTargetOS(var("QMAKE_QMAKE")) << endl; |
2367 t << "QMAKE = " << var("QMAKE_QMAKE") << endl; |
2362 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
2368 t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
2363 t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
2369 t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
2364 t << "MKDIR = " << var("QMAKE_MKDIR") << endl; |
2370 t << "MKDIR = " << var("QMAKE_MKDIR") << endl; |
2365 t << "COPY = " << var("QMAKE_COPY") << endl; |
2371 t << "COPY = " << var("QMAKE_COPY") << endl; |
2366 t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; |
2372 t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; |
2679 if(Option::mkfile::do_cache) |
2685 if(Option::mkfile::do_cache) |
2680 t << escapeDependencyPath(fileFixify(Option::mkfile::cachefile)) << " "; |
2686 t << escapeDependencyPath(fileFixify(Option::mkfile::cachefile)) << " "; |
2681 if(!specdir().isEmpty()) { |
2687 if(!specdir().isEmpty()) { |
2682 if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf"))) |
2688 if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"qmake.conf"))) |
2683 t << escapeDependencyPath(specdir() + Option::dir_sep + "qmake.conf") << " "; |
2689 t << escapeDependencyPath(specdir() + Option::dir_sep + "qmake.conf") << " "; |
2684 else if(exists(Option::fixPathToLocalOS(specdir()+QDir::separator()+"tmake.conf"))) |
|
2685 t << escapeDependencyPath(specdir() + Option::dir_sep + "tmake.conf") << " "; |
|
2686 } |
2690 } |
2687 const QStringList &included = project->values("QMAKE_INTERNAL_INCLUDED_FILES"); |
2691 const QStringList &included = project->values("QMAKE_INTERNAL_INCLUDED_FILES"); |
2688 t << escapeDependencyPaths(included).join(" \\\n\t\t") << "\n\t" |
2692 t << escapeDependencyPaths(included).join(" \\\n\t\t") << "\n\t" |
2689 << qmake << endl; |
2693 << qmake << endl; |
2690 for(int include = 0; include < included.size(); ++include) { |
2694 for(int include = 0; include < included.size(); ++include) { |