📄 unixmake2.cpp
字号:
t << "TARGETD = " << var("TARGET_x") << endl; t << "TARGET0 = " << var("TARGET_") << endl; } } writeExtraVariables(t); t << endl; // blasted includes QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; QStringList::Iterator it; for( it = qeui.begin(); it != qeui.end(); ++it) t << "include " << (*it) << endl; /* rules */ t << "first: all" << endl; t << "####### Implicit rules" << endl << endl; t << ".SUFFIXES: .c " << Option::obj_ext; QStringList::Iterator cppit; for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) t << " " << (*cppit); t << endl << endl; for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; if(include_deps) { QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); QString odir; if(!project->variables()["OBJECTS_DIR"].isEmpty()) odir = project->first("OBJECTS_DIR"); t << "###### Dependencies" << endl << endl; t << odir << ".deps/%.d: %.cpp\n\t" << "@echo Creating depend for $<" << "\n\t" << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; t << odir << ".deps/%.d: %.c\n\t" << "@echo Creating depend for $<" << "\n\t" << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; for(int x = 0; !src[x].isNull(); x++) { 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)).grep(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).findRev(Option::dir_sep); if(slsh != -1) dir = (*it).left(slsh + 1); QString targ = dir + libinfo.first("QMAKE_PRL_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(do_incremental) { //incremental target QString incr_target = var("TARGET") + "_incremental"; if(incr_target.find(Option::dir_sep) != -1) incr_target = incr_target.right(incr_target.length() - (incr_target.findRev(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 = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)"; 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) $(INCREMENTAL_OBJMOC)" << "\n\t"; if(!destdir.isEmpty()) t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << 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" + QDir::currentDirPath(); } if(!incr_objs.isEmpty()) incr_objs += " "; incr_objs += " -l" + incr_target; deps.prepend(incr_target_dir + " "); incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; } 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" << "test -d " << destdir << " || mkdir -p " << 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 << " $(LIBS) $(OBJCOMP)"; 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") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << target_deps << " " << var("POST_TARGETDEPS") << "\n\t"; if(!destdir.isEmpty()) t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; if(!project->isEmpty("QMAKE_PRE_LINK")) t << var("QMAKE_PRE_LINK") << "\n\t"; t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)"; 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(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.find(Option::dir_sep) != -1) incr_target = incr_target.right(incr_target.length() - (incr_target.findRev(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 = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; 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) $(OBJMOC)", "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick cmd.append(incr_target_dir); deps.prepend(incr_target_dir + " "); incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; } else { //actual target QString incr_target_dir = var("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) $(INCREMENTAL_OBJMOC)" << "\n\t"; if(!destdir.isEmpty()) t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << 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 = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; } t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << var("DESTDIR_TARGET") << endl << endl; //real target t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS"); } else { t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << var("DESTDIR_TARGET") << endl << endl; t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) " << target_deps << " " << var("POST_TARGETDEPS"); } if(!destdir.isEmpty()) t << "\n\t" << "test -d " << destdir << " || mkdir -p " << 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) " << var("DESTDIR"); if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; 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) " << var("DESTDIR") << "$(TARGET)\n\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("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" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" << "-$(MOVE) $(TARGET) $(TARGET0) " << var("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") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)"; if(do_incremental) t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; t << var("POST_TARGETDEPS") << "\n\t" << "-$(DEL_FILE) $(TARGETA) " << "\n\t" << var("QMAKE_AR_CMD"); if(do_incremental) t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; if(!project->isEmpty("QMAKE_RANLIB")) t << "\n\t" << "$(RANLIB) $(TARGETA)"; t << endl << endl;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -