1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the qmake application of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #include "winmakefile.h"
|
---|
43 | #include "option.h"
|
---|
44 | #include "project.h"
|
---|
45 | #include "meta.h"
|
---|
46 | #include <qtextstream.h>
|
---|
47 | #include <qstring.h>
|
---|
48 | #include <qhash.h>
|
---|
49 | #include <qregexp.h>
|
---|
50 | #include <qstringlist.h>
|
---|
51 | #include <qdir.h>
|
---|
52 | #include <stdlib.h>
|
---|
53 |
|
---|
54 | QT_BEGIN_NAMESPACE
|
---|
55 |
|
---|
56 | Win32MakefileGenerator::Win32MakefileGenerator() : MakefileGenerator()
|
---|
57 | {
|
---|
58 | }
|
---|
59 |
|
---|
60 | int
|
---|
61 | Win32MakefileGenerator::findHighestVersion(const QString &d, const QString &stem, const QString &ext)
|
---|
62 | {
|
---|
63 | QString bd = Option::fixPathToLocalOS(d, true);
|
---|
64 | if(!exists(bd))
|
---|
65 | return -1;
|
---|
66 |
|
---|
67 | QString dllStem = stem + QTDLL_POSTFIX;
|
---|
68 | QMakeMetaInfo libinfo;
|
---|
69 | bool libInfoRead = libinfo.readLib(bd + Option::dir_sep + dllStem);
|
---|
70 |
|
---|
71 | // If the library, for which we're trying to find the highest version
|
---|
72 | // number, is a static library
|
---|
73 | if (libInfoRead && libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib"))
|
---|
74 | return -1;
|
---|
75 |
|
---|
76 | if(!project->values("QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE").isEmpty())
|
---|
77 | return project->values("QMAKE_" + stem.toUpper() + "_VERSION_OVERRIDE").first().toInt();
|
---|
78 |
|
---|
79 | int biggest=-1;
|
---|
80 | if(!project->isActiveConfig("no_versionlink")) {
|
---|
81 | QDir dir(bd);
|
---|
82 | QStringList entries = dir.entryList();
|
---|
83 | QRegExp regx(QString("((lib)?%1([0-9]*)).(%2|prl)$").arg(dllStem).arg(ext), Qt::CaseInsensitive);
|
---|
84 | for(QStringList::Iterator it = entries.begin(); it != entries.end(); ++it) {
|
---|
85 | if(regx.exactMatch((*it))) {
|
---|
86 | if (!regx.cap(3).isEmpty()) {
|
---|
87 | bool ok = true;
|
---|
88 | int num = regx.cap(3).toInt(&ok);
|
---|
89 | biggest = qMax(biggest, (!ok ? -1 : num));
|
---|
90 | }
|
---|
91 | }
|
---|
92 | }
|
---|
93 | }
|
---|
94 | if(libInfoRead
|
---|
95 | && !libinfo.values("QMAKE_PRL_CONFIG").contains("staticlib")
|
---|
96 | && !libinfo.isEmpty("QMAKE_PRL_VERSION"))
|
---|
97 | biggest = qMax(biggest, libinfo.first("QMAKE_PRL_VERSION").replace(".", "").toInt());
|
---|
98 | return biggest;
|
---|
99 | }
|
---|
100 |
|
---|
101 | bool
|
---|
102 | Win32MakefileGenerator::findLibraries(const QString &where)
|
---|
103 | {
|
---|
104 | QStringList &l = project->values(where);
|
---|
105 | QList<QMakeLocalFileName> dirs;
|
---|
106 | {
|
---|
107 | QStringList &libpaths = project->values("QMAKE_LIBDIR");
|
---|
108 | for(QStringList::Iterator libpathit = libpaths.begin();
|
---|
109 | libpathit != libpaths.end(); ++libpathit)
|
---|
110 | dirs.append(QMakeLocalFileName((*libpathit)));
|
---|
111 | }
|
---|
112 | for(QStringList::Iterator it = l.begin(); it != l.end();) {
|
---|
113 | QChar quote;
|
---|
114 | bool modified_opt = false, remove = false;
|
---|
115 | QString opt = (*it).trimmed();
|
---|
116 | if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0]) {
|
---|
117 | quote = opt[0];
|
---|
118 | opt = opt.mid(1, opt.length()-2);
|
---|
119 | }
|
---|
120 | if(opt.startsWith("/LIBPATH:")) {
|
---|
121 | dirs.append(QMakeLocalFileName(opt.mid(9)));
|
---|
122 | } else if(opt.startsWith("-L") || opt.startsWith("/L")) {
|
---|
123 | QString libpath = opt.mid(2);
|
---|
124 | QMakeLocalFileName l(libpath);
|
---|
125 | if(!dirs.contains(l)) {
|
---|
126 | dirs.append(l);
|
---|
127 | modified_opt = true;
|
---|
128 | if (!quote.isNull()) {
|
---|
129 | libpath = quote + libpath + quote;
|
---|
130 | quote = QChar();
|
---|
131 | }
|
---|
132 | (*it) = "/LIBPATH:" + libpath;
|
---|
133 | } else {
|
---|
134 | remove = true;
|
---|
135 | }
|
---|
136 | } else if(opt.startsWith("-l") || opt.startsWith("/l")) {
|
---|
137 | QString lib = opt.right(opt.length() - 2), out;
|
---|
138 | if(!lib.isEmpty()) {
|
---|
139 | QString suffix;
|
---|
140 | if(!project->isEmpty("QMAKE_" + lib.toUpper() + "_SUFFIX"))
|
---|
141 | suffix = project->first("QMAKE_" + lib.toUpper() + "_SUFFIX");
|
---|
142 | for(QList<QMakeLocalFileName>::Iterator it = dirs.begin();
|
---|
143 | it != dirs.end(); ++it) {
|
---|
144 | QString extension;
|
---|
145 | int ver = findHighestVersion((*it).local(), lib);
|
---|
146 | if(ver > 0)
|
---|
147 | extension += QString::number(ver);
|
---|
148 | extension += suffix;
|
---|
149 | extension += ".lib";
|
---|
150 | if(QMakeMetaInfo::libExists((*it).local() + Option::dir_sep + lib) ||
|
---|
151 | exists((*it).local() + Option::dir_sep + lib + extension)) {
|
---|
152 | out = (*it).real() + Option::dir_sep + lib + extension;
|
---|
153 | break;
|
---|
154 | }
|
---|
155 | }
|
---|
156 | }
|
---|
157 | if(out.isEmpty())
|
---|
158 | out = lib + ".lib";
|
---|
159 | modified_opt = true;
|
---|
160 | (*it) = out;
|
---|
161 | } else if(!exists(Option::fixPathToLocalOS(opt))) {
|
---|
162 | QList<QMakeLocalFileName> lib_dirs;
|
---|
163 | QString file = opt;
|
---|
164 | int slsh = file.lastIndexOf(Option::dir_sep);
|
---|
165 | if(slsh != -1) {
|
---|
166 | lib_dirs.append(QMakeLocalFileName(file.left(slsh+1)));
|
---|
167 | file = file.right(file.length() - slsh - 1);
|
---|
168 | } else {
|
---|
169 | lib_dirs = dirs;
|
---|
170 | }
|
---|
171 | if(file.endsWith(".lib")) {
|
---|
172 | file = file.left(file.length() - 4);
|
---|
173 | if(!file.at(file.length()-1).isNumber()) {
|
---|
174 | QString suffix;
|
---|
175 | if(!project->isEmpty("QMAKE_" + file.section(Option::dir_sep, -1).toUpper() + "_SUFFIX"))
|
---|
176 | suffix = project->first("QMAKE_" + file.section(Option::dir_sep, -1).toUpper() + "_SUFFIX");
|
---|
177 | for(QList<QMakeLocalFileName>::Iterator dep_it = lib_dirs.begin(); dep_it != lib_dirs.end(); ++dep_it) {
|
---|
178 | QString lib_tmpl(file + "%1" + suffix + ".lib");
|
---|
179 | int ver = findHighestVersion((*dep_it).local(), file);
|
---|
180 | if(ver != -1) {
|
---|
181 | if(ver)
|
---|
182 | lib_tmpl = lib_tmpl.arg(ver);
|
---|
183 | else
|
---|
184 | lib_tmpl = lib_tmpl.arg("");
|
---|
185 | if(slsh != -1) {
|
---|
186 | QString dir = (*dep_it).real();
|
---|
187 | if(!dir.endsWith(Option::dir_sep))
|
---|
188 | dir += Option::dir_sep;
|
---|
189 | lib_tmpl.prepend(dir);
|
---|
190 | }
|
---|
191 | modified_opt = true;
|
---|
192 | (*it) = lib_tmpl;
|
---|
193 | break;
|
---|
194 | }
|
---|
195 | }
|
---|
196 | }
|
---|
197 | }
|
---|
198 | }
|
---|
199 | if(remove) {
|
---|
200 | it = l.erase(it);
|
---|
201 | } else {
|
---|
202 | if(!quote.isNull() && modified_opt)
|
---|
203 | (*it) = quote + (*it) + quote;
|
---|
204 | ++it;
|
---|
205 | }
|
---|
206 | }
|
---|
207 | return true;
|
---|
208 | }
|
---|
209 |
|
---|
210 | void
|
---|
211 | Win32MakefileGenerator::processPrlFiles()
|
---|
212 | {
|
---|
213 | QHash<QString, bool> processed;
|
---|
214 | QList<QMakeLocalFileName> libdirs;
|
---|
215 | {
|
---|
216 | QStringList &libpaths = project->values("QMAKE_LIBDIR");
|
---|
217 | for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit)
|
---|
218 | libdirs.append(QMakeLocalFileName((*libpathit)));
|
---|
219 | }
|
---|
220 | for(bool ret = false; true; ret = false) {
|
---|
221 | //read in any prl files included..
|
---|
222 | QStringList l_out;
|
---|
223 | QString where = "QMAKE_LIBS";
|
---|
224 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
|
---|
225 | where = project->first("QMAKE_INTERNAL_PRL_LIBS");
|
---|
226 | QStringList l = project->values(where);
|
---|
227 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
|
---|
228 | QString opt = (*it).trimmed();
|
---|
229 | if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0])
|
---|
230 | opt = opt.mid(1, opt.length()-2);
|
---|
231 | if(opt.startsWith("/")) {
|
---|
232 | if(opt.startsWith("/LIBPATH:")) {
|
---|
233 | QMakeLocalFileName l(opt.mid(9));
|
---|
234 | if(!libdirs.contains(l))
|
---|
235 | libdirs.append(l);
|
---|
236 | }
|
---|
237 | } else if(!processed.contains(opt)) {
|
---|
238 | if(processPrlFile(opt)) {
|
---|
239 | processed.insert(opt, true);
|
---|
240 | ret = true;
|
---|
241 | } else if(QDir::isRelativePath(opt) || opt.startsWith("-l")) {
|
---|
242 | QString tmp;
|
---|
243 | if (opt.startsWith("-l"))
|
---|
244 | tmp = opt.mid(2);
|
---|
245 | else
|
---|
246 | tmp = opt;
|
---|
247 | for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) {
|
---|
248 | QString prl = (*it).local() + Option::dir_sep + tmp;
|
---|
249 | // the original is used as the key
|
---|
250 | QString orgprl = prl;
|
---|
251 | if(processed.contains(prl)) {
|
---|
252 | break;
|
---|
253 | } else if(processPrlFile(prl)) {
|
---|
254 | processed.insert(orgprl, true);
|
---|
255 | ret = true;
|
---|
256 | break;
|
---|
257 | }
|
---|
258 | }
|
---|
259 | }
|
---|
260 | }
|
---|
261 | if(!opt.isEmpty())
|
---|
262 | l_out.append(opt);
|
---|
263 | }
|
---|
264 | if(ret)
|
---|
265 | l = l_out;
|
---|
266 | else
|
---|
267 | break;
|
---|
268 | }
|
---|
269 | }
|
---|
270 |
|
---|
271 |
|
---|
272 | void Win32MakefileGenerator::processVars()
|
---|
273 | {
|
---|
274 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET
|
---|
275 | if(!project->isEmpty("TARGET")) {
|
---|
276 | QString targ = project->first("TARGET");
|
---|
277 | int slsh = qMax(targ.lastIndexOf('/'), targ.lastIndexOf(Option::dir_sep));
|
---|
278 | if(slsh != -1) {
|
---|
279 | if(project->isEmpty("DESTDIR"))
|
---|
280 | project->values("DESTDIR").append("");
|
---|
281 | else if(project->first("DESTDIR").right(1) != Option::dir_sep)
|
---|
282 | project->values("DESTDIR") = QStringList(project->first("DESTDIR") + Option::dir_sep);
|
---|
283 | project->values("DESTDIR") = QStringList(project->first("DESTDIR") + targ.left(slsh+1));
|
---|
284 | project->values("TARGET") = QStringList(targ.mid(slsh+1));
|
---|
285 | }
|
---|
286 | }
|
---|
287 |
|
---|
288 | project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
|
---|
289 | if (!project->values("QMAKE_INCDIR").isEmpty())
|
---|
290 | project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR");
|
---|
291 |
|
---|
292 | if (!project->values("VERSION").isEmpty()) {
|
---|
293 | QStringList l = project->first("VERSION").split('.');
|
---|
294 | if (l.size() > 0)
|
---|
295 | project->values("VER_MAJ").append(l[0]);
|
---|
296 | if (l.size() > 1)
|
---|
297 | project->values("VER_MIN").append(l[1]);
|
---|
298 | }
|
---|
299 |
|
---|
300 | // TARGET_VERSION_EXT will be used to add a version number onto the target name
|
---|
301 | if (project->values("TARGET_VERSION_EXT").isEmpty()
|
---|
302 | && !project->values("VER_MAJ").isEmpty())
|
---|
303 | project->values("TARGET_VERSION_EXT").append(project->values("VER_MAJ").first());
|
---|
304 |
|
---|
305 | if(project->isEmpty("QMAKE_COPY_FILE"))
|
---|
306 | project->values("QMAKE_COPY_FILE").append("$(COPY)");
|
---|
307 | if(project->isEmpty("QMAKE_COPY_DIR"))
|
---|
308 | project->values("QMAKE_COPY_DIR").append("xcopy /s /q /y /i");
|
---|
309 | if(project->isEmpty("QMAKE_INSTALL_FILE"))
|
---|
310 | project->values("QMAKE_INSTALL_FILE").append("$(COPY_FILE)");
|
---|
311 | if(project->isEmpty("QMAKE_INSTALL_PROGRAM"))
|
---|
312 | project->values("QMAKE_INSTALL_PROGRAM").append("$(COPY_FILE)");
|
---|
313 | if(project->isEmpty("QMAKE_INSTALL_DIR"))
|
---|
314 | project->values("QMAKE_INSTALL_DIR").append("$(COPY_DIR)");
|
---|
315 |
|
---|
316 | fixTargetExt();
|
---|
317 | processRcFileVar();
|
---|
318 | processFileTagsVar();
|
---|
319 |
|
---|
320 | QStringList &incDir = project->values("INCLUDEPATH");
|
---|
321 | for(QStringList::Iterator incDir_it = incDir.begin(); incDir_it != incDir.end(); ++incDir_it) {
|
---|
322 | if(!(*incDir_it).isEmpty())
|
---|
323 | (*incDir_it) = Option::fixPathToTargetOS((*incDir_it), false, false);
|
---|
324 | }
|
---|
325 | QStringList &libDir = project->values("QMAKE_LIBDIR");
|
---|
326 | for(QStringList::Iterator libDir_it = libDir.begin(); libDir_it != libDir.end(); ++libDir_it) {
|
---|
327 | if(!(*libDir_it).isEmpty())
|
---|
328 | (*libDir_it) = Option::fixPathToTargetOS((*libDir_it), false, false);
|
---|
329 | }
|
---|
330 | }
|
---|
331 |
|
---|
332 | void Win32MakefileGenerator::fixTargetExt()
|
---|
333 | {
|
---|
334 | if (!project->values("QMAKE_APP_FLAG").isEmpty())
|
---|
335 | project->values("TARGET_EXT").append(".exe");
|
---|
336 | else if (project->isActiveConfig("shared"))
|
---|
337 | project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + ".dll");
|
---|
338 | else
|
---|
339 | project->values("TARGET_EXT").append(".lib");
|
---|
340 | }
|
---|
341 |
|
---|
342 | void Win32MakefileGenerator::processRcFileVar()
|
---|
343 | {
|
---|
344 | if (Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING)
|
---|
345 | return;
|
---|
346 |
|
---|
347 | if (((!project->values("VERSION").isEmpty())
|
---|
348 | && project->values("RC_FILE").isEmpty()
|
---|
349 | && project->values("RES_FILE").isEmpty()
|
---|
350 | && !project->isActiveConfig("no_generated_target_info")
|
---|
351 | && (project->isActiveConfig("shared") || !project->values("QMAKE_APP_FLAG").isEmpty()))
|
---|
352 | || !project->values("QMAKE_WRITE_DEFAULT_RC").isEmpty()){
|
---|
353 |
|
---|
354 | QByteArray rcString;
|
---|
355 | QTextStream ts(&rcString, QFile::WriteOnly);
|
---|
356 |
|
---|
357 | QStringList vers = project->values("VERSION").first().split(".");
|
---|
358 | for (int i = vers.size(); i < 4; i++)
|
---|
359 | vers += "0";
|
---|
360 | QString versionString = vers.join(".");
|
---|
361 |
|
---|
362 | QString companyName;
|
---|
363 | if (!project->values("QMAKE_TARGET_COMPANY").isEmpty())
|
---|
364 | companyName = project->values("QMAKE_TARGET_COMPANY").join(" ");
|
---|
365 |
|
---|
366 | QString description;
|
---|
367 | if (!project->values("QMAKE_TARGET_DESCRIPTION").isEmpty())
|
---|
368 | description = project->values("QMAKE_TARGET_DESCRIPTION").join(" ");
|
---|
369 |
|
---|
370 | QString copyright;
|
---|
371 | if (!project->values("QMAKE_TARGET_COPYRIGHT").isEmpty())
|
---|
372 | copyright = project->values("QMAKE_TARGET_COPYRIGHT").join(" ");
|
---|
373 |
|
---|
374 | QString productName;
|
---|
375 | if (!project->values("QMAKE_TARGET_PRODUCT").isEmpty())
|
---|
376 | productName = project->values("QMAKE_TARGET_PRODUCT").join(" ");
|
---|
377 | else
|
---|
378 | productName = project->values("TARGET").first();
|
---|
379 |
|
---|
380 | QString originalName = project->values("TARGET").first() + project->values("TARGET_EXT").first();
|
---|
381 |
|
---|
382 | ts << "# if defined(UNDER_CE)" << endl;
|
---|
383 | ts << "# include <winbase.h>" << endl;
|
---|
384 | ts << "# else" << endl;
|
---|
385 | ts << "# include <winver.h>" << endl;
|
---|
386 | ts << "# endif" << endl;
|
---|
387 | ts << endl;
|
---|
388 | ts << "VS_VERSION_INFO VERSIONINFO" << endl;
|
---|
389 | ts << "\tFILEVERSION " << QString(versionString).replace(".", ",") << endl;
|
---|
390 | ts << "\tPRODUCTVERSION " << QString(versionString).replace(".", ",") << endl;
|
---|
391 | ts << "\tFILEFLAGSMASK 0x3fL" << endl;
|
---|
392 | ts << "#ifdef _DEBUG" << endl;
|
---|
393 | ts << "\tFILEFLAGS VS_FF_DEBUG" << endl;
|
---|
394 | ts << "#else" << endl;
|
---|
395 | ts << "\tFILEFLAGS 0x0L" << endl;
|
---|
396 | ts << "#endif" << endl;
|
---|
397 | ts << "\tFILEOS VOS__WINDOWS32" << endl;
|
---|
398 | if (project->isActiveConfig("shared"))
|
---|
399 | ts << "\tFILETYPE VFT_DLL" << endl;
|
---|
400 | else
|
---|
401 | ts << "\tFILETYPE VFT_APP" << endl;
|
---|
402 | ts << "\tFILESUBTYPE 0x0L" << endl;
|
---|
403 | ts << "\tBEGIN" << endl;
|
---|
404 | ts << "\t\tBLOCK \"StringFileInfo\"" << endl;
|
---|
405 | ts << "\t\tBEGIN" << endl;
|
---|
406 | ts << "\t\t\tBLOCK \"040904B0\"" << endl;
|
---|
407 | ts << "\t\t\tBEGIN" << endl;
|
---|
408 | ts << "\t\t\t\tVALUE \"CompanyName\", \"" << companyName << "\\0\"" << endl;
|
---|
409 | ts << "\t\t\t\tVALUE \"FileDescription\", \"" << description << "\\0\"" << endl;
|
---|
410 | ts << "\t\t\t\tVALUE \"FileVersion\", \"" << versionString << "\\0\"" << endl;
|
---|
411 | ts << "\t\t\t\tVALUE \"LegalCopyright\", \"" << copyright << "\\0\"" << endl;
|
---|
412 | ts << "\t\t\t\tVALUE \"OriginalFilename\", \"" << originalName << "\\0\"" << endl;
|
---|
413 | ts << "\t\t\t\tVALUE \"ProductName\", \"" << productName << "\\0\"" << endl;
|
---|
414 | ts << "\t\t\tEND" << endl;
|
---|
415 | ts << "\t\tEND" << endl;
|
---|
416 | ts << "\tEND" << endl;
|
---|
417 | ts << "/* End of Version info */" << endl;
|
---|
418 | ts << endl;
|
---|
419 |
|
---|
420 | ts.flush();
|
---|
421 |
|
---|
422 |
|
---|
423 | QString rcFilename = project->values("OUT_PWD").first()
|
---|
424 | + "/"
|
---|
425 | + project->values("TARGET").first()
|
---|
426 | + "_resource"
|
---|
427 | + ".rc";
|
---|
428 | QFile rcFile(QDir::cleanPath(rcFilename));
|
---|
429 |
|
---|
430 | bool writeRcFile = true;
|
---|
431 | if (rcFile.exists() && rcFile.open(QFile::ReadOnly)) {
|
---|
432 | writeRcFile = rcFile.readAll() != rcString;
|
---|
433 | rcFile.close();
|
---|
434 | }
|
---|
435 | if (writeRcFile && rcFile.open(QFile::WriteOnly)) {
|
---|
436 | rcFile.write(rcString);
|
---|
437 | rcFile.close();
|
---|
438 | }
|
---|
439 | if (project->values("QMAKE_WRITE_DEFAULT_RC").isEmpty())
|
---|
440 | project->values("RC_FILE").insert(0, rcFile.fileName());
|
---|
441 | }
|
---|
442 | if (!project->values("RC_FILE").isEmpty()) {
|
---|
443 | if (!project->values("RES_FILE").isEmpty()) {
|
---|
444 | fprintf(stderr, "Both rc and res file specified.\n");
|
---|
445 | fprintf(stderr, "Please specify one of them, not both.");
|
---|
446 | exit(1);
|
---|
447 | }
|
---|
448 | QString resFile = project->values("RC_FILE").first();
|
---|
449 |
|
---|
450 | // if this is a shadow build then use the absolute path of the rc file
|
---|
451 | if (Option::output_dir != qmake_getpwd()) {
|
---|
452 | QFileInfo fi(resFile);
|
---|
453 | project->values("RC_FILE").first() = fi.absoluteFilePath();
|
---|
454 | }
|
---|
455 |
|
---|
456 | resFile.replace(".rc", Option::res_ext);
|
---|
457 | project->values("RES_FILE").prepend(fileInfo(resFile).fileName());
|
---|
458 | if (!project->values("OBJECTS_DIR").isEmpty())
|
---|
459 | if(project->isActiveConfig("staticlib"))
|
---|
460 | project->values("RES_FILE").first().prepend(fileInfo(project->values("DESTDIR").first()).absoluteFilePath() + Option::dir_sep);
|
---|
461 | else
|
---|
462 | project->values("RES_FILE").first().prepend(project->values("OBJECTS_DIR").first() + Option::dir_sep);
|
---|
463 | project->values("RES_FILE").first() = Option::fixPathToTargetOS(project->values("RES_FILE").first(), false, false);
|
---|
464 | project->values("POST_TARGETDEPS") += project->values("RES_FILE");
|
---|
465 | project->values("CLEAN_FILES") += project->values("RES_FILE");
|
---|
466 | }
|
---|
467 | }
|
---|
468 |
|
---|
469 | void Win32MakefileGenerator::processFileTagsVar()
|
---|
470 | {
|
---|
471 | QStringList tags;
|
---|
472 | tags << "SOURCES" << "GENERATED_SOURCES" << "DEF_FILE" << "RC_FILE"
|
---|
473 | << "TARGET" << "QMAKE_LIBS" << "DESTDIR" << "DLLDESTDIR" << "INCLUDEPATH";
|
---|
474 | if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
|
---|
475 | const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
|
---|
476 | for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it)
|
---|
477 | tags += project->values((*it)+".input");
|
---|
478 | }
|
---|
479 |
|
---|
480 | //clean path
|
---|
481 | QStringList &filetags = project->values("QMAKE_FILETAGS");
|
---|
482 | for(int i = 0; i < tags.size(); ++i)
|
---|
483 | filetags += Option::fixPathToTargetOS(tags.at(i), false);
|
---|
484 | }
|
---|
485 |
|
---|
486 | void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
|
---|
487 | {
|
---|
488 | const QString del_statement("-$(DEL_FILE)");
|
---|
489 | const QString del_suffix =
|
---|
490 | Option::target_mode == Option::TARG_OS2_MODE ?
|
---|
491 | QString(" >nul 2>&1"): // reduce noise
|
---|
492 | QString::null;
|
---|
493 |
|
---|
494 | const int commandlineLimit =
|
---|
495 | Option::target_mode == Option::TARG_OS2_MODE ?
|
---|
496 | 1000: // OS/2 CMD.EXE limit (1024 - suffix - reserve)
|
---|
497 | 2047; // NT limit, expanded
|
---|
498 |
|
---|
499 | t << "clean: compiler_clean " << var("CLEAN_DEPS");
|
---|
500 | {
|
---|
501 | const char *clean_targets[] = { "OBJECTS", "QMAKE_CLEAN", "CLEAN_FILES", 0 };
|
---|
502 | for(int i = 0; clean_targets[i]; ++i) {
|
---|
503 | const QStringList &list = project->values(clean_targets[i]);
|
---|
504 | if(project->isActiveConfig("no_delete_multiple_files")) {
|
---|
505 | for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
|
---|
506 | t << "\n\t" << del_statement << " " << escapeFilePath((*it)) << del_suffix;
|
---|
507 | } else {
|
---|
508 | QString files, file;
|
---|
509 | for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
|
---|
510 | file = " " + escapeFilePath((*it));
|
---|
511 | if(del_statement.length() + files.length() +
|
---|
512 | qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit &&
|
---|
513 | !files.isEmpty()) {
|
---|
514 | t << "\n\t" << del_statement << files << del_suffix;
|
---|
515 | files.clear();
|
---|
516 | }
|
---|
517 | files += file;
|
---|
518 | }
|
---|
519 | if(!files.isEmpty())
|
---|
520 | t << "\n\t" << del_statement << files << del_suffix;
|
---|
521 | }
|
---|
522 | }
|
---|
523 | }
|
---|
524 | t << endl << endl;
|
---|
525 |
|
---|
526 | t << "distclean: clean";
|
---|
527 | {
|
---|
528 | const char *clean_targets[] = { "QMAKE_DISTCLEAN", 0 };
|
---|
529 | for(int i = 0; clean_targets[i]; ++i) {
|
---|
530 | const QStringList &list = project->values(clean_targets[i]);
|
---|
531 | if(project->isActiveConfig("no_delete_multiple_files")) {
|
---|
532 | for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
|
---|
533 | t << "\n\t" << del_statement << " " << escapeFilePath((*it)) << del_suffix;
|
---|
534 | } else {
|
---|
535 | QString files, file;
|
---|
536 | for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
|
---|
537 | file = " " + escapeFilePath((*it));
|
---|
538 | if(del_statement.length() + files.length() +
|
---|
539 | qMax(fixEnvVariables(file).length(), file.length()) > commandlineLimit &&
|
---|
540 | !files.isEmpty()) {
|
---|
541 | t << "\n\t" << del_statement << files << del_suffix;
|
---|
542 | files.clear();
|
---|
543 | }
|
---|
544 | files += file;
|
---|
545 | }
|
---|
546 | if(!files.isEmpty())
|
---|
547 | t << "\n\t" << del_statement << files << del_suffix;
|
---|
548 | }
|
---|
549 | }
|
---|
550 | }
|
---|
551 | t << "\n\t" << del_statement << " $(DESTDIR_TARGET)" << del_suffix << endl;
|
---|
552 | {
|
---|
553 | QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
|
---|
554 | if(!ofile.isEmpty())
|
---|
555 | t << "\t" << del_statement << " " << ofile << del_suffix << endl;
|
---|
556 | }
|
---|
557 | t << endl;
|
---|
558 | }
|
---|
559 |
|
---|
560 | void Win32MakefileGenerator::writeIncPart(QTextStream &t)
|
---|
561 | {
|
---|
562 | t << "INCPATH = ";
|
---|
563 |
|
---|
564 | const QStringList &incs = project->values("INCLUDEPATH");
|
---|
565 | for(int i = 0; i < incs.size(); ++i) {
|
---|
566 | QString inc = incs.at(i);
|
---|
567 | inc.replace(QRegExp("\\\\$"), "");
|
---|
568 | inc.replace(QRegExp("\""), "");
|
---|
569 | if(!inc.isEmpty())
|
---|
570 | t << "-I" << "\"" << inc << "\" ";
|
---|
571 | }
|
---|
572 | t << "-I\"" << specdir() << "\""
|
---|
573 | << endl;
|
---|
574 | }
|
---|
575 |
|
---|
576 | void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
|
---|
577 | {
|
---|
578 | t << "####### Compiler, tools and options" << endl << endl;
|
---|
579 | t << "CC = " << var("QMAKE_CC") << endl;
|
---|
580 | t << "CXX = " << var("QMAKE_CXX") << endl;
|
---|
581 | t << "DEFINES = "
|
---|
582 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
|
---|
583 | << varGlue("DEFINES","-D"," -D","") << endl;
|
---|
584 | t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)" << endl;
|
---|
585 | t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)" << endl;
|
---|
586 |
|
---|
587 | writeIncPart(t);
|
---|
588 | writeLibsPart(t);
|
---|
589 |
|
---|
590 | t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") :
|
---|
591 | Option::fixPathToTargetOS(var("QMAKE_QMAKE"), false)) << endl;
|
---|
592 | t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? QString("idc") :
|
---|
593 | Option::fixPathToTargetOS(var("QMAKE_IDC"), false)) << endl;
|
---|
594 | t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? QString("midl") :
|
---|
595 | Option::fixPathToTargetOS(var("QMAKE_IDL"), false)) << endl;
|
---|
596 | t << "RC = " << (project->isEmpty("QMAKE_RC") ? QString("rc") :
|
---|
597 | Option::fixPathToTargetOS(var("QMAKE_RC"), false)) << endl;
|
---|
598 | t << "ZIP = " << var("QMAKE_ZIP") << endl;
|
---|
599 | t << "COPY = " << var("QMAKE_COPY") << endl;
|
---|
600 | t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl;
|
---|
601 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl;
|
---|
602 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
|
---|
603 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
|
---|
604 | t << "MOVE = " << var("QMAKE_MOVE") << endl;
|
---|
605 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
|
---|
606 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
|
---|
607 | t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl;
|
---|
608 | t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl;
|
---|
609 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
|
---|
610 | t << endl;
|
---|
611 |
|
---|
612 | t << "####### Output directory" << endl << endl;
|
---|
613 | if(!project->values("OBJECTS_DIR").isEmpty())
|
---|
614 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR").replace(QRegExp("\\\\$"),"") << endl;
|
---|
615 | else
|
---|
616 | t << "OBJECTS_DIR = . " << endl;
|
---|
617 | t << endl;
|
---|
618 |
|
---|
619 | t << "####### Files" << endl << endl;
|
---|
620 | t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES")))
|
---|
621 | << " " << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl;
|
---|
622 |
|
---|
623 | // do this here so we can set DEST_TARGET to be the complete path to the final target if it is needed.
|
---|
624 | QString orgDestDir = var("DESTDIR");
|
---|
625 | QString destDir = Option::fixPathToTargetOS(orgDestDir, false);
|
---|
626 | if (orgDestDir.endsWith('/') || orgDestDir.endsWith(Option::dir_sep))
|
---|
627 | destDir += Option::dir_sep;
|
---|
628 | QString target = project->first("TARGET_SHORT");
|
---|
629 | if (target.isEmpty())
|
---|
630 | target = project->first("TARGET");
|
---|
631 | target += project->first("TARGET_EXT");
|
---|
632 | target.remove("\"");
|
---|
633 | project->values("DEST_TARGET").prepend(destDir + target);
|
---|
634 |
|
---|
635 | writeObjectsPart(t);
|
---|
636 | writeRcAndDefVariables(t);
|
---|
637 |
|
---|
638 | writeExtraCompilerVariables(t);
|
---|
639 | writeExtraVariables(t);
|
---|
640 |
|
---|
641 | t << "DIST = " << varList("DISTFILES") << endl;
|
---|
642 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
|
---|
643 | // The comment is important to maintain variable compatability with Unix
|
---|
644 | // Makefiles, while not interpreting a trailing-slash as a linebreak
|
---|
645 | t << "DESTDIR = " << escapeFilePath(destDir) << " #avoid trailing-slash linebreak" << endl;
|
---|
646 | t << "TARGET = " << escapeFilePath(target) << endl;
|
---|
647 | t << "DESTDIR_TARGET = " << escapeFilePath(var("DEST_TARGET")) << endl;
|
---|
648 | t << endl;
|
---|
649 |
|
---|
650 | t << "####### Implicit rules" << endl << endl;
|
---|
651 | writeImplicitRulesPart(t);
|
---|
652 |
|
---|
653 | t << "####### Build rules" << endl << endl;
|
---|
654 | writeBuildRulesPart(t);
|
---|
655 |
|
---|
656 | if(project->isActiveConfig("shared") && !project->values("DLLDESTDIR").isEmpty()) {
|
---|
657 | QStringList dlldirs = project->values("DLLDESTDIR");
|
---|
658 | for (QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir) {
|
---|
659 | t << "\n\t" << "-$(COPY_FILE) \"$(DESTDIR_TARGET)\" " << Option::fixPathToTargetOS(*dlldir, false);
|
---|
660 | }
|
---|
661 | }
|
---|
662 | t << endl << endl;
|
---|
663 |
|
---|
664 | writeRcAndDefPart(t);
|
---|
665 |
|
---|
666 | writeMakeQmake(t);
|
---|
667 |
|
---|
668 | QStringList dist_files = fileFixify(Option::mkfile::project_files);
|
---|
669 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES"))
|
---|
670 | dist_files += project->values("QMAKE_INTERNAL_INCLUDED_FILES");
|
---|
671 | if(!project->isEmpty("TRANSLATIONS"))
|
---|
672 | dist_files << var("TRANSLATIONS");
|
---|
673 | if(!project->isEmpty("FORMS")) {
|
---|
674 | QStringList &forms = project->values("FORMS");
|
---|
675 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {
|
---|
676 | QString ui_h = fileFixify((*formit) + Option::h_ext.first());
|
---|
677 | if(exists(ui_h))
|
---|
678 | dist_files << ui_h;
|
---|
679 | }
|
---|
680 | }
|
---|
681 | t << "dist:" << "\n\t"
|
---|
682 | << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(DIST) "
|
---|
683 | << dist_files.join(" ") << " " << var("TRANSLATIONS") << " ";
|
---|
684 | if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
|
---|
685 | const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
|
---|
686 | for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
|
---|
687 | const QStringList &inputs = project->values((*it)+".input");
|
---|
688 | for(QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
|
---|
689 | t << (*input) << " ";
|
---|
690 | }
|
---|
691 | }
|
---|
692 | }
|
---|
693 | t << endl << endl;
|
---|
694 |
|
---|
695 | writeCleanParts(t);
|
---|
696 | writeExtraTargets(t);
|
---|
697 | writeExtraCompilerTargets(t);
|
---|
698 | t << endl << endl;
|
---|
699 | }
|
---|
700 |
|
---|
701 | void Win32MakefileGenerator::writeLibsPart(QTextStream &t)
|
---|
702 | {
|
---|
703 | if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
|
---|
704 | t << "LIBAPP = " << var("QMAKE_LIB") << endl;
|
---|
705 | t << "LIBFLAGS = " << var("QMAKE_LIBFLAGS") << endl;
|
---|
706 | } else {
|
---|
707 | t << "LINK = " << var("QMAKE_LINK") << endl;
|
---|
708 | t << "LFLAGS = ";
|
---|
709 | if(!project->values("QMAKE_LIBDIR").isEmpty())
|
---|
710 | writeLibDirPart(t);
|
---|
711 | t << var("QMAKE_LFLAGS") << endl;
|
---|
712 | t << "LIBS = " << var("QMAKE_LIBS") << endl;
|
---|
713 | }
|
---|
714 | }
|
---|
715 |
|
---|
716 | void Win32MakefileGenerator::writeLibDirPart(QTextStream &t)
|
---|
717 | {
|
---|
718 | QStringList libDirs = project->values("QMAKE_LIBDIR");
|
---|
719 | for (int i = 0; i < libDirs.size(); ++i)
|
---|
720 | libDirs[i].remove("\"");
|
---|
721 | t << valGlue(libDirs,"-L\"","\" -L\"","\"") << " ";
|
---|
722 | }
|
---|
723 |
|
---|
724 | void Win32MakefileGenerator::writeObjectsPart(QTextStream &t)
|
---|
725 | {
|
---|
726 | t << "OBJECTS = " << valList(escapeDependencyPaths(project->values("OBJECTS"))) << endl;
|
---|
727 | }
|
---|
728 |
|
---|
729 | void Win32MakefileGenerator::writeImplicitRulesPart(QTextStream &t)
|
---|
730 | {
|
---|
731 | t << ".SUFFIXES:";
|
---|
732 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
|
---|
733 | t << " " << (*cppit);
|
---|
734 | for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
|
---|
735 | t << " " << (*cit);
|
---|
736 | t << endl << endl;
|
---|
737 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
|
---|
738 | t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
|
---|
739 | for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
|
---|
740 | t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
|
---|
741 | }
|
---|
742 |
|
---|
743 | void Win32MakefileGenerator::writeBuildRulesPart(QTextStream &)
|
---|
744 | {
|
---|
745 | }
|
---|
746 |
|
---|
747 | void Win32MakefileGenerator::writeRcAndDefVariables(QTextStream &t)
|
---|
748 | {
|
---|
749 | t << "DEF_FILE = " << varList("DEF_FILE") << endl;
|
---|
750 | t << "RES_FILE = " << varList("RES_FILE") << endl; // Not on mingw, can't see why not though...
|
---|
751 | }
|
---|
752 |
|
---|
753 | void Win32MakefileGenerator::writeRcAndDefPart(QTextStream &t)
|
---|
754 | {
|
---|
755 | if(!project->values("RC_FILE").isEmpty()) {
|
---|
756 | const QString res_file = project->first("RES_FILE"),
|
---|
757 | rc_file = fileFixify(project->first("RC_FILE"));
|
---|
758 | // The resource tool needs to have the same defines passed in as the compiler, since you may
|
---|
759 | // use these defines in the .rc file itself. Also, we need to add the _DEBUG define manually
|
---|
760 | // since the compiler defines this symbol by itself, and we use it in the automatically
|
---|
761 | // created rc file when VERSION is define the .pro file.
|
---|
762 | t << res_file << ": " << rc_file << "\n\t"
|
---|
763 | << var("QMAKE_RC") << (project->isActiveConfig("debug") ? " -D_DEBUG" : "") << " $(DEFINES) -fo " << res_file << " " << rc_file;
|
---|
764 | t << endl << endl;
|
---|
765 | }
|
---|
766 | }
|
---|
767 |
|
---|
768 | QString Win32MakefileGenerator::getLibTarget()
|
---|
769 | {
|
---|
770 | return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".lib");
|
---|
771 | }
|
---|
772 |
|
---|
773 | QString Win32MakefileGenerator::defaultInstall(const QString &t)
|
---|
774 | {
|
---|
775 | if((t != "target" && t != "dlltarget") ||
|
---|
776 | (t == "dlltarget" && (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("shared"))) ||
|
---|
777 | project->first("TEMPLATE") == "subdirs")
|
---|
778 | return QString();
|
---|
779 |
|
---|
780 | const QString root = "$(INSTALL_ROOT)";
|
---|
781 | QStringList &uninst = project->values(t + ".uninstall");
|
---|
782 | QString ret;
|
---|
783 | QString targetdir = Option::fixPathToTargetOS(project->first(t + ".path"), false);
|
---|
784 | targetdir = fileFixify(targetdir, FileFixifyAbsolute);
|
---|
785 | if(targetdir.right(1) != Option::dir_sep)
|
---|
786 | targetdir += Option::dir_sep;
|
---|
787 |
|
---|
788 | const QString del_suffix =
|
---|
789 | Option::target_mode == Option::TARG_OS2_MODE ?
|
---|
790 | QString(" >nul 2>&1"): // reduce noise
|
---|
791 | QString::null;
|
---|
792 |
|
---|
793 | if(t == "target" && project->first("TEMPLATE") == "lib") {
|
---|
794 | if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") &&
|
---|
795 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
|
---|
796 | QString dst_prl = Option::fixPathToTargetOS(project->first("QMAKE_INTERNAL_PRL_FILE"));
|
---|
797 | int slsh = dst_prl.lastIndexOf(Option::dir_sep);
|
---|
798 | if(slsh != -1)
|
---|
799 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
|
---|
800 | dst_prl = filePrefixRoot(root, targetdir + dst_prl);
|
---|
801 | ret += "-$(INSTALL_FILE) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\"";
|
---|
802 | if(!uninst.isEmpty())
|
---|
803 | uninst.append("\n\t");
|
---|
804 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"" + del_suffix);
|
---|
805 | }
|
---|
806 | if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) {
|
---|
807 | QString lib_target = getLibTarget();
|
---|
808 | lib_target.remove('"');
|
---|
809 | QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + lib_target;
|
---|
810 | QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + lib_target, FileFixifyAbsolute));
|
---|
811 | if(!ret.isEmpty())
|
---|
812 | ret += "\n\t";
|
---|
813 | ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\"";
|
---|
814 | if(!uninst.isEmpty())
|
---|
815 | uninst.append("\n\t");
|
---|
816 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"" + del_suffix);
|
---|
817 | }
|
---|
818 | }
|
---|
819 |
|
---|
820 | if(t == "dlltarget" || project->values(t + ".CONFIG").indexOf("no_dll") == -1) {
|
---|
821 | QString src_targ = "$(DESTDIR_TARGET)";
|
---|
822 | QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + "$(TARGET)", FileFixifyAbsolute));
|
---|
823 | if(!ret.isEmpty())
|
---|
824 | ret += "\n\t";
|
---|
825 | ret += QString("-$(INSTALL_FILE)") + " \"" + src_targ + "\" \"" + dst_targ + "\"";
|
---|
826 | if(!uninst.isEmpty())
|
---|
827 | uninst.append("\n\t");
|
---|
828 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"" + del_suffix);
|
---|
829 | }
|
---|
830 | return ret;
|
---|
831 | }
|
---|
832 |
|
---|
833 | QString Win32MakefileGenerator::escapeFilePath(const QString &path) const
|
---|
834 | {
|
---|
835 | QString ret = path;
|
---|
836 | if(!ret.isEmpty()) {
|
---|
837 | ret = unescapeFilePath(ret);
|
---|
838 | if(ret.contains(" "))
|
---|
839 | ret = "\"" + ret + "\"";
|
---|
840 | debug_msg(2, "EscapeFilePath: %s -> %s", path.toLatin1().constData(), ret.toLatin1().constData());
|
---|
841 | }
|
---|
842 | return ret;
|
---|
843 | }
|
---|
844 |
|
---|
845 | QT_END_NAMESPACE
|
---|