author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff) | |
tree | e6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/generators/unix/unixmake.cpp | |
parent | 86703e8a5527ef114facd02c005b6b3a7e62e263 (diff) | |
download | opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2 |
update qmake to 1.05a
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,260 +1,259 @@ | |||
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 | ** |
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 <qdict.h> | 42 | #include <qdict.h> |
43 | #include <qdir.h> | 43 | #include <qdir.h> |
44 | #include <time.h> | 44 | #include <time.h> |
45 | 45 | ||
46 | 46 | ||
47 | void | 47 | void |
48 | UnixMakefileGenerator::init() | 48 | UnixMakefileGenerator::init() |
49 | { | 49 | { |
50 | if(init_flag) | 50 | if(init_flag) |
51 | return; | 51 | return; |
52 | init_flag = TRUE; | 52 | init_flag = TRUE; |
53 | 53 | ||
54 | if(!project->isEmpty("QMAKE_FAILED_REQUIREMENTS")) /* no point */ | 54 | if(!project->isEmpty("QMAKE_FAILED_REQUIREMENTS")) /* no point */ |
55 | return; | 55 | return; |
56 | 56 | ||
57 | QStringList &configs = project->variables()["CONFIG"]; | 57 | QStringList &configs = project->variables()["CONFIG"]; |
58 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 58 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
59 | if(project->first("TEMPLATE") == "app") | 59 | if(project->first("TEMPLATE") == "app") |
60 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 60 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
61 | else if(project->first("TEMPLATE") == "lib") | 61 | else if(project->first("TEMPLATE") == "lib") |
62 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 62 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
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 | } |
99 | 98 | ||
100 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 99 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
101 | 100 | ||
102 | bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" || | 101 | bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" || |
103 | project->first("TARGET") == "qt-mt" || project->first("TARGET") == "qte-mt"); | 102 | project->first("TARGET") == "qt-mt" || project->first("TARGET") == "qte-mt"); |
104 | bool extern_libs = !project->isEmpty("QMAKE_APP_FLAG") || | 103 | bool extern_libs = !project->isEmpty("QMAKE_APP_FLAG") || |
105 | (!project->isEmpty("QMAKE_LIB_FLAG") && | 104 | (!project->isEmpty("QMAKE_LIB_FLAG") && |
106 | project->isActiveConfig("dll")) || is_qt; | 105 | project->isActiveConfig("dll")) || is_qt; |
107 | if(!project->isActiveConfig("global_init_link_order")) | 106 | if(!project->isActiveConfig("global_init_link_order")) |
108 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 107 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
109 | if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) || | 108 | if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) || |
110 | (project->isActiveConfig("qt") && project->isActiveConfig( "plugin" ) )) { | 109 | (project->isActiveConfig("qt") && project->isActiveConfig( "plugin" ) )) { |
111 | if(configs.findIndex("dll") == -1) configs.append("dll"); | 110 | if(configs.findIndex("dll") == -1) configs.append("dll"); |
112 | } else if ( !project->isEmpty("QMAKE_APP_FLAG") || project->isActiveConfig("dll") ) { | 111 | } else if ( !project->isEmpty("QMAKE_APP_FLAG") || project->isActiveConfig("dll") ) { |
113 | configs.remove("staticlib"); | 112 | configs.remove("staticlib"); |
114 | } | 113 | } |
115 | if ( project->isActiveConfig("warn_off") ) { | 114 | if ( project->isActiveConfig("warn_off") ) { |
116 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | 115 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; |
117 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | 116 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; |
118 | } else if ( project->isActiveConfig("warn_on") ) { | 117 | } else if ( project->isActiveConfig("warn_on") ) { |
119 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | 118 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; |
120 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | 119 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; |
121 | } | 120 | } |
122 | if ( project->isActiveConfig("debug") ) { | 121 | if ( project->isActiveConfig("debug") ) { |
123 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | 122 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; |
124 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | 123 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; |
125 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | 124 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; |
126 | } else { | 125 | } else { |
127 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | 126 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; |
128 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | 127 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; |
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"); |
154 | if(configs.findIndex("x11inc") == -1) | 153 | if(configs.findIndex("x11inc") == -1) |
155 | configs.append("x11inc"); | 154 | configs.append("x11inc"); |
156 | } | 155 | } |
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") ) { |
225 | initOutPaths(); // Need to fix MOC_DIR since we do this before init() | 224 | initOutPaths(); // Need to fix MOC_DIR since we do this before init() |
226 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); | 225 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); |
227 | project->variables()["SOURCES"].prepend(allmoc); | 226 | project->variables()["SOURCES"].prepend(allmoc); |
228 | project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"]; | 227 | project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"]; |
229 | project->variables()["HEADERS"].clear(); | 228 | project->variables()["HEADERS"].clear(); |
230 | } | 229 | } |
231 | if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) | 230 | if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) |
232 | include_deps = TRUE; //do not generate deps | 231 | include_deps = TRUE; //do not generate deps |
233 | 232 | ||
234 | MakefileGenerator::init(); | 233 | MakefileGenerator::init(); |
235 | if ( project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 234 | if ( project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
236 | if(!project->isEmpty("QMAKE_APP_FLAG")) { | 235 | if(!project->isEmpty("QMAKE_APP_FLAG")) { |
237 | if(project->isEmpty("DESTDIR")) | 236 | if(project->isEmpty("DESTDIR")) |
238 | project->values("DESTDIR").append(""); | 237 | project->values("DESTDIR").append(""); |
239 | project->variables()["DESTDIR"].first() += project->variables()["TARGET"].first() + | 238 | project->variables()["DESTDIR"].first() += project->variables()["TARGET"].first() + |
240 | ".app/Contents/MacOS/"; | 239 | ".app/Contents/MacOS/"; |
241 | project->variables()["QMAKE_PKGINFO"].append(project->first("DESTDIR") + "../PkgInfo"); | 240 | project->variables()["QMAKE_PKGINFO"].append(project->first("DESTDIR") + "../PkgInfo"); |
242 | project->variables()["ALL_DEPS"] += project->first("QMAKE_PKGINFO"); | 241 | project->variables()["ALL_DEPS"] += project->first("QMAKE_PKGINFO"); |
243 | 242 | ||
244 | QString plist = specdir() + QDir::separator() + "Info.plist." + | 243 | QString plist = specdir() + QDir::separator() + "Info.plist." + |
245 | project->first("TEMPLATE"); | 244 | project->first("TEMPLATE"); |
246 | if(QFile::exists(Option::fixPathToLocalOS(plist))) { | 245 | if(QFile::exists(Option::fixPathToLocalOS(plist))) { |
247 | project->variables()["QMAKE_INFO_PLIST"].append(plist); | 246 | project->variables()["QMAKE_INFO_PLIST"].append(plist); |
248 | project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") + | 247 | project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") + |
249 | "../Info.plist"); | 248 | "../Info.plist"); |
250 | project->variables()["ALL_DEPS"] += project->first("QMAKE_INFO_PLIST_OUT"); | 249 | project->variables()["ALL_DEPS"] += project->first("QMAKE_INFO_PLIST_OUT"); |
251 | if(!project->isEmpty("RC_FILE")) | 250 | if(!project->isEmpty("RC_FILE")) |
252 | project->variables()["ALL_DEPS"] += project->first("DESTDIR") + | 251 | project->variables()["ALL_DEPS"] += project->first("DESTDIR") + |
253 | "../Resources/application.icns"; | 252 | "../Resources/application.icns"; |
254 | } | 253 | } |
255 | } | 254 | } |
256 | } | 255 | } |
257 | 256 | ||
258 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) | 257 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) |
259 | project->variables()["DISTFILES"] += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; | 258 | project->variables()["DISTFILES"] += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; |
260 | project->variables()["DISTFILES"] += Option::mkfile::project_files; | 259 | project->variables()["DISTFILES"] += Option::mkfile::project_files; |
@@ -295,226 +294,311 @@ UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &li | |||
295 | if((*it).startsWith("-")) { | 294 | if((*it).startsWith("-")) { |
296 | if((*it).startsWith("-l") || (*it).startsWith("-L")) { | 295 | if((*it).startsWith("-l") || (*it).startsWith("-L")) { |
297 | unique = list2.findIndex((*it)) == -1; | 296 | unique = list2.findIndex((*it)) == -1; |
298 | } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) { | 297 | } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) { |
299 | int as_one = TRUE; | 298 | int as_one = TRUE; |
300 | QString framework_in; | 299 | QString framework_in; |
301 | if((*it).length() > 11) { | 300 | if((*it).length() > 11) { |
302 | framework_in = (*it).mid(11); | 301 | framework_in = (*it).mid(11); |
303 | } else { | 302 | } else { |
304 | if(it != list1.end()) { | 303 | if(it != list1.end()) { |
305 | ++it; | 304 | ++it; |
306 | as_one = FALSE; | 305 | as_one = FALSE; |
307 | framework_in = (*it); | 306 | framework_in = (*it); |
308 | } | 307 | } |
309 | } | 308 | } |
310 | if(!framework_in.isEmpty()) { | 309 | if(!framework_in.isEmpty()) { |
311 | for(QStringList::ConstIterator outit = list2.begin(); outit != list2.end(); ++outit) { | 310 | for(QStringList::ConstIterator outit = list2.begin(); outit != list2.end(); ++outit) { |
312 | if((*outit).startsWith("-framework")) { | 311 | if((*outit).startsWith("-framework")) { |
313 | QString framework_out; | 312 | QString framework_out; |
314 | if((*outit).length() > 11) { | 313 | if((*outit).length() > 11) { |
315 | framework_out = (*outit).mid(11); | 314 | framework_out = (*outit).mid(11); |
316 | } else { | 315 | } else { |
317 | if(it != list2.end()) { | 316 | if(it != list2.end()) { |
318 | ++outit; | 317 | ++outit; |
319 | framework_out = (*outit); | 318 | framework_out = (*outit); |
320 | } | 319 | } |
321 | } | 320 | } |
322 | if(framework_out == framework_in) { | 321 | if(framework_out == framework_in) { |
323 | unique = FALSE; | 322 | unique = FALSE; |
324 | break; | 323 | break; |
325 | } | 324 | } |
326 | } | 325 | } |
327 | } | 326 | } |
328 | if(unique) { | 327 | if(unique) { |
329 | unique = FALSE; //because I'm about to just insert it myself | 328 | unique = FALSE; //because I'm about to just insert it myself |
330 | if(as_one) { | 329 | if(as_one) { |
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) { |
372 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); | 455 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); |
373 | QString opt = (*it).stripWhiteSpace();; | 456 | QString opt = (*it).stripWhiteSpace();; |
374 | if(opt.startsWith("-")) { | 457 | if(opt.startsWith("-")) { |
375 | if(opt.startsWith("-L")) { | 458 | if(opt.startsWith("-L")) { |
376 | QString r = opt.right(opt.length() - 2), l = r; | 459 | QString r = opt.right(opt.length() - 2), l = r; |
377 | fixEnvVariables(l); | 460 | fixEnvVariables(l); |
378 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 461 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
379 | l.replace("\"",""))); | 462 | l.replace("\"",""))); |
380 | } else if(opt.startsWith("-l") && !processed[opt]) { | 463 | } else if(opt.startsWith("-l") && !processed[opt]) { |
381 | QString lib = opt.right(opt.length() - 2), prl; | 464 | QString lib = opt.right(opt.length() - 2), prl; |
382 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 465 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
383 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext; | 466 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext; |
384 | if(processPrlFile(prl)) { | 467 | if(processPrlFile(prl)) { |
385 | if(prl.startsWith(mdd->local_dir)) | 468 | if(prl.startsWith(mdd->local_dir)) |
386 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); | 469 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); |
387 | QRegExp reg("^.*lib(" + lib + "[^./=]*)\\..*$"); | 470 | QRegExp reg("^.*lib(" + lib + "[^./=]*)\\..*$"); |
388 | if(reg.exactMatch(prl)) | 471 | if(reg.exactMatch(prl)) |
389 | prl = "-l" + reg.cap(1); | 472 | prl = "-l" + reg.cap(1); |
390 | opt = prl; | 473 | opt = prl; |
391 | processed.insert(opt, (void*)1); | 474 | processed.insert(opt, (void*)1); |
392 | ret = TRUE; | 475 | ret = TRUE; |
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()) |
418 | l_out.append(opt); | 501 | l_out.append(opt); |
419 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 502 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); |
420 | } | 503 | } |
421 | } | 504 | } |
422 | if(ret && l != l_out) | 505 | if(ret && l != l_out) |
423 | l = l_out; | 506 | l = l_out; |
424 | else | 507 | else |
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 | |||