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

📄 unixmake2.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the qmake application of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "unixmake.h"#include "option.h"#include "meta.h"#include <qregexp.h>#include <qbytearray.h>#include <qfile.h>#include <qdir.h>#include <qdatetime.h>#include <qdebug.h>#include <time.h>UnixMakefileGenerator::UnixMakefileGenerator() : MakefileGenerator(), init_flag(false), include_deps(false){}voidUnixMakefileGenerator::writePrlFile(QTextStream &t){    MakefileGenerator::writePrlFile(t);    // libtool support    if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib") { //write .la        if(project->isActiveConfig("compile_libtool"))            warn_msg(WarnLogic, "create_libtool specified with compile_libtool can lead to conflicting .la\n"                     "formats, create_libtool has been disabled\n");        else            writeLibtoolFile();    }    // pkg-config support    if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")        writePkgConfigFile();}boolUnixMakefileGenerator::writeMakefile(QTextStream &t){    writeHeader(t);    if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {        t << "QMAKE    = "        << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;        QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");        for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)            t << *it << " ";        t << "first all clean install distclean uninstall qmake_all:" << "\n\t"          << "@echo \"Some of the required modules ("          << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"          << "@echo \"Skipped.\"" << endl << endl;        writeMakeQmake(t);        if(project->isEmpty("QMAKE_NOFORCE"))            t << "FORCE:" << endl << endl;        return true;    }    if (project->values("TEMPLATE").first() == "app" ||        project->values("TEMPLATE").first() == "lib") {        if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t))            return true;        writeMakeParts(t);        return MakefileGenerator::writeMakefile(t);    } else if(project->values("TEMPLATE").first() == "subdirs") {        MakefileGenerator::writeSubDirs(t);        return true;    }    return false;}voidUnixMakefileGenerator::writeMakeParts(QTextStream &t){    QString deps = fileFixify(Option::output.fileName()), target_deps, prl;    bool do_incremental = (project->isActiveConfig("incremental") &&                           !project->values("QMAKE_INCREMENTAL").isEmpty() &&                           (!project->values("QMAKE_APP_FLAG").isEmpty() ||                            (!project->isActiveConfig("staticlib")))),         src_incremental=false;    t << "####### Compiler, tools and options" << endl << endl;    t << "CC            = " << var("QMAKE_CC") << endl;    t << "CXX           = " << var("QMAKE_CXX") << endl;    t << "DEFINES       = "      << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")      << varGlue("DEFINES","-D"," -D","") << endl;    t << "CFLAGS        = " << var("QMAKE_CFLAGS") << " $(DEFINES)" << endl;    t << "CXXFLAGS      = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)" << endl;    t << "INCPATH       = " << "-I" << specdir();    if(!project->isActiveConfig("no_include_pwd")) {        QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));        if(pwd.isEmpty())            pwd = ".";        t << " -I" << pwd;    }    {        const QStringList &incs = project->values("INCLUDEPATH");        for(int i = 0; i < incs.size(); ++i) {            QString inc = escapeFilePath(incs.at(i));            if(!inc.isEmpty())                t << " " << "-I" << inc;        }    }    if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS"))       t << " " << var("QMAKE_FRAMEWORKPATH_FLAGS");    t << endl;    if(!project->isActiveConfig("staticlib")) {        t << "LINK          = " << var("QMAKE_LINK") << endl;        t << "LFLAGS        = " << var("QMAKE_LFLAGS") << endl;        t << "LIBS          = " << "$(SUBLIBS) " << var("QMAKE_FRAMEWORKDIR_FLAGS") << " "          << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl;    }    t << "AR            = " << var("QMAKE_AR") << endl;    t << "RANLIB        = " << var("QMAKE_RANLIB") << endl;    t << "QMAKE         = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;    t << "TAR           = " << var("QMAKE_TAR") << endl;    t << "COMPRESS      = " << var("QMAKE_GZIP") << endl;    if(project->isActiveConfig("compile_libtool"))        t << "LIBTOOL       = " << var("QMAKE_LIBTOOL") << endl;    t << "COPY          = " << var("QMAKE_COPY") << endl;    t << "SED           = " << var("QMAKE_STREAM_EDITOR") << endl;    t << "COPY_FILE     = " << var("QMAKE_COPY_FILE") << endl;    t << "COPY_DIR      = " << var("QMAKE_COPY_DIR") << endl;    t << "INSTALL_FILE  = " << var("QMAKE_INSTALL_FILE") << endl;    t << "INSTALL_DIR   = " << var("QMAKE_INSTALL_DIR") << endl;    t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;    t << "DEL_FILE      = " << var("QMAKE_DEL_FILE") << endl;    t << "SYMLINK       = " << var("QMAKE_SYMBOLIC_LINK") << endl;    t << "DEL_DIR       = " << var("QMAKE_DEL_DIR") << endl;    t << "MOVE          = " << var("QMAKE_MOVE") << endl;    t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;    t << "MKDIR         = " << var("QMAKE_MKDIR") << endl;    if(!project->isEmpty("QMAKE_MACOSX_DEPLOYMENT_TARGET"))        t << "export MACOSX_DEPLOYMENT_TARGET = " //exported to children processes          << project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET") << endl;    t << endl;    t << "####### Output directory" << endl << endl;    if (! project->values("OBJECTS_DIR").isEmpty())        t << "OBJECTS_DIR   = " << var("OBJECTS_DIR") << endl;    else        t << "OBJECTS_DIR   = ./" << endl;    t << endl;    /* files */    t << "####### Files" << endl << endl;    t << "SOURCES       = " << valList(escapeFilePaths(project->values("SOURCES"))) << " "      << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl;    if(do_incremental) {        QStringList &objs = project->values("OBJECTS"), &incrs = project->values("QMAKE_INCREMENTAL"), incrs_out;        t << "OBJECTS       = ";        for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) {            bool increment = false;            for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {                if((*objit).indexOf(QRegExp((*incrit), Qt::CaseSensitive,                                    QRegExp::Wildcard)) != -1) {                    increment = true;                    incrs_out.append((*objit));                    break;                }            }            if(!increment)                t << "\\\n\t\t" << (*objit);        }        if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!            t << escapeFilePaths(incrs_out).join(" \\\n\t\t") << endl;        } else if(!incrs_out.count()) {            t << endl;        } else {            src_incremental = true;            t << endl;            t << "INCREMENTAL_OBJECTS = " << escapeFilePaths(incrs_out).join(" \\\n\t\t") << endl;        }    } else {        t << "OBJECTS       = " << valList(escapeFilePaths(project->values("OBJECTS"))) << endl;    }    if(do_incremental && !src_incremental)        do_incremental = false;    t << "DIST          = " << valList(fileFixify(project->values("DISTFILES"))) << endl;    t << "QMAKE_TARGET  = " << var("QMAKE_ORIG_TARGET") << endl;    t << "DESTDIR       = " << var("DESTDIR") << endl;    if(project->isActiveConfig("compile_libtool"))        t << "TARGETL       = " << var("TARGET_la") << endl;    t << "TARGET        = " << escapeFilePath(var("TARGET")) << endl;    if(project->isActiveConfig("plugin")) {        t << "TARGETD       = " << escapeFilePath(var("TARGET")) << endl;    } else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty()) {        t << "TARGETA       = " << escapeFilePath(var("TARGETA")) << endl;        if(!project->isEmpty("QMAKE_BUNDLE")) {            t << "TARGETD       = " << escapeFilePath(var("TARGET_x.y")) << endl;            t << "TARGET0       = " << escapeFilePath(var("TARGET_")) << endl;        } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) {            t << "TARGETD       = " << escapeFilePath(var("TARGET_x.y.z")) << endl;            t << "TARGET0       = " << escapeFilePath(var("TARGET_")) << endl;            t << "TARGET1       = " << escapeFilePath(var("TARGET_x")) << endl;            t << "TARGET2       = " << escapeFilePath(var("TARGET_x.y")) << endl;        } else {            t << "TARGETD       = " << escapeFilePath(var("TARGET_x")) << endl;            t << "TARGET0       = " << escapeFilePath(var("TARGET_")) << endl;        }    }    writeExtraCompilerVariables(t);    writeExtraVariables(t);    t << endl;    // blasted includes    QStringList &qeui = project->values("QMAKE_EXTRA_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;

⌨️ 快捷键说明

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