1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the qmake application of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include "winmakefile.h"
33
#include <qtextstream.h>
37
#include <qstringlist.h>
41
Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator()
46
Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem)
48
QString bd = Option::fixPathToLocalOS(d, true);
52
QString dllStem = stem + QTDLL_POSTFIX;
53
QMakeMetaInfo libinfo;
54
bool libInfoRead = libinfo.readLib(bd + Option::dir_sep + dllStem);
56
// If the library, for which we're trying to find the highest version
57
// number, is a static library
58
if (libInfoRead && libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib"))
61
if(!project->variables()["QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE"].isEmpty())
62
return project->variables()["QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE"].first().toInt();
65
if(!project->isActiveConfig("no_versionlink")) {
67
QStringList entries = dir.entryList();
68
QRegExp regx("((lib)?" + dllStem + "([0-9]*)).(a|lib|prl)$", Qt::CaseInsensitive);
69
for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) {
70
if(regx.exactMatch((*it))) {
71
if (!regx.cap(3).isEmpty()) {
73
int num = regx.cap(3).toInt(&ok);
74
biggest = qMax(biggest, (!ok ? -1 : num));
80
&& !libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib")
81
&& !libinfo.isEmpty("QMAKE_PRL_VERSION"))
82
biggest = qMax(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt());
87
Win32MakefileGenerator::findLibraries(const QString &where)
89
QStringList &l = project->variables()[where];
90
QList<QMakeLocalFileName> dirs;
92
QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
93
for(QStringList::Iterator libpathit = libpaths.begin();
94
libpathit != libpaths.end(); ++libpathit)
95
dirs.append(QMakeLocalFileName((*libpathit)));
97
for(QStringList::Iterator it = l.begin(); it != l.end();) {
99
bool modified_opt = false, remove = false;
100
QString opt = (*it).trimmed();
101
if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) {
103
opt = opt.mid(1, opt.length()-2);
105
if(opt.startsWith("/LIBPATH:")) {
106
dirs.append(QMakeLocalFileName(opt.mid(9)));
107
} else if(opt.startsWith("-L") || opt.startsWith("/L")) {
108
QString libpath = opt.mid(2);
109
dirs.append(QMakeLocalFileName(libpath));
111
if (!quote.isNull()) {
112
libpath = quote + libpath + quote;
115
(*it) = "/LIBPATH:" + libpath;
116
} else if(opt.startsWith("-l") || opt.startsWith("/l")) {
117
QString lib = opt.right(opt.length() - 2), out;
120
if(!project->isEmpty("QMAKE_" + lib.toUpper() + "_SUFFIX"))
121
suffix = project->first("QMAKE_" + lib.toUpper() + "_SUFFIX");
122
for(QList<QMakeLocalFileName>::Iterator it = dirs.begin();
123
it != dirs.end(); ++it) {
125
int ver = findHighestVersion((*it).local(), lib);
127
extension += QString::number(ver);
130
if(QMakeMetaInfo::libExists((*it).local() + Option::dir_sep + lib) ||
131
exists((*it).local() + Option::dir_sep + lib + extension)) {
132
out = (*it).real() + Option::dir_sep + lib + extension;
141
} else if(!exists(Option::fixPathToLocalOS(opt))) {
142
QList<QMakeLocalFileName> lib_dirs;
144
int slsh = file.lastIndexOf(Option::dir_sep);
146
lib_dirs.append(QMakeLocalFileName(file.left(slsh+1)));
147
file = file.right(file.length() - slsh - 1);
151
if(file.endsWith(".lib")) {
152
file = file.left(file.length() - 4);
153
if(!file.at(file.length()-1).isNumber()) {
155
if(!project->isEmpty("QMAKE_" + file.section(Option::dir_sep, -1).toUpper() + "_SUFFIX"))
156
suffix = project->first("QMAKE_" + file.section(Option::dir_sep, -1).toUpper() + "_SUFFIX");
157
for(QList<QMakeLocalFileName>::Iterator dep_it = lib_dirs.begin(); dep_it != lib_dirs.end(); ++dep_it) {
158
QString lib_tmpl(file + "%1" + suffix + ".lib");
159
int ver = findHighestVersion((*dep_it).local(), file);
162
lib_tmpl = lib_tmpl.arg(ver);
164
lib_tmpl = lib_tmpl.arg("");
166
QString dir = (*dep_it).real();
167
if(!dir.endsWith(Option::dir_sep))
168
dir += Option::dir_sep;
169
lib_tmpl.prepend(dir);
182
if(!quote.isNull() && modified_opt)
183
(*it) = quote + (*it) + quote;
191
Win32MakefileGenerator::processPrlFiles()
193
QHash<QString, bool> processed;
194
QList<QMakeLocalFileName> libdirs;
196
QStringList &libpaths = project->variables()["QMAKE_LIBDIR"];
197
for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit)
198
libdirs.append(QMakeLocalFileName((*libpathit)));
200
for(bool ret = false; true; ret = false) {
201
//read in any prl files included..
203
QString where = "QMAKE_LIBS";
204
if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
205
where = project->first("QMAKE_INTERNAL_PRL_LIBS");
206
QStringList l = project->variables()[where];
207
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
208
QString opt = (*it).trimmed();
209
if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0])
210
opt = opt.mid(1, opt.length()-2);
211
if(opt.startsWith("/")) {
212
if(opt.startsWith("/LIBPATH:"))
213
libdirs.append(QMakeLocalFileName(opt.mid(9)));
214
} else if(!processed.contains(opt)) {
215
if(processPrlFile(opt)) {
216
processed.insert(opt, true);
218
} else if(QDir::isRelativePath(opt) || opt.startsWith("-l")) {
220
if (opt.startsWith("-l"))
224
for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) {
225
QString prl = (*it).local() + Option::dir_sep + tmp;
226
// the orignal is used as the key
227
QString orgprl = prl;
228
if(processed.contains(prl)) {
230
} else if(processPrlFile(prl)) {
231
processed.insert(orgprl, true);
249
void Win32MakefileGenerator::processVars()
251
//If the TARGET looks like a path split it into DESTDIR and the resulting TARGET
252
if(!project->isEmpty("TARGET")) {
253
QString targ = project->first("TARGET");
254
int slsh = qMax(targ.lastIndexOf('/'), targ.lastIndexOf(Option::dir_sep));
256
if(project->isEmpty("DESTDIR"))
257
project->values("DESTDIR").append("");
258
else if(project->first("DESTDIR").right(1) != Option::dir_sep)
259
project->variables()["DESTDIR"] = QStringList(project->first("DESTDIR") + Option::dir_sep);
260
project->variables()["DESTDIR"] = QStringList(project->first("DESTDIR") + targ.left(slsh+1));
261
project->variables()["TARGET"] = QStringList(targ.mid(slsh+1));
265
project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
266
if (!project->variables()["QMAKE_INCDIR"].isEmpty())
267
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
269
if (!project->variables()["VERSION"].isEmpty()) {
270
QStringList l = project->first("VERSION").split('.');
271
project->variables()["VER_MAJ"].append(l[0]);
272
project->variables()["VER_MIN"].append(l[1]);
275
// TARGET_VERSION_EXT will be used to add a version number onto the target name
276
if (project->variables()["TARGET_VERSION_EXT"].isEmpty()
277
&& !project->variables()["VER_MAJ"].isEmpty())
278
project->variables()["TARGET_VERSION_EXT"].append(project->variables()["VER_MAJ"].first());
280
if(project->isEmpty("QMAKE_COPY_FILE"))
281
project->variables()["QMAKE_COPY_FILE"].append("$(COPY)");
282
if(project->isEmpty("QMAKE_COPY_DIR"))
283
project->variables()["QMAKE_COPY_DIR"].append("xcopy /s /q /y /i");
284
if(project->isEmpty("QMAKE_INSTALL_FILE"))
285
project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)");
286
if(project->isEmpty("QMAKE_INSTALL_DIR"))
287
project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)");
291
processFileTagsVar();
293
QStringList &incDir = project->variables()["INCLUDEPATH"];
294
for(QStringList::Iterator incDir_it = incDir.begin(); incDir_it != incDir.end(); ++incDir_it) {
295
if(!(*incDir_it).isEmpty())
296
(*incDir_it) = Option::fixPathToTargetOS((*incDir_it), false, false);
298
QStringList &libDir = project->variables()["QMAKE_LIBDIR"];
299
for(QStringList::Iterator libDir_it = libDir.begin(); libDir_it != libDir.end(); ++libDir_it) {
300
if(!(*libDir_it).isEmpty())
301
(*libDir_it) = Option::fixPathToTargetOS((*libDir_it), false, false);
305
void Win32MakefileGenerator::fixTargetExt()
307
if (project->isActiveConfig("dll")) {
308
project->variables()["TARGET_EXT"].append(project->first("TARGET_VERSION_EXT") + ".dll");
310
if (!project->variables()["QMAKE_APP_FLAG"].isEmpty())
311
project->variables()["TARGET_EXT"].append(".exe");
313
project->variables()["TARGET_EXT"].append(".lib");
317
void Win32MakefileGenerator::processRcFileVar()
319
if ((!project->variables()["VERSION"].isEmpty())
320
&& project->variables()["RC_FILE"].isEmpty()
321
&& project->variables()["RES_FILE"].isEmpty()
322
&& !project->isActiveConfig("no_generated_target_info")
323
&& (project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty())) {
326
QTextStream ts(&rcString, QFile::WriteOnly);
328
QStringList vers = project->variables()["VERSION"].first().split(".");
329
for (int i = vers.size(); i < 4; i++)
331
QString versionString = vers.join(".");
334
if (!project->variables()["QMAKE_TARGET_COMPANY"].isEmpty())
335
companyName = project->variables()["QMAKE_TARGET_COMPANY"].join(" ");
338
if (!project->variables()["QMAKE_TARGET_DESCRIPTION"].isEmpty())
339
description = project->variables()["QMAKE_TARGET_DESCRIPTION"].join(" ");
342
if (!project->variables()["QMAKE_TARGET_COPYRIGHT"].isEmpty())
343
copyright = project->variables()["QMAKE_TARGET_COPYRIGHT"].join(" ");
346
if (!project->variables()["QMAKE_TARGET_PRODUCT"].isEmpty())
347
productName = project->variables()["QMAKE_TARGET_PRODUCT"].join(" ");
349
productName = project->variables()["TARGET"].first();
351
QString originalName = project->variables()["TARGET"].first() + project->variables()["TARGET_EXT"].first();
353
ts << "#ifndef Q_CC_BOR" << endl;
354
ts << "# if defined(UNDER_CE) && UNDER_CE >= 400" << endl;
355
ts << "# include <winbase.h>" << endl;
356
ts << "# else" << endl;
357
ts << "# include <winver.h>" << endl;
358
ts << "# endif" << endl;
359
ts << "#endif" << endl;
361
ts << "VS_VERSION_INFO VERSIONINFO" << endl;
362
ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl;
363
ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl;
364
ts << "\tFILEFLAGSMASK 0x3fL" << endl;
365
ts << "#ifdef _DEBUG" << endl;
366
ts << "\tFILEFLAGS VS_FF_DEBUG" << endl;
367
ts << "#else" << endl;
368
ts << "\tFILEFLAGS 0x0L" << endl;
369
ts << "#endif" << endl;
370
ts << "\tFILEOS VOS__WINDOWS32" << endl;
371
if (project->isActiveConfig("dll"))
372
ts << "\tFILETYPE VFT_DLL" << endl;
374
ts << "\tFILETYPE VFT_APP" << endl;
375
ts << "\tFILESUBTYPE 0x0L" << endl;
376
ts << "\tBEGIN" << endl;
377
ts << "\t\tBLOCK \"StringFileInfo\"" << endl;
378
ts << "\t\tBEGIN" << endl;
379
ts << "\t\t\tBLOCK \"040904B0\"" << endl;
380
ts << "\t\t\tBEGIN" << endl;
381
ts << "\t\t\t\tVALUE \"CompanyName\", \"" << companyName << "\\0\"" << endl;
382
ts << "\t\t\t\tVALUE \"FileDescription\", \"" << description << "\\0\"" << endl;
383
ts << "\t\t\t\tVALUE \"FileVersion\", \"" << versionString << "\\0\"" << endl;
384
ts << "\t\t\t\tVALUE \"LegalCopyright\", \"" << copyright << "\\0\"" << endl;
385
ts << "\t\t\t\tVALUE \"OriginalFilename\", \"" << originalName << "\\0\"" << endl;
386
ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"" << endl;
387
ts << "\t\t\tEND" << endl;
388
ts << "\t\tEND" << endl;
389
ts << "\tEND" << endl;
390
ts << "/* End of Version info */" << endl;
396
QFile rcFile(project->variables()["TARGET"].first() + "_resource" + ".rc");
397
bool writeRcFile = true;
398
if (rcFile.exists() && rcFile.open(QFile::ReadOnly)) {
399
writeRcFile = rcFile.readAll() != rcString;
402
if (writeRcFile && rcFile.open(QFile::WriteOnly)) {
403
rcFile.write(rcString);
406
project->variables()["RC_FILE"].insert(0, Option::fixPathToTargetOS(rcFile.fileName(), false, false));
408
if (!project->variables()["RC_FILE"].isEmpty()) {
409
if (!project->variables()["RES_FILE"].isEmpty()) {
410
fprintf(stderr, "Both rc and res file specified.\n");
411
fprintf(stderr, "Please specify one of them, not both.");
414
QString resFile = project->variables()["RC_FILE"].first();
415
resFile.replace(".rc", Option::res_ext);
416
project->variables()["RES_FILE"].prepend(fileInfo(resFile).fileName());
417
if (!project->variables()["OBJECTS_DIR"].isEmpty())
418
project->variables()["RES_FILE"].first().prepend(project->variables()["OBJECTS_DIR"].first() + Option::dir_sep);
419
project->variables()["RES_FILE"].first() = Option::fixPathToTargetOS(project->variables()["RES_FILE"].first(), false, false);
420
project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
421
project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"];
425
void Win32MakefileGenerator::processFileTagsVar()
428
tags << "SOURCES" << "GENERATED_SOURCES" << "DEF_FILE" << "RC_FILE"
429
<< "TARGET" << "QMAKE_LIBS" << "DESTDIR" << "DLLDESTDIR" << "INCLUDEPATH";
430
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
431
const QStringList &quc = project->variables()["QMAKE_EXTRA_COMPILERS"];
432
for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it)
433
tags += project->variables()[(*it)+".input"];
437
QStringList &filetags = project->variables()["QMAKE_FILETAGS"];
438
for(int i = 0; i < tags.size(); ++i)
439
filetags += Option::fixPathToTargetOS(tags.at(i), false);
442
void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
444
t << "clean: compiler_clean";
445
const char *clean_targets[] = { "OBJECTS", "QMAKE_CLEAN", "CLEAN_FILES", 0 };
446
for(int i = 0; clean_targets[i]; ++i) {
447
const QStringList &list = project->values(clean_targets[i]);
448
const QString del_statement("-$(DEL_FILE)");
449
if(project->isActiveConfig("no_delete_multiple_files")) {
450
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
451
t << "\n\t" << del_statement << " " << (*it);
454
const int commandlineLimit = 2047; // NT limit, expanded
455
for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
457
if(del_statement.length() + files.length() +
458
qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit) {
459
t << "\n\t" << del_statement << files;
465
t << "\n\t" << del_statement << files;
470
t << "distclean: clean"
471
<< "\n\t-$(DEL_FILE) \"$(TARGET)\"" << endl;
473
QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
475
t << "\t-$(DEL_FILE) " << ofile << endl;
480
void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
482
t << "####### Compiler, tools and options" << endl << endl;
483
t << "CC = " << var("QMAKE_CC") << endl;
484
t << "CXX = " << var("QMAKE_CXX") << endl;
485
t << "LEX = " << var("QMAKE_LEX") << endl;
486
t << "YACC = " << var("QMAKE_YACC") << endl;
488
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
489
<< varGlue("DEFINES","-D"," -D","") << endl;
490
t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)" << endl;
491
t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)" << endl;
492
t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl;
493
t << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl;
496
QStringList &incs = project->variables()["INCLUDEPATH"];
497
for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
498
QString inc = (*incit);
499
inc.replace(QRegExp("\\\\$"), "");
500
inc.replace(QRegExp("\""), "");
501
t << "-I" << "\"" << inc << "\" ";
503
t << "-I\"" << specdir() << "\""
508
t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") :
509
Option::fixPathToTargetOS(var("QMAKE_QMAKE"), false)) << endl;
510
t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
511
Option::fixPathToTargetOS(var("QMAKE_IDC"), false)) << endl;
512
t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
513
Option::fixPathToTargetOS(var("QMAKE_IDL"), false)) << endl;
514
t << "ZIP = " << var("QMAKE_ZIP") << endl;
515
t << "DEF_FILE = " << varList("DEF_FILE") << endl;
516
t << "RES_FILE = " << varList("RES_FILE") << endl; // Not on mingw, can't see why not though...
517
t << "COPY = " << var("QMAKE_COPY") << endl;
518
t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl;
519
t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl;
520
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
521
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
522
t << "MOVE = " << var("QMAKE_MOVE") << endl;
523
t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
524
t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
525
t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl;
526
t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
529
t << "####### Output directory" << endl << endl;
530
if(!project->variables()["OBJECTS_DIR"].isEmpty())
531
t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl;
533
t << "OBJECTS_DIR = . " << endl;
536
t << "####### Files" << endl << endl;
537
t << "SOURCES = " << varList("SOURCES") << " " << varList("GENERATED_SOURCES") << endl;
541
writeExtraCompilerVariables(t);
542
writeExtraVariables(t);
544
t << "DIST = " << varList("DISTFILES") << endl;
545
t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
546
// The comment is important to maintain variable compatability with Unix
547
// Makefiles, while not interpreting a trailing-slash as a linebreak
548
t << "DESTDIR = " << var("DESTDIR") << " #avoid trailing-slash linebreak" << endl;
550
QString target = var("DESTDIR") + project->first("TARGET") + project->first("TARGET_EXT");
555
t << "####### Implicit rules" << endl << endl;
556
writeImplicitRulesPart(t);
558
t << "####### Build rules" << endl << endl;
559
writeBuildRulesPart(t);
561
if (!project->variables()["QMAKE_POST_LINK"].isEmpty())
562
t << "\t" <<var("QMAKE_POST_LINK") << endl;
564
if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
565
QStringList dlldirs = project->variables()["DLLDESTDIR"];
566
for (QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) {
567
t << "\n\t" << "-$(COPY_FILE) \"$(TARGET)\" " << *dlldir;
576
QStringList dist_files = fileFixify(Option::mkfile::project_files);
577
if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES"))
578
dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"];
579
if(!project->isEmpty("TRANSLATIONS"))
580
dist_files << var("TRANSLATIONS");
581
if(!project->isEmpty("FORMS")) {
582
QStringList &forms = project->variables()["FORMS"];
583
for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {
584
QString ui_h = fileFixify((*formit) + Option::h_ext.first());
589
t << "dist:" << "\n\t"
590
<< "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(DIST) "
591
<< dist_files.join(" ") << " " << var("TRANSLATIONS") << " ";
592
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
593
const QStringList &quc = project->variables()["QMAKE_EXTRA_COMPILERS"];
594
for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
595
const QStringList &inputs = project->variables()[(*it)+".input"];
596
for(QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
597
t << (*input) << " ";
604
writeExtraTargets(t);
605
writeExtraCompilerTargets(t);
609
void Win32MakefileGenerator::writeLibsPart(QTextStream &t)
611
if(project->isActiveConfig("staticlib")) {
612
t << "LIB = " << var("QMAKE_LIB") << endl;
614
t << "LINK = " << var("QMAKE_LINK") << endl;
616
if(!project->variables()["QMAKE_LIBDIR"].isEmpty())
618
t << var("QMAKE_LFLAGS") << endl;
619
t << "LIBS = " << var("QMAKE_LIBS") << endl;
623
void Win32MakefileGenerator::writeLibDirPart(QTextStream &t)
625
t << varGlue("QMAKE_LIBDIR","-L\"","\" -L\"","\"") << " ";
628
void Win32MakefileGenerator::writeObjectsPart(QTextStream &t)
630
t << "OBJECTS = " << varList("OBJECTS") << endl;
633
void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &t)
635
t << ".SUFFIXES: .c";
636
QStringList::Iterator cppit;
637
for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
638
t << " " << (*cppit);
640
for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
641
t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
642
t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
645
void Win32MakefileGenerator::writeBuildRulesPart(QTextStream &)
649
void Win32MakefileGenerator::writeRcFilePart(QTextStream &t)
651
if(!project->variables()["RC_FILE"].isEmpty()) {
652
t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
653
<< var("QMAKE_RC") << " -fo " << var("RES_FILE") << " "
659
QString Win32MakefileGenerator::defaultInstall(const QString &t)
661
if(t != "target" || project->first("TEMPLATE") == "subdirs")
664
const QString root = "$(INSTALL_ROOT)";
665
QStringList &uninst = project->variables()[t + ".uninstall"];
667
QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), false);
668
targetdir = fileFixify(targetdir, FileFixifyAbsolute);
669
if(targetdir.right(1) != Option::dir_sep)
670
targetdir += Option::dir_sep;
673
QString target="$(TARGET)";
674
if(project->first("TEMPLATE") == "lib") {
675
if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") &&
676
!project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
677
QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE");
678
int slsh = dst_prl.lastIndexOf('/');
680
dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
681
dst_prl = filePrefixRoot(root, targetdir + dst_prl);
682
ret += "-$(INSTALL_FILE) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\"";
683
if(!uninst.isEmpty())
684
uninst.append("\n\t");
685
uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"");
689
QString src_targ = target;
690
QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + target, FileFixifyAbsolute));
693
ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\"";
694
if(!uninst.isEmpty())
695
uninst.append("\n\t");
696
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");