author | mickeyl <mickeyl> | 2003-12-28 00:32:51 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-28 00:32:51 (UTC) |
commit | e889485e945d8fa9564566f286114be10d2a1ce5 (patch) (unidiff) | |
tree | 23eb3b07521f36d22b165793164c25f1d0acdaae | |
parent | 7812187f6732eef351e501d993aa664b7e351cbb (diff) | |
download | opie-e889485e945d8fa9564566f286114be10d2a1ce5.zip opie-e889485e945d8fa9564566f286114be10d2a1ce5.tar.gz opie-e889485e945d8fa9564566f286114be10d2a1ce5.tar.bz2 |
fix qmake 1.05a to generate the PRO line in a Makefile
this feature seemed to have been removed in 1.05a - it was
in 1.04a and is needed for opie-lupdate to work
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 7fbb9f4..d8a4a0d 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp | |||
@@ -1,1109 +1,1110 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of ________ class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Created : 970521 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 10 | ** This file is part of the network module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 22 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 23 | ** with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "unixmake.h" | 38 | #include "unixmake.h" |
39 | #include "option.h" | 39 | #include "option.h" |
40 | #include <qregexp.h> | 40 | #include <qregexp.h> |
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <time.h> | 43 | #include <time.h> |
44 | 44 | ||
45 | 45 | ||
46 | UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE) | 46 | UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE) |
47 | { | 47 | { |
48 | 48 | ||
49 | } | 49 | } |
50 | 50 | ||
51 | bool | 51 | bool |
52 | UnixMakefileGenerator::writeMakefile(QTextStream &t) | 52 | UnixMakefileGenerator::writeMakefile(QTextStream &t) |
53 | { | 53 | { |
54 | writeHeader(t); | 54 | writeHeader(t); |
55 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 55 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
56 | t << "all clean:" << "\n\t" | 56 | t << "all clean:" << "\n\t" |
57 | << "@echo \"Some of the required modules (" | 57 | << "@echo \"Some of the required modules (" |
58 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | 58 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" |
59 | << "@echo \"Skipped.\"" << endl << endl; | 59 | << "@echo \"Skipped.\"" << endl << endl; |
60 | writeMakeQmake(t); | 60 | writeMakeQmake(t); |
61 | return TRUE; | 61 | return TRUE; |
62 | } | 62 | } |
63 | 63 | ||
64 | if (project->variables()["TEMPLATE"].first() == "app" || | 64 | if (project->variables()["TEMPLATE"].first() == "app" || |
65 | project->variables()["TEMPLATE"].first() == "lib") { | 65 | project->variables()["TEMPLATE"].first() == "lib") { |
66 | writeMakeParts(t); | 66 | writeMakeParts(t); |
67 | return MakefileGenerator::writeMakefile(t); | 67 | return MakefileGenerator::writeMakefile(t); |
68 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { | 68 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { |
69 | writeSubdirs(t); | 69 | writeSubdirs(t); |
70 | return TRUE; | 70 | return TRUE; |
71 | } | 71 | } |
72 | return FALSE; | 72 | return FALSE; |
73 | } | 73 | } |
74 | 74 | ||
75 | void | 75 | void |
76 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) | 76 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) |
77 | { | 77 | { |
78 | QString deps = fileFixify(Option::output.name()), prl; | 78 | QString deps = fileFixify(Option::output.name()), prl; |
79 | bool do_incremental = (project->isActiveConfig("incremental") && | 79 | bool do_incremental = (project->isActiveConfig("incremental") && |
80 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && | 80 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && |
81 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || | 81 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || |
82 | !project->isActiveConfig("staticlib"))), | 82 | !project->isActiveConfig("staticlib"))), |
83 | src_incremental=FALSE, moc_incremental=FALSE; | 83 | src_incremental=FALSE, moc_incremental=FALSE; |
84 | 84 | ||
85 | t << "####### Compiler, tools and options" << endl << endl; | 85 | t << "####### Compiler, tools and options" << endl << endl; |
86 | t << "CC = "; | 86 | t << "CC = "; |
87 | if (project->isActiveConfig("thread") && | 87 | if (project->isActiveConfig("thread") && |
88 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) | 88 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) |
89 | t << var("QMAKE_CC_THREAD") << endl; | 89 | t << var("QMAKE_CC_THREAD") << endl; |
90 | else | 90 | else |
91 | t << var("QMAKE_CC") << endl; | 91 | t << var("QMAKE_CC") << endl; |
92 | 92 | ||
93 | t << "CXX = "; | 93 | t << "CXX = "; |
94 | if (project->isActiveConfig("thread") && | 94 | if (project->isActiveConfig("thread") && |
95 | ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) | 95 | ! project->variables()["QMAKE_CXX_THREAD"].isEmpty()) |
96 | t << var("QMAKE_CXX_THREAD") << endl; | 96 | t << var("QMAKE_CXX_THREAD") << endl; |
97 | else | 97 | else |
98 | t << var("QMAKE_CXX") << endl; | 98 | t << var("QMAKE_CXX") << endl; |
99 | 99 | ||
100 | t << "LEX = " << var("QMAKE_LEX") << endl; | 100 | t << "LEX = " << var("QMAKE_LEX") << endl; |
101 | t << "YACC = " << var("QMAKE_YACC") << endl; | 101 | t << "YACC = " << var("QMAKE_YACC") << endl; |
102 | t << "CFLAGS = " << var("QMAKE_CFLAGS") << " " | 102 | t << "CFLAGS = " << var("QMAKE_CFLAGS") << " " |
103 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 103 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
104 | << varGlue("DEFINES","-D"," -D","") << endl; | 104 | << varGlue("DEFINES","-D"," -D","") << endl; |
105 | t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " " | 105 | t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " " |
106 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " | 106 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " " |
107 | << varGlue("DEFINES","-D"," -D","") << endl; | 107 | << varGlue("DEFINES","-D"," -D","") << endl; |
108 | t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; | 108 | t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl; |
109 | t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; | 109 | t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl; |
110 | t << "INCPATH = " << "-I" << specdir(); | 110 | t << "INCPATH = " << "-I" << specdir(); |
111 | if(!project->isActiveConfig("no_include_pwd")) { | 111 | if(!project->isActiveConfig("no_include_pwd")) { |
112 | QString pwd = fileFixify(QDir::currentDirPath()); | 112 | QString pwd = fileFixify(QDir::currentDirPath()); |
113 | if(pwd.isEmpty()) | 113 | if(pwd.isEmpty()) |
114 | pwd = "."; | 114 | pwd = "."; |
115 | t << " -I" << pwd; | 115 | t << " -I" << pwd; |
116 | } | 116 | } |
117 | t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl; | 117 | t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl; |
118 | 118 | ||
119 | if(!project->isActiveConfig("staticlib")) { | 119 | if(!project->isActiveConfig("staticlib")) { |
120 | t << "LINK = "; | 120 | t << "LINK = "; |
121 | if (project->isActiveConfig("thread") && | 121 | if (project->isActiveConfig("thread") && |
122 | ! project->variables()["QMAKE_LINK_THREAD"].isEmpty()) | 122 | ! project->variables()["QMAKE_LINK_THREAD"].isEmpty()) |
123 | t << var("QMAKE_LINK_THREAD") << endl; | 123 | t << var("QMAKE_LINK_THREAD") << endl; |
124 | else | 124 | else |
125 | t << var("QMAKE_LINK") << endl; | 125 | t << var("QMAKE_LINK") << endl; |
126 | 126 | ||
127 | t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; | 127 | t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; |
128 | t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; | 128 | t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; |
129 | } | 129 | } |
130 | 130 | ||
131 | t << "AR = " << var("QMAKE_AR") << endl; | 131 | t << "AR = " << var("QMAKE_AR") << endl; |
132 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; | 132 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; |
133 | t << "MOC = " << var("QMAKE_MOC") << endl; | 133 | t << "MOC = " << var("QMAKE_MOC") << endl; |
134 | t << "UIC = "<< var("QMAKE_UIC") << endl; | 134 | t << "UIC = "<< var("QMAKE_UIC") << endl; |
135 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; | 135 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
136 | t << "TAR = "<< var("QMAKE_TAR") << endl; | 136 | t << "TAR = "<< var("QMAKE_TAR") << endl; |
137 | t << "GZIP = " << var("QMAKE_GZIP") << endl; | 137 | t << "GZIP = " << var("QMAKE_GZIP") << endl; |
138 | t << "COPY = " << var("QMAKE_COPY") << endl; | 138 | t << "COPY = " << var("QMAKE_COPY") << endl; |
139 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; | 139 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; |
140 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; | 140 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; |
141 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 141 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
142 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; | 142 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; |
143 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; | 143 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
144 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 144 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
145 | t << "PRO = " << fileFixify(project->projectFile() )<< endl; | ||
145 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; | 146 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
146 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; | 147 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; |
147 | t << endl; | 148 | t << endl; |
148 | 149 | ||
149 | t << "####### Output directory" << endl << endl; | 150 | t << "####### Output directory" << endl << endl; |
150 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) | 151 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) |
151 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; | 152 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; |
152 | else | 153 | else |
153 | t << "OBJECTS_DIR = ./" << endl; | 154 | t << "OBJECTS_DIR = ./" << endl; |
154 | t << endl; | 155 | t << endl; |
155 | 156 | ||
156 | /* files */ | 157 | /* files */ |
157 | t << "####### Files" << endl << endl; | 158 | t << "####### Files" << endl << endl; |
158 | t << "HEADERS = " << varList("HEADERS") << endl; | 159 | t << "HEADERS = " << varList("HEADERS") << endl; |
159 | t << "SOURCES = " << varList("SOURCES") << endl; | 160 | t << "SOURCES = " << varList("SOURCES") << endl; |
160 | if(do_incremental) { | 161 | if(do_incremental) { |
161 | QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; | 162 | QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; |
162 | t << "OBJECTS = "; | 163 | t << "OBJECTS = "; |
163 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { | 164 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { |
164 | bool increment = FALSE; | 165 | bool increment = FALSE; |
165 | for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { | 166 | for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { |
166 | if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { | 167 | if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { |
167 | increment = TRUE; | 168 | increment = TRUE; |
168 | incrs_out.append((*objit)); | 169 | incrs_out.append((*objit)); |
169 | break; | 170 | break; |
170 | } | 171 | } |
171 | } | 172 | } |
172 | if(!increment) | 173 | if(!increment) |
173 | t << "\\\n\t\t" << (*objit); | 174 | t << "\\\n\t\t" << (*objit); |
174 | } | 175 | } |
175 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! | 176 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! |
176 | t << incrs_out.join(" \\\n\t\t") << endl; | 177 | t << incrs_out.join(" \\\n\t\t") << endl; |
177 | } else if(!incrs_out.count()) { | 178 | } else if(!incrs_out.count()) { |
178 | t << endl; | 179 | t << endl; |
179 | } else { | 180 | } else { |
180 | src_incremental = TRUE; | 181 | src_incremental = TRUE; |
181 | t << endl; | 182 | t << endl; |
182 | t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl; | 183 | t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl; |
183 | } | 184 | } |
184 | } else { | 185 | } else { |
185 | t << "OBJECTS = " << varList("OBJECTS") << endl; | 186 | t << "OBJECTS = " << varList("OBJECTS") << endl; |
186 | } | 187 | } |
187 | t << "FORMS = " << varList("FORMS") << endl; | 188 | t << "FORMS = " << varList("FORMS") << endl; |
188 | t << "UICDECLS = " << varList("UICDECLS") << endl; | 189 | t << "UICDECLS = " << varList("UICDECLS") << endl; |
189 | t << "UICIMPLS = " << varList("UICIMPLS") << endl; | 190 | t << "UICIMPLS = " << varList("UICIMPLS") << endl; |
190 | QString srcMoc = varList("SRCMOC"), objMoc = varList("OBJMOC"); | 191 | QString srcMoc = varList("SRCMOC"), objMoc = varList("OBJMOC"); |
191 | t << "SRCMOC = " << srcMoc << endl; | 192 | t << "SRCMOC = " << srcMoc << endl; |
192 | if(do_incremental) { | 193 | if(do_incremental) { |
193 | QStringList &objs = project->variables()["OBJMOC"], | 194 | QStringList &objs = project->variables()["OBJMOC"], |
194 | &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; | 195 | &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out; |
195 | t << "OBJMOC = "; | 196 | t << "OBJMOC = "; |
196 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { | 197 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { |
197 | bool increment = FALSE; | 198 | bool increment = FALSE; |
198 | for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { | 199 | for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { |
199 | if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { | 200 | if((*objit).find(QRegExp((*incrit), TRUE, TRUE)) != -1) { |
200 | increment = TRUE; | 201 | increment = TRUE; |
201 | incrs_out.append((*objit)); | 202 | incrs_out.append((*objit)); |
202 | break; | 203 | break; |
203 | } | 204 | } |
204 | } | 205 | } |
205 | if(!increment) | 206 | if(!increment) |
206 | t << "\\\n\t\t" << (*objit); | 207 | t << "\\\n\t\t" << (*objit); |
207 | } | 208 | } |
208 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! | 209 | if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done! |
209 | t << incrs_out.join(" \\\n\t\t") << endl; | 210 | t << incrs_out.join(" \\\n\t\t") << endl; |
210 | } else if(!incrs_out.count()) { | 211 | } else if(!incrs_out.count()) { |
211 | t << endl; | 212 | t << endl; |
212 | } else { | 213 | } else { |
213 | moc_incremental = TRUE; | 214 | moc_incremental = TRUE; |
214 | t << endl; | 215 | t << endl; |
215 | t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; | 216 | t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; |
216 | } | 217 | } |
217 | } else { | 218 | } else { |
218 | t << "OBJMOC = " << objMoc << endl; | 219 | t << "OBJMOC = " << objMoc << endl; |
219 | } | 220 | } |
220 | if(do_incremental && !moc_incremental && !src_incremental) | 221 | if(do_incremental && !moc_incremental && !src_incremental) |
221 | do_incremental = FALSE; | 222 | do_incremental = FALSE; |
222 | t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl; | 223 | t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl; |
223 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; | 224 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; |
224 | t << "DESTDIR = " << var("DESTDIR") << endl; | 225 | t << "DESTDIR = " << var("DESTDIR") << endl; |
225 | t << "TARGET = " << var("TARGET") << endl; | 226 | t << "TARGET = " << var("TARGET") << endl; |
226 | if(project->isActiveConfig("plugin") ) { | 227 | if(project->isActiveConfig("plugin") ) { |
227 | t << "TARGETD = " << var("TARGET") << endl; | 228 | t << "TARGETD = " << var("TARGET") << endl; |
228 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 229 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
229 | t << "TARGETA= " << var("TARGETA") << endl; | 230 | t << "TARGETA= " << var("TARGETA") << endl; |
230 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) { | 231 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) { |
231 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; | 232 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; |
232 | t << "TARGET0= " << var("TARGET_") << endl; | 233 | t << "TARGET0= " << var("TARGET_") << endl; |
233 | t << "TARGET1= " << var("TARGET_x") << endl; | 234 | t << "TARGET1= " << var("TARGET_x") << endl; |
234 | t << "TARGET2= " << var("TARGET_x.y") << endl; | 235 | t << "TARGET2= " << var("TARGET_x.y") << endl; |
235 | } else { | 236 | } else { |
236 | t << "TARGETD= " << var("TARGET_x") << endl; | 237 | t << "TARGETD= " << var("TARGET_x") << endl; |
237 | t << "TARGET0= " << var("TARGET_") << endl; | 238 | t << "TARGET0= " << var("TARGET_") << endl; |
238 | } | 239 | } |
239 | } | 240 | } |
240 | t << endl; | 241 | t << endl; |
241 | 242 | ||
242 | // blasted incldues | 243 | // blasted incldues |
243 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; | 244 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; |
244 | QStringList::Iterator it; | 245 | QStringList::Iterator it; |
245 | for( it = qeui.begin(); it != qeui.end(); ++it) | 246 | for( it = qeui.begin(); it != qeui.end(); ++it) |
246 | t << "include " << (*it) << endl; | 247 | t << "include " << (*it) << endl; |
247 | 248 | ||
248 | /* rules */ | 249 | /* rules */ |
249 | t << "first: all" << endl; | 250 | t << "first: all" << endl; |
250 | t << "####### Implicit rules" << endl << endl; | 251 | t << "####### Implicit rules" << endl << endl; |
251 | t << ".SUFFIXES: .c"; | 252 | t << ".SUFFIXES: .c"; |
252 | QStringList::Iterator cppit; | 253 | QStringList::Iterator cppit; |
253 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 254 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
254 | t << " " << (*cppit); | 255 | t << " " << (*cppit); |
255 | t << endl << endl; | 256 | t << endl << endl; |
256 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 257 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
257 | t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 258 | t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
258 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | 259 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
259 | 260 | ||
260 | if(include_deps) { | 261 | if(include_deps) { |
261 | QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; | 262 | QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; |
262 | cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); | 263 | cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); |
263 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 264 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
264 | cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; | 265 | cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; |
265 | cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); | 266 | cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); |
266 | QString odir; | 267 | QString odir; |
267 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) | 268 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) |
268 | odir = project->first("OBJECTS_DIR"); | 269 | odir = project->first("OBJECTS_DIR"); |
269 | t << "###### Dependencies" << endl << endl; | 270 | t << "###### Dependencies" << endl << endl; |
270 | t << odir << ".deps/%.d: %.cpp\n\t" | 271 | t << odir << ".deps/%.d: %.cpp\n\t" |
271 | << "@echo Creating depend for $<" << "\n\t" | 272 | << "@echo Creating depend for $<" << "\n\t" |
272 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" | 273 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" |
273 | << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; | 274 | << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; |
274 | 275 | ||
275 | t << odir << ".deps/%.d: %.c\n\t" | 276 | t << odir << ".deps/%.d: %.c\n\t" |
276 | << "@echo Creating depend for $<" << "\n\t" | 277 | << "@echo Creating depend for $<" << "\n\t" |
277 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" | 278 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" |
278 | << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; | 279 | << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; |
279 | 280 | ||
280 | 281 | ||
281 | QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; | 282 | QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; |
282 | for(int x = 0; !src[x].isNull(); x++) { | 283 | for(int x = 0; !src[x].isNull(); x++) { |
283 | QStringList &l = project->variables()[src[x]]; | 284 | QStringList &l = project->variables()[src[x]]; |
284 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 285 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
285 | if(!(*it).isEmpty()) { | 286 | if(!(*it).isEmpty()) { |
286 | QString d_file; | 287 | QString d_file; |
287 | if((*it).endsWith(".c")) { | 288 | if((*it).endsWith(".c")) { |
288 | d_file = (*it).left((*it).length() - 2); | 289 | d_file = (*it).left((*it).length() - 2); |
289 | } else { | 290 | } else { |
290 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 291 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
291 | cppit != Option::cpp_ext.end(); ++cppit) { | 292 | cppit != Option::cpp_ext.end(); ++cppit) { |
292 | if((*it).endsWith((*cppit))) { | 293 | if((*it).endsWith((*cppit))) { |
293 | d_file = (*it).left((*it).length() - (*cppit).length()); | 294 | d_file = (*it).left((*it).length() - (*cppit).length()); |
294 | break; | 295 | break; |
295 | } | 296 | } |
296 | } | 297 | } |
297 | } | 298 | } |
298 | if(!d_file.isEmpty()) { | 299 | if(!d_file.isEmpty()) { |
299 | d_file = odir + ".deps/" + d_file + ".d"; | 300 | d_file = odir + ".deps/" + d_file + ".d"; |
300 | QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$")); | 301 | QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$")); |
301 | if(!deps.isEmpty()) | 302 | if(!deps.isEmpty()) |
302 | t << d_file << ": " << deps.join(" ") << endl; | 303 | t << d_file << ": " << deps.join(" ") << endl; |
303 | t << "-include " << d_file << endl; | 304 | t << "-include " << d_file << endl; |
304 | } | 305 | } |
305 | } | 306 | } |
306 | } | 307 | } |
307 | } | 308 | } |
308 | } | 309 | } |
309 | 310 | ||
310 | t << "####### Build rules" << endl << endl; | 311 | t << "####### Build rules" << endl << endl; |
311 | if(!project->variables()["SUBLIBS"].isEmpty()) { | 312 | if(!project->variables()["SUBLIBS"].isEmpty()) { |
312 | QString libdir = "tmp/"; | 313 | QString libdir = "tmp/"; |
313 | if(!project->isEmpty("SUBLIBS_DIR")) | 314 | if(!project->isEmpty("SUBLIBS_DIR")) |
314 | libdir = project->first("SUBLIBS_DIR"); | 315 | libdir = project->first("SUBLIBS_DIR"); |
315 | t << "SUBLIBS= "; | 316 | t << "SUBLIBS= "; |
316 | QStringList &l = project->variables()["SUBLIBS"]; | 317 | QStringList &l = project->variables()["SUBLIBS"]; |
317 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) | 318 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) |
318 | t << libdir << "lib" << (*it) << ".a "; | 319 | t << libdir << "lib" << (*it) << ".a "; |
319 | t << endl << endl; | 320 | t << endl << endl; |
320 | } | 321 | } |
321 | if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { | 322 | if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { |
322 | QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; | 323 | QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; |
323 | QStringList::Iterator it; | 324 | QStringList::Iterator it; |
324 | for(it = l.begin(); it != l.end(); ++it) { | 325 | for(it = l.begin(); it != l.end(); ++it) { |
325 | QMakeProject proj; | 326 | QMakeProject proj; |
326 | if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) { | 327 | if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) { |
327 | QString dir; | 328 | QString dir; |
328 | int slsh = (*it).findRev(Option::dir_sep); | 329 | int slsh = (*it).findRev(Option::dir_sep); |
329 | if(slsh != -1) | 330 | if(slsh != -1) |
330 | dir = (*it).left(slsh + 1); | 331 | dir = (*it).left(slsh + 1); |
331 | QString targ = dir + proj.first("QMAKE_PRL_TARGET"); | 332 | QString targ = dir + proj.first("QMAKE_PRL_TARGET"); |
332 | deps += " " + targ; | 333 | deps += " " + targ; |
333 | t << targ << ":" << "\n\t" | 334 | t << targ << ":" << "\n\t" |
334 | << "@echo \"Creating '" << targ << "'\"" << "\n\t" | 335 | << "@echo \"Creating '" << targ << "'\"" << "\n\t" |
335 | << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";" | 336 | << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";" |
336 | << "$(MAKE) )" << endl; | 337 | << "$(MAKE) )" << endl; |
337 | } | 338 | } |
338 | } | 339 | } |
339 | } | 340 | } |
340 | if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 341 | if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
341 | QString destdir = project->first("DESTDIR"); | 342 | QString destdir = project->first("DESTDIR"); |
342 | if(do_incremental) { | 343 | if(do_incremental) { |
343 | //incremental target | 344 | //incremental target |
344 | QString incr_target = var("TARGET") + "_incremental"; | 345 | QString incr_target = var("TARGET") + "_incremental"; |
345 | if(incr_target.find(Option::dir_sep) != -1) | 346 | if(incr_target.find(Option::dir_sep) != -1) |
346 | incr_target = incr_target.right(incr_target.length() - | 347 | incr_target = incr_target.right(incr_target.length() - |
347 | (incr_target.findRev(Option::dir_sep) + 1)); | 348 | (incr_target.findRev(Option::dir_sep) + 1)); |
348 | QString incr_deps, incr_objs; | 349 | QString incr_deps, incr_objs; |
349 | if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { | 350 | if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { |
350 | QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; | 351 | QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; |
351 | //actual target | 352 | //actual target |
352 | t << incr_target_dir << ": $(OBJECTS)" << "\n\t" | 353 | t << incr_target_dir << ": $(OBJECTS)" << "\n\t" |
353 | << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl; | 354 | << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl; |
354 | //communicated below | 355 | //communicated below |
355 | deps.prepend(incr_target_dir + " "); | 356 | deps.prepend(incr_target_dir + " "); |
356 | incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)"; | 357 | incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC) $(OBJMOC)"; |
357 | if(!incr_objs.isEmpty()) | 358 | if(!incr_objs.isEmpty()) |
358 | incr_objs += " "; | 359 | incr_objs += " "; |
359 | incr_objs += incr_target_dir; | 360 | incr_objs += incr_target_dir; |
360 | } else { | 361 | } else { |
361 | //actual target | 362 | //actual target |
362 | QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + | 363 | QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + |
363 | project->variables()["QMAKE_EXTENSION_SHLIB"].first(); | 364 | project->variables()["QMAKE_EXTENSION_SHLIB"].first(); |
364 | QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; | 365 | QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; |
365 | if(project->isActiveConfig("debug")) | 366 | if(project->isActiveConfig("debug")) |
366 | incr_lflags += var("QMAKE_LFLAGS_DEBUG"); | 367 | incr_lflags += var("QMAKE_LFLAGS_DEBUG"); |
367 | else | 368 | else |
368 | incr_lflags += var("QMAKE_LFLAGS_RELEASE"); | 369 | incr_lflags += var("QMAKE_LFLAGS_RELEASE"); |
369 | t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; | 370 | t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; |
370 | if(!destdir.isEmpty()) | 371 | if(!destdir.isEmpty()) |
371 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 372 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
372 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << | 373 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << |
373 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; | 374 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; |
374 | //communicated below | 375 | //communicated below |
375 | if(!destdir.isEmpty()) { | 376 | if(!destdir.isEmpty()) { |
376 | if(!incr_objs.isEmpty()) | 377 | if(!incr_objs.isEmpty()) |
377 | incr_objs += " "; | 378 | incr_objs += " "; |
378 | incr_objs += "-L" + destdir; | 379 | incr_objs += "-L" + destdir; |
379 | } else { | 380 | } else { |
380 | if(!incr_objs.isEmpty()) | 381 | if(!incr_objs.isEmpty()) |
381 | incr_objs += " "; | 382 | incr_objs += " "; |
382 | incr_objs += "-L" + QDir::currentDirPath(); | 383 | incr_objs += "-L" + QDir::currentDirPath(); |
383 | } | 384 | } |
384 | if(!incr_objs.isEmpty()) | 385 | if(!incr_objs.isEmpty()) |
385 | incr_objs += " "; | 386 | incr_objs += " "; |
386 | incr_objs += " -l" + incr_target; | 387 | incr_objs += " -l" + incr_target; |
387 | deps.prepend(incr_target_dir + " "); | 388 | deps.prepend(incr_target_dir + " "); |
388 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 389 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
389 | } | 390 | } |
390 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" | 391 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" |
391 | << endl << endl; | 392 | << endl << endl; |
392 | 393 | ||
393 | //real target | 394 | //real target |
394 | t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps | 395 | t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps |
395 | << " " << var("POST_TARGETDEPS") << "\n\t"; | 396 | << " " << var("POST_TARGETDEPS") << "\n\t"; |
396 | if(!destdir.isEmpty()) | 397 | if(!destdir.isEmpty()) |
397 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 398 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
398 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 399 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
399 | t << var("QMAKE_PRE_LINK") << "\n\t"; | 400 | t << var("QMAKE_PRE_LINK") << "\n\t"; |
400 | t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; | 401 | t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; |
401 | if(!project->isEmpty("QMAKE_POST_LINK")) | 402 | if(!project->isEmpty("QMAKE_POST_LINK")) |
402 | t << "\n\t" << var("QMAKE_POST_LINK"); | 403 | t << "\n\t" << var("QMAKE_POST_LINK"); |
403 | t << endl << endl; | 404 | t << endl << endl; |
404 | } else { | 405 | } else { |
405 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" | 406 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" |
406 | << endl << endl; | 407 | << endl << endl; |
407 | 408 | ||
408 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 409 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
409 | << var("POST_TARGETDEPS") << "\n\t"; | 410 | << var("POST_TARGETDEPS") << "\n\t"; |
410 | if(!destdir.isEmpty()) | 411 | if(!destdir.isEmpty()) |
411 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 412 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
412 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 413 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
413 | t << var("QMAKE_PRE_LINK") << "\n\t"; | 414 | t << var("QMAKE_PRE_LINK") << "\n\t"; |
414 | t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; | 415 | t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; |
415 | if(!project->isEmpty("QMAKE_POST_LINK")) | 416 | if(!project->isEmpty("QMAKE_POST_LINK")) |
416 | t << "\n\t" << var("QMAKE_POST_LINK"); | 417 | t << "\n\t" << var("QMAKE_POST_LINK"); |
417 | t << endl << endl; | 418 | t << endl << endl; |
418 | } | 419 | } |
419 | } else if(!project->isActiveConfig("staticlib")) { | 420 | } else if(!project->isActiveConfig("staticlib")) { |
420 | QString destdir = project->first("DESTDIR"), incr_deps; | 421 | QString destdir = project->first("DESTDIR"), incr_deps; |
421 | if(do_incremental) { | 422 | if(do_incremental) { |
422 | QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); | 423 | QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); |
423 | QString incr_target = var("QMAKE_ORIG_TARGET").replace( | 424 | QString incr_target = var("QMAKE_ORIG_TARGET").replace( |
424 | QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; | 425 | QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; |
425 | if(incr_target.find(Option::dir_sep) != -1) | 426 | if(incr_target.find(Option::dir_sep) != -1) |
426 | incr_target = incr_target.right(incr_target.length() - | 427 | incr_target = incr_target.right(incr_target.length() - |
427 | (incr_target.findRev(Option::dir_sep) + 1)); | 428 | (incr_target.findRev(Option::dir_sep) + 1)); |
428 | 429 | ||
429 | if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { | 430 | if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") { |
430 | QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; | 431 | QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext; |
431 | //actual target | 432 | //actual target |
432 | const QString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 433 | const QString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
433 | t << incr_target_dir << ": " << link_deps << "\n\t" | 434 | t << incr_target_dir << ": " << link_deps << "\n\t" |
434 | << "ld -r -o " << incr_target_dir << " " << link_deps << endl; | 435 | << "ld -r -o " << incr_target_dir << " " << link_deps << endl; |
435 | //communicated below | 436 | //communicated below |
436 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; | 437 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; |
437 | cmd.first().replace("$(OBJECTS) $(OBJMOC)", | 438 | cmd.first().replace("$(OBJECTS) $(OBJMOC)", |
438 | "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick | 439 | "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"); //ick |
439 | cmd.append(incr_target_dir); | 440 | cmd.append(incr_target_dir); |
440 | deps.prepend(incr_target_dir + " "); | 441 | deps.prepend(incr_target_dir + " "); |
441 | incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 442 | incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
442 | } else { | 443 | } else { |
443 | //actual target | 444 | //actual target |
444 | QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext; | 445 | QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext; |
445 | QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; | 446 | QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " "; |
446 | if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL")) | 447 | if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL")) |
447 | incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " "; | 448 | incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " "; |
448 | if(project->isActiveConfig("debug")) | 449 | if(project->isActiveConfig("debug")) |
449 | incr_lflags += var("QMAKE_LFLAGS_DEBUG"); | 450 | incr_lflags += var("QMAKE_LFLAGS_DEBUG"); |
450 | else | 451 | else |
451 | incr_lflags += var("QMAKE_LFLAGS_RELEASE"); | 452 | incr_lflags += var("QMAKE_LFLAGS_RELEASE"); |
452 | t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; | 453 | t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << "\n\t"; |
453 | if(!destdir.isEmpty()) | 454 | if(!destdir.isEmpty()) |
454 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 455 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
455 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << | 456 | t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir << |
456 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; | 457 | " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)" << endl; |
457 | //communicated below | 458 | //communicated below |
458 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; | 459 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; |
459 | if(!destdir.isEmpty()) | 460 | if(!destdir.isEmpty()) |
460 | cmd.append(" -L" + destdir); | 461 | cmd.append(" -L" + destdir); |
461 | cmd.append(" -l" + incr_target); | 462 | cmd.append(" -l" + incr_target); |
462 | deps.prepend(incr_target_dir + " "); | 463 | deps.prepend(incr_target_dir + " "); |
463 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 464 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
464 | } | 465 | } |
465 | 466 | ||
466 | t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") | 467 | t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") |
467 | << " " << var("DESTDIR_TARGET") << endl << endl; | 468 | << " " << var("DESTDIR_TARGET") << endl << endl; |
468 | 469 | ||
469 | //real target | 470 | //real target |
470 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " | 471 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " |
471 | << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS"); | 472 | << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS"); |
472 | } else { | 473 | } else { |
473 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << | 474 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << |
474 | var("DESTDIR_TARGET") << endl << endl; | 475 | var("DESTDIR_TARGET") << endl << endl; |
475 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") | 476 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") |
476 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS"); | 477 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS"); |
477 | } | 478 | } |
478 | if(!destdir.isEmpty()) | 479 | if(!destdir.isEmpty()) |
479 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; | 480 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; |
480 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 481 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
481 | t << "\n\t" << var("QMAKE_PRE_LINK"); | 482 | t << "\n\t" << var("QMAKE_PRE_LINK"); |
482 | 483 | ||
483 | if(project->isActiveConfig("plugin")) { | 484 | if(project->isActiveConfig("plugin")) { |
484 | t << "\n\t" | 485 | t << "\n\t" |
485 | << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 486 | << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
486 | << var("QMAKE_LINK_SHLIB_CMD"); | 487 | << var("QMAKE_LINK_SHLIB_CMD"); |
487 | if(!destdir.isEmpty()) | 488 | if(!destdir.isEmpty()) |
488 | t << "\n\t" | 489 | t << "\n\t" |
489 | << "-$(MOVE) $(TARGET) " << var("DESTDIR"); | 490 | << "-$(MOVE) $(TARGET) " << var("DESTDIR"); |
490 | if(!project->isEmpty("QMAKE_POST_LINK")) | 491 | if(!project->isEmpty("QMAKE_POST_LINK")) |
491 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; | 492 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; |
492 | t << endl << endl; | 493 | t << endl << endl; |
493 | } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { | 494 | } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { |
494 | t << "\n\t" | 495 | t << "\n\t" |
495 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" | 496 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" |
496 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | 497 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; |
497 | t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" | 498 | t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t" |
498 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" | 499 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t" |
499 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); | 500 | << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)"); |
500 | if(!destdir.isEmpty()) | 501 | if(!destdir.isEmpty()) |
501 | t << "\n\t" | 502 | t << "\n\t" |
502 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | 503 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" |
503 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | 504 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" |
504 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" | 505 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t" |
505 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" | 506 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t" |
506 | << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); | 507 | << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR"); |
507 | if(!project->isEmpty("QMAKE_POST_LINK")) | 508 | if(!project->isEmpty("QMAKE_POST_LINK")) |
508 | t << "\n\t" << var("QMAKE_POST_LINK"); | 509 | t << "\n\t" << var("QMAKE_POST_LINK"); |
509 | t << endl << endl; | 510 | t << endl << endl; |
510 | } else { | 511 | } else { |
511 | t << "\n\t" | 512 | t << "\n\t" |
512 | << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" | 513 | << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t" |
513 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; | 514 | << var("QMAKE_LINK_SHLIB_CMD") << "\n\t"; |
514 | t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); | 515 | t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)"); |
515 | if(!destdir.isEmpty()) | 516 | if(!destdir.isEmpty()) |
516 | t << "\n\t" | 517 | t << "\n\t" |
517 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | 518 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" |
518 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | 519 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" |
519 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); | 520 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); |
520 | if(!project->isEmpty("QMAKE_POST_LINK")) | 521 | if(!project->isEmpty("QMAKE_POST_LINK")) |
521 | t << "\n\t" << var("QMAKE_POST_LINK"); | 522 | t << "\n\t" << var("QMAKE_POST_LINK"); |
522 | t << endl << endl; | 523 | t << endl << endl; |
523 | } | 524 | } |
524 | t << endl << endl; | 525 | t << endl << endl; |
525 | 526 | ||
526 | if (! project->isActiveConfig("plugin")) { | 527 | if (! project->isActiveConfig("plugin")) { |
527 | t << "staticlib: $(TARGETA)" << endl << endl; | 528 | t << "staticlib: $(TARGETA)" << endl << endl; |
528 | t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 529 | t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
529 | if(do_incremental) | 530 | if(do_incremental) |
530 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 531 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
531 | t << var("POST_TARGETDEPS") << "\n\t" | 532 | t << var("POST_TARGETDEPS") << "\n\t" |
532 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" | 533 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" |
533 | << var("QMAKE_AR_CMD"); | 534 | << var("QMAKE_AR_CMD"); |
534 | if(do_incremental) | 535 | if(do_incremental) |
535 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 536 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
536 | if(!project->isEmpty("QMAKE_RANLIB")) | 537 | if(!project->isEmpty("QMAKE_RANLIB")) |
537 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; | 538 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; |
538 | t << endl << endl; | 539 | t << endl << endl; |
539 | } | 540 | } |
540 | } else { | 541 | } else { |
541 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " | 542 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " |
542 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" | 543 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" |
543 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; | 544 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; |
544 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { | 545 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { |
545 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") | 546 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
546 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t"; | 547 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t"; |
547 | if(!project->isEmpty("DESTDIR")) { | 548 | if(!project->isEmpty("DESTDIR")) { |
548 | QString destdir = project->first("DESTDIR"); | 549 | QString destdir = project->first("DESTDIR"); |
549 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 550 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
550 | } | 551 | } |
551 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 552 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
552 | << var("QMAKE_AR_CMD") << "\n"; | 553 | << var("QMAKE_AR_CMD") << "\n"; |
553 | if(!project->isEmpty("QMAKE_POST_LINK")) | 554 | if(!project->isEmpty("QMAKE_POST_LINK")) |
554 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 555 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
555 | if(!project->isEmpty("QMAKE_RANLIB")) | 556 | if(!project->isEmpty("QMAKE_RANLIB")) |
556 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; | 557 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; |
557 | if(!project->isEmpty("DESTDIR")) | 558 | if(!project->isEmpty("DESTDIR")) |
558 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" | 559 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" |
559 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; | 560 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; |
560 | } else { | 561 | } else { |
561 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); | 562 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); |
562 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], | 563 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], |
563 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; | 564 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; |
564 | libs.prepend("$(TARGET)"); | 565 | libs.prepend("$(TARGET)"); |
565 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); | 566 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); |
566 | libit != libs.end(); ++libit) { | 567 | libit != libs.end(); ++libit) { |
567 | QStringList build; | 568 | QStringList build; |
568 | for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) | 569 | for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) |
569 | build << (*objit); | 570 | build << (*objit); |
570 | QString ar; | 571 | QString ar; |
571 | if((*libit) == "$(TARGET)") { | 572 | if((*libit) == "$(TARGET)") { |
572 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") | 573 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
573 | << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; | 574 | << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; |
574 | ar = project->variables()["QMAKE_AR_CMD"].first(); | 575 | ar = project->variables()["QMAKE_AR_CMD"].first(); |
575 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", | 576 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", |
576 | build.join(" ")); | 577 | build.join(" ")); |
577 | } else { | 578 | } else { |
578 | t << (*libit) << ": " << valList(build) << "\n\t"; | 579 | t << (*libit) << ": " << valList(build) << "\n\t"; |
579 | ar = "$(AR) " + (*libit) + " " + build.join(" "); | 580 | ar = "$(AR) " + (*libit) + " " + build.join(" "); |
580 | } | 581 | } |
581 | if(!project->isEmpty("DESTDIR")) { | 582 | if(!project->isEmpty("DESTDIR")) { |
582 | QString destdir = project->first("DESTDIR"); | 583 | QString destdir = project->first("DESTDIR"); |
583 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 584 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
584 | } | 585 | } |
585 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" | 586 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" |
586 | << ar << "\n"; | 587 | << ar << "\n"; |
587 | if(!project->isEmpty("QMAKE_POST_LINK")) | 588 | if(!project->isEmpty("QMAKE_POST_LINK")) |
588 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 589 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
589 | if(!project->isEmpty("QMAKE_RANLIB")) | 590 | if(!project->isEmpty("QMAKE_RANLIB")) |
590 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; | 591 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; |
591 | if(!project->isEmpty("DESTDIR")) | 592 | if(!project->isEmpty("DESTDIR")) |
592 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" | 593 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" |
593 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; | 594 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; |
594 | } | 595 | } |
595 | } | 596 | } |
596 | t << endl << endl; | 597 | t << endl << endl; |
597 | } | 598 | } |
598 | 599 | ||
599 | t << "mocables: $(SRCMOC)" << endl << endl; | 600 | t << "mocables: $(SRCMOC)" << endl << endl; |
600 | 601 | ||
601 | if(!project->isActiveConfig("no_mocdepend")) { | 602 | if(!project->isActiveConfig("no_mocdepend")) { |
602 | //this is an implicity depend on moc, so it will be built if necesary, however | 603 | //this is an implicity depend on moc, so it will be built if necesary, however |
603 | //moc itself shouldn't have this dependency - this is a little kludgy but it is | 604 | //moc itself shouldn't have this dependency - this is a little kludgy but it is |
604 | //better than the alternative for now. | 605 | //better than the alternative for now. |
605 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); | 606 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); |
606 | fixEnvVariables(target); | 607 | fixEnvVariables(target); |
607 | fixEnvVariables(moc); | 608 | fixEnvVariables(moc); |
608 | if(target != moc) | 609 | if(target != moc) |
609 | t << "$(MOC): \n\t" | 610 | t << "$(MOC): \n\t" |
610 | << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; | 611 | << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; |
611 | } | 612 | } |
612 | 613 | ||
613 | writeMakeQmake(t); | 614 | writeMakeQmake(t); |
614 | 615 | ||
615 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { | 616 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { |
616 | QString pkginfo = project->first("QMAKE_PKGINFO"); | 617 | QString pkginfo = project->first("QMAKE_PKGINFO"); |
617 | QString destdir = project->first("DESTDIR"); | 618 | QString destdir = project->first("DESTDIR"); |
618 | t << pkginfo << ": " << "\n\t"; | 619 | t << pkginfo << ": " << "\n\t"; |
619 | if(!destdir.isEmpty()) | 620 | if(!destdir.isEmpty()) |
620 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 621 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
621 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" | 622 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" |
622 | << "@echo \"APPL????\" >" << pkginfo << endl; | 623 | << "@echo \"APPL????\" >" << pkginfo << endl; |
623 | } | 624 | } |
624 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { | 625 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { |
625 | QString info_plist = project->first("QMAKE_INFO_PLIST"), | 626 | QString info_plist = project->first("QMAKE_INFO_PLIST"), |
626 | info_plist_out = project->first("QMAKE_INFO_PLIST_OUT"); | 627 | info_plist_out = project->first("QMAKE_INFO_PLIST_OUT"); |
627 | QString destdir = project->first("DESTDIR"); | 628 | QString destdir = project->first("DESTDIR"); |
628 | t << info_plist_out << ": " << "\n\t"; | 629 | t << info_plist_out << ": " << "\n\t"; |
629 | if(!destdir.isEmpty()) | 630 | if(!destdir.isEmpty()) |
630 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 631 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
631 | t << "@$(DEL_FILE) " << info_plist_out << "\n\t" | 632 | t << "@$(DEL_FILE) " << info_plist_out << "\n\t" |
632 | << "@cp \"" << info_plist << "\" \"" << info_plist_out << "\"" << endl; | 633 | << "@cp \"" << info_plist << "\" \"" << info_plist_out << "\"" << endl; |
633 | if(!project->first("RC_FILE").isEmpty()) { | 634 | if(!project->first("RC_FILE").isEmpty()) { |
634 | QString dir = destdir + "../Resources/"; | 635 | QString dir = destdir + "../Resources/"; |
635 | t << dir << "application.icns:" << "\n\t" | 636 | t << dir << "application.icns:" << "\n\t" |
636 | << "@test -d " << dir << " || mkdir -p " << dir << "\n\t" | 637 | << "@test -d " << dir << " || mkdir -p " << dir << "\n\t" |
637 | << "@cp " << var("RC_FILE") << " " << dir << "application.icns" << endl; | 638 | << "@cp " << var("RC_FILE") << " " << dir << "application.icns" << endl; |
638 | } | 639 | } |
639 | } | 640 | } |
640 | 641 | ||
641 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : | 642 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : |
642 | project->first("QMAKE_DISTDIR"); | 643 | project->first("QMAKE_DISTDIR"); |
643 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : | 644 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : |
644 | project->first("OBJECTS_DIR")) + ddir); | 645 | project->first("OBJECTS_DIR")) + ddir); |
645 | t << "dist: " << "\n\t" | 646 | t << "dist: " << "\n\t" |
646 | << "@mkdir -p " << ddir_c << " && " | 647 | << "@mkdir -p " << ddir_c << " && " |
647 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; | 648 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; |
648 | if(!project->isEmpty("TRANSLATIONS")) | 649 | if(!project->isEmpty("TRANSLATIONS")) |
649 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; | 650 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; |
650 | if(!project->isEmpty("FORMS")) { | 651 | if(!project->isEmpty("FORMS")) { |
651 | QStringList &forms = project->variables()["FORMS"], ui_headers; | 652 | QStringList &forms = project->variables()["FORMS"], ui_headers; |
652 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | 653 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { |
653 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | 654 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); |
654 | if(QFile::exists(ui_h) ) | 655 | if(QFile::exists(ui_h) ) |
655 | ui_headers << ui_h; | 656 | ui_headers << ui_h; |
656 | } | 657 | } |
657 | if(!ui_headers.isEmpty()) | 658 | if(!ui_headers.isEmpty()) |
658 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; | 659 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; |
659 | } | 660 | } |
660 | t << "( cd `dirname " << ddir_c << "` && " | 661 | t << "( cd `dirname " << ddir_c << "` && " |
661 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " | 662 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " |
662 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " | 663 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " |
663 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " | 664 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " |
664 | << "$(DEL_FILE) -r " << ddir_c | 665 | << "$(DEL_FILE) -r " << ddir_c |
665 | << endl << endl; | 666 | << endl << endl; |
666 | 667 | ||
667 | QString clean_targets; | 668 | QString clean_targets; |
668 | if(mocAware()) { | 669 | if(mocAware()) { |
669 | t << "mocclean:" << "\n"; | 670 | t << "mocclean:" << "\n"; |
670 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { | 671 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { |
671 | if(!objMoc.isEmpty()) | 672 | if(!objMoc.isEmpty()) |
672 | t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; | 673 | t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; |
673 | if(!srcMoc.isEmpty()) | 674 | if(!srcMoc.isEmpty()) |
674 | t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; | 675 | t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; |
675 | if(moc_incremental) | 676 | if(moc_incremental) |
676 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; | 677 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; |
677 | clean_targets += " mocclean"; | 678 | clean_targets += " mocclean"; |
678 | } | 679 | } |
679 | t << endl; | 680 | t << endl; |
680 | } | 681 | } |
681 | t << "uiclean:" << "\n"; | 682 | t << "uiclean:" << "\n"; |
682 | if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) { | 683 | if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) { |
683 | t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n"; | 684 | t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n"; |
684 | clean_targets += " uiclean"; | 685 | clean_targets += " uiclean"; |
685 | } | 686 | } |
686 | t << endl; | 687 | t << endl; |
687 | 688 | ||
688 | t << "yaccclean:" << "\n"; | 689 | t << "yaccclean:" << "\n"; |
689 | if(!var("YACCSOURCES").isEmpty()) { | 690 | if(!var("YACCSOURCES").isEmpty()) { |
690 | QStringList clean, &l = project->variables()["YACCSOURCES"]; | 691 | QStringList clean, &l = project->variables()["YACCSOURCES"]; |
691 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 692 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
692 | QFileInfo fi((*it)); | 693 | QFileInfo fi((*it)); |
693 | QString dir; | 694 | QString dir; |
694 | if(fi.dirPath() != ".") | 695 | if(fi.dirPath() != ".") |
695 | dir = fi.dirPath() + Option::dir_sep; | 696 | dir = fi.dirPath() + Option::dir_sep; |
696 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 697 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
697 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 698 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
698 | dir += Option::dir_sep; | 699 | dir += Option::dir_sep; |
699 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | 700 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); |
700 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | 701 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); |
701 | } | 702 | } |
702 | if(!clean.isEmpty()) { | 703 | if(!clean.isEmpty()) { |
703 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | 704 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; |
704 | clean_targets += " yaccclean"; | 705 | clean_targets += " yaccclean"; |
705 | } | 706 | } |
706 | } | 707 | } |
707 | 708 | ||
708 | t << "lexclean:" << "\n"; | 709 | t << "lexclean:" << "\n"; |
709 | if(!var("LEXSOURCES").isEmpty()) { | 710 | if(!var("LEXSOURCES").isEmpty()) { |
710 | QStringList clean, &l = project->variables()["LEXSOURCES"]; | 711 | QStringList clean, &l = project->variables()["LEXSOURCES"]; |
711 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 712 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
712 | QFileInfo fi((*it)); | 713 | QFileInfo fi((*it)); |
713 | QString dir; | 714 | QString dir; |
714 | if(fi.dirPath() != ".") | 715 | if(fi.dirPath() != ".") |
715 | dir = fi.dirPath() + Option::dir_sep; | 716 | dir = fi.dirPath() + Option::dir_sep; |
716 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 717 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
717 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 718 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
718 | dir += Option::dir_sep; | 719 | dir += Option::dir_sep; |
719 | clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | 720 | clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); |
720 | } | 721 | } |
721 | if(!clean.isEmpty()) { | 722 | if(!clean.isEmpty()) { |
722 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | 723 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; |
723 | clean_targets += " lexclean"; | 724 | clean_targets += " lexclean"; |
724 | } | 725 | } |
725 | } | 726 | } |
726 | 727 | ||
727 | if(do_incremental) { | 728 | if(do_incremental) { |
728 | t << "incrclean:" << "\n"; | 729 | t << "incrclean:" << "\n"; |
729 | if(src_incremental) | 730 | if(src_incremental) |
730 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; | 731 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; |
731 | if(moc_incremental) | 732 | if(moc_incremental) |
732 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; | 733 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; |
733 | t << endl; | 734 | t << endl; |
734 | } | 735 | } |
735 | 736 | ||
736 | t << "clean:" << clean_targets << "\n\t"; | 737 | t << "clean:" << clean_targets << "\n\t"; |
737 | if(!project->isEmpty("OBJECTS")) | 738 | if(!project->isEmpty("OBJECTS")) |
738 | t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t"; | 739 | t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t"; |
739 | if(!project->isEmpty("IMAGES")) | 740 | if(!project->isEmpty("IMAGES")) |
740 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; | 741 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; |
741 | if(src_incremental) | 742 | if(src_incremental) |
742 | t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; | 743 | t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; |
743 | t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") | 744 | t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") |
744 | << "-$(DEL_FILE) *~ core *.core" << "\n" | 745 | << "-$(DEL_FILE) *~ core *.core" << "\n" |
745 | << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; | 746 | << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; |
746 | t << "####### Sub-libraries" << endl << endl; | 747 | t << "####### Sub-libraries" << endl << endl; |
747 | if ( !project->variables()["SUBLIBS"].isEmpty() ) { | 748 | if ( !project->variables()["SUBLIBS"].isEmpty() ) { |
748 | QString libdir = "tmp/"; | 749 | QString libdir = "tmp/"; |
749 | if(!project->isEmpty("SUBLIBS_DIR")) | 750 | if(!project->isEmpty("SUBLIBS_DIR")) |
750 | libdir = project->first("SUBLIBS_DIR"); | 751 | libdir = project->first("SUBLIBS_DIR"); |
751 | QStringList &l = project->variables()["SUBLIBS"]; | 752 | QStringList &l = project->variables()["SUBLIBS"]; |
752 | for(it = l.begin(); it != l.end(); ++it) | 753 | for(it = l.begin(); it != l.end(); ++it) |
753 | t << libdir << "lib" << (*it) << ".a" << ":\n\t" | 754 | t << libdir << "lib" << (*it) << ".a" << ":\n\t" |
754 | << var(QString("MAKELIB") + (*it)) << endl << endl; | 755 | << var(QString("MAKELIB") + (*it)) << endl << endl; |
755 | } | 756 | } |
756 | 757 | ||
757 | QString destdir = project->first("DESTDIR"); | 758 | QString destdir = project->first("DESTDIR"); |
758 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 759 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
759 | destdir += Option::dir_sep; | 760 | destdir += Option::dir_sep; |
760 | t << "distclean: " << "clean\n"; | 761 | t << "distclean: " << "clean\n"; |
761 | if(project->first("TEMPLATE") == "app" && | 762 | if(project->first("TEMPLATE") == "app" && |
762 | project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | 763 | project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) |
763 | t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n"; | 764 | t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n"; |
764 | else | 765 | else |
765 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; | 766 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; |
766 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && | 767 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && |
767 | !project->isActiveConfig("plugin")) | 768 | !project->isActiveConfig("plugin")) |
768 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " | 769 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " |
769 | << destdir << "$(TARGET2) $(TARGETA)" << "\n"; | 770 | << destdir << "$(TARGET2) $(TARGETA)" << "\n"; |
770 | t << endl << endl; | 771 | t << endl << endl; |
771 | 772 | ||
772 | if ( !project->isEmpty("PRECOMPH") ) { | 773 | if ( !project->isEmpty("PRECOMPH") ) { |
773 | QString outdir = project->first("MOC_DIR"); | 774 | QString outdir = project->first("MOC_DIR"); |
774 | QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH")); | 775 | QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH")); |
775 | t << "###### Combined headers" << endl << endl; | 776 | t << "###### Combined headers" << endl << endl; |
776 | //XXX | 777 | //XXX |
777 | t << outdir << "allmoc.cpp: " << qt_dot_h << " " | 778 | t << outdir << "allmoc.cpp: " << qt_dot_h << " " |
778 | << varList("HEADERS_ORIG") << "\n\t" | 779 | << varList("HEADERS_ORIG") << "\n\t" |
779 | << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t" | 780 | << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t" |
780 | << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " | 781 | << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " |
781 | << outdir << "allmoc.cpp" << "\n\t" | 782 | << outdir << "allmoc.cpp" << "\n\t" |
782 | << "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t" | 783 | << "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t" |
783 | << "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \"" | 784 | << "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \"" |
784 | << qt_dot_h << "\"}' " << outdir << "allmoc.cpp" << "\n\t" | 785 | << qt_dot_h << "\"}' " << outdir << "allmoc.cpp" << "\n\t" |
785 | << "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl; | 786 | << "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl; |
786 | } | 787 | } |
787 | 788 | ||
788 | // blasted user defined targets | 789 | // blasted user defined targets |
789 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | 790 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; |
790 | for(it = qut.begin(); it != qut.end(); ++it) { | 791 | for(it = qut.begin(); it != qut.end(); ++it) { |
791 | QString targ = var((*it) + ".target"), | 792 | QString targ = var((*it) + ".target"), |
792 | cmd = var((*it) + ".commands"), deps; | 793 | cmd = var((*it) + ".commands"), deps; |
793 | if(targ.isEmpty()) | 794 | if(targ.isEmpty()) |
794 | targ = (*it); | 795 | targ = (*it); |
795 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 796 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
796 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 797 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
797 | QString dep = var((*dep_it) + ".target"); | 798 | QString dep = var((*dep_it) + ".target"); |
798 | if(dep.isEmpty()) | 799 | if(dep.isEmpty()) |
799 | dep = (*dep_it); | 800 | dep = (*dep_it); |
800 | deps += " " + dep; | 801 | deps += " " + dep; |
801 | } | 802 | } |
802 | t << targ << ":" << deps << "\n\t" | 803 | t << targ << ":" << deps << "\n\t" |
803 | << cmd << endl << endl; | 804 | << cmd << endl << endl; |
804 | } | 805 | } |
805 | t <<"FORCE:" << endl << endl; | 806 | t <<"FORCE:" << endl << endl; |
806 | } | 807 | } |
807 | 808 | ||
808 | struct SubDir | 809 | struct SubDir |
809 | { | 810 | { |
810 | QString directory, profile, target, makefile; | 811 | QString directory, profile, target, makefile; |
811 | }; | 812 | }; |
812 | 813 | ||
813 | void | 814 | void |
814 | UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | 815 | UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) |
815 | { | 816 | { |
816 | QPtrList<SubDir> subdirs; | 817 | QPtrList<SubDir> subdirs; |
817 | { | 818 | { |
818 | QStringList subdirs_in = project->variables()["SUBDIRS"]; | 819 | QStringList subdirs_in = project->variables()["SUBDIRS"]; |
819 | for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { | 820 | for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { |
820 | QString file = (*it); | 821 | QString file = (*it); |
821 | fileFixify(file); | 822 | fileFixify(file); |
822 | SubDir *sd = new SubDir; | 823 | SubDir *sd = new SubDir; |
823 | subdirs.append(sd); | 824 | subdirs.append(sd); |
824 | sd->makefile = "$(MAKEFILE)"; | 825 | sd->makefile = "$(MAKEFILE)"; |
825 | if((*it).right(4) == ".pro") { | 826 | if((*it).right(4) == ".pro") { |
826 | int slsh = file.findRev(Option::dir_sep); | 827 | int slsh = file.findRev(Option::dir_sep); |
827 | if(slsh != -1) { | 828 | if(slsh != -1) { |
828 | sd->directory = file.left(slsh+1); | 829 | sd->directory = file.left(slsh+1); |
829 | sd->profile = file.mid(slsh+1); | 830 | sd->profile = file.mid(slsh+1); |
830 | } else { | 831 | } else { |
831 | sd->profile = file; | 832 | sd->profile = file; |
832 | } | 833 | } |
833 | } else { | 834 | } else { |
834 | sd->directory = file; | 835 | sd->directory = file; |
835 | } | 836 | } |
836 | while(sd->directory.right(1) == Option::dir_sep) | 837 | while(sd->directory.right(1) == Option::dir_sep) |
837 | sd->directory = sd->directory.left(sd->directory.length() - 1); | 838 | sd->directory = sd->directory.left(sd->directory.length() - 1); |
838 | if(!sd->profile.isEmpty()) { | 839 | if(!sd->profile.isEmpty()) { |
839 | QString basename = sd->directory; | 840 | QString basename = sd->directory; |
840 | int new_slsh = basename.findRev(Option::dir_sep); | 841 | int new_slsh = basename.findRev(Option::dir_sep); |
841 | if(new_slsh != -1) | 842 | if(new_slsh != -1) |
842 | basename = basename.mid(new_slsh+1); | 843 | basename = basename.mid(new_slsh+1); |
843 | if(sd->profile != basename + ".pro") | 844 | if(sd->profile != basename + ".pro") |
844 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro | 845 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro |
845 | } | 846 | } |
846 | sd->target = "sub-" + (*it); | 847 | sd->target = "sub-" + (*it); |
847 | sd->target.replace('/', '-'); | 848 | sd->target.replace('/', '-'); |
848 | sd->target.replace('.', '_'); | 849 | sd->target.replace('.', '_'); |
849 | } | 850 | } |
850 | } | 851 | } |
851 | QPtrListIterator<SubDir> it(subdirs); | 852 | QPtrListIterator<SubDir> it(subdirs); |
852 | 853 | ||
853 | QString ofile = Option::output.name(); | 854 | QString ofile = Option::output.name(); |
854 | if(ofile.findRev(Option::dir_sep) != -1) | 855 | if(ofile.findRev(Option::dir_sep) != -1) |
855 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); | 856 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); |
856 | t << "MAKEFILE =" << var("MAKEFILE") << endl; | 857 | t << "MAKEFILE =" << var("MAKEFILE") << endl; |
857 | t << "QMAKE =" << var("QMAKE") << endl; | 858 | t << "QMAKE =" << var("QMAKE") << endl; |
858 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 859 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
859 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory | 860 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory |
860 | for( it.toFirst(); it.current(); ++it) | 861 | for( it.toFirst(); it.current(); ++it) |
861 | t << " \\\n\t\t" << it.current()->target; | 862 | t << " \\\n\t\t" << it.current()->target; |
862 | t << endl << endl; | 863 | t << endl << endl; |
863 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; | 864 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; |
864 | 865 | ||
865 | // generate target rules | 866 | // generate target rules |
866 | for( it.toFirst(); it.current(); ++it) { | 867 | for( it.toFirst(); it.current(); ++it) { |
867 | bool have_dir = !(*it)->directory.isEmpty(); | 868 | bool have_dir = !(*it)->directory.isEmpty(); |
868 | QString mkfile = (*it)->makefile, out; | 869 | QString mkfile = (*it)->makefile, out; |
869 | if(have_dir) | 870 | if(have_dir) |
870 | mkfile.prepend((*it)->directory + Option::dir_sep); | 871 | mkfile.prepend((*it)->directory + Option::dir_sep); |
871 | if(direct || (*it)->makefile != "$(MAKEFILE)") | 872 | if(direct || (*it)->makefile != "$(MAKEFILE)") |
872 | out = " -o " + (*it)->makefile; | 873 | out = " -o " + (*it)->makefile; |
873 | //qmake it | 874 | //qmake it |
874 | t << mkfile << ": " << "\n\t"; | 875 | t << mkfile << ": " << "\n\t"; |
875 | if(have_dir) | 876 | if(have_dir) |
876 | t << "cd " << (*it)->directory << " && "; | 877 | t << "cd " << (*it)->directory << " && "; |
877 | t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; | 878 | t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; |
878 | //actually compile | 879 | //actually compile |
879 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; | 880 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; |
880 | if(have_dir) | 881 | if(have_dir) |
881 | t << "cd " << (*it)->directory << " && "; | 882 | t << "cd " << (*it)->directory << " && "; |
882 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; | 883 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; |
883 | } | 884 | } |
884 | 885 | ||
885 | if (project->isActiveConfig("ordered")) { // generate dependencies | 886 | if (project->isActiveConfig("ordered")) { // generate dependencies |
886 | for( it.toFirst(); it.current(); ) { | 887 | for( it.toFirst(); it.current(); ) { |
887 | QString tar = it.current()->target; | 888 | QString tar = it.current()->target; |
888 | ++it; | 889 | ++it; |
889 | if (it.current()) | 890 | if (it.current()) |
890 | t << it.current()->target << ": " << tar << endl; | 891 | t << it.current()->target << ": " << tar << endl; |
891 | } | 892 | } |
892 | t << endl; | 893 | t << endl; |
893 | } | 894 | } |
894 | 895 | ||
895 | writeMakeQmake(t); | 896 | writeMakeQmake(t); |
896 | 897 | ||
897 | if(project->isEmpty("SUBDIRS")) { | 898 | if(project->isEmpty("SUBDIRS")) { |
898 | t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl; | 899 | t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl; |
899 | } else { | 900 | } else { |
900 | t << "all: $(SUBTARGETS)" << endl; | 901 | t << "all: $(SUBTARGETS)" << endl; |
901 | t << "qmake_all:"; | 902 | t << "qmake_all:"; |
902 | for( it.toFirst(); it.current(); ++it) { | 903 | for( it.toFirst(); it.current(); ++it) { |
903 | t << " "; | 904 | t << " "; |
904 | if(!(*it)->directory.isEmpty()) | 905 | if(!(*it)->directory.isEmpty()) |
905 | t << (*it)->directory << Option::dir_sep; | 906 | t << (*it)->directory << Option::dir_sep; |
906 | t << (*it)->makefile; | 907 | t << (*it)->makefile; |
907 | } | 908 | } |
908 | for( it.toFirst(); it.current(); ++it) { | 909 | for( it.toFirst(); it.current(); ++it) { |
909 | t << "\n\t ( "; | 910 | t << "\n\t ( "; |
910 | if(!(*it)->directory.isEmpty()) | 911 | if(!(*it)->directory.isEmpty()) |
911 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 912 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
912 | t << "grep \"^qmake_all:\" " << (*it)->makefile | 913 | t << "grep \"^qmake_all:\" " << (*it)->makefile |
913 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; | 914 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; |
914 | } | 915 | } |
915 | t << endl; | 916 | t << endl; |
916 | t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE"; | 917 | t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE"; |
917 | for( it.toFirst(); it.current(); ++it) { | 918 | for( it.toFirst(); it.current(); ++it) { |
918 | t << "\n\t ( "; | 919 | t << "\n\t ( "; |
919 | if(!(*it)->directory.isEmpty()) | 920 | if(!(*it)->directory.isEmpty()) |
920 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 921 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
921 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; | 922 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; |
922 | } | 923 | } |
923 | t << endl; | 924 | t << endl; |
924 | t << "distclean: qmake_all FORCE"; | 925 | t << "distclean: qmake_all FORCE"; |
925 | for( it.toFirst(); it.current(); ++it) { | 926 | for( it.toFirst(); it.current(); ++it) { |
926 | t << "\n\t ( "; | 927 | t << "\n\t ( "; |
927 | if(!(*it)->directory.isEmpty()) | 928 | if(!(*it)->directory.isEmpty()) |
928 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 929 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
929 | t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; | 930 | t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; |
930 | } | 931 | } |
931 | t << endl << endl; | 932 | t << endl << endl; |
932 | } | 933 | } |
933 | t <<"FORCE:" << endl << endl; | 934 | t <<"FORCE:" << endl << endl; |
934 | } | 935 | } |
935 | 936 | ||
936 | void UnixMakefileGenerator::init2() | 937 | void UnixMakefileGenerator::init2() |
937 | { | 938 | { |
938 | //version handling | 939 | //version handling |
939 | if(project->variables()["VERSION"].isEmpty()) | 940 | if(project->variables()["VERSION"].isEmpty()) |
940 | project->variables()["VERSION"].append("1.0." + | 941 | project->variables()["VERSION"].append("1.0." + |
941 | (project->isEmpty("VER_PAT") ? QString("0") : | 942 | (project->isEmpty("VER_PAT") ? QString("0") : |
942 | project->first("VER_PAT")) ); | 943 | project->first("VER_PAT")) ); |
943 | QStringList l = QStringList::split('.', project->first("VERSION")); | 944 | QStringList l = QStringList::split('.', project->first("VERSION")); |
944 | l << "0" << "0"; //make sure there are three | 945 | l << "0" << "0"; //make sure there are three |
945 | project->variables()["VER_MAJ"].append(l[0]); | 946 | project->variables()["VER_MAJ"].append(l[0]); |
946 | project->variables()["VER_MIN"].append(l[1]); | 947 | project->variables()["VER_MIN"].append(l[1]); |
947 | project->variables()["VER_PAT"].append(l[2]); | 948 | project->variables()["VER_PAT"].append(l[2]); |
948 | 949 | ||
949 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 950 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
950 | #if 0 | 951 | #if 0 |
951 | if ( project->isActiveConfig("dll") ) { | 952 | if ( project->isActiveConfig("dll") ) { |
952 | project->variables()["TARGET"] += project->variables()["TARGET.so"]; | 953 | project->variables()["TARGET"] += project->variables()["TARGET.so"]; |
953 | if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty()) | 954 | if(project->variables()["QMAKE_LFLAGS_SHAPP"].isEmpty()) |
954 | project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; | 955 | project->variables()["QMAKE_LFLAGS_SHAPP"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; |
955 | if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) | 956 | if(!project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) |
956 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); | 957 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); |
957 | } | 958 | } |
958 | #endif | 959 | #endif |
959 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 960 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); |
960 | if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() ) | 961 | if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() ) |
961 | project->variables()["TARGET_EXT"].append(".exe"); | 962 | project->variables()["TARGET_EXT"].append(".exe"); |
962 | } else if ( project->isActiveConfig("staticlib") ) { | 963 | } else if ( project->isActiveConfig("staticlib") ) { |
963 | project->variables()["TARGET"].first().prepend("lib"); | 964 | project->variables()["TARGET"].first().prepend("lib"); |
964 | project->variables()["TARGET"].first() += ".a"; | 965 | project->variables()["TARGET"].first() += ".a"; |
965 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) | 966 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) |
966 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); | 967 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); |
967 | } else { | 968 | } else { |
968 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); | 969 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); |
969 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) | 970 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) |
970 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); | 971 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); |
971 | else | 972 | else |
972 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); | 973 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); |
973 | if( project->isActiveConfig("plugin") ) { | 974 | if( project->isActiveConfig("plugin") ) { |
974 | project->variables()["TARGET_x.y.z"].append("lib" + | 975 | project->variables()["TARGET_x.y.z"].append("lib" + |
975 | project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); | 976 | project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); |
976 | if(project->isActiveConfig("lib_version_first")) | 977 | if(project->isActiveConfig("lib_version_first")) |
977 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 978 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
978 | project->first("VER_MAJ") + "." + | 979 | project->first("VER_MAJ") + "." + |
979 | project->first("QMAKE_EXTENSION_SHLIB")); | 980 | project->first("QMAKE_EXTENSION_SHLIB")); |
980 | else | 981 | else |
981 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 982 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
982 | project->first("QMAKE_EXTENSION_SHLIB") + | 983 | project->first("QMAKE_EXTENSION_SHLIB") + |
983 | "." + project->first("VER_MAJ")); | 984 | "." + project->first("VER_MAJ")); |
984 | 985 | ||
985 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 986 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
986 | if(project->isActiveConfig("qt")) | 987 | if(project->isActiveConfig("qt")) |
987 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 988 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
988 | } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) { | 989 | } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
989 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); | 990 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); |
990 | if(project->isActiveConfig("lib_version_first")) | 991 | if(project->isActiveConfig("lib_version_first")) |
991 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + | 992 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + |
992 | project->first("TARGET")); | 993 | project->first("TARGET")); |
993 | else | 994 | else |
994 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 995 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
995 | project->first("VER_MAJ")); | 996 | project->first("VER_MAJ")); |
996 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; | 997 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; |
997 | } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) { | 998 | } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) { |
998 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); | 999 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); |
999 | if(project->isActiveConfig("lib_version_first")) { | 1000 | if(project->isActiveConfig("lib_version_first")) { |
1000 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1001 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1001 | project->first("VER_MAJ") + "." + | 1002 | project->first("VER_MAJ") + "." + |
1002 | project->first("QMAKE_EXTENSION_SHLIB")); | 1003 | project->first("QMAKE_EXTENSION_SHLIB")); |
1003 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1004 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1004 | project->first("VER_MAJ") + | 1005 | project->first("VER_MAJ") + |
1005 | "." + project->first("VER_MIN") + "." + | 1006 | "." + project->first("VER_MIN") + "." + |
1006 | project->first("QMAKE_EXTENSION_SHLIB")); | 1007 | project->first("QMAKE_EXTENSION_SHLIB")); |
1007 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + | 1008 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + |
1008 | project->first("VER_MAJ") + "." + | 1009 | project->first("VER_MAJ") + "." + |
1009 | project->first("VER_MIN") + "." + | 1010 | project->first("VER_MIN") + "." + |
1010 | project->first("VER_PAT") + "." + | 1011 | project->first("VER_PAT") + "." + |
1011 | project->first("QMAKE_EXTENSION_SHLIB")); | 1012 | project->first("QMAKE_EXTENSION_SHLIB")); |
1012 | } else { | 1013 | } else { |
1013 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1014 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1014 | project->first("QMAKE_EXTENSION_SHLIB") + | 1015 | project->first("QMAKE_EXTENSION_SHLIB") + |
1015 | "." + project->first("VER_MAJ")); | 1016 | "." + project->first("VER_MAJ")); |
1016 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1017 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1017 | project->first("QMAKE_EXTENSION_SHLIB") + | 1018 | project->first("QMAKE_EXTENSION_SHLIB") + |
1018 | "." + project->first("VER_MAJ") + | 1019 | "." + project->first("VER_MAJ") + |
1019 | "." + project->first("VER_MIN")); | 1020 | "." + project->first("VER_MIN")); |
1020 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + | 1021 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + |
1021 | project->first("QMAKE_EXTENSION_SHLIB") + "." + | 1022 | project->first("QMAKE_EXTENSION_SHLIB") + "." + |
1022 | project->first("VER_MAJ") + "." + | 1023 | project->first("VER_MAJ") + "." + |
1023 | project->first("VER_MIN") + "." + | 1024 | project->first("VER_MIN") + "." + |
1024 | project->first("VER_PAT")); | 1025 | project->first("VER_PAT")); |
1025 | } | 1026 | } |
1026 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 1027 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
1027 | } else { | 1028 | } else { |
1028 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + "." + | 1029 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + "." + |
1029 | project->first("QMAKE_EXTENSION_SHLIB")); | 1030 | project->first("QMAKE_EXTENSION_SHLIB")); |
1030 | if(project->isActiveConfig("lib_version_first")) { | 1031 | if(project->isActiveConfig("lib_version_first")) { |
1031 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1032 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1032 | project->first("VER_MAJ") + "." + | 1033 | project->first("VER_MAJ") + "." + |
1033 | project->first("QMAKE_EXTENSION_SHLIB")); | 1034 | project->first("QMAKE_EXTENSION_SHLIB")); |
1034 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1035 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1035 | project->first("VER_MAJ") + | 1036 | project->first("VER_MAJ") + |
1036 | "." + project->first("VER_MIN") + "." + | 1037 | "." + project->first("VER_MIN") + "." + |
1037 | project->first("QMAKE_EXTENSION_SHLIB")); | 1038 | project->first("QMAKE_EXTENSION_SHLIB")); |
1038 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + | 1039 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." + |
1039 | project->first("VER_MAJ") + "." + | 1040 | project->first("VER_MAJ") + "." + |
1040 | project->first("VER_MIN") + "." + | 1041 | project->first("VER_MIN") + "." + |
1041 | project->first("VER_PAT") + "." + | 1042 | project->first("VER_PAT") + "." + |
1042 | project->variables()["QMAKE_EXTENSION_SHLIB"].first()); | 1043 | project->variables()["QMAKE_EXTENSION_SHLIB"].first()); |
1043 | } else { | 1044 | } else { |
1044 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1045 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1045 | project->first("QMAKE_EXTENSION_SHLIB") + | 1046 | project->first("QMAKE_EXTENSION_SHLIB") + |
1046 | "." + project->first("VER_MAJ")); | 1047 | "." + project->first("VER_MAJ")); |
1047 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1048 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1048 | project->first("QMAKE_EXTENSION_SHLIB") | 1049 | project->first("QMAKE_EXTENSION_SHLIB") |
1049 | + "." + project->first("VER_MAJ") + | 1050 | + "." + project->first("VER_MAJ") + |
1050 | "." + project->first("VER_MIN")); | 1051 | "." + project->first("VER_MIN")); |
1051 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + | 1052 | project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + |
1052 | "." + | 1053 | "." + |
1053 | project->variables()[ | 1054 | project->variables()[ |
1054 | "QMAKE_EXTENSION_SHLIB"].first() + "." + | 1055 | "QMAKE_EXTENSION_SHLIB"].first() + "." + |
1055 | project->first("VER_MAJ") + "." + | 1056 | project->first("VER_MAJ") + "." + |
1056 | project->first("VER_MIN") + "." + | 1057 | project->first("VER_MIN") + "." + |
1057 | project->first("VER_PAT")); | 1058 | project->first("VER_PAT")); |
1058 | } | 1059 | } |
1059 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 1060 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
1060 | } | 1061 | } |
1061 | if(project->isEmpty("QMAKE_LN_SHLIB")) | 1062 | if(project->isEmpty("QMAKE_LN_SHLIB")) |
1062 | project->variables()["QMAKE_LN_SHLIB"].append("ln -s"); | 1063 | project->variables()["QMAKE_LN_SHLIB"].append("ln -s"); |
1063 | project->variables()["DESTDIR_TARGET"].append("$(TARGET)"); | 1064 | project->variables()["DESTDIR_TARGET"].append("$(TARGET)"); |
1064 | if ( !project->variables()["DESTDIR"].isEmpty() ) | 1065 | if ( !project->variables()["DESTDIR"].isEmpty() ) |
1065 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); | 1066 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); |
1066 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) { | 1067 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) { |
1067 | if(project->isActiveConfig("plugin")) { | 1068 | if(project->isActiveConfig("plugin")) { |
1068 | if(!project->variables()["TARGET"].isEmpty() ) | 1069 | if(!project->variables()["TARGET"].isEmpty() ) |
1069 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); | 1070 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); |
1070 | } else { | 1071 | } else { |
1071 | if(!project->variables()["TARGET_x"].isEmpty() ) | 1072 | if(!project->variables()["TARGET_x"].isEmpty() ) |
1072 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); | 1073 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); |
1073 | } | 1074 | } |
1074 | } | 1075 | } |
1075 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) | 1076 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) |
1076 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( | 1077 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( |
1077 | "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"); | 1078 | "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"); |
1078 | } | 1079 | } |
1079 | if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) | 1080 | if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) |
1080 | project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); | 1081 | project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); |
1081 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 1082 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
1082 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"]; | 1083 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"]; |
1083 | } else if ( project->isActiveConfig("dll") ) { | 1084 | } else if ( project->isActiveConfig("dll") ) { |
1084 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; | 1085 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; |
1085 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; | 1086 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; |
1086 | if ( project->isActiveConfig("plugin") ) { | 1087 | if ( project->isActiveConfig("plugin") ) { |
1087 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; | 1088 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; |
1088 | if( !project->isActiveConfig("plugin_no_soname") ) | 1089 | if( !project->isActiveConfig("plugin_no_soname") ) |
1089 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | 1090 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; |
1090 | } else { | 1091 | } else { |
1091 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; | 1092 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; |
1092 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | 1093 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; |
1093 | } | 1094 | } |
1094 | QString destdir = project->first("DESTDIR"); | 1095 | QString destdir = project->first("DESTDIR"); |
1095 | if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) { | 1096 | if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) { |
1096 | QString rpath_destdir = destdir; | 1097 | QString rpath_destdir = destdir; |
1097 | if(QDir::isRelativePath(rpath_destdir)) { | 1098 | if(QDir::isRelativePath(rpath_destdir)) { |
1098 | QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir)); | 1099 | QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir)); |
1099 | if(fi.convertToAbs()) //strange, shouldn't really happen | 1100 | if(fi.convertToAbs()) //strange, shouldn't really happen |
1100 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); | 1101 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); |
1101 | else | 1102 | else |
1102 | rpath_destdir = fi.filePath(); | 1103 | rpath_destdir = fi.filePath(); |
1103 | } else { | 1104 | } else { |
1104 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); | 1105 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); |
1105 | } | 1106 | } |
1106 | project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir; | 1107 | project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir; |
1107 | } | 1108 | } |
1108 | } | 1109 | } |
1109 | } | 1110 | } |