⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unixmake2.cpp

📁 Linux下的基于X11的图形开发环境。
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		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") << ": " << " " << incr_deps << " " << var("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)";	    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): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("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)";	    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") << ": " << incr_deps << " $(SUBLIBS) " <<		var("TARGETDEPS");	} else {	    t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " <<		var("DESTDIR_TARGET") << endl << endl;	    t << var("DESTDIR_TARGET") << ":  $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " <<		var("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("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): $(UICDECLS) $(OBJECTS) $(OBJMOC)";	    if(do_incremental)		t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";	    t << var("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;	}    } else {	t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " 	  << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n"	  << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n";	if(project->isEmpty("QMAKE_AR_SUBLIBS")) {	    t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t";	    if(!project->isEmpty("DESTDIR")) {		QString destdir = project->first("DESTDIR");		t << "test -d " << destdir << " || mkdir -p " << 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(!project->isEmpty("DESTDIR")) 		t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n"		  << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n";	} else {	    int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();	    QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"],			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 << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) " 		      << valList(build) << "\n\t";		    ar = project->variables()["QMAKE_AR_CMD"].first();		    ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", 							     build.join(" "));		} else {		    t << (*libit) << ": " << valList(build) << "\n\t";		    ar = "$(AR) " + (*libit) + " " + build.join(" ");		}		if(!project->isEmpty("DESTDIR")) {		    QString destdir = project->first("DESTDIR");		    t << "test -d " << destdir << " || mkdir -p " << 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(!project->isEmpty("DESTDIR")) 		    t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n"		      << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n";	    }	}	t << endl << endl;    }    t << "mocables: $(SRCMOC)" << endl << endl;    if(!project->isActiveConfig("no_mocdepend")) {	//this is an implicity depend on moc, so it will be built if necesary, however	//moc itself shouldn't have this dependency - this is a little kludgy but it is	//better than the alternative for now.	QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET");	fixEnvVariables(target);	fixEnvVariables(moc);	if(target != moc) 	    t << "$(MOC): \n\t"	      << "( cd $(QTDIR)/src/moc ; $(MAKE) )"  << endl << endl;    }    writeMakeQmake(t);    if(!project->first("QMAKE_PKGINFO").isEmpty()) {	QString pkginfo = project->first("QMAKE_PKGINFO");	QString destdir = project->first("DESTDIR");	t << pkginfo << ": " << "\n\t";	if(!destdir.isEmpty())	    t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t";	t << "@$(DEL_FILE) " << pkginfo << "\n\t"	  << "@echo \"APPL????\" >" << pkginfo << endl;    }    if(!project->first("QMAKE_INFO_PLIST").isEmpty()) {	QString info_plist = project->first("QMAKE_INFO_PLIST"),	       info_plist_out = project->first("QMAKE_INFO_PLIST_OUT");	QString destdir = project->first("DESTDIR");	t << info_plist_out << ": " << "\n\t";	if(!destdir.isEmpty())	    t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t";	t << "@$(DEL_FILE) " << info_plist_out << "\n\t"	  << "@cp \"" << info_plist << "\" \"" << info_plist_out << "\"" << endl;	if(!project->first("RC_FILE").isEmpty()) {	    QString dir = destdir + "../Resources/";	    t << dir << "application.icns:" << "\n\t"	      << "@test -d " << dir << " || mkdir -p " << dir << "\n\t"	      << "@cp " << var("RC_FILE") << " " << dir << "application.icns" << endl;	}    }    QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") :		   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 " << ddir_c << " && "      << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && ";    if(!project->isEmpty("TRANSLATIONS"))	t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && ";    if(!project->isEmpty("FORMS")) {	QStringList &forms = project->variables()["FORMS"], ui_headers;	for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {	    QString ui_h = fileFixify((*formit) + Option::h_ext.first());	    if(QFile::exists(ui_h) ) 	       ui_headers << ui_h;	}	if(!ui_headers.isEmpty())	    t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && ";    }    t << "( cd `dirname " << ddir_c << "` && "      << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && "      << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && "      << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && "      << "$(DEL_FILE) -r " << ddir_c      << endl << endl;    QString clean_targets;    if(mocAware()) {	t << "mocclean:" << "\n";	if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) {	    if(!objMoc.isEmpty())		t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n';	    if(!srcMoc.isEmpty())		t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n';	    if(moc_incremental)		t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n';	    clean_targets += " mocclean";	}	t << endl;    }    t << "uiclean:" << "\n";    if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) {	t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n";	clean_targets += " uiclean";    }    t << endl;    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((*it));	    QString dir;	    if(fi.dirPath() != ".")		dir = fi.dirPath() + Option::dir_sep;	    dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir);	    if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)		dir += Option::dir_sep;	    clean <<  dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first();	    clean << dir + fi.baseName(TRUE) + 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((*it));	    QString dir;	    if(fi.dirPath() != ".")		dir = fi.dirPath() + Option::dir_sep;	    dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir);	    if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)		dir += Option::dir_sep;	    clean <<  dir + fi.baseName(TRUE) + 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";	if(moc_incremental)	    t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n';	t << endl;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -