📄 unixmake2.cpp
字号:
<< "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t" << "-$(MOVE) $(TARGET) $(TARGET0) " << destdir; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } t << endl << endl; if (! project->isActiveConfig("plugin")) { t << "staticlib: $(TARGETA)" << endl << endl; t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(OBJECTS) $(OBJCOMP)"; if(do_incremental) t << " $(INCREMENTAL_OBJECTS)"; t << " " << var("POST_TARGETDEPS") << "\n\t" << "-$(DEL_FILE) $(TARGETA) " << "\n\t" << var("QMAKE_AR_CMD"); if(do_incremental) t << " $(INCREMENTAL_OBJECTS)"; if(!project->isEmpty("QMAKE_RANLIB")) t << "\n\t" << "$(RANLIB) $(TARGETA)"; t << endl << endl; } } else { QString destdir = project->first("DESTDIR"); t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << destdir << "$(TARGET) " << varGlue("QMAKE_AR_SUBLIBS", destdir, " " + destdir, "") << "\n\n" << "staticlib: " << destdir << "$(TARGET)" << "\n\n"; if(project->isEmpty("QMAKE_AR_SUBLIBS")) { t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) $(OBJCOMP) " << var("POST_TARGETDEPS") << "\n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; t << "-$(DEL_FILE) $(TARGET)" << "\n\t" << var("QMAKE_AR_CMD") << "\n"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\t" << var("QMAKE_POST_LINK") << "\n"; if(!project->isEmpty("QMAKE_RANLIB")) t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; if(!destdir.isEmpty()) t << "\t" << "-$(DEL_FILE) " << destdir << "$(TARGET)" << "\n" << "\t" << "-$(MOVE) $(TARGET) " << destdir << "\n"; } else { int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJCOMP"], libs = project->variables()["QMAKE_AR_SUBLIBS"]; libs.prepend("$(TARGET)"); for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); libit != libs.end(); ++libit) { QStringList build; for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) build << (*objit); QString ar; if((*libit) == "$(TARGET)") { t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; ar = project->variables()["QMAKE_AR_CMD"].first(); ar = ar.replace("$(OBJECTS)", build.join(" ")); } else { t << (*libit) << ": " << valList(build) << "\n\t"; ar = "$(AR) " + (*libit) + " " + build.join(" "); } if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; t << "-$(DEL_FILE) " << (*libit) << "\n\t" << ar << "\n"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\t" << var("QMAKE_POST_LINK") << "\n"; if(!project->isEmpty("QMAKE_RANLIB")) t << "\t" << "$(RANLIB) " << (*libit) << "\n"; if(!destdir.isEmpty()) t << "\t" << "-$(DEL_FILE) " << destdir << (*libit) << "\n" << "\t" << "-$(MOVE) " << (*libit) << " " << destdir << "\n"; } } t << endl << endl; } writeMakeQmake(t); if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake")) { QString meta_files; if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib" && !project->isActiveConfig("compile_libtool")) { //libtool if(!meta_files.isEmpty()) meta_files += " "; meta_files += libtoolFileName(); } if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") { //pkg-config if(!meta_files.isEmpty()) meta_files += " "; meta_files += pkgConfigFileName(); } if(!meta_files.isEmpty()) t << meta_files << ": " << "\n\t" << "@$(QMAKE) -prl " << buildArgs() << " " << project->projectFile() << endl; } if(!project->first("QMAKE_PKGINFO").isEmpty()) { QString pkginfo = project->first("QMAKE_PKGINFO"); QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE_NAME") + "/Contents"; t << pkginfo << ": " << "\n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; t << "@$(DEL_FILE) " << pkginfo << "\n\t" << "@echo \"APPL" << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << "\" >" << pkginfo << endl; } if(!project->isEmpty("QMAKE_BUNDLE_NAME")) { //copy the plist QString info_plist = fileFixify(project->first("QMAKE_INFO_PLIST")), info_plist_out = project->first("QMAKE_INFO_PLIST_OUT"); QString destdir = info_plist_out.section(Option::dir_sep, 0, -2); t << info_plist_out << ": " << "\n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; if(project->first("TEMPLATE") == "app") { QString icon = fileFixify(var("ICON")); t << "@$(DEL_FILE) " << info_plist_out << "\n\t" << "@sed " << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" " << "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" " << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " << "\"" << info_plist << "\" >\"" << info_plist_out << "\"" << endl; //copy the icon if(!project->isEmpty("ICON")) { QString dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE_NAME") + "/Contents/Resources/"; t << dir << icon.section(Option::dir_sep, -1) << ": " << icon << "\n\t" << mkdir_p_asstring(dir) << "\n\t" << "@$(DEL_FILE) " << dir << icon.section(Option::dir_sep, -1) << "\n\t" << "@$(COPY_FILE) " << icon << " " << dir << endl; } } else { t << "@$(DEL_FILE) " << info_plist_out << "\n\t" << "@sed " << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" " << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" " << "-e \"s,@TYPEINFO@," << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " << "\"" << info_plist << "\" >\"" << info_plist_out << "\"" << endl; } //copy other data if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE_NAME") + "/"; const QStringList &bundle_data = project->variables()["QMAKE_BUNDLE_DATA"]; for(int i = 0; i < bundle_data.count(); i++) { const QStringList &files = project->variables()[bundle_data[i] + ".files"]; QString path = bundle_dir; if(!project->isEmpty(bundle_data[i] + ".version")) { QString version = project->first(bundle_data[i] + ".version") + "/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/"; t << Option::fixPathToLocalOS(path + project->first(bundle_data[i] + ".path")) << ": " << "\n\t" << mkdir_p_asstring(path) << "\n\t" << "@$(SYMLINK) " << version << project->first(bundle_data[i] + ".path") << " " << path << endl; path += version; } path += project->first(bundle_data[i] + ".path"); path = Option::fixPathToLocalOS(path); for(int file = 0; file < files.count(); file++) { const QString dst = path + Option::dir_sep + fileInfo(files[file]).fileName(); t << dst << ": " << files[file] << "\n\t" << mkdir_p_asstring(path) << "\n\t" << "@$(DEL_FILE) " << dst << "\n\t"; QFileInfo fi(fileInfo(files[file])); if(fi.isDir()) t << "@$(COPY_DIR) " << files[file] << " " << dst << endl; else t << "@$(COPY_FILE) " << files[file] << " " << dst << endl; } } } } QString ddir; QString packageName(project->first("QMAKE_ORIG_TARGET")); if(!project->isActiveConfig("no_dist_version")) packageName += var("VERSION"); if (project->isEmpty("QMAKE_DISTDIR")) ddir = packageName; else ddir = project->first("QMAKE_DISTDIR"); QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : project->first("OBJECTS_DIR")) + ddir); t << "dist: " << "\n\t" << mkdir_p_asstring(ddir_c) << "\n\t" << "$(COPY_FILE) --parents $(SOURCES) $(DIST) " << ddir_c << Option::dir_sep << " && "; if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { const QStringList &quc = project->variables()["QMAKE_EXTRA_COMPILERS"]; for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { const QStringList &var = project->variables()[(*it)+".input"]; for(QStringList::ConstIterator var_it = var.begin(); var_it != var.end(); ++var_it) { const QStringList &val = project->variables()[(*var_it)]; if(val.isEmpty()) continue; t << "$(COPY_FILE) --parents " << val.join(" ") << " " << ddir_c << Option::dir_sep << " && "; } } } if(!project->isEmpty("TRANSLATIONS")) t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; t << "(cd `dirname " << ddir_c << "` && " << "$(TAR) " << packageName << ".tar " << ddir << " && " << "$(COMPRESS) " << packageName << ".tar) && " << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << packageName << ".tar.gz . && " << "$(DEL_FILE) -r " << ddir_c << endl << endl; t << endl; QString clean_targets = "compiler_clean " + var("CLEAN_DEPS"); t << "yaccclean:" << "\n"; if(!var("YACCSOURCES").isEmpty()) { QStringList clean, &l = project->variables()["YACCSOURCES"]; for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { QFileInfo fi(fileInfo((*it))); QString dir; if(fi.path() != ".") dir = fi.path() + Option::dir_sep; dir = fileFixify(dir, qmake_getpwd(), Option::output_dir); if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) dir += Option::dir_sep; clean << (dir + fi.completeBaseName() + Option::yacc_mod + Option::cpp_ext.first()); clean << (dir + fi.completeBaseName() + Option::yacc_mod + Option::h_ext.first()); } if(!clean.isEmpty()) { t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; clean_targets += " yaccclean"; } } t << "lexclean:" << "\n"; if(!var("LEXSOURCES").isEmpty()) { QStringList clean, &l = project->variables()["LEXSOURCES"]; for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { QFileInfo fi(fileInfo((*it))); QString dir; if(fi.path() != ".") dir = fi.path() + Option::dir_sep; dir = fileFixify(dir, qmake_getpwd(), Option::output_dir); if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) dir += Option::dir_sep; clean << (dir + fi.completeBaseName() + Option::lex_mod + Option::cpp_ext.first()); } if(!clean.isEmpty()) { t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; clean_targets += " lexclean"; } } if(do_incremental) { t << "incrclean:" << "\n"; if(src_incremental) t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; t << endl;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -