qmake/generators/win32/mingw_make.cpp
changeset 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the qmake application of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include "mingw_make.h"
       
    43 #include "option.h"
       
    44 #include "meta.h"
       
    45 #include <qregexp.h>
       
    46 #include <qdir.h>
       
    47 #include <stdlib.h>
       
    48 #include <time.h>
       
    49 
       
    50 QT_BEGIN_NAMESPACE
       
    51 
       
    52 MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator(), init_flag(false)
       
    53 {
       
    54     if (Option::shellPath.isEmpty())
       
    55         quote = "\"";
       
    56     else
       
    57         quote = "'";
       
    58 }
       
    59 
       
    60 bool MingwMakefileGenerator::isWindowsShell() const
       
    61 {
       
    62 #ifdef Q_OS_WIN
       
    63     return Option::shellPath.isEmpty();
       
    64 #else
       
    65     return Win32MakefileGenerator::isWindowsShell();
       
    66 #endif
       
    67 }
       
    68 
       
    69 QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const
       
    70 {
       
    71     QString ret = path;
       
    72     ret.remove('\"');
       
    73     ret.replace('\\', "/");
       
    74     ret.replace(' ', "\\ ");
       
    75     return ret;
       
    76 }
       
    77 
       
    78 QString MingwMakefileGenerator::getLibTarget()
       
    79 {
       
    80     return QString("lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".a");
       
    81 }
       
    82 
       
    83 bool MingwMakefileGenerator::findLibraries()
       
    84 {
       
    85     return findLibraries("QMAKE_LIBS") && findLibraries("QMAKE_LIBS_PRIVATE");
       
    86 }
       
    87 
       
    88 bool MingwMakefileGenerator::findLibraries(const QString &where)
       
    89 {
       
    90     QStringList &l = project->values(where);
       
    91 
       
    92     QList<QMakeLocalFileName> dirs;
       
    93     {
       
    94         QStringList &libpaths = project->values("QMAKE_LIBDIR");
       
    95         for(QStringList::Iterator libpathit = libpaths.begin();
       
    96             libpathit != libpaths.end(); ++libpathit)
       
    97             dirs.append(QMakeLocalFileName((*libpathit)));
       
    98     }
       
    99 
       
   100     QStringList::Iterator it = l.begin();
       
   101     while (it != l.end()) {
       
   102         if ((*it).startsWith("-l")) {
       
   103             QString steam = (*it).mid(2), out;
       
   104             QString suffix;
       
   105             if (!project->isEmpty("QMAKE_" + steam.toUpper() + "_SUFFIX"))
       
   106                 suffix = project->first("QMAKE_" + steam.toUpper() + "_SUFFIX");
       
   107             for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
       
   108                 QString extension;
       
   109                 int ver = findHighestVersion((*dir_it).local(), steam, "dll.a|a");
       
   110                 if (ver != -1)
       
   111                     extension += QString::number(ver);
       
   112                 extension += suffix;
       
   113                 if(QMakeMetaInfo::libExists((*dir_it).local() + Option::dir_sep + steam) ||
       
   114                     exists((*dir_it).local() + Option::dir_sep + steam + extension + ".a") ||
       
   115                     exists((*dir_it).local() + Option::dir_sep + steam + extension + ".dll.a")) {
       
   116                         out = (*it) + extension;
       
   117                         break;
       
   118                 }
       
   119             }
       
   120             if (!out.isEmpty()) // We assume if it never finds it that its correct
       
   121                 (*it) = out;
       
   122 	    } else if((*it).startsWith("-L")) {
       
   123             dirs.append(QMakeLocalFileName((*it).mid(2)));
       
   124         }
       
   125 
       
   126         ++it;
       
   127     }
       
   128     return true;
       
   129 }
       
   130 
       
   131 bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
       
   132 {
       
   133     writeHeader(t);
       
   134     if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
       
   135         t << "all clean:" << "\n\t"
       
   136           << "@echo \"Some of the required modules ("
       
   137           << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
       
   138           << "@echo \"Skipped.\"" << endl << endl;
       
   139         writeMakeQmake(t);
       
   140         return true;
       
   141     }
       
   142 
       
   143     if(project->first("TEMPLATE") == "app" ||
       
   144        project->first("TEMPLATE") == "lib") {
       
   145         if(Option::mkfile::do_stub_makefile) {
       
   146             t << "QMAKE    = "        << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
       
   147             QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
       
   148             for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
       
   149                 t << *it << " ";
       
   150             t << "first all clean install distclean uninstall: qmake" << endl
       
   151               << "qmake_all:" << endl;
       
   152             writeMakeQmake(t);
       
   153             if(project->isEmpty("QMAKE_NOFORCE"))
       
   154                 t << "FORCE:" << endl << endl;
       
   155             return true;
       
   156         }
       
   157         writeMingwParts(t);
       
   158         return MakefileGenerator::writeMakefile(t);
       
   159     }
       
   160     else if(project->first("TEMPLATE") == "subdirs") {
       
   161         writeSubDirs(t);
       
   162         return true;
       
   163     }
       
   164     return false;
       
   165  }
       
   166 
       
   167 void createLdObjectScriptFile(const QString &fileName, const QStringList &objList)
       
   168 {
       
   169     QString filePath = Option::output_dir + QDir::separator() + fileName;
       
   170     QFile file(filePath);
       
   171     if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
       
   172         if (Option::mkfile::listgen) {
       
   173             // TODO generatePrint(fileInfo(file.fileName()).absoluteFilePath());
       
   174         }
       
   175         QTextStream t(&file);
       
   176         t << "INPUT(" << endl;
       
   177         for (QStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
       
   178             if (QDir::isRelativePath(*it))
       
   179 		t << "./" << *it << endl;
       
   180 	    else
       
   181 		t << *it << endl;
       
   182         }
       
   183         t << ");" << endl;
       
   184 	t.flush();
       
   185         file.close();
       
   186     }
       
   187 }
       
   188 
       
   189 void createArObjectScriptFile(const QString &fileName, const QString &target, const QStringList &objList)
       
   190 {
       
   191     QString filePath = Option::output_dir + QDir::separator() + fileName;
       
   192     QFile file(filePath);
       
   193     if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
       
   194         if (Option::mkfile::listgen) {
       
   195             // TODO generatePrint(file.fileName()).absoluteFilePath());
       
   196         }
       
   197         QTextStream t(&file);
       
   198         t << "CREATE " << target << endl;
       
   199         for (QStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
       
   200             if (QDir::isRelativePath(*it))
       
   201 		t << "ADDMOD " << *it << endl;
       
   202 	    else
       
   203 		t << *it << endl;
       
   204         }
       
   205         t << "SAVE" << endl;
       
   206 	t.flush();
       
   207         file.close();
       
   208     }
       
   209 }
       
   210 
       
   211 void MingwMakefileGenerator::writeMingwParts(QTextStream &t)
       
   212 {
       
   213     writeStandardParts(t);
       
   214 
       
   215     if (!preCompHeaderOut.isEmpty()) {
       
   216 	QString header = project->first("PRECOMPILED_HEADER");
       
   217 	QString cHeader = preCompHeaderOut + Option::dir_sep + "c";
       
   218 	t << escapeDependencyPath(cHeader) << ": " << escapeDependencyPath(header) << " "
       
   219           << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")
       
   220 	  << "\n\t" << mkdir_p_asstring(preCompHeaderOut)
       
   221 	  << "\n\t" << "$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << cHeader << " " << header
       
   222           << endl << endl;
       
   223 	QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++";
       
   224 	t << escapeDependencyPath(cppHeader) << ": " << escapeDependencyPath(header) << " "
       
   225           << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")
       
   226 	  << "\n\t" << mkdir_p_asstring(preCompHeaderOut)
       
   227 	  << "\n\t" << "$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << cppHeader << " " << header
       
   228           << endl << endl;
       
   229     }
       
   230 }
       
   231 
       
   232 void MingwMakefileGenerator::init()
       
   233 {
       
   234     if(init_flag)
       
   235         return;
       
   236     init_flag = true;
       
   237 
       
   238     /* this should probably not be here, but I'm using it to wrap the .t files */
       
   239     if(project->first("TEMPLATE") == "app")
       
   240         project->values("QMAKE_APP_FLAG").append("1");
       
   241     else if(project->first("TEMPLATE") == "lib")
       
   242         project->values("QMAKE_LIB_FLAG").append("1");
       
   243     else if(project->first("TEMPLATE") == "subdirs") {
       
   244         MakefileGenerator::init();
       
   245         if(project->isEmpty("QMAKE_COPY_FILE"))
       
   246             project->values("QMAKE_COPY_FILE").append("$(COPY)");
       
   247         if(project->isEmpty("QMAKE_COPY_DIR"))
       
   248             project->values("QMAKE_COPY_DIR").append("xcopy /s /q /y /i");
       
   249         if(project->isEmpty("QMAKE_INSTALL_FILE"))
       
   250             project->values("QMAKE_INSTALL_FILE").append("$(COPY_FILE)");
       
   251         if(project->isEmpty("QMAKE_INSTALL_PROGRAM"))
       
   252             project->values("QMAKE_INSTALL_PROGRAM").append("$(COPY_FILE)");
       
   253         if(project->isEmpty("QMAKE_INSTALL_DIR"))
       
   254             project->values("QMAKE_INSTALL_DIR").append("$(COPY_DIR)");
       
   255         if(project->values("MAKEFILE").isEmpty())
       
   256             project->values("MAKEFILE").append("Makefile");
       
   257         if(project->values("QMAKE_QMAKE").isEmpty())
       
   258             project->values("QMAKE_QMAKE").append("qmake");
       
   259         return;
       
   260     }
       
   261 
       
   262     project->values("TARGET_PRL").append(project->first("TARGET"));
       
   263 
       
   264     processVars();
       
   265 
       
   266     if (!project->values("RES_FILE").isEmpty()) {
       
   267         project->values("QMAKE_LIBS") += escapeFilePaths(project->values("RES_FILE"));
       
   268     }
       
   269 
       
   270     // LIBS defined in Profile comes first for gcc
       
   271     project->values("QMAKE_LIBS") += escapeFilePaths(project->values("LIBS"));
       
   272     project->values("QMAKE_LIBS_PRIVATE") += escapeFilePaths(project->values("LIBS_PRIVATE"));
       
   273 
       
   274     QString targetfilename = project->values("TARGET").first();
       
   275     QStringList &configs = project->values("CONFIG");
       
   276 
       
   277     if(project->isActiveConfig("qt_dll"))
       
   278         if(configs.indexOf("qt") == -1)
       
   279             configs.append("qt");
       
   280 
       
   281     if(project->isActiveConfig("dll")) {
       
   282         QString destDir = "";
       
   283         if(!project->first("DESTDIR").isEmpty())
       
   284             destDir = Option::fixPathToTargetOS(project->first("DESTDIR") + Option::dir_sep, false, false);
       
   285         project->values("MINGW_IMPORT_LIB").prepend(destDir + "lib" + project->first("TARGET")
       
   286                                                          + project->first("TARGET_VERSION_EXT") + ".a");
       
   287 	project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + project->first("MINGW_IMPORT_LIB"));
       
   288     }
       
   289 
       
   290     if(!project->values("DEF_FILE").isEmpty())
       
   291         project->values("QMAKE_LFLAGS").append(QString("-Wl,") + project->first("DEF_FILE"));
       
   292 
       
   293     MakefileGenerator::init();
       
   294 
       
   295     // precomp
       
   296     if (!project->first("PRECOMPILED_HEADER").isEmpty()
       
   297         && project->isActiveConfig("precompile_header")) {
       
   298         QString preCompHeader = var("PRECOMPILED_DIR")
       
   299 		         + QFileInfo(project->first("PRECOMPILED_HEADER")).fileName();
       
   300 	preCompHeaderOut = preCompHeader + ".gch";
       
   301 	project->values("QMAKE_CLEAN").append(preCompHeaderOut + Option::dir_sep + "c");
       
   302 	project->values("QMAKE_CLEAN").append(preCompHeaderOut + Option::dir_sep + "c++");
       
   303 
       
   304 	project->values("QMAKE_RUN_CC").clear();
       
   305 	project->values("QMAKE_RUN_CC").append("$(CC) -c -include " + preCompHeader +
       
   306                                                     " $(CFLAGS) $(INCPATH) -o $obj $src");
       
   307         project->values("QMAKE_RUN_CC_IMP").clear();
       
   308 	project->values("QMAKE_RUN_CC_IMP").append("$(CC)  -c -include " + preCompHeader +
       
   309                                                         " $(CFLAGS) $(INCPATH) -o $@ $<");
       
   310         project->values("QMAKE_RUN_CXX").clear();
       
   311 	project->values("QMAKE_RUN_CXX").append("$(CXX) -c -include " + preCompHeader +
       
   312                                                      " $(CXXFLAGS) $(INCPATH) -o $obj $src");
       
   313         project->values("QMAKE_RUN_CXX_IMP").clear();
       
   314 	project->values("QMAKE_RUN_CXX_IMP").append("$(CXX) -c -include " + preCompHeader +
       
   315                                                          " $(CXXFLAGS) $(INCPATH) -o $@ $<");
       
   316     }
       
   317 
       
   318     if(project->isActiveConfig("dll")) {
       
   319         project->values("QMAKE_CLEAN").append(project->first("MINGW_IMPORT_LIB"));
       
   320     }
       
   321 }
       
   322 
       
   323 void MingwMakefileGenerator::fixTargetExt()
       
   324 {
       
   325     if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
       
   326         project->values("TARGET_EXT").append(".a");
       
   327         project->values("QMAKE_LFLAGS").append("-static");
       
   328         project->values("TARGET").first() =  "lib" + project->first("TARGET");
       
   329     } else {
       
   330         Win32MakefileGenerator::fixTargetExt();
       
   331     }
       
   332 }
       
   333 
       
   334 void MingwMakefileGenerator::writeIncPart(QTextStream &t)
       
   335 {
       
   336     t << "INCPATH       = ";
       
   337 
       
   338     QStringList &incs = project->values("INCLUDEPATH");
       
   339     for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
       
   340         QString inc = (*incit);
       
   341         inc.replace(QRegExp("\\\\$"), "");
       
   342         inc.replace(QRegExp("\""), "");
       
   343         t << "-I" << quote << inc << quote << " ";
       
   344     }
       
   345     t << "-I" << quote << specdir() << quote
       
   346       << endl;
       
   347 }
       
   348 
       
   349 void MingwMakefileGenerator::writeLibsPart(QTextStream &t)
       
   350 {
       
   351     if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
       
   352         t << "LIB        =        " << var("QMAKE_LIB") << endl;
       
   353     } else {
       
   354         t << "LINK        =        " << var("QMAKE_LINK") << endl;
       
   355         t << "LFLAGS        =        " << var("QMAKE_LFLAGS") << endl;
       
   356         t << "LIBS        =        ";
       
   357         if(!project->values("QMAKE_LIBDIR").isEmpty())
       
   358             writeLibDirPart(t);
       
   359         t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << ' '
       
   360           << var("QMAKE_LIBS_PRIVATE").replace(QRegExp("(\\slib|^lib)")," -l") << endl;
       
   361     }
       
   362 }
       
   363 
       
   364 void MingwMakefileGenerator::writeLibDirPart(QTextStream &t)
       
   365 {
       
   366     QStringList libDirs = project->values("QMAKE_LIBDIR");
       
   367     for (int i = 0; i < libDirs.size(); ++i)
       
   368         libDirs[i].remove("\"");
       
   369     t << valGlue(libDirs,"-L"+quote,quote+" -L" +quote,quote) << " ";
       
   370 }
       
   371 
       
   372 void MingwMakefileGenerator::writeObjectsPart(QTextStream &t)
       
   373 {
       
   374     if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
       
   375         objectsLinkLine = "$(OBJECTS)";
       
   376     } else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
       
   377         QString ar_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
       
   378         if (!var("BUILD_NAME").isEmpty()) {
       
   379             ar_script_file += "." + var("BUILD_NAME");
       
   380         }
       
   381         createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
       
   382         if(!project->isEmpty("QMAKE_AR")) {
       
   383             objectsLinkLine = var("QMAKE_AR") + " -M < " + ar_script_file;
       
   384         } else {
       
   385             objectsLinkLine = "ar -M < " + ar_script_file;
       
   386         }
       
   387     } else {
       
   388         QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
       
   389 	if (!var("BUILD_NAME").isEmpty()) {
       
   390 	    ld_script_file += "." + var("BUILD_NAME");
       
   391 	}
       
   392 	createLdObjectScriptFile(ld_script_file, project->values("OBJECTS"));
       
   393         objectsLinkLine = ld_script_file;
       
   394     }
       
   395     Win32MakefileGenerator::writeObjectsPart(t);
       
   396 }
       
   397 
       
   398 void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
       
   399 {
       
   400     t << "first: all" << endl;
       
   401     t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl;
       
   402     t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS");
       
   403     if(!project->isEmpty("QMAKE_PRE_LINK"))
       
   404         t << "\n\t" <<var("QMAKE_PRE_LINK");
       
   405     if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
       
   406 	if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
       
   407             t << "\n\t" << "$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
       
   408         } else {
       
   409             t << "\n\t" << objectsLinkLine << " " ;
       
   410         }
       
   411     } else {
       
   412         t << "\n\t" << "$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) " << objectsLinkLine << " " << " $(LIBS)";
       
   413     }
       
   414     if(!project->isEmpty("QMAKE_POST_LINK"))
       
   415         t << "\n\t" <<var("QMAKE_POST_LINK");
       
   416     t << endl;
       
   417 }
       
   418 
       
   419 void MingwMakefileGenerator::writeRcFilePart(QTextStream &t)
       
   420 {
       
   421     const QString rc_file = fileFixify(project->first("RC_FILE"));
       
   422 
       
   423     QString incPathStr = fileInfo(rc_file).path();
       
   424     if (incPathStr != "." && QDir::isRelativePath(incPathStr))
       
   425         incPathStr.prepend("./");
       
   426 
       
   427     if (!rc_file.isEmpty()) {
       
   428         t << escapeDependencyPath(var("RES_FILE")) << ": " << rc_file << "\n\t"
       
   429           << var("QMAKE_RC") << " -i " << rc_file << " -o " << var("RES_FILE") 
       
   430           << " --include-dir=" << incPathStr << endl << endl;
       
   431     }
       
   432 }
       
   433 
       
   434 void MingwMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l)
       
   435 {
       
   436     if (var == "QMAKE_PRL_LIBS") {
       
   437         QString where = "QMAKE_LIBS";
       
   438         if (!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
       
   439             where = project->first("QMAKE_INTERNAL_PRL_LIBS");
       
   440         QStringList &out = project->values(where);
       
   441         for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
       
   442             out.removeAll((*it));
       
   443             out.append((*it));
       
   444         }
       
   445     } else {
       
   446         Win32MakefileGenerator::processPrlVariable(var, l);
       
   447     }
       
   448 }
       
   449 
       
   450 QStringList &MingwMakefileGenerator::findDependencies(const QString &file)
       
   451 {
       
   452     QStringList &aList = MakefileGenerator::findDependencies(file);
       
   453     // Note: The QMAKE_IMAGE_COLLECTION file have all images
       
   454     // as dependency, so don't add precompiled header then
       
   455     if (file == project->first("QMAKE_IMAGE_COLLECTION")
       
   456         || preCompHeaderOut.isEmpty())
       
   457         return aList;
       
   458     for (QStringList::Iterator it = Option::c_ext.begin(); it != Option::c_ext.end(); ++it) {
       
   459         if (file.endsWith(*it)) {
       
   460             QString cHeader = preCompHeaderOut + Option::dir_sep + "c";
       
   461             if (!aList.contains(cHeader))
       
   462                 aList += cHeader;
       
   463             break;
       
   464         }
       
   465     }
       
   466     for (QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
       
   467         if (file.endsWith(*it)) {
       
   468             QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++";
       
   469             if (!aList.contains(cppHeader))
       
   470                 aList += cppHeader;
       
   471             break;
       
   472         }
       
   473     }
       
   474     return aList;
       
   475 }
       
   476 
       
   477 QT_END_NAMESPACE