📄 unixmake2.cpp
字号:
QStringList &l = project->variables()[src[x]]; for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { if(!(*it).isEmpty()) { QString d_file; if((*it).endsWith(".c")) { d_file = (*it).left((*it).length() - 2); } else { for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { if((*it).endsWith((*cppit))) { d_file = (*it).left((*it).length() - (*cppit).length()); break; } } } if(!d_file.isEmpty()) { d_file = odir + ".deps/" + d_file + ".d"; QStringList deps = findDependencies((*it)).filter(QRegExp(Option::cpp_moc_ext + "$")); if(!deps.isEmpty()) t << d_file << ": " << deps.join(" ") << endl; t << "-include " << d_file << endl; } } } } } t << "####### Build rules" << endl << endl; if(!project->variables()["SUBLIBS"].isEmpty()) { QString libdir = "tmp/"; if(!project->isEmpty("SUBLIBS_DIR")) libdir = project->first("SUBLIBS_DIR"); t << "SUBLIBS = "; QStringList &l = project->variables()["SUBLIBS"]; for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) t << libdir << "lib" << (*it) << ".a "; t << endl << endl; } if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; QStringList::Iterator it; for(it = l.begin(); it != l.end(); ++it) { QMakeMetaInfo libinfo; if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) { QString dir; int slsh = (*it).lastIndexOf(Option::dir_sep); if(slsh != -1) dir = (*it).left(slsh + 1); QString targ = dir + libinfo.first("QMAKE_PRL_TARGET"); target_deps += " " + targ; t << targ << ":" << "\n\t" << "@echo \"Creating '" << targ << "'\"" << "\n\t" << "(cd " << libinfo.first("QMAKE_PRL_BUILD_DIR") << ";" << "$(MAKE))" << endl; } } } if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { QString destdir = project->first("DESTDIR"); if(!project->isEmpty("QMAKE_BUNDLE_NAME")) destdir += project->first("QMAKE_BUNDLE_NAME") + "/Contents/MacOS/"; if(do_incremental) { //incremental target QString incr_target = var("TARGET") + "_incremental"; if(incr_target.indexOf(Option::dir_sep) != -1) incr_target = incr_target.right(incr_target.length() - (incr_target.lastIndexOf(Option::dir_sep) + 1)); QString incr_deps, incr_objs; if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; //actual target t << incr_target_dir << ": $(OBJECTS)" << "\n\t" << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl; //communicated below deps.prepend(incr_target_dir + " "); incr_deps = "$(INCREMENTAL_OBJECTS)"; if(!incr_objs.isEmpty()) incr_objs += " "; incr_objs += incr_target_dir; } else { //actual target QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + project->variables()["QMAKE_EXTENSION_SHLIB"].first(); QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; if(project->isActiveConfig("debug")) incr_lflags += var("QMAKE_LFLAGS_DEBUG"); else incr_lflags += var("QMAKE_LFLAGS_RELEASE"); t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)" << "\n\t"; if(!destdir.isEmpty()) t << "\n\t" << mkdir_p_asstring(destdir) << "\n\t"; t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << " $(INCREMENTAL_OBJECTS)" << endl; //communicated below if(!destdir.isEmpty()) { if(!incr_objs.isEmpty()) incr_objs += " "; incr_objs += "-L" + destdir; } else { if(!incr_objs.isEmpty()) incr_objs += " "; incr_objs += "-L" + qmake_getpwd(); } if(!incr_objs.isEmpty()) incr_objs += " "; incr_objs += " -l" + incr_target; deps.prepend(incr_target_dir + " "); incr_deps = "$(OBJECTS)"; } t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; //real target t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps << " " << target_deps << " " << var("POST_TARGETDEPS") << "\n\t"; if(!destdir.isEmpty()) t << "\n\t" << mkdir_p_asstring(destdir) << "\n\t"; if(!project->isEmpty("QMAKE_PRE_LINK")) t << var("QMAKE_PRE_LINK") << "\n\t"; t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } else { t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl; t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << target_deps << " " << var("POST_TARGETDEPS") << "\n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; if(!project->isEmpty("QMAKE_PRE_LINK")) t << var("QMAKE_PRE_LINK") << "\n\t"; t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } } else if(!project->isActiveConfig("staticlib")) { QString destdir = project->first("DESTDIR"), incr_deps; if(!project->isEmpty("QMAKE_BUNDLE_NAME")) destdir += project->first("QMAKE_BUNDLE_NAME") + "/"; if(do_incremental) { QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); QString incr_target = var("QMAKE_ORIG_TARGET").replace( QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; if(incr_target.indexOf(Option::dir_sep) != -1) incr_target = incr_target.right(incr_target.length() - (incr_target.lastIndexOf(Option::dir_sep) + 1)); if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; //actual target const QString link_deps = "$(OBJECTS) "; t << incr_target_dir << ": " << link_deps << "\n\t" << "ld -r -o " << incr_target_dir << " " << link_deps << endl; //communicated below QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; cmd.first().replace("$(OBJECTS) ", "$(INCREMENTAL_OBJECTS)"); //ick cmd.append(incr_target_dir); deps.prepend(incr_target_dir + " "); incr_deps = "$(INCREMENTAL_OBJECTS)"; } else { //actual target QString incr_target_dir = destdir + "lib" + incr_target + "." + s_ext; QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL")) incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " "; if(project->isActiveConfig("debug")) incr_lflags += var("QMAKE_LFLAGS_DEBUG"); else incr_lflags += var("QMAKE_LFLAGS_RELEASE"); t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)" << "\n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << " $(INCREMENTAL_OBJECTS)" << endl; //communicated below QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; if(!destdir.isEmpty()) cmd.append(" -L" + destdir); cmd.append(" -l" + incr_target); deps.prepend(incr_target_dir + " "); incr_deps = "$(OBJECTS)"; } t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << destdir << "$(TARGET)" << endl << endl; //real target t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " " << incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS"); } else { t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << destdir << "$(TARGET)" << endl << endl; t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps << " " << var("POST_TARGETDEPS"); } if(!destdir.isEmpty()) t << "\n\t" << mkdir_p_asstring(destdir); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" << var("QMAKE_PRE_LINK"); if(project->isActiveConfig("compile_libtool")) { t << "\n\t" << var("QMAKE_LINK_SHLIB_CMD"); } else if(project->isActiveConfig("plugin")) { t << "\n\t" << "-$(DEL_FILE) $(TARGET)" << "\n\t" << var("QMAKE_LINK_SHLIB_CMD"); if(!destdir.isEmpty()) t << "\n\t" << "-$(MOVE) $(TARGET) " << destdir; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; t << endl << endl; } else if(!project->isEmpty("QMAKE_BUNDLE_NAME")) { t << "\n\t" << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(DESTDIR)$(TARGET0)" << "\n\t" << var("QMAKE_LINK_SHLIB_CMD") << "\n\t" << mkdir_p_asstring("`dirname $(DESTDIR)$(TARGETD)`") << "\n\t" << "-$(MOVE) $(TARGET) $(DESTDIR)$(TARGETD)" << "\n\t" << mkdir_p_asstring("`dirname $(DESTDIR)$(TARGET0)`") << "\n\t" << varGlue("QMAKE_LN_SHLIB","-"," "," Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t" << "-$(DEL_FILE) " << destdir << "Versions/Current" << "\n\t" << varGlue("QMAKE_LN_SHLIB","-"," ", " " + project->first("QMAKE_FRAMEWORK_VERSION") + " " + destdir + "Versions/Current") << "\n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { t << "\n\t" << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); if(!destdir.isEmpty()) t << "\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET1)\n\t" << "-$(DEL_FILE) " << destdir << "$(TARGET2)\n\t" << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << destdir; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; } else { t << "\n\t" << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); if(!destdir.isEmpty()) t << "\n\t"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -