1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
|
/****************************************************************************
**
** NmakeMakefileGenerator of BorlandMakefileGenerator class.
**
** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
**
** This file is part of qmake.
**
** This file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the files LICENSE.GPL2
** and LICENSE.GPL3 included in the packaging of this file.
** Alternatively you may (at your option) use any later version
** of the GNU General Public License if such license has been
** publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free TQt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at [email protected].
**
** This file may be used under the terms of the Q Public License as
** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
** included in the packaging of this file. Licensees holding valid TQt
** Commercial licenses may use this file in accordance with the TQt
** Commercial License Agreement provided with the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
**********************************************************************/
#include "borland_bmake.h"
#include "option.h"
#include <ntqdir.h>
#include <ntqregexp.h>
#include <time.h>
#include <stdlib.h>
BorlandMakefileGenerator::BorlandMakefileGenerator(TQMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
{
}
bool
BorlandMakefileGenerator::writeMakefile(TQTextStream &t)
{
writeHeader(t);
if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
t << "all clean:" << "\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
<< "@echo \"Skipped.\"" << endl << endl;
return TRUE;
}
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib") {
writeBorlandParts(t);
return MakefileGenerator::writeMakefile(t);
}
else if(project->first("TEMPLATE") == "subdirs") {
writeSubDirs(t);
return TRUE;
}
return FALSE;
}
void
BorlandMakefileGenerator::writeBorlandParts(TQTextStream &t)
{
t << "!if !$d(BCB)" << endl;
t << "BCB = $(MAKEDIR)\\.." << endl;
t << "!endif" << endl << endl;
t << "####### Compiler, tools and options" << endl << endl;
t << "CC = " << var("QMAKE_CC") << endl;
t << "CXX = " << var("QMAKE_CXX") << endl;
t << "LEX = " << var("QMAKE_LEX") << endl;
t << "YACC = " << var("QMAKE_YACC") << endl;
t << "CFLAGS = " << var("QMAKE_CFLAGS") << " "
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
<< varGlue("DEFINES","-D"," -D","") << endl;
t << "CXXFLAGS= " << var("QMAKE_CXXFLAGS") << " "
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
<< varGlue("DEFINES","-D"," -D","") << endl;
t << "LEXFLAGS=" << var("QMAKE_LEXFLAGS") << endl;
t << "YACCFLAGS=" << var("QMAKE_YACCFLAGS") << endl;
t << "INCPATH = ";
TQStringList &incs = project->variables()["INCLUDEPATH"];
for(TQStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
TQString inc = (*incit);
inc.replace(TQRegExp("\\\\*$"), "");
inc.replace("\"", "");
t << " -I\"" << inc << "\"";
}
t << " -I\"" << specdir() << "\""
<< endl;
if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
t << "LINK = " << var("QMAKE_LINK") << endl;
t << "LFLAGS = ";
if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() )
t << varGlue("QMAKE_LIBDIR","-L",";","") << " ";
t << var("QMAKE_LFLAGS") << endl;
t << "LIBS = " << var("QMAKE_LIBS") << endl;
}
else {
t << "LIB = " << var("QMAKE_LIB") << endl;
}
t << "MOC = " << (project->isEmpty("QMAKE_MOC") ? TQString("moc") :
Option::fixPathToTargetOS(var("QMAKE_MOC"), FALSE)) << endl;
t << "UIC = " << (project->isEmpty("QMAKE_UIC") ? TQString("uic") :
Option::fixPathToTargetOS(var("QMAKE_UIC"), FALSE)) << endl;
t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? TQString("qmake") :
Option::fixPathToTargetOS(var("QMAKE_QMAKE"), FALSE)) << endl;
t << "IDC = " << (project->isEmpty("QMAKE_IDC") ? TQString("idc") :
Option::fixPathToTargetOS(var("QMAKE_IDC"), FALSE)) << endl;
t << "IDL = " << (project->isEmpty("QMAKE_IDL") ? TQString("midl") :
Option::fixPathToTargetOS(var("QMAKE_IDL"), FALSE)) << endl;
t << "ZIP = " << var("QMAKE_ZIP") << endl;
t << "DEF_FILE = " << varList("DEF_FILE") << endl;
t << "RES_FILE = " << varList("RES_FILE") << endl;
t << "COPY_FILE = " << var("QMAKE_COPY") << endl;
t << "COPY_DIR = " << var("QMAKE_COPY") << endl;
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
t << "MOVE = " << var("QMAKE_MOVE") << endl;
t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl;
t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
t << endl;
t << "####### Files" << endl << endl;
t << "HEADERS = " << varList("HEADERS") << endl;
t << "SOURCES = " << varList("SOURCES") << endl;
t << "OBJECTS = " << varList("OBJECTS") << endl;
t << "FORMS = " << varList("FORMS") << endl;
t << "UICDECLS = " << varList("UICDECLS") << endl;
t << "UICIMPLS = " << varList("UICIMPLS") << endl;
t << "SRCMOC = " << varList("SRCMOC") << endl;
t << "OBJMOC = " << varList("OBJMOC") << endl;
TQString extraCompilerDeps;
if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) {
t << "OBJCOMP = " << varList("OBJCOMP") << endl;
extraCompilerDeps += " $(OBJCOMP) ";
TQStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"];
for(TQStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) {
TQStringList &vars = project->variables()[(*compit) + ".variables"];
for(TQStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) {
TQStringList vals = project->variables()[(*varit)];
if(!vals.isEmpty())
t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl;
}
}
}
t << "DIST = " << varList("DISTFILES") << endl;
t << "TARGET = "
<< varGlue("TARGET",project->first("DESTDIR"),"",project->first("TARGET_EXT"))
<< endl;
t << endl;
t << "####### Implicit rules" << endl << endl;
t << ".SUFFIXES: .c";
TQStringList::Iterator cppit;
for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
t << " " << (*cppit);
t << endl << endl;
for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
t << "####### Build rules" << endl << endl;
t << "all: " << fileFixify(Option::output.name()) << " " << varGlue("ALL_DEPS"," "," "," ") << " $(TARGET)" << endl << endl;
t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
<< extraCompilerDeps << var("POST_TARGETDEPS");
if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
t << "\n\t" << "$(LINK) @&&|" << "\n\t"
<< "$(LFLAGS) $(OBJECTS) $(OBJMOC),$(TARGET),,$(LIBS),$(DEF_FILE),$(RES_FILE)";
} else {
t << "\n\t-$(DEL_FILE) $(TARGET)"
<< "\n\t" << "$(LIB) $(TARGET) @&&|" << " \n+"
<< project->variables()["OBJECTS"].join(" \\\n+") << " \\\n+"
<< project->variables()["OBJMOC"].join(" \\\n+");
}
t << extraCompilerDeps;
t << endl << "|" << endl;
if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
t << "\t" <<var("QMAKE_POST_LINK") << endl;
if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
TQStringList dlldirs = project->variables()["DLLDESTDIR"];
for ( TQStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
t << "\n\t" << "-$(COPY_FILE) \"$(TARGET)\" " << *dlldir;
}
}
TQString targetfilename = project->variables()["TARGET"].first();
if(project->isActiveConfig("activeqt")) {
TQString version = project->variables()["VERSION"].first();
if ( version.isEmpty() )
version = "1.0";
if ( project->isActiveConfig("dll")) {
t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version);
t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
} else {
t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version);
t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
t << "\n\t" << ("-$(TARGET) -regserver");
}
}
t << endl << endl;
if(!project->variables()["RC_FILE"].isEmpty()) {
t << var("RES_FILE") << ": " << var("RC_FILE") << "\n\t"
<< var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl;
}
t << "mocables: $(SRCMOC)" << endl
<< "uicables: $(UICIMPLS) $(UICDECLS)" << endl << endl;
writeMakeQmake(t);
TQStringList dist_files = Option::mkfile::project_files;
if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES"))
dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"];
if(!project->isEmpty("TRANSLATIONS"))
dist_files << var("TRANSLATIONS");
if(!project->isEmpty("FORMS")) {
TQStringList &forms = project->variables()["FORMS"];
for(TQStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {
TQString ui_h = fileFixify((*formit) + Option::h_ext.first());
if(TQFile::exists(ui_h) )
dist_files << ui_h;
}
}
t << "dist:" << "\n\t"
<< "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(HEADERS) $(DIST) $(FORMS) "
<< dist_files.join(" ") << " " << var("TRANSLATIONS") << " " << var("IMAGES") << endl << endl;
t << "uiclean:";
TQString uiclean = varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") + varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","");
if ( uiclean.isEmpty() ) {
// Borland make does not like an empty command section
uiclean = "\n\t@cd .";
}
t << uiclean << endl;
t << "mocclean:";
TQString mocclean = varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") + varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","");
if ( mocclean.isEmpty() ) {
// Borland make does not like an empty command section
mocclean = "\n\t@cd .";
}
t << mocclean << endl;
t << "clean: uiclean mocclean"
<< varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","")
<< varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","")
<< varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","");
if ( project->isActiveConfig("activeqt")) {
t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl");
t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb");
}
if(!project->isEmpty("IMAGES"))
t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", "");
t << endl;
// user defined targets
TQStringList::Iterator it;
TQStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
for(it = qut.begin(); it != qut.end(); ++it) {
TQString targ = var((*it) + ".target"),
cmd = var((*it) + ".commands"), deps;
if(targ.isEmpty())
targ = (*it);
TQStringList &deplist = project->variables()[(*it) + ".depends"];
for(TQStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
TQString dep = var((*dep_it) + ".target");
if(dep.isEmpty())
dep = (*dep_it);
deps += " " + dep;
}
if(!project->variables()["QMAKE_NOFORCE"].isEmpty() &&
project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1)
deps += TQString(" ") + "FORCE";
t << "\n\n" << targ << ":" << deps << "\n\t"
<< cmd;
}
t << endl << endl;
TQStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"];
for(it = quc.begin(); it != quc.end(); ++it) {
TQString tmp_out = project->variables()[(*it) + ".output"].first();
TQString tmp_cmd = project->variables()[(*it) + ".commands"].join(" ");
TQString tmp_dep = project->variables()[(*it) + ".depends"].join(" ");
TQStringList &vars = project->variables()[(*it) + ".variables"];
if(tmp_out.isEmpty() || tmp_cmd.isEmpty())
continue;
TQStringList &tmp = project->variables()[(*it) + ".input"];
for(TQStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
TQStringList &inputs = project->variables()[(*it2)];
for(TQStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
TQFileInfo fi(Option::fixPathToLocalOS((*input)));
TQString in = Option::fixPathToTargetOS((*input), FALSE),
out = tmp_out, cmd = tmp_cmd, deps;
out.replace("${QMAKE_FILE_BASE}", fi.baseName());
out.replace("${QMAKE_FILE_NAME}", fi.filePath());
cmd.replace("${QMAKE_FILE_BASE}", fi.baseName());
cmd.replace("${QMAKE_FILE_OUT}", out);
cmd.replace("${QMAKE_FILE_NAME}", fi.filePath());
for(TQStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3)
cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")");
if(!tmp_dep.isEmpty()) {
char buff[256];
TQString dep_cmd = tmp_dep;
dep_cmd.replace("${QMAKE_FILE_NAME}", fi.filePath());
if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) {
while(!feof(proc)) {
int read_in = int(fread(buff, 1, 255, proc));
if(!read_in)
break;
int l = 0;
for(int i = 0; i < read_in; i++) {
if(buff[i] == '\n' || buff[i] == ' ') {
deps += " " + TQCString(buff+l, (i - l) + 1);
l = i;
}
}
}
fclose(proc);
}
}
t << out << ": " << in << deps << "\n\t"
<< cmd << endl << endl;
}
}
}
t << endl;
t << "distclean: clean"
<< "\n\t-$(DEL_FILE) $(TARGET)"
<< endl << endl;
}
void
BorlandMakefileGenerator::init()
{
if(init_flag)
return;
init_flag = TRUE;
project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
/* this should probably not be here, but I'm using it to wrap the .t files */
if(project->first("TEMPLATE") == "app")
project->variables()["QMAKE_APP_FLAG"].append("1");
else if(project->first("TEMPLATE") == "lib")
project->variables()["QMAKE_LIB_FLAG"].append("1");
else if(project->first("TEMPLATE") == "subdirs") {
MakefileGenerator::init();
if(project->variables()["MAKEFILE"].isEmpty())
project->variables()["MAKEFILE"].append("Makefile");
if(project->variables()["QMAKE"].isEmpty())
project->variables()["QMAKE"].append("qmake");
return;
}
if(project->isEmpty("QMAKE_INSTALL_FILE"))
project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)");
if(project->isEmpty("QMAKE_INSTALL_DIR"))
project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)");
bool is_qt = (project->first("TARGET") == "qt" TQTDLL_POSTFIX || project->first("TARGET") == "qtmt" TQTDLL_POSTFIX);
TQStringList &configs = project->variables()["CONFIG"];
if (project->isActiveConfig("shared"))
project->variables()["DEFINES"].append("QT_DLL");
if (project->isActiveConfig("qt_dll"))
if(configs.findIndex("qt") == -1) configs.append("qt");
if ( project->isActiveConfig("qtopia") ) {
if(configs.findIndex("qtopialib") == -1)
configs.append("qtopialib");
if(configs.findIndex("qtopiainc") == -1)
configs.append("qtopiainc");
}
if ( project->isActiveConfig("qt") ) {
if ( project->isActiveConfig("plugin") ) {
project->variables()["CONFIG"].append("dll");
project->variables()["DEFINES"].append("QT_PLUGIN");
}
if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) &&
((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 ||
project->variables()["DEFINES"].findIndex("QT_DLL") != -1) ||
(getenv("QT_DLL") && !getenv("QT_NODLL"))) ) {
project->variables()["QMAKE_QT_DLL"].append("1");
if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() )
project->variables()["CONFIG"].append("dll");
}
}
if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
project->variables()["CONFIG"].remove("staticlib");
project->variables()["QMAKE_APP_OR_DLL"].append("1");
} else {
project->variables()["CONFIG"].append("staticlib");
}
if ( project->isActiveConfig("warn_off") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"];
} else if ( project->isActiveConfig("warn_on") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"];
}
if(project->isActiveConfig("qt")) {
if ( project->isActiveConfig("thread") )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("TQT_THREAD_SUPPORT");
if ( project->isActiveConfig("accessibility" ) )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT");
if ( project->isActiveConfig("tablet") )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT");
}
if ( project->isActiveConfig("debug") ) {
if ( project->isActiveConfig("thread") ) {
if ( project->isActiveConfig("dll") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLLDBG"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DBG"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"];
}
}
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"];
} else {
if ( project->isActiveConfig("thread") ) {
if ( project->isActiveConfig("dll") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT_DLL"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_MT"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_MT"];
}
}
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"];
}
if ( !project->variables()["QMAKE_INCDIR"].isEmpty()) {
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
}
if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) {
project->variables()["CONFIG"].append("windows");
}
if ( project->isActiveConfig("qtopiainc") )
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_TQTOPIA"];
if ( project->isActiveConfig("qtopialib") ) {
if(!project->isEmpty("QMAKE_LIBDIR_TQTOPIA"))
project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_TQTOPIA"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"];
}
if ( project->isActiveConfig("qt") ) {
project->variables()["CONFIG"].append("moc");
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_TQT"];
project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_TQT"];
if ( !project->isActiveConfig("debug") )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("TQT_NO_DEBUG");
if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) {
if ( !project->variables()["QMAKE_QT_DLL"].isEmpty()) {
project->variables()["DEFINES"].append("QT_MAKEDLL");
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_QT_DLL"];
}
} else {
if(project->isActiveConfig("thread"))
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
else
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) {
int hver = findHighestVersion(project->first("QMAKE_LIBDIR_TQT"), "qt");
if ( hver == -1 )
hver = findHighestVersion(project->first("QMAKE_LIBDIR_TQT"), "qtmt");
if(hver != -1) {
TQString ver;
ver.sprintf("qt%s" TQTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "mt" : ""), hver);
TQStringList &libs = project->variables()["QMAKE_LIBS"];
for(TQStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit)
(*libit).replace(TQRegExp("qt(mt)?\\.lib"), ver);
}
}
if ( project->isActiveConfig( "activeqt" ) ) {
project->variables().remove("QMAKE_LIBS_QT_ENTRY");
project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib";
if ( project->isActiveConfig( "dll" ) )
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"];
}
if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"];
}
}
}
if ( project->isActiveConfig("opengl") ) {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"];
}
if ( project->isActiveConfig("dll") ) {
project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE_DLL"];
project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE_DLL"];
project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE_DLL"];
project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS_DLL"];
if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty()) {
project->variables()["TARGET_EXT"].append(
TQStringList::split('.',project->first("VERSION")).join("") + ".dll");
} else {
project->variables()["TARGET_EXT"].append(".dll");
}
} else {
project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CFLAGS_CONSOLE"];
project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_CXXFLAGS_CONSOLE"];
project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"] = project->variables()["QMAKE_LFLAGS_CONSOLE"];
project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"] = project->variables()["QMAKE_LFLAGS_WINDOWS"];
if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
project->variables()["TARGET_EXT"].append(".exe");
} else {
project->variables()["TARGET_EXT"].append(".lib");
}
}
if ( project->isActiveConfig("windows") ) {
if ( project->isActiveConfig("console") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
} else {
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"];
}
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
}
if ( project->isActiveConfig("stl") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"];
}
if ( project->isActiveConfig("exceptions") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"];
}
if ( project->isActiveConfig("rtti") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"];
}
if ( project->isActiveConfig("thread") ) {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RTMT"];
} else {
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_RT"];
}
if ( project->isActiveConfig("moc") ) {
setMocAware(TRUE);
}
project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
// Update -lname to name.lib, and -Ldir to
TQStringList &libList = project->variables()["QMAKE_LIBS"];
for( TQStringList::Iterator stIt = libList.begin(); stIt != libList.end(); ) {
TQString s = *stIt;
if( s.startsWith( "-l" ) ) {
stIt = libList.remove( stIt );
stIt = libList.insert( stIt, s.mid( 2 ) + ".lib" );
} else if( s.startsWith( "-L" ) ) {
stIt = libList.remove( stIt );
project->variables()["QMAKE_LIBDIR"].append(TQDir::convertSeparators(s.mid( 2 )));
} else {
stIt++;
}
}
project->variables()["QMAKE_FILETAGS"] += TQStringList::split(' ',
"HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
TQStringList &l = project->variables()["QMAKE_FILETAGS"];
TQStringList::Iterator it;
for(it = l.begin(); it != l.end(); ++it) {
TQStringList &gdmf = project->variables()[(*it)];
for(TQStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
(*inner) = Option::fixPathToTargetOS((*inner), FALSE);
}
if ( !project->variables()["RC_FILE"].isEmpty()) {
if ( !project->variables()["RES_FILE"].isEmpty()) {
fprintf(stderr, "Both .rc and .res file specified.\n");
fprintf(stderr, "Please specify one of them, not both.");
exit(666);
}
project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
project->variables()["RES_FILE"].first().replace(".rc",".res");
project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"];
}
MakefileGenerator::init();
if ( !project->variables()["VERSION"].isEmpty()) {
TQStringList l = TQStringList::split('.', project->first("VERSION"));
project->variables()["VER_MAJ"].append(l[0]);
project->variables()["VER_MIN"].append(l[1]);
}
if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
// bcc does not generate a .tds file for static libs
TQString tdsPostfix;
if ( !project->variables()["VERSION"].isEmpty() ) {
tdsPostfix = TQStringList::split( '.', project->first("VERSION") ).join("")
+ ".tds";
} else {
tdsPostfix = ".tds";
}
project->variables()["QMAKE_CLEAN"].append(
project->first("DESTDIR") + project->first("TARGET") + tdsPostfix );
}
TQStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"];
for(it = quc.begin(); it != quc.end(); ++it) {
TQString tmp_out = project->variables()[(*it) + ".output"].first();
if(tmp_out.isEmpty())
continue;
TQStringList &tmp = project->variables()[(*it) + ".input"];
for(TQStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
TQStringList &inputs = project->variables()[(*it2)];
for(TQStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
TQFileInfo fi(Option::fixPathToLocalOS((*input)));
TQString in = Option::fixPathToTargetOS((*input), FALSE),
out = tmp_out;
out.replace("${QMAKE_FILE_BASE}", fi.baseName());
out.replace("${QMAKE_FILE_NAME}", fi.filePath());
if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1)
project->variables()["OBJCOMP"] += out;
}
}
}
}
|