Diffstat (limited to 'qmake/generators/unix/unixmake.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 168 |
1 files changed, 126 insertions, 42 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 7df95b2..e274481 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp | |||
@@ -1,20 +1,20 @@ | |||
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-2003 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 | ** |
@@ -63,36 +63,35 @@ UnixMakefileGenerator::init() | |||
63 | else if(project->first("TEMPLATE") == "subdirs") { | 63 | else if(project->first("TEMPLATE") == "subdirs") { |
64 | MakefileGenerator::init(); | 64 | MakefileGenerator::init(); |
65 | if(project->isEmpty("MAKEFILE")) | 65 | if(project->isEmpty("MAKEFILE")) |
66 | project->variables()["MAKEFILE"].append("Makefile"); | 66 | project->variables()["MAKEFILE"].append("Makefile"); |
67 | if(project->isEmpty("QMAKE")) | 67 | if(project->isEmpty("QMAKE")) |
68 | project->variables()["QMAKE"].append("qmake"); | 68 | project->variables()["QMAKE"].append("qmake"); |
69 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) | 69 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) |
70 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); | 70 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); |
71 | return; /* subdirs is done */ | 71 | return; /* subdirs is done */ |
72 | } | 72 | } |
73 | 73 | ||
74 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { | 74 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { |
75 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | 75 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
76 | if ( os == "cygwin" ) { | ||
77 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); | ||
78 | } else { | ||
79 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); | 76 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); |
77 | } else { | ||
78 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); | ||
80 | } | 79 | } |
81 | } | 80 | } |
82 | if( project->isEmpty("QMAKE_COPY_FILE") ) | 81 | if( project->isEmpty("QMAKE_COPY_FILE") ) |
83 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" ); | 82 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" ); |
84 | if( project->isEmpty("QMAKE_COPY_DIR") ) | 83 | if( project->isEmpty("QMAKE_COPY_DIR") ) |
85 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" ); | 84 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" ); |
86 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET | 85 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET |
87 | if(!project->isEmpty("TARGET")) { | 86 | if(!project->isEmpty("TARGET")) { |
88 | QString targ = project->first("TARGET"); | 87 | QString targ = project->first("TARGET"); |
89 | int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); | 88 | int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); |
90 | if(slsh != -1) { | 89 | if(slsh != -1) { |
91 | if(project->isEmpty("DESTDIR")) | 90 | if(project->isEmpty("DESTDIR")) |
92 | project->values("DESTDIR").append(""); | 91 | project->values("DESTDIR").append(""); |
93 | else if(project->first("DESTDIR").right(1) != Option::dir_sep) | 92 | else if(project->first("DESTDIR").right(1) != Option::dir_sep) |
94 | project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; | 93 | project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; |
95 | project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); | 94 | project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); |
96 | project->variables()["TARGET"] = targ.mid(slsh+1); | 95 | project->variables()["TARGET"] = targ.mid(slsh+1); |
97 | } | 96 | } |
98 | } | 97 | } |
@@ -129,25 +128,25 @@ UnixMakefileGenerator::init() | |||
129 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | 128 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; |
130 | } | 129 | } |
131 | if(!project->isEmpty("QMAKE_INCREMENTAL")) | 130 | if(!project->isEmpty("QMAKE_INCREMENTAL")) |
132 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; | 131 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; |
133 | else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && | 132 | else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && |
134 | !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && | 133 | !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && |
135 | project->isActiveConfig("dll")) | 134 | project->isActiveConfig("dll")) |
136 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; | 135 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; |
137 | if(!project->isEmpty("QMAKE_INCDIR")) | 136 | if(!project->isEmpty("QMAKE_INCDIR")) |
138 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | 137 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; |
139 | if(!project->isEmpty("QMAKE_LIBDIR")) { | 138 | if(!project->isEmpty("QMAKE_LIBDIR")) { |
140 | if ( !project->isEmpty("QMAKE_RPATH") ) | 139 | if ( !project->isEmpty("QMAKE_RPATH") ) |
141 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), | 140 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), |
142 | " " + var("QMAKE_RPATH"), ""); | 141 | " " + var("QMAKE_RPATH"), ""); |
143 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); | 142 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); |
144 | } | 143 | } |
145 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { | 144 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { |
146 | if(configs.findIndex("x11lib") == -1) | 145 | if(configs.findIndex("x11lib") == -1) |
147 | configs.append("x11lib"); | 146 | configs.append("x11lib"); |
148 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) | 147 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) |
149 | configs.append("x11inc"); | 148 | configs.append("x11inc"); |
150 | } | 149 | } |
151 | if ( project->isActiveConfig("x11") ) { | 150 | if ( project->isActiveConfig("x11") ) { |
152 | if(configs.findIndex("x11lib") == -1) | 151 | if(configs.findIndex("x11lib") == -1) |
153 | configs.append("x11lib"); | 152 | configs.append("x11lib"); |
@@ -157,68 +156,68 @@ UnixMakefileGenerator::init() | |||
157 | if ( project->isActiveConfig("qt") ) { | 156 | if ( project->isActiveConfig("qt") ) { |
158 | if ( project->isActiveConfig("accessibility" ) ) | 157 | if ( project->isActiveConfig("accessibility" ) ) |
159 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 158 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
160 | if ( project->isActiveConfig("tablet") ) | 159 | if ( project->isActiveConfig("tablet") ) |
161 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 160 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
162 | if(configs.findIndex("moc")) configs.append("moc"); | 161 | if(configs.findIndex("moc")) configs.append("moc"); |
163 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; | 162 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; |
164 | if ( !project->isActiveConfig("debug") ) | 163 | if ( !project->isActiveConfig("debug") ) |
165 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 164 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
166 | if ( !is_qt ) { | 165 | if ( !is_qt ) { |
167 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) { | 166 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) { |
168 | if ( !project->isEmpty("QMAKE_RPATH") ) | 167 | if ( !project->isEmpty("QMAKE_RPATH") ) |
169 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), | 168 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), |
170 | " " + var("QMAKE_RPATH"), ""); | 169 | " " + var("QMAKE_RPATH"), ""); |
171 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); | 170 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); |
172 | } | 171 | } |
173 | if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD")) | 172 | if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD")) |
174 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 173 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
175 | else | 174 | else |
176 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 175 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
177 | } | 176 | } |
178 | } | 177 | } |
179 | if ( project->isActiveConfig("thread") ) { | ||
180 | if(project->isActiveConfig("qt")) | ||
181 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | ||
182 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | ||
183 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | ||
184 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | ||
185 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
186 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | ||
187 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; | ||
188 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) | ||
189 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; | ||
190 | } | ||
191 | if ( project->isActiveConfig("opengl") ) { | 178 | if ( project->isActiveConfig("opengl") ) { |
192 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; | 179 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; |
193 | if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) | 180 | if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) |
194 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); | 181 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); |
195 | if ( is_qt ) | 182 | if ( is_qt ) |
196 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; | 183 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; |
197 | else | 184 | else |
198 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 185 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
199 | } | 186 | } |
200 | if(project->isActiveConfig("global_init_link_order")) | 187 | if(project->isActiveConfig("global_init_link_order")) |
201 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 188 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
202 | if ( project->isActiveConfig("x11sm") ) | ||
203 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; | ||
204 | if ( project->isActiveConfig("dylib") ) | ||
205 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; | ||
206 | if ( project->isActiveConfig("x11inc") ) | 189 | if ( project->isActiveConfig("x11inc") ) |
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; | 190 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; |
208 | if ( project->isActiveConfig("x11lib") ) { | 191 | if ( project->isActiveConfig("x11lib") ) { |
209 | if(!project->isEmpty("QMAKE_LIBDIR_X11")) | 192 | if(!project->isEmpty("QMAKE_LIBDIR_X11")) |
210 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); | 193 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); |
211 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; | 194 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; |
212 | } | 195 | } |
196 | if ( project->isActiveConfig("x11sm") ) | ||
197 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; | ||
198 | if ( project->isActiveConfig("dylib") ) | ||
199 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; | ||
200 | if ( project->isActiveConfig("thread") ) { | ||
201 | if(project->isActiveConfig("qt")) | ||
202 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | ||
203 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | ||
204 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | ||
205 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | ||
206 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | ||
208 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; | ||
209 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) | ||
210 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; | ||
211 | } | ||
213 | if ( project->isActiveConfig("moc") ) | 212 | if ( project->isActiveConfig("moc") ) |
214 | setMocAware(TRUE); | 213 | setMocAware(TRUE); |
215 | if ( project->isEmpty("QMAKE_RUN_CC") ) | 214 | if ( project->isEmpty("QMAKE_RUN_CC") ) |
216 | project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src"); | 215 | project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src"); |
217 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) | 216 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) |
218 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<"); | 217 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<"); |
219 | if ( project->isEmpty("QMAKE_RUN_CXX") ) | 218 | if ( project->isEmpty("QMAKE_RUN_CXX") ) |
220 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src"); | 219 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src"); |
221 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) | 220 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) |
222 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<"); | 221 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<"); |
223 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); | 222 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); |
224 | if ( !project->isEmpty("PRECOMPH") ) { | 223 | if ( !project->isEmpty("PRECOMPH") ) { |
@@ -331,41 +330,125 @@ UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &li | |||
331 | ret.append("-framework " + framework_in); | 330 | ret.append("-framework " + framework_in); |
332 | } else { | 331 | } else { |
333 | ret.append("-framework"); | 332 | ret.append("-framework"); |
334 | ret.append(framework_in); | 333 | ret.append(framework_in); |
335 | } | 334 | } |
336 | } | 335 | } |
337 | } | 336 | } |
338 | } else { | 337 | } else { |
339 | unique = (list2.findIndex((*it)) == -1); | 338 | unique = (list2.findIndex((*it)) == -1); |
340 | } | 339 | } |
341 | } else if(QFile::exists((*it))) { | 340 | } else if(QFile::exists((*it))) { |
342 | unique = (list2.findIndex((*it)) == -1); | 341 | unique = (list2.findIndex((*it)) == -1); |
343 | } | 342 | } |
344 | if(unique) | 343 | if(unique) |
345 | ret.append((*it)); | 344 | ret.append((*it)); |
346 | } | 345 | } |
347 | return ret; | 346 | return ret; |
348 | } | 347 | } |
349 | 348 | ||
350 | 349 | ||
351 | void | 350 | void |
352 | UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 351 | UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
353 | { | 352 | { |
354 | if(var == "QMAKE_PRL_LIBS") | 353 | if(var == "QMAKE_PRL_LIBS") |
355 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]); | 354 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]); |
356 | else | 355 | else |
357 | MakefileGenerator::processPrlVariable(var, l); | 356 | MakefileGenerator::processPrlVariable(var, l); |
358 | } | 357 | } |
359 | 358 | ||
359 | bool | ||
360 | UnixMakefileGenerator::findLibraries() | ||
361 | { | ||
362 | QPtrList<MakefileDependDir> libdirs; | ||
363 | libdirs.setAutoDelete(TRUE); | ||
364 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | ||
365 | for(int i = 0; !lflags[i].isNull(); i++) { | ||
366 | QStringList &l = project->variables()[lflags[i]]; | ||
367 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | ||
368 | QString stub, dir, extn, opt = (*it).stripWhiteSpace(); | ||
369 | if(opt.startsWith("-")) { | ||
370 | if(opt.startsWith("-L")) { | ||
371 | QString r = opt.right(opt.length() - 2), l = r; | ||
372 | fixEnvVariables(l); | ||
373 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | ||
374 | l.replace("\"",""))); | ||
375 | } else if(opt.startsWith("-l")) { | ||
376 | stub = opt.mid(2); | ||
377 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | ||
378 | if(opt.length() > 11) { | ||
379 | opt = opt.mid(11); | ||
380 | } else { | ||
381 | ++it; | ||
382 | opt = (*it); | ||
383 | } | ||
384 | extn = ""; | ||
385 | dir = "/System/Library/Frameworks/" + opt + ".framework/"; | ||
386 | stub = opt; | ||
387 | } | ||
388 | } else { | ||
389 | extn = dir = ""; | ||
390 | stub = opt; | ||
391 | int slsh = opt.findRev(Option::dir_sep); | ||
392 | if(slsh != -1) { | ||
393 | dir = opt.left(slsh); | ||
394 | stub = opt.mid(slsh+1); | ||
395 | } | ||
396 | QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$"); | ||
397 | if(stub_reg.exactMatch(stub)) { | ||
398 | stub = stub_reg.cap(1); | ||
399 | extn = stub_reg.cap(2); | ||
400 | } | ||
401 | } | ||
402 | if(!stub.isEmpty()) { | ||
403 | const QString modifs[] = { "-mt", QString::null }; | ||
404 | for(int modif = 0; !modifs[modif].isNull(); modif++) { | ||
405 | bool found = FALSE; | ||
406 | QStringList extens; | ||
407 | if(!extn.isNull()) | ||
408 | extens << extn; | ||
409 | else | ||
410 | extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a"; | ||
411 | for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) { | ||
412 | if(dir.isNull()) { | ||
413 | QString lib_stub; | ||
414 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | ||
415 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + | ||
416 | modifs[modif] + "." + (*extit))) { | ||
417 | lib_stub = stub + modifs[modif]; | ||
418 | break; | ||
419 | } | ||
420 | } | ||
421 | if(!lib_stub.isNull()) { | ||
422 | (*it) = "-l" + lib_stub; | ||
423 | found = TRUE; | ||
424 | break; | ||
425 | } | ||
426 | } else { | ||
427 | if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) { | ||
428 | (*it) = "lib" + stub + modifs[modif] + "." + (*extit); | ||
429 | found = TRUE; | ||
430 | break; | ||
431 | } | ||
432 | } | ||
433 | } | ||
434 | if(found) | ||
435 | break; | ||
436 | } | ||
437 | } | ||
438 | } | ||
439 | } | ||
440 | return FALSE; | ||
441 | } | ||
442 | |||
360 | void | 443 | void |
361 | UnixMakefileGenerator::processPrlFiles() | 444 | UnixMakefileGenerator::processPrlFiles() |
362 | { | 445 | { |
363 | QDict<void> processed; | 446 | QDict<void> processed; |
364 | QPtrList<MakefileDependDir> libdirs; | 447 | QPtrList<MakefileDependDir> libdirs; |
365 | libdirs.setAutoDelete(TRUE); | 448 | libdirs.setAutoDelete(TRUE); |
366 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | 449 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; |
367 | for(int i = 0; !lflags[i].isNull(); i++) { | 450 | for(int i = 0; !lflags[i].isNull(); i++) { |
368 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 451 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
369 | QStringList l_out; | 452 | QStringList l_out; |
370 | QStringList &l = project->variables()[lflags[i]]; | 453 | QStringList &l = project->variables()[lflags[i]]; |
371 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 454 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
@@ -393,25 +476,25 @@ UnixMakefileGenerator::processPrlFiles() | |||
393 | break; | 476 | break; |
394 | } | 477 | } |
395 | } | 478 | } |
396 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | 479 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { |
397 | if(opt.length() > 11) { | 480 | if(opt.length() > 11) { |
398 | opt = opt.mid(11); | 481 | opt = opt.mid(11); |
399 | } else { | 482 | } else { |
400 | ++it; | 483 | ++it; |
401 | opt = (*it); | 484 | opt = (*it); |
402 | } | 485 | } |
403 | QString prl = "/System/Library/Frameworks/" + opt + | 486 | QString prl = "/System/Library/Frameworks/" + opt + |
404 | ".framework/" + opt + Option::prl_ext; | 487 | ".framework/" + opt + Option::prl_ext; |
405 | if(processPrlFile(prl)) | 488 | if(processPrlFile(prl)) |
406 | ret = TRUE; | 489 | ret = TRUE; |
407 | l_out.append("-framework"); | 490 | l_out.append("-framework"); |
408 | } | 491 | } |
409 | if(!opt.isEmpty()) | 492 | if(!opt.isEmpty()) |
410 | l_out.append(opt); | 493 | l_out.append(opt); |
411 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 494 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); |
412 | } else { | 495 | } else { |
413 | if(!processed[opt] && processPrlFile(opt)) { | 496 | if(!processed[opt] && processPrlFile(opt)) { |
414 | processed.insert(opt, (void*)1); | 497 | processed.insert(opt, (void*)1); |
415 | ret = TRUE; | 498 | ret = TRUE; |
416 | } | 499 | } |
417 | if(!opt.isEmpty()) | 500 | if(!opt.isEmpty()) |
@@ -425,96 +508,97 @@ UnixMakefileGenerator::processPrlFiles() | |||
425 | break; | 508 | break; |
426 | } | 509 | } |
427 | } | 510 | } |
428 | } | 511 | } |
429 | 512 | ||
430 | QString | 513 | QString |
431 | UnixMakefileGenerator::defaultInstall(const QString &t) | 514 | UnixMakefileGenerator::defaultInstall(const QString &t) |
432 | { | 515 | { |
433 | if(t != "target" || project->first("TEMPLATE") == "subdirs") | 516 | if(t != "target" || project->first("TEMPLATE") == "subdirs") |
434 | return QString(); | 517 | return QString(); |
435 | 518 | ||
436 | bool resource = FALSE; | 519 | bool resource = FALSE; |
520 | const QString root = "$(INSTALL_ROOT)"; | ||
437 | QStringList &uninst = project->variables()[t + ".uninstall"]; | 521 | QStringList &uninst = project->variables()[t + ".uninstall"]; |
438 | QString ret, destdir=fileFixify(project->first("DESTDIR")); | 522 | QString ret, destdir=project->first("DESTDIR"); |
439 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); | 523 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); |
440 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 524 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
441 | destdir += Option::dir_sep; | 525 | destdir += Option::dir_sep; |
442 | targetdir = "$(INSTALL_ROOT)" + Option::fixPathToTargetOS(targetdir, FALSE); | 526 | targetdir = fileFixify(targetdir); |
443 | if(targetdir.right(1) != Option::dir_sep) | 527 | if(targetdir.right(1) != Option::dir_sep) |
444 | targetdir += Option::dir_sep; | 528 | targetdir += Option::dir_sep; |
445 | 529 | ||
446 | QStringList links; | 530 | QStringList links; |
447 | QString target="$(TARGET)"; | 531 | QString target="$(TARGET)"; |
448 | if(project->first("TEMPLATE") == "app") { | 532 | if(project->first("TEMPLATE") == "app") { |
449 | target = "$(QMAKE_TARGET)"; | 533 | target = "$(QMAKE_TARGET)"; |
450 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 534 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
451 | destdir += "../../../"; | 535 | destdir += "../../../"; |
452 | target += ".app"; | 536 | target += ".app"; |
453 | resource = TRUE; | 537 | resource = TRUE; |
454 | } | 538 | } |
455 | } else if(project->first("TEMPLATE") == "lib") { | 539 | } else if(project->first("TEMPLATE") == "lib") { |
456 | if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | 540 | if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { |
457 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); | 541 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); |
458 | int slsh = dst_prl.findRev('/'); | 542 | int slsh = dst_prl.findRev('/'); |
459 | if(slsh != -1) | 543 | if(slsh != -1) |
460 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); | 544 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); |
461 | dst_prl = targetdir + dst_prl; | 545 | dst_prl = root + targetdir + dst_prl; |
462 | ret += "-$(COPY) " + project->first("QMAKE_INTERNAL_PRL_FILE") + " " + dst_prl; | 546 | ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; |
463 | if(!uninst.isEmpty()) | 547 | if(!uninst.isEmpty()) |
464 | uninst.append("\n\t"); | 548 | uninst.append("\n\t"); |
465 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); | 549 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); |
466 | } | 550 | } |
467 | QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 ); | 551 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
468 | if ( os != "cygwin" ) { | ||
469 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { | 552 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { |
470 | if ( os == "hpux" ) { | 553 | if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
471 | links << "$(TARGET0)"; | ||
472 | } else { | ||
473 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; | 554 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; |
555 | } else { | ||
556 | links << "$(TARGET0)"; | ||
474 | } | 557 | } |
475 | } | 558 | } |
476 | } | 559 | } |
477 | } | 560 | } |
478 | QString src_targ = target; | 561 | QString src_targ = target; |
479 | if(!destdir.isEmpty()) | 562 | if(!destdir.isEmpty()) |
480 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | 563 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); |
481 | QString dst_targ = fileFixify(targetdir + target); | 564 | QString dst_targ = root + fileFixify(targetdir + target); |
482 | if(!ret.isEmpty()) | 565 | if(!ret.isEmpty()) |
483 | ret += "\n\t"; | 566 | ret += "\n\t"; |
484 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + | 567 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + |
485 | src_targ + "\" \"" + dst_targ + "\""; | 568 | src_targ + "\" \"" + dst_targ + "\""; |
486 | if(!project->isEmpty("QMAKE_STRIP")) { | 569 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) { |
487 | ret += "\n\t-" + var("QMAKE_STRIP"); | 570 | ret += "\n\t-" + var("QMAKE_STRIP"); |
571 | if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib") | ||
572 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | ||
488 | if(resource) | 573 | if(resource) |
489 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)"; | 574 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; |
490 | else | 575 | else |
491 | ret += " \"" + dst_targ + "\""; | 576 | ret += " \"" + dst_targ + "\""; |
492 | } | 577 | } |
493 | if(!uninst.isEmpty()) | 578 | if(!uninst.isEmpty()) |
494 | uninst.append("\n\t"); | 579 | uninst.append("\n\t"); |
495 | if(resource) | 580 | if(resource) |
496 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); | 581 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); |
497 | else | 582 | else |
498 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); | 583 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); |
499 | if(!links.isEmpty()) { | 584 | if(!links.isEmpty()) { |
500 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { | 585 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { |
501 | if(Option::target_mode == Option::TARG_WIN_MODE || | 586 | if(Option::target_mode == Option::TARG_WIN_MODE || |
502 | Option::target_mode == Option::TARG_MAC9_MODE) { | 587 | Option::target_mode == Option::TARG_MAC9_MODE) { |
503 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || | 588 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || |
504 | Option::target_mode == Option::TARG_MACX_MODE) { | 589 | Option::target_mode == Option::TARG_MACX_MODE) { |
505 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); | 590 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); |
506 | int lslash = link.findRev(Option::dir_sep); | 591 | int lslash = link.findRev(Option::dir_sep); |
507 | if(lslash != -1) | 592 | if(lslash != -1) |
508 | link = link.right(link.length() - (lslash + 1)); | 593 | link = link.right(link.length() - (lslash + 1)); |
509 | QString dst_link = fileFixify(targetdir + link); | 594 | QString dst_link = root + fileFixify(targetdir + link); |
510 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; | 595 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; |
511 | if(!uninst.isEmpty()) | 596 | if(!uninst.isEmpty()) |
512 | uninst.append("\n\t"); | 597 | uninst.append("\n\t"); |
513 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); | 598 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); |
514 | } | 599 | } |
515 | } | 600 | } |
516 | } | 601 | } |
517 | return ret; | 602 | return ret; |
518 | } | 603 | } |
519 | 604 | ||
520 | |||