Changeset 31 for trunk/qmake/generators/os2/gnumake.cpp
- Timestamp:
- Jun 16, 2009, 1:59:37 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qmake/generators/os2/gnumake.cpp
r29 r31 80 80 QString GNUMakefileGenerator::getLibTarget() 81 81 { 82 return QString("lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ". a");82 return QString("lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".lib"); 83 83 } 84 84 … … 104 104 for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { 105 105 QString extension; 106 int ver = findHighestVersion((*dir_it).local(), steam, "dll. a|a");106 int ver = findHighestVersion((*dir_it).local(), steam, "dll.lib|lib"); 107 107 if (ver != -1) 108 108 extension += QString::number(ver); 109 109 extension += suffix; 110 110 if(QMakeMetaInfo::libExists((*dir_it).local() + Option::dir_sep + steam) || 111 exists((*dir_it).local() + Option::dir_sep + steam + extension + ". a") ||112 exists((*dir_it).local() + Option::dir_sep + steam + extension + ".dll. a")) {111 exists((*dir_it).local() + Option::dir_sep + steam + extension + ".lib") || 112 exists((*dir_it).local() + Option::dir_sep + steam + extension + ".dll.lib")) { 113 113 out = (*it) + extension; 114 114 break; … … 162 162 } 163 163 164 /* @todo remove165 void createLdObjectScriptFile(const QString &fileName, const QStringList &objList)166 {167 QString filePath = Option::output_dir + QDir::separator() + fileName;168 QFile file(filePath);169 if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {170 QTextStream t(&file);171 t << "INPUT(" << endl;172 for (QStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {173 if (QDir::isRelativePath(*it))174 t << "./" << *it << endl;175 else176 t << *it << endl;177 }178 t << ");" << endl;179 t.flush();180 file.close();181 }182 }183 184 void createArObjectScriptFile(const QString &fileName, const QString &target, const QStringList &objList)185 {186 QString filePath = Option::output_dir + QDir::separator() + fileName;187 QFile file(filePath);188 if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {189 QTextStream t(&file);190 t << "CREATE " << target << endl;191 for (QStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {192 if (QDir::isRelativePath(*it))193 t << "ADDMOD " << *it << endl;194 else195 t << *it << endl;196 }197 t << "SAVE" << endl;198 t.flush();199 file.close();200 }201 }202 */203 204 164 void GNUMakefileGenerator::writeGNUParts(QTextStream &t) 205 165 { 166 t << "QMAKESPECDIR = " << quote << specdir() << quote << endl << endl; 167 206 168 writeStandardParts(t); 207 169 208 170 if (!preCompHeaderOut.isEmpty()) { 209 210 211 212 << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")213 214 215 << endl << endl;216 217 218 << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t")219 220 221 << endl << endl;171 QString header = project->first("PRECOMPILED_HEADER"); 172 QString cHeader = preCompHeaderOut + Option::dir_sep + "c"; 173 t << escapeDependencyPath(cHeader) << ": " << escapeDependencyPath(header) << " " 174 << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t") 175 << "\n\t" << mkdir_p_asstring(preCompHeaderOut) 176 << "\n\t" << "$(CC) -x c-header -c $(CFLAGS) $(INCPATH) -o " << cHeader << " " << header 177 << endl << endl; 178 QString cppHeader = preCompHeaderOut + Option::dir_sep + "c++"; 179 t << escapeDependencyPath(cppHeader) << ": " << escapeDependencyPath(header) << " " 180 << escapeDependencyPaths(findDependencies(header)).join(" \\\n\t\t") 181 << "\n\t" << mkdir_p_asstring(preCompHeaderOut) 182 << "\n\t" << "$(CXX) -x c++-header -c $(CXXFLAGS) $(INCPATH) -o " << cppHeader << " " << header 183 << endl << endl; 222 184 } 223 185 } … … 275 237 if(!project->first("DESTDIR").isEmpty()) 276 238 destDir = Option::fixPathToTargetOS(project->first("DESTDIR") + Option::dir_sep, false, false); 277 project->values("MINGW_IMPORT_LIB").prepend(destDir + "lib" + project->first("TARGET")278 + project->first("TARGET_VERSION_EXT") + ".a");279 project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + project->first("MINGW_IMPORT_LIB"));280 239 } 281 240 … … 307 266 " $(CXXFLAGS) $(INCPATH) -o $@ $<"); 308 267 } 309 310 if(project->isActiveConfig("dll")) {311 project->values("QMAKE_CLEAN").append(project->first("MINGW_IMPORT_LIB"));312 }313 268 } 314 269 … … 316 271 { 317 272 if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { 318 project->values("TARGET_EXT").append(". a");273 project->values("TARGET_EXT").append(".lib"); 319 274 project->values("QMAKE_LFLAGS").append("-static"); 320 275 project->values("TARGET").first() = "lib" + project->first("TARGET"); … … 326 281 void GNUMakefileGenerator::writeIncPart(QTextStream &t) 327 282 { 328 t << "INCPATH = "; 329 283 t << "INCPATH ="; 284 285 QString opt = var("QMAKE_CFLAGS_INCDIR"); 330 286 QStringList &incs = project->values("INCLUDEPATH"); 287 QString incsSemicolon; 331 288 for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { 332 QString inc = (*incit);333 inc.replace(QRegExp("\\\\$"), "");334 inc .replace(QRegExp("\""), "");335 t << "-I" << quote << inc << quote << " ";336 }337 t << "-I" << quote << specdir() << quote338 289 QString inc = maybeQuotePath(*incit); 290 t << " " << opt << inc; 291 incsSemicolon += inc + Option::dirlist_sep; 292 } 293 t << " " << opt << "$(QMAKESPECDIR)" << endl; 294 incsSemicolon += "$(QMAKESPECDIR)"; 295 t << "INCLUDEPATH = " << incsSemicolon << endl; 339 296 } 340 297 … … 342 299 { 343 300 if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { 344 t << "LIB =" << var("QMAKE_LIB") << endl;301 t << "LIB = " << var("QMAKE_LIB") << endl; 345 302 } else { 346 t << "LINK =" << var("QMAKE_LINK") << endl;347 t << "LFLAGS = 348 t << "LIBS =";303 t << "LINK = " << var("QMAKE_LINK") << endl; 304 t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; 305 t << "LIBS ="; 349 306 if(!project->values("QMAKE_LIBDIR").isEmpty()) 350 307 writeLibDirPart(t); 351 t << var("QMAKE_LIBS").replace(QRegExp("(\\slib|^lib)")," -l") << endl; 308 QString opt = var("QMAKE_LFLAGS_LIB"); 309 QStringList libs = project->values("QMAKE_LIBS"); 310 for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) { 311 QString lib = maybeQuotePath(*it); 312 t << " " << opt << lib; 313 } 314 t << endl; 352 315 } 353 316 } … … 355 318 void GNUMakefileGenerator::writeLibDirPart(QTextStream &t) 356 319 { 320 QString opt = var("QMAKE_LFLAGS_LIBDIR"); 357 321 QStringList libDirs = project->values("QMAKE_LIBDIR"); 358 for (int i = 0; i < libDirs.size(); ++i) 359 libDirs[i].remove("\""); 360 t << valGlue(libDirs,"-L"+quote,quote+" -L" +quote,quote) << " "; 322 for(QStringList::Iterator it = libDirs.begin(); it != libDirs.end(); ++it) { 323 QString libDir = maybeQuotePath(*it); 324 t << " " << opt << libDir; 325 } 361 326 } 362 327 363 328 void GNUMakefileGenerator::writeObjectsPart(QTextStream &t) 364 329 { 365 if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) { 366 objectsLinkLine = "$(OBJECTS)"; 367 } else if (project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { 368 QString ar_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET"); 369 if (!var("BUILD_NAME").isEmpty()) { 370 ar_script_file += "." + var("BUILD_NAME"); 371 } 372 /* @todo remove 373 createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS")); 374 */ 375 objectsLinkLine = "ar -M < " + ar_script_file; 376 } else { 377 QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET"); 378 if (!var("BUILD_NAME").isEmpty()) { 379 ld_script_file += "." + var("BUILD_NAME"); 380 } 381 /* @todo remove 382 createLdObjectScriptFile(ld_script_file, project->values("OBJECTS")); 383 */ 384 objectsLinkLine = ld_script_file; 385 } 330 /* @todo generate response files for the linker to overcome the 1024 chars 331 * CMD.EXE limitation */ 386 332 Win32MakefileGenerator::writeObjectsPart(t); 387 333 } … … 395 341 t << "\n\t" <<var("QMAKE_PRE_LINK"); 396 342 if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { 397 if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) { 398 t << "\n\t" << "$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; 399 } else { 400 t << "\n\t" << objectsLinkLine << " " ; 401 } 343 t << "\n\t" << "$(LIB) $(DESTDIR_TARGET) $(OBJECTS)"; 402 344 } else { 403 t << "\n\t" << "$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) " << objectsLinkLine << " " << "$(LIBS)";345 t << "\n\t" << "$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)"; 404 346 } 405 347 if(!project->isEmpty("QMAKE_POST_LINK")) … … 466 408 } 467 409 410 QString GNUMakefileGenerator::maybeQuotePath(const QString &path) 411 { 412 QString quoted = path; 413 quoted.replace(QRegExp("\\\\$"), ""); 414 quoted.replace(QRegExp("\""), ""); 415 if (quoted.contains(QRegExp("[ +&;$%()]"))) 416 quoted = quote + quoted + quote; 417 return quoted; 418 } 419 468 420 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.