Diffstat (limited to 'qmake/generators/unix/unixmake.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 557 |
1 files changed, 415 insertions, 142 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index e274481..caaddee 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp | |||
@@ -1,604 +1,877 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of UnixMakefileGenerator class. |
5 | ** | ||
6 | ** Created : 970521 | ||
7 | ** | 5 | ** |
8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
9 | ** | 7 | ** |
10 | ** This file is part of the network module of the Qt GUI Toolkit. | 8 | ** This file is part of qmake. |
11 | ** | 9 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 10 | ** 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 | 11 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 12 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 13 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 14 | ** 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 | 15 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 16 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 17 | ** packaging of this file. |
20 | ** | 18 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition licenses may use this | 19 | ** Licensees holding valid Qt Enterprise Edition licenses may use this |
22 | ** file in accordance with the Qt Commercial License Agreement provided | 20 | ** file in accordance with the Qt Commercial License Agreement provided |
23 | ** with the Software. | 21 | ** with the Software. |
24 | ** | 22 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 23 | ** 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. | 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 25 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 27 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 30 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 31 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 32 | ** not clear to you. |
35 | ** | 33 | ** |
36 | **********************************************************************/ | 34 | **********************************************************************/ |
37 | 35 | ||
38 | #include "unixmake.h" | 36 | #include "unixmake.h" |
39 | #include "option.h" | 37 | #include "option.h" |
40 | #include <qregexp.h> | 38 | #include <qregexp.h> |
41 | #include <qfile.h> | 39 | #include <qfile.h> |
42 | #include <qdict.h> | 40 | #include <qdict.h> |
43 | #include <qdir.h> | 41 | #include <qdir.h> |
44 | #include <time.h> | 42 | #include <time.h> |
45 | 43 | ||
46 | 44 | ||
47 | void | 45 | void |
48 | UnixMakefileGenerator::init() | 46 | UnixMakefileGenerator::init() |
49 | { | 47 | { |
50 | if(init_flag) | 48 | if(init_flag) |
51 | return; | 49 | return; |
52 | init_flag = TRUE; | 50 | init_flag = TRUE; |
53 | 51 | ||
54 | if(!project->isEmpty("QMAKE_FAILED_REQUIREMENTS")) /* no point */ | 52 | if(!project->isEmpty("QMAKE_FAILED_REQUIREMENTS")) /* no point */ |
55 | return; | 53 | return; |
56 | 54 | ||
57 | QStringList &configs = project->variables()["CONFIG"]; | 55 | QStringList &configs = project->variables()["CONFIG"]; |
58 | /* this should probably not be here, but I'm using it to wrap the .t files */ | 56 | /* this should probably not be here, but I'm using it to wrap the .t files */ |
59 | if(project->first("TEMPLATE") == "app") | 57 | if(project->first("TEMPLATE") == "app") |
60 | project->variables()["QMAKE_APP_FLAG"].append("1"); | 58 | project->variables()["QMAKE_APP_FLAG"].append("1"); |
61 | else if(project->first("TEMPLATE") == "lib") | 59 | else if(project->first("TEMPLATE") == "lib") |
62 | project->variables()["QMAKE_LIB_FLAG"].append("1"); | 60 | project->variables()["QMAKE_LIB_FLAG"].append("1"); |
63 | else if(project->first("TEMPLATE") == "subdirs") { | 61 | else if(project->first("TEMPLATE") == "subdirs") { |
64 | MakefileGenerator::init(); | 62 | MakefileGenerator::init(); |
65 | if(project->isEmpty("MAKEFILE")) | 63 | if(project->isEmpty("MAKEFILE")) |
66 | project->variables()["MAKEFILE"].append("Makefile"); | 64 | project->variables()["MAKEFILE"].append("Makefile"); |
67 | if(project->isEmpty("QMAKE")) | 65 | if(project->isEmpty("QMAKE")) |
68 | project->variables()["QMAKE"].append("qmake"); | 66 | project->variables()["QMAKE"].append("qmake"); |
69 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) | 67 | if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1) |
70 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); | 68 | project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all"); |
71 | return; /* subdirs is done */ | 69 | return; /* subdirs is done */ |
72 | } | 70 | } |
73 | 71 | ||
74 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { | 72 | if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) { |
75 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { | 73 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
76 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); | 74 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" ); |
77 | } else { | 75 | } else { |
78 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); | 76 | project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" ); |
79 | } | 77 | } |
80 | } | 78 | } |
79 | if( project->isEmpty("QMAKE_CFLAGS_PRECOMPILE")) | ||
80 | project->variables()["QMAKE_CFLAGS_PRECOMPILE"].append("-x c-header -c"); | ||
81 | if( project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE")) | ||
82 | project->variables()["QMAKE_CXXFLAGS_PRECOMPILE"].append("-x c++-header -c"); | ||
83 | if( project->isEmpty("QMAKE_CFLAGS_USE_PRECOMPILE")) | ||
84 | project->variables()["QMAKE_CFLAGS_USE_PRECOMPILE"].append("-include"); | ||
85 | if( project->isEmpty("QMAKE_EXTENSION_PLUGIN") ) | ||
86 | project->variables()["QMAKE_EXTENSION_PLUGIN"].append(project->first("QMAKE_EXTENSION_SHLIB")); | ||
81 | if( project->isEmpty("QMAKE_COPY_FILE") ) | 87 | if( project->isEmpty("QMAKE_COPY_FILE") ) |
82 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" ); | 88 | project->variables()["QMAKE_COPY_FILE"].append( "$(COPY)" ); |
83 | if( project->isEmpty("QMAKE_COPY_DIR") ) | 89 | if( project->isEmpty("QMAKE_COPY_DIR") ) |
84 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" ); | 90 | project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -R" ); |
91 | if( project->isEmpty("QMAKE_INSTALL_FILE") ) | ||
92 | project->variables()["QMAKE_INSTALL_FILE"].append( "$(COPY_FILE)" ); | ||
93 | if( project->isEmpty("QMAKE_INSTALL_DIR") ) | ||
94 | project->variables()["QMAKE_INSTALL_DIR"].append( "$(COPY_DIR)" ); | ||
95 | if( project->isEmpty("QMAKE_LIBTOOL") ) | ||
96 | project->variables()["QMAKE_LIBTOOL"].append( "libtool --silent" ); | ||
85 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET | 97 | //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET |
86 | if(!project->isEmpty("TARGET")) { | 98 | if(!project->isEmpty("TARGET")) { |
87 | QString targ = project->first("TARGET"); | 99 | QString targ = project->first("TARGET"); |
88 | int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); | 100 | int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep)); |
89 | if(slsh != -1) { | 101 | if(slsh != -1) { |
90 | if(project->isEmpty("DESTDIR")) | 102 | if(project->isEmpty("DESTDIR")) |
91 | project->values("DESTDIR").append(""); | 103 | project->values("DESTDIR").append(""); |
92 | else if(project->first("DESTDIR").right(1) != Option::dir_sep) | 104 | else if(project->first("DESTDIR").right(1) != Option::dir_sep) |
93 | project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; | 105 | project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep; |
94 | project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); | 106 | project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1); |
95 | project->variables()["TARGET"] = targ.mid(slsh+1); | 107 | project->variables()["TARGET"] = targ.mid(slsh+1); |
96 | } | 108 | } |
97 | } | 109 | } |
98 | 110 | ||
99 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; | 111 | project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; |
100 | 112 | ||
101 | bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" || | 113 | bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" || |
102 | project->first("TARGET") == "qt-mt" || project->first("TARGET") == "qte-mt"); | 114 | project->first("TARGET") == "qt-mt" || project->first("TARGET") == "qte-mt"); |
103 | bool extern_libs = !project->isEmpty("QMAKE_APP_FLAG") || | 115 | bool extern_libs = !project->isEmpty("QMAKE_APP_FLAG") || |
104 | (!project->isEmpty("QMAKE_LIB_FLAG") && | 116 | (!project->isEmpty("QMAKE_LIB_FLAG") && |
105 | project->isActiveConfig("dll")) || is_qt; | 117 | project->isActiveConfig("dll")) || is_qt; |
106 | if(!project->isActiveConfig("global_init_link_order")) | 118 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; |
107 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | ||
108 | if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) || | 119 | if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) || |
109 | (project->isActiveConfig("qt") && project->isActiveConfig( "plugin" ) )) { | 120 | (project->isActiveConfig("qt") && project->isActiveConfig( "plugin" ) )) { |
110 | if(configs.findIndex("dll") == -1) configs.append("dll"); | 121 | if(configs.findIndex("dll") == -1) configs.append("dll"); |
111 | } else if ( !project->isEmpty("QMAKE_APP_FLAG") || project->isActiveConfig("dll") ) { | 122 | } else if ( !project->isEmpty("QMAKE_APP_FLAG") || project->isActiveConfig("dll") ) { |
112 | configs.remove("staticlib"); | 123 | configs.remove("staticlib"); |
113 | } | 124 | } |
114 | if ( project->isActiveConfig("warn_off") ) { | 125 | if ( project->isActiveConfig("warn_off") ) { |
115 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; | 126 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"]; |
116 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; | 127 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"]; |
117 | } else if ( project->isActiveConfig("warn_on") ) { | 128 | } else if ( project->isActiveConfig("warn_on") ) { |
118 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; | 129 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"]; |
119 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; | 130 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"]; |
120 | } | 131 | } |
121 | if ( project->isActiveConfig("debug") ) { | 132 | if ( project->isActiveConfig("debug") ) { |
122 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; | 133 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_DEBUG"]; |
123 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; | 134 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_DEBUG"]; |
124 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; | 135 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_DEBUG"]; |
125 | } else { | 136 | } else { |
126 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; | 137 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RELEASE"]; |
127 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; | 138 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RELEASE"]; |
128 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; | 139 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"]; |
129 | } | 140 | } |
130 | if(!project->isEmpty("QMAKE_INCREMENTAL")) | 141 | if(!project->isEmpty("QMAKE_INCREMENTAL")) |
131 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; | 142 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"]; |
132 | else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && | 143 | else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") && |
133 | !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && | 144 | !project->variables()["QMAKE_LIB_FLAG"].isEmpty() && |
134 | project->isActiveConfig("dll")) | 145 | project->isActiveConfig("dll")) |
135 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; | 146 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"]; |
136 | if(!project->isEmpty("QMAKE_INCDIR")) | 147 | if(!project->isEmpty("QMAKE_INCDIR")) |
137 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; | 148 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"]; |
138 | if(!project->isEmpty("QMAKE_LIBDIR")) { | 149 | if(!project->isEmpty("QMAKE_LIBDIR")) { |
139 | if ( !project->isEmpty("QMAKE_RPATH") ) | 150 | if ( !project->isEmpty("QMAKE_RPATH") ) |
140 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), | 151 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"), |
141 | " " + var("QMAKE_RPATH"), ""); | 152 | " " + var("QMAKE_RPATH"), ""); |
142 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); | 153 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" ); |
143 | } | 154 | } |
144 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { | 155 | if ( project->isActiveConfig("qtopia") ) { |
145 | if(configs.findIndex("x11lib") == -1) | 156 | if(configs.findIndex("qtopialib") == -1) |
146 | configs.append("x11lib"); | 157 | configs.append("qtopialib"); |
147 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) | 158 | if(configs.findIndex("qtopiainc") == -1) |
148 | configs.append("x11inc"); | 159 | configs.append("qtopiainc"); |
149 | } | 160 | } |
150 | if ( project->isActiveConfig("x11") ) { | 161 | if ( project->isActiveConfig("qtopiainc") ) |
151 | if(configs.findIndex("x11lib") == -1) | 162 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"]; |
152 | configs.append("x11lib"); | 163 | if ( project->isActiveConfig("qtopialib") ) { |
153 | if(configs.findIndex("x11inc") == -1) | 164 | if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA")) |
154 | configs.append("x11inc"); | 165 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QTOPIA", "-L", " -L", ""); |
166 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"]; | ||
155 | } | 167 | } |
156 | if ( project->isActiveConfig("qt") ) { | 168 | if ( project->isActiveConfig("qt") ) { |
157 | if ( project->isActiveConfig("accessibility" ) ) | 169 | if ( project->isActiveConfig("accessibility" ) ) |
158 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); | 170 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); |
159 | if ( project->isActiveConfig("tablet") ) | 171 | if ( project->isActiveConfig("tablet") ) |
160 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); | 172 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); |
161 | if(configs.findIndex("moc")) configs.append("moc"); | 173 | if(configs.findIndex("moc")) configs.append("moc"); |
162 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; | 174 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; |
163 | if ( !project->isActiveConfig("debug") ) | 175 | if ( !project->isActiveConfig("debug") ) |
164 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); | 176 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG"); |
165 | if ( !is_qt ) { | 177 | if ( !is_qt ) { |
166 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) { | 178 | if ( !project->isEmpty("QMAKE_RPATH") ) { |
167 | if ( !project->isEmpty("QMAKE_RPATH") ) | 179 | if ( !project->isEmpty("QMAKE_RTLDIR_QT") ) |
168 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), | 180 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_RTLDIR_QT", " " + var("QMAKE_RPATH"), |
169 | " " + var("QMAKE_RPATH"), ""); | 181 | " " + var("QMAKE_RPATH"), ""); |
170 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); | 182 | else if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) |
183 | project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"), | ||
184 | " " + var("QMAKE_RPATH"), ""); | ||
171 | } | 185 | } |
172 | if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD")) | 186 | if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) |
187 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", ""); | ||
188 | if ( project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD") ) | ||
173 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; | 189 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; |
174 | else | 190 | else |
175 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; | 191 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; |
176 | } | 192 | } |
177 | } | 193 | } |
178 | if ( project->isActiveConfig("opengl") ) { | 194 | if ( project->isActiveConfig("opengl") && !project->isActiveConfig("dlopen_opengl")) { |
179 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; | 195 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"]; |
180 | if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) | 196 | if(!project->isEmpty("QMAKE_LIBDIR_OPENGL")) |
181 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); | 197 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", ""); |
182 | if ( is_qt ) | 198 | if ( is_qt ) |
183 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; | 199 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"]; |
184 | else | 200 | else |
185 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; | 201 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; |
186 | } | 202 | } |
187 | if(project->isActiveConfig("global_init_link_order")) | 203 | if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) { |
188 | project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"]; | 204 | if(configs.findIndex("x11lib") == -1) |
205 | configs.append("x11lib"); | ||
206 | if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 ) | ||
207 | configs.append("x11inc"); | ||
208 | } | ||
209 | if ( project->isActiveConfig("x11") ) { | ||
210 | if(configs.findIndex("x11lib") == -1) | ||
211 | configs.append("x11lib"); | ||
212 | if(configs.findIndex("x11inc") == -1) | ||
213 | configs.append("x11inc"); | ||
214 | } | ||
189 | if ( project->isActiveConfig("x11inc") ) | 215 | if ( project->isActiveConfig("x11inc") ) |
190 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; | 216 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"]; |
191 | if ( project->isActiveConfig("x11lib") ) { | 217 | if ( project->isActiveConfig("x11lib") ) { |
192 | if(!project->isEmpty("QMAKE_LIBDIR_X11")) | 218 | if(!project->isEmpty("QMAKE_LIBDIR_X11")) |
193 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); | 219 | project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", ""); |
194 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; | 220 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"]; |
195 | } | 221 | } |
196 | if ( project->isActiveConfig("x11sm") ) | 222 | if ( project->isActiveConfig("x11sm") ) |
197 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; | 223 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"]; |
198 | if ( project->isActiveConfig("dylib") ) | 224 | if ( project->isActiveConfig("dylib") ) |
199 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; | 225 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"]; |
200 | if ( project->isActiveConfig("thread") ) { | 226 | if ( project->isActiveConfig("thread") ) { |
201 | if(project->isActiveConfig("qt")) | 227 | if(project->isActiveConfig("qt")) |
202 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); | 228 | project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT"); |
203 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) | 229 | if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) { |
204 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; | 230 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; |
205 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) | 231 | project->variables()["PRL_EXPORT_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"]; |
232 | } | ||
233 | if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) { | ||
206 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | 234 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; |
235 | project->variables()["PRL_EXPORT_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"]; | ||
236 | } | ||
207 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; | 237 | project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"]; |
208 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; | 238 | project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"]; |
209 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) | 239 | if(!project->isEmpty("QMAKE_LFLAGS_THREAD")) |
210 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; | 240 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"]; |
211 | } | 241 | } |
212 | if ( project->isActiveConfig("moc") ) | 242 | if ( project->isActiveConfig("moc") ) |
213 | setMocAware(TRUE); | 243 | setMocAware(TRUE); |
214 | if ( project->isEmpty("QMAKE_RUN_CC") ) | 244 | QString compile_flag = var("QMAKE_COMPILE_FLAG"); |
215 | project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src"); | 245 | if(compile_flag.isEmpty()) |
216 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) | 246 | compile_flag = "-c"; |
217 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<"); | 247 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) { |
218 | if ( project->isEmpty("QMAKE_RUN_CXX") ) | 248 | QString prefix_flags = project->first("QMAKE_CFLAGS_PREFIX_INCLUDE"); |
219 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src"); | 249 | if(prefix_flags.isEmpty()) |
220 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) | 250 | prefix_flags = "-include"; |
221 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<"); | 251 | compile_flag += " " + prefix_flags + " " + project->first("QMAKE_ORIG_TARGET"); |
222 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); | 252 | } |
223 | if ( !project->isEmpty("PRECOMPH") ) { | 253 | if(!project->isEmpty("ALLMOC_HEADER")) { |
224 | initOutPaths(); // Need to fix MOC_DIR since we do this before init() | 254 | initOutPaths(); // Need to fix outdirs since we do this before init() (because we could add to SOURCES et al) |
225 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); | 255 | QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir); |
226 | project->variables()["SOURCES"].prepend(allmoc); | 256 | project->variables()["SOURCES"].prepend(allmoc); |
227 | project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"]; | 257 | project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"]; |
228 | project->variables()["HEADERS"].clear(); | 258 | project->variables()["HEADERS"].clear(); |
229 | } | 259 | } |
260 | if ( project->isEmpty("QMAKE_RUN_CC") ) | ||
261 | project->variables()["QMAKE_RUN_CC"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $obj $src"); | ||
262 | if ( project->isEmpty("QMAKE_RUN_CC_IMP") ) | ||
263 | project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $@ $<"); | ||
264 | if ( project->isEmpty("QMAKE_RUN_CXX") ) | ||
265 | project->variables()["QMAKE_RUN_CXX"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $obj $src"); | ||
266 | if ( project->isEmpty("QMAKE_RUN_CXX_IMP") ) | ||
267 | project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $@ $<"); | ||
268 | project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " "); | ||
230 | if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) | 269 | if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS")) |
231 | include_deps = TRUE; //do not generate deps | 270 | include_deps = TRUE; //do not generate deps |
271 | if(project->isActiveConfig("compile_libtool")) | ||
272 | Option::obj_ext = ".lo"; //override the .o | ||
232 | 273 | ||
233 | MakefileGenerator::init(); | 274 | MakefileGenerator::init(); |
234 | if ( project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 275 | if ( project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
235 | if(!project->isEmpty("QMAKE_APP_FLAG")) { | 276 | if(!project->isEmpty("QMAKE_APP_FLAG")) { |
236 | if(project->isEmpty("DESTDIR")) | 277 | if(project->isEmpty("DESTDIR")) |
237 | project->values("DESTDIR").append(""); | 278 | project->values("DESTDIR").append(""); |
238 | project->variables()["DESTDIR"].first() += project->variables()["TARGET"].first() + | 279 | project->variables()["DESTDIR"].first() += project->variables()["TARGET"].first() + |
239 | ".app/Contents/MacOS/"; | 280 | ".app/Contents/MacOS/"; |
240 | project->variables()["QMAKE_PKGINFO"].append(project->first("DESTDIR") + "../PkgInfo"); | 281 | project->variables()["QMAKE_PKGINFO"].append(project->first("DESTDIR") + "../PkgInfo"); |
241 | project->variables()["ALL_DEPS"] += project->first("QMAKE_PKGINFO"); | 282 | project->variables()["ALL_DEPS"] += project->first("QMAKE_PKGINFO"); |
242 | 283 | ||
243 | QString plist = specdir() + QDir::separator() + "Info.plist." + | 284 | QString plist = fileFixify(project->first("QMAKE_INFO_PLIST")); |
244 | project->first("TEMPLATE"); | 285 | if(plist.isEmpty()) |
286 | plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); | ||
245 | if(QFile::exists(Option::fixPathToLocalOS(plist))) { | 287 | if(QFile::exists(Option::fixPathToLocalOS(plist))) { |
246 | project->variables()["QMAKE_INFO_PLIST"].append(plist); | 288 | if(project->isEmpty("QMAKE_INFO_PLIST")) |
289 | project->variables()["QMAKE_INFO_PLIST"].append(plist); | ||
247 | project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") + | 290 | project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") + |
248 | "../Info.plist"); | 291 | "../Info.plist"); |
249 | project->variables()["ALL_DEPS"] += project->first("QMAKE_INFO_PLIST_OUT"); | 292 | project->variables()["ALL_DEPS"] += project->first("QMAKE_INFO_PLIST_OUT"); |
250 | if(!project->isEmpty("RC_FILE")) | 293 | if(!project->isEmpty("RC_FILE")) |
251 | project->variables()["ALL_DEPS"] += project->first("DESTDIR") + | 294 | project->variables()["ALL_DEPS"] += project->first("DESTDIR") + |
252 | "../Resources/application.icns"; | 295 | "../Resources/application.icns"; |
253 | } | 296 | } |
254 | } | 297 | } |
255 | } | 298 | } |
256 | 299 | ||
257 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) | 300 | if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES")) |
258 | project->variables()["DISTFILES"] += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; | 301 | project->variables()["DISTFILES"] += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"]; |
259 | project->variables()["DISTFILES"] += Option::mkfile::project_files; | 302 | project->variables()["DISTFILES"] += Option::mkfile::project_files; |
260 | 303 | ||
261 | init2(); | 304 | init2(); |
262 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_LIBDIR_FLAGS" << "QMAKE_LIBS"; | 305 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_LIBDIR_FLAGS" << "QMAKE_LIBS"; |
263 | if(!project->isEmpty("QMAKE_MAX_FILES_PER_AR")) { | 306 | if(!project->isEmpty("QMAKE_MAX_FILES_PER_AR")) { |
264 | bool ok; | 307 | bool ok; |
265 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(&ok); | 308 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(&ok); |
266 | QStringList ar_sublibs, objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"]; | 309 | QStringList ar_sublibs, objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"]; |
267 | if(ok && max_files > 5 && max_files < (int)objs.count()) { | 310 | if(ok && max_files > 5 && max_files < (int)objs.count()) { |
268 | int obj_cnt = 0, lib_cnt = 0; | 311 | int obj_cnt = 0, lib_cnt = 0; |
269 | QString lib; | 312 | QString lib; |
270 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { | 313 | for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { |
271 | if((++obj_cnt) >= max_files) { | 314 | if((++obj_cnt) >= max_files) { |
272 | if(lib_cnt) { | 315 | if(lib_cnt) { |
273 | lib.sprintf("lib%s-tmp%d.a", project->first("QMAKE_ORIG_TARGET").latin1(), lib_cnt); | 316 | lib.sprintf("lib%s-tmp%d.a", project->first("QMAKE_ORIG_TARGET").latin1(), lib_cnt); |
274 | ar_sublibs << lib; | 317 | ar_sublibs << lib; |
275 | obj_cnt = 0; | 318 | obj_cnt = 0; |
276 | } | 319 | } |
277 | lib_cnt++; | 320 | lib_cnt++; |
278 | } | 321 | } |
279 | } | 322 | } |
280 | } | 323 | } |
281 | if(!ar_sublibs.isEmpty()) { | 324 | if(!ar_sublibs.isEmpty()) { |
282 | project->variables()["QMAKE_AR_SUBLIBS"] = ar_sublibs; | 325 | project->variables()["QMAKE_AR_SUBLIBS"] = ar_sublibs; |
283 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_AR_SUBLIBS"; | 326 | project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_AR_SUBLIBS"; |
284 | } | 327 | } |
285 | } | 328 | } |
329 | |||
330 | if(project->isActiveConfig("compile_libtool")) { | ||
331 | const QString libtoolify[] = { "QMAKE_RUN_CC", "QMAKE_RUN_CC_IMP", | ||
332 | "QMAKE_RUN_CXX", "QMAKE_RUN_CXX_IMP", | ||
333 | "QMAKE_LINK_THREAD", "QMAKE_LINK", "QMAKE_AR_CMD", "QMAKE_LINK_SHLIB_CMD", | ||
334 | QString::null }; | ||
335 | for(int i = 0; !libtoolify[i].isNull(); i++) { | ||
336 | QStringList &l = project->variables()[libtoolify[i]]; | ||
337 | if(!l.isEmpty()) { | ||
338 | QString libtool_flags, comp_flags; | ||
339 | if(libtoolify[i].startsWith("QMAKE_LINK") || libtoolify[i] == "QMAKE_AR_CMD") { | ||
340 | libtool_flags += " --mode=link"; | ||
341 | if(project->isActiveConfig("staticlib")) { | ||
342 | libtool_flags += " -static"; | ||
343 | } else { | ||
344 | if(!project->isEmpty("QMAKE_LIB_FLAG")) { | ||
345 | int maj = project->first("VER_MAJ").toInt(); | ||
346 | int min = project->first("VER_MIN").toInt(); | ||
347 | int pat = project->first("VER_PAT").toInt(); | ||
348 | comp_flags += " -version-info " + QString::number(10*maj + min) + | ||
349 | ":" + QString::number(pat) + ":0"; | ||
350 | if(libtoolify[i] != "QMAKE_AR_CMD") { | ||
351 | QString rpath = Option::output_dir; | ||
352 | if(!project->isEmpty("DESTDIR")) { | ||
353 | rpath = project->first("DESTDIR"); | ||
354 | if(QDir::isRelativePath(rpath)) | ||
355 | rpath.prepend(Option::output_dir + Option::dir_sep); | ||
356 | } | ||
357 | comp_flags += " -rpath " + Option::fixPathToTargetOS(rpath, FALSE); | ||
358 | } | ||
359 | } | ||
360 | } | ||
361 | if(project->isActiveConfig("plugin")) | ||
362 | libtool_flags += " -module"; | ||
363 | } else { | ||
364 | libtool_flags += " --mode=compile"; | ||
365 | } | ||
366 | l.first().prepend("$(LIBTOOL)" + libtool_flags + " "); | ||
367 | if(!comp_flags.isEmpty()) | ||
368 | l.first() += comp_flags; | ||
369 | } | ||
370 | } | ||
371 | } | ||
286 | } | 372 | } |
287 | 373 | ||
288 | QStringList | 374 | QStringList |
289 | UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &list2) | 375 | UnixMakefileGenerator::combineSetLFlags(const QStringList &list1, const QStringList &list2) |
290 | { | 376 | { |
377 | if(project->isActiveConfig("no_smart_library_merge")) | ||
378 | return list1 + list2; | ||
379 | |||
291 | QStringList ret; | 380 | QStringList ret; |
292 | for(QStringList::ConstIterator it = list1.begin(); it != list1.end(); ++it) { | 381 | for(int i = 0; i < 2; i++) { |
293 | bool unique = TRUE; | 382 | const QStringList *lst = i ? &list2 : &list1; |
294 | if((*it).startsWith("-")) { | 383 | for(QStringList::ConstIterator it = lst->begin(); it != lst->end(); ++it) { |
295 | if((*it).startsWith("-l") || (*it).startsWith("-L")) { | 384 | if((*it).startsWith("-")) { |
296 | unique = list2.findIndex((*it)) == -1; | 385 | if((*it).startsWith("-L")) { |
297 | } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) { | 386 | if(ret.findIndex((*it)) == -1) |
298 | int as_one = TRUE; | 387 | ret.append((*it)); |
299 | QString framework_in; | 388 | } else if((*it).startsWith("-l")) { |
300 | if((*it).length() > 11) { | 389 | while(1) { |
301 | framework_in = (*it).mid(11); | 390 | QStringList::Iterator idx = ret.find((*it)); |
302 | } else { | 391 | if(idx == ret.end()) |
303 | if(it != list1.end()) { | 392 | break; |
304 | ++it; | 393 | ret.remove(idx); |
305 | as_one = FALSE; | ||
306 | framework_in = (*it); | ||
307 | } | 394 | } |
308 | } | 395 | ret.append((*it)); |
309 | if(!framework_in.isEmpty()) { | 396 | } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) { |
310 | for(QStringList::ConstIterator outit = list2.begin(); outit != list2.end(); ++outit) { | 397 | int as_one = TRUE; |
311 | if((*outit).startsWith("-framework")) { | 398 | QString framework_in; |
312 | QString framework_out; | 399 | if((*it).length() > 11) { |
313 | if((*outit).length() > 11) { | 400 | framework_in = (*it).mid(11); |
314 | framework_out = (*outit).mid(11); | 401 | } else { |
315 | } else { | 402 | if(it != lst->end()) { |
316 | if(it != list2.end()) { | 403 | ++it; |
317 | ++outit; | 404 | as_one = FALSE; |
318 | framework_out = (*outit); | 405 | framework_in = (*it); |
406 | } | ||
407 | } | ||
408 | if(!framework_in.isEmpty()) { | ||
409 | for(QStringList::Iterator outit = ret.begin(); outit != ret.end(); ++outit) { | ||
410 | if((*outit).startsWith("-framework")) { | ||
411 | int found = 0; | ||
412 | if((*outit).length() > 11) { | ||
413 | if(framework_in == (*outit).mid(11)) | ||
414 | found = 1; | ||
415 | } else { | ||
416 | if(it != lst->end()) { | ||
417 | ++outit; | ||
418 | if(framework_in == (*outit)) { | ||
419 | --outit; | ||
420 | found = 2; | ||
421 | } | ||
422 | } | ||
319 | } | 423 | } |
320 | } | 424 | for(int i = 0; i < found; i++) |
321 | if(framework_out == framework_in) { | 425 | outit = ret.remove(outit); |
322 | unique = FALSE; | ||
323 | break; | ||
324 | } | 426 | } |
325 | } | 427 | } |
326 | } | ||
327 | if(unique) { | ||
328 | unique = FALSE; //because I'm about to just insert it myself | ||
329 | if(as_one) { | 428 | if(as_one) { |
330 | ret.append("-framework " + framework_in); | 429 | ret.append("-framework " + framework_in); |
331 | } else { | 430 | } else { |
332 | ret.append("-framework"); | 431 | ret.append("-framework"); |
333 | ret.append(framework_in); | 432 | ret.append(framework_in); |
334 | } | 433 | } |
335 | } | 434 | } |
435 | } else { | ||
436 | #if 1 | ||
437 | while(1) { | ||
438 | QStringList::Iterator idx = ret.find((*it)); | ||
439 | if(idx == ret.end()) | ||
440 | break; | ||
441 | ret.remove(idx); | ||
442 | } | ||
443 | #endif | ||
444 | ret.append((*it)); | ||
336 | } | 445 | } |
337 | } else { | 446 | } else /*if(QFile::exists((*it)))*/ { |
338 | unique = (list2.findIndex((*it)) == -1); | 447 | while(1) { |
448 | QStringList::Iterator idx = ret.find((*it)); | ||
449 | if(idx == ret.end()) | ||
450 | break; | ||
451 | ret.remove(idx); | ||
452 | } | ||
453 | ret.append((*it)); | ||
339 | } | 454 | } |
340 | } else if(QFile::exists((*it))) { | ||
341 | unique = (list2.findIndex((*it)) == -1); | ||
342 | } | 455 | } |
343 | if(unique) | ||
344 | ret.append((*it)); | ||
345 | } | 456 | } |
346 | return ret; | 457 | return ret; |
347 | } | 458 | } |
348 | 459 | ||
349 | |||
350 | void | 460 | void |
351 | UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) | 461 | UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) |
352 | { | 462 | { |
353 | if(var == "QMAKE_PRL_LIBS") | 463 | if(var == "QMAKE_PRL_LIBS") |
354 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]); | 464 | project->variables()["QMAKE_CURRENT_PRL_LIBS"] = combineSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"] + |
465 | project->variables()["QMAKE_LIBS"], l); | ||
355 | else | 466 | else |
356 | MakefileGenerator::processPrlVariable(var, l); | 467 | MakefileGenerator::processPrlVariable(var, l); |
357 | } | 468 | } |
358 | 469 | ||
470 | QString | ||
471 | UnixMakefileGenerator::findDependency(const QString &dep) | ||
472 | { | ||
473 | QStringList::Iterator it; | ||
474 | { | ||
475 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | ||
476 | for(it = qut.begin(); it != qut.end(); ++it) { | ||
477 | QString targ = var((*it) + ".target"); | ||
478 | if(targ.isEmpty()) | ||
479 | targ = (*it); | ||
480 | if(targ.endsWith(dep)) | ||
481 | return targ; | ||
482 | } | ||
483 | } | ||
484 | { | ||
485 | QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
486 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
487 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
488 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
489 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
490 | continue; | ||
491 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
492 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
493 | QStringList &inputs = project->variables()[(*it2)]; | ||
494 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
495 | QString out = tmp_out; | ||
496 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
497 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
498 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
499 | if(out.endsWith(dep)) | ||
500 | return out; | ||
501 | } | ||
502 | } | ||
503 | } | ||
504 | } | ||
505 | return MakefileGenerator::findDependency(dep); | ||
506 | } | ||
507 | |||
508 | QStringList | ||
509 | &UnixMakefileGenerator::findDependencies(const QString &file) | ||
510 | { | ||
511 | QStringList &ret = MakefileGenerator::findDependencies(file); | ||
512 | // Note: The QMAKE_IMAGE_COLLECTION file have all images | ||
513 | // as dependency, so don't add precompiled header then | ||
514 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER") | ||
515 | && file != project->first("QMAKE_IMAGE_COLLECTION")) { | ||
516 | QString header_prefix = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep; | ||
517 | header_prefix += project->first("QMAKE_PRECOMP_PREFIX"); | ||
518 | if(file.endsWith(".c")) { | ||
519 | QString precomp_h = header_prefix + "c"; | ||
520 | if(!ret.contains(precomp_h)) | ||
521 | ret += precomp_h; | ||
522 | } else { | ||
523 | for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) { | ||
524 | if(file.endsWith(*it)) { | ||
525 | QString precomp_h = header_prefix + "c++"; | ||
526 | if(!ret.contains(precomp_h)) | ||
527 | ret += precomp_h; | ||
528 | break; | ||
529 | } | ||
530 | } | ||
531 | } | ||
532 | } | ||
533 | return ret; | ||
534 | } | ||
535 | |||
359 | bool | 536 | bool |
360 | UnixMakefileGenerator::findLibraries() | 537 | UnixMakefileGenerator::findLibraries() |
361 | { | 538 | { |
362 | QPtrList<MakefileDependDir> libdirs; | 539 | QPtrList<MakefileDependDir> libdirs; |
363 | libdirs.setAutoDelete(TRUE); | 540 | libdirs.setAutoDelete(TRUE); |
364 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | 541 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; |
365 | for(int i = 0; !lflags[i].isNull(); i++) { | 542 | for(int i = 0; !lflags[i].isNull(); i++) { |
366 | QStringList &l = project->variables()[lflags[i]]; | 543 | QStringList &l = project->variables()[lflags[i]]; |
367 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 544 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
368 | QString stub, dir, extn, opt = (*it).stripWhiteSpace(); | 545 | QString stub, dir, extn, opt = (*it).stripWhiteSpace(); |
369 | if(opt.startsWith("-")) { | 546 | if(opt.startsWith("-")) { |
370 | if(opt.startsWith("-L")) { | 547 | if(opt.startsWith("-L")) { |
371 | QString r = opt.right(opt.length() - 2), l = r; | 548 | QString r = opt.right(opt.length() - 2), l = r; |
372 | fixEnvVariables(l); | 549 | fixEnvVariables(l); |
373 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 550 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
374 | l.replace("\"",""))); | 551 | l.replace("\"",""))); |
375 | } else if(opt.startsWith("-l")) { | 552 | } else if(opt.startsWith("-l")) { |
376 | stub = opt.mid(2); | 553 | stub = opt.mid(2); |
377 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | 554 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { |
378 | if(opt.length() > 11) { | 555 | if(opt.length() > 11) { |
379 | opt = opt.mid(11); | 556 | opt = opt.mid(11); |
380 | } else { | 557 | } else { |
381 | ++it; | 558 | ++it; |
382 | opt = (*it); | 559 | opt = (*it); |
383 | } | 560 | } |
384 | extn = ""; | 561 | extn = ""; |
385 | dir = "/System/Library/Frameworks/" + opt + ".framework/"; | 562 | dir = "/System/Library/Frameworks/" + opt + ".framework/"; |
386 | stub = opt; | 563 | stub = opt; |
387 | } | 564 | } |
388 | } else { | 565 | } else { |
389 | extn = dir = ""; | 566 | extn = dir = ""; |
390 | stub = opt; | 567 | stub = opt; |
391 | int slsh = opt.findRev(Option::dir_sep); | 568 | int slsh = opt.findRev(Option::dir_sep); |
392 | if(slsh != -1) { | 569 | if(slsh != -1) { |
393 | dir = opt.left(slsh); | 570 | dir = opt.left(slsh); |
394 | stub = opt.mid(slsh+1); | 571 | stub = opt.mid(slsh+1); |
395 | } | 572 | } |
396 | QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$"); | 573 | QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$"); |
397 | if(stub_reg.exactMatch(stub)) { | 574 | if(stub_reg.exactMatch(stub)) { |
398 | stub = stub_reg.cap(1); | 575 | stub = stub_reg.cap(1); |
399 | extn = stub_reg.cap(2); | 576 | extn = stub_reg.cap(2); |
400 | } | 577 | } |
401 | } | 578 | } |
402 | if(!stub.isEmpty()) { | 579 | if(!stub.isEmpty()) { |
403 | const QString modifs[] = { "-mt", QString::null }; | 580 | const QString modifs[] = { "", "-mt", QString::null }; |
404 | for(int modif = 0; !modifs[modif].isNull(); modif++) { | 581 | for(int modif = 0; !modifs[modif].isNull(); modif++) { |
405 | bool found = FALSE; | 582 | bool found = FALSE; |
406 | QStringList extens; | 583 | QStringList extens; |
407 | if(!extn.isNull()) | 584 | if(!extn.isNull()) |
408 | extens << extn; | 585 | extens << extn; |
409 | else | 586 | else |
410 | extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a"; | 587 | extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a"; |
411 | for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) { | 588 | for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) { |
412 | if(dir.isNull()) { | 589 | if(dir.isNull()) { |
413 | QString lib_stub; | 590 | QString lib_stub; |
414 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 591 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
415 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + | 592 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + |
416 | modifs[modif] + "." + (*extit))) { | 593 | modifs[modif] + "." + (*extit))) { |
417 | lib_stub = stub + modifs[modif]; | 594 | lib_stub = stub + modifs[modif]; |
418 | break; | 595 | break; |
419 | } | 596 | } |
420 | } | 597 | } |
421 | if(!lib_stub.isNull()) { | 598 | if(!lib_stub.isNull()) { |
422 | (*it) = "-l" + lib_stub; | 599 | (*it) = "-l" + lib_stub; |
423 | found = TRUE; | 600 | found = TRUE; |
424 | break; | 601 | break; |
425 | } | 602 | } |
426 | } else { | 603 | } else { |
427 | if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) { | 604 | if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) { |
428 | (*it) = "lib" + stub + modifs[modif] + "." + (*extit); | 605 | (*it) = "lib" + stub + modifs[modif] + "." + (*extit); |
429 | found = TRUE; | 606 | found = TRUE; |
430 | break; | 607 | break; |
431 | } | 608 | } |
432 | } | 609 | } |
433 | } | 610 | } |
611 | if(!found && project->isActiveConfig("compile_libtool")) { | ||
612 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | ||
613 | if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + modifs[modif] + Option::libtool_ext)) { | ||
614 | (*it) = mdd->real_dir + Option::dir_sep + "lib" + stub + modifs[modif] + Option::libtool_ext; | ||
615 | found = TRUE; | ||
616 | break; | ||
617 | } | ||
618 | } | ||
619 | } | ||
434 | if(found) | 620 | if(found) |
435 | break; | 621 | break; |
622 | |||
436 | } | 623 | } |
437 | } | 624 | } |
438 | } | 625 | } |
439 | } | 626 | } |
440 | return FALSE; | 627 | return FALSE; |
441 | } | 628 | } |
442 | 629 | ||
630 | QString linkLib(const QString &file, const QString &libName) { | ||
631 | QString ret; | ||
632 | QRegExp reg("^.*lib(" + libName + "[^./=]*).*$"); | ||
633 | if(reg.exactMatch(file)) | ||
634 | ret = "-l" + reg.cap(1); | ||
635 | return ret; | ||
636 | } | ||
637 | |||
443 | void | 638 | void |
444 | UnixMakefileGenerator::processPrlFiles() | 639 | UnixMakefileGenerator::processPrlFiles() |
445 | { | 640 | { |
446 | QDict<void> processed; | 641 | QDict<void> processed; |
447 | QPtrList<MakefileDependDir> libdirs; | 642 | QPtrList<MakefileDependDir> libdirs; |
448 | libdirs.setAutoDelete(TRUE); | 643 | libdirs.setAutoDelete(TRUE); |
449 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; | 644 | const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null }; |
450 | for(int i = 0; !lflags[i].isNull(); i++) { | 645 | for(int i = 0; !lflags[i].isNull(); i++) { |
451 | for(bool ret = FALSE; TRUE; ret = FALSE) { | 646 | for(bool ret = FALSE; TRUE; ret = FALSE) { |
452 | QStringList l_out; | 647 | QStringList l_out; |
453 | QStringList &l = project->variables()[lflags[i]]; | 648 | QStringList &l = project->variables()[lflags[i]]; |
454 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 649 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
455 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); | 650 | project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear(); |
456 | QString opt = (*it).stripWhiteSpace();; | 651 | QString opt = (*it).stripWhiteSpace(); |
457 | if(opt.startsWith("-")) { | 652 | if(opt.startsWith("-")) { |
458 | if(opt.startsWith("-L")) { | 653 | if(opt.startsWith("-L")) { |
459 | QString r = opt.right(opt.length() - 2), l = r; | 654 | QString r = opt.right(opt.length() - 2), l = r; |
460 | fixEnvVariables(l); | 655 | fixEnvVariables(l); |
461 | libdirs.append(new MakefileDependDir(r.replace("\"",""), | 656 | libdirs.append(new MakefileDependDir(r.replace("\"",""), |
462 | l.replace("\"",""))); | 657 | l.replace("\"",""))); |
463 | } else if(opt.startsWith("-l") && !processed[opt]) { | 658 | } else if(opt.startsWith("-l") && !processed[opt]) { |
464 | QString lib = opt.right(opt.length() - 2), prl; | 659 | QString lib = opt.right(opt.length() - 2); |
465 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { | 660 | for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) { |
466 | prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext; | 661 | if(!project->isActiveConfig("compile_libtool")) { //give them the .libs.. |
662 | QString la = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::libtool_ext; | ||
663 | if(QFile::exists(la) && QFile::exists(mdd->local_dir + Option::dir_sep + ".libs")) { | ||
664 | l_out.append("-L" + mdd->real_dir + Option::dir_sep + ".libs"); | ||
665 | libdirs.append(new MakefileDependDir(mdd->real_dir + Option::dir_sep + ".libs", | ||
666 | mdd->local_dir + Option::dir_sep + ".libs")); | ||
667 | } | ||
668 | } | ||
669 | |||
670 | QString prl = mdd->local_dir + Option::dir_sep + "lib" + lib; | ||
467 | if(processPrlFile(prl)) { | 671 | if(processPrlFile(prl)) { |
468 | if(prl.startsWith(mdd->local_dir)) | 672 | if(prl.startsWith(mdd->local_dir)) |
469 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); | 673 | prl.replace(0, mdd->local_dir.length(), mdd->real_dir); |
470 | QRegExp reg("^.*lib(" + lib + "[^./=]*)\\..*$"); | 674 | opt = linkLib(prl, lib); |
471 | if(reg.exactMatch(prl)) | ||
472 | prl = "-l" + reg.cap(1); | ||
473 | opt = prl; | ||
474 | processed.insert(opt, (void*)1); | 675 | processed.insert(opt, (void*)1); |
475 | ret = TRUE; | 676 | ret = TRUE; |
476 | break; | 677 | break; |
477 | } | 678 | } |
478 | } | 679 | } |
479 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { | 680 | } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) { |
480 | if(opt.length() > 11) { | 681 | if(opt.length() > 11) { |
481 | opt = opt.mid(11); | 682 | opt = opt.mid(11); |
482 | } else { | 683 | } else { |
483 | ++it; | 684 | ++it; |
484 | opt = (*it); | 685 | opt = (*it); |
485 | } | 686 | } |
486 | QString prl = "/System/Library/Frameworks/" + opt + | 687 | QString prl = "/System/Library/Frameworks/" + opt + |
487 | ".framework/" + opt + Option::prl_ext; | 688 | ".framework/" + opt; |
488 | if(processPrlFile(prl)) | 689 | if(processPrlFile(prl)) |
489 | ret = TRUE; | 690 | ret = TRUE; |
490 | l_out.append("-framework"); | 691 | l_out.append("-framework"); |
491 | } | 692 | } |
492 | if(!opt.isEmpty()) | 693 | if(!opt.isEmpty()) |
493 | l_out.append(opt); | 694 | l_out.append(opt); |
494 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 695 | l_out = combineSetLFlags(l_out, project->variables()["QMAKE_CURRENT_PRL_LIBS"]); |
495 | } else { | 696 | } else { |
496 | if(!processed[opt] && processPrlFile(opt)) { | 697 | QString lib = opt; |
497 | processed.insert(opt, (void*)1); | 698 | if(!processed[lib] && processPrlFile(lib)) { |
498 | ret = TRUE; | 699 | processed.insert(lib, (void*)1); |
700 | ret = TRUE; | ||
499 | } | 701 | } |
702 | #if 0 | ||
703 | if(ret) | ||
704 | opt = linkLib(lib, ""); | ||
705 | #endif | ||
500 | if(!opt.isEmpty()) | 706 | if(!opt.isEmpty()) |
501 | l_out.append(opt); | 707 | l_out.append(opt); |
502 | l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out); | 708 | l_out = combineSetLFlags(l_out, project->variables()["QMAKE_CURRENT_PRL_LIBS"]); |
503 | } | 709 | } |
504 | } | 710 | } |
505 | if(ret && l != l_out) | 711 | if(ret && l != l_out) |
506 | l = l_out; | 712 | l = l_out; |
507 | else | 713 | else |
508 | break; | 714 | break; |
509 | } | 715 | } |
510 | } | 716 | } |
511 | } | 717 | } |
512 | 718 | ||
513 | QString | 719 | QString |
514 | UnixMakefileGenerator::defaultInstall(const QString &t) | 720 | UnixMakefileGenerator::defaultInstall(const QString &t) |
515 | { | 721 | { |
516 | if(t != "target" || project->first("TEMPLATE") == "subdirs") | 722 | if(t != "target" || project->first("TEMPLATE") == "subdirs") |
517 | return QString(); | 723 | return QString(); |
518 | 724 | ||
519 | bool resource = FALSE; | 725 | bool resource = FALSE; |
520 | const QString root = "$(INSTALL_ROOT)"; | 726 | const QString root = "$(INSTALL_ROOT)"; |
521 | QStringList &uninst = project->variables()[t + ".uninstall"]; | 727 | QStringList &uninst = project->variables()[t + ".uninstall"]; |
522 | QString ret, destdir=project->first("DESTDIR"); | 728 | QString ret, destdir=project->first("DESTDIR"); |
523 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); | 729 | QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE); |
524 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 730 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
525 | destdir += Option::dir_sep; | 731 | destdir += Option::dir_sep; |
526 | targetdir = fileFixify(targetdir); | 732 | targetdir = fileFixify(targetdir); |
527 | if(targetdir.right(1) != Option::dir_sep) | 733 | if(targetdir.right(1) != Option::dir_sep) |
528 | targetdir += Option::dir_sep; | 734 | targetdir += Option::dir_sep; |
529 | 735 | ||
530 | QStringList links; | 736 | QStringList links; |
531 | QString target="$(TARGET)"; | 737 | QString target="$(TARGET)"; |
532 | if(project->first("TEMPLATE") == "app") { | 738 | if(project->first("TEMPLATE") == "app") { |
533 | target = "$(QMAKE_TARGET)"; | 739 | target = "$(QMAKE_TARGET)"; |
534 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { | 740 | if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) { |
535 | destdir += "../../../"; | 741 | destdir += "../../../"; |
536 | target += ".app"; | 742 | target += ".app"; |
537 | resource = TRUE; | 743 | resource = TRUE; |
538 | } | 744 | } |
539 | } else if(project->first("TEMPLATE") == "lib") { | 745 | } else if(project->first("TEMPLATE") == "lib") { |
540 | if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | 746 | if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") && |
747 | !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) { | ||
541 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); | 748 | QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE"); |
542 | int slsh = dst_prl.findRev('/'); | 749 | int slsh = dst_prl.findRev('/'); |
543 | if(slsh != -1) | 750 | if(slsh != -1) |
544 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); | 751 | dst_prl = dst_prl.right(dst_prl.length() - slsh - 1); |
545 | dst_prl = root + targetdir + dst_prl; | 752 | dst_prl = root + targetdir + dst_prl; |
546 | ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; | 753 | ret += "-$(INSTALL_FILE) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\""; |
547 | if(!uninst.isEmpty()) | 754 | if(!uninst.isEmpty()) |
548 | uninst.append("\n\t"); | 755 | uninst.append("\n\t"); |
549 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); | 756 | uninst.append("-$(DEL_FILE) \"" + dst_prl + "\""); |
550 | } | 757 | } |
758 | if(project->isActiveConfig("create_libtool") && !project->isActiveConfig("compile_libtool")) { | ||
759 | QString src_lt = var("QMAKE_ORIG_TARGET"); | ||
760 | int slsh = src_lt.findRev(Option::dir_sep); | ||
761 | if(slsh != -1) | ||
762 | src_lt = src_lt.right(src_lt.length() - slsh); | ||
763 | int dot = src_lt.find('.'); | ||
764 | if(dot != -1) | ||
765 | src_lt = src_lt.left(dot); | ||
766 | src_lt += Option::libtool_ext; | ||
767 | src_lt.prepend("lib"); | ||
768 | QString dst_lt = root + targetdir + src_lt; | ||
769 | if(!project->isEmpty("DESTDIR")) { | ||
770 | src_lt.prepend(var("DESTDIR")); | ||
771 | src_lt = Option::fixPathToLocalOS(fileFixify(src_lt, | ||
772 | QDir::currentDirPath(), Option::output_dir)); | ||
773 | } | ||
774 | if(!ret.isEmpty()) | ||
775 | ret += "\n\t"; | ||
776 | ret += "-$(INSTALL_FILE) \"" + src_lt + "\" \"" + dst_lt + "\""; | ||
777 | if(!uninst.isEmpty()) | ||
778 | uninst.append("\n\t"); | ||
779 | uninst.append("-$(DEL_FILE) \"" + dst_lt + "\""); | ||
780 | } | ||
781 | if(project->isActiveConfig("create_pc")) { | ||
782 | QString src_pc = var("QMAKE_ORIG_TARGET"); | ||
783 | int slsh = src_pc.findRev(Option::dir_sep); | ||
784 | if(slsh != -1) | ||
785 | src_pc = src_pc.right(src_pc.length() - slsh); | ||
786 | int dot = src_pc.find('.'); | ||
787 | if(dot != -1) | ||
788 | src_pc = src_pc.left(dot); | ||
789 | src_pc += ".pc"; | ||
790 | QString d = root + targetdir + "pkgconfig" + Option::dir_sep; | ||
791 | QString dst_pc = d + src_pc; | ||
792 | if(!project->isEmpty("DESTDIR")) { | ||
793 | src_pc.prepend(var("DESTDIR")); | ||
794 | src_pc = Option::fixPathToLocalOS(fileFixify(src_pc, | ||
795 | QDir::currentDirPath(), Option::output_dir)); | ||
796 | } | ||
797 | if(!ret.isEmpty()) | ||
798 | ret += "\n\t"; | ||
799 | ret += mkdir_p_asstring(d) + "\n\t"; | ||
800 | ret += "-$(INSTALL_FILE) \"" + src_pc + "\" \"" + dst_pc + "\""; | ||
801 | if(!uninst.isEmpty()) | ||
802 | uninst.append("\n\t"); | ||
803 | uninst.append("-$(DEL_FILE) \"" + dst_pc + "\""); | ||
804 | } | ||
551 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { | 805 | if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) { |
552 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { | 806 | if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) { |
553 | if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) { | 807 | if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
554 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; | 808 | links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)"; |
555 | } else { | 809 | } else { |
556 | links << "$(TARGET0)"; | 810 | links << "$(TARGET0)"; |
557 | } | 811 | } |
558 | } | 812 | } |
559 | } | 813 | } |
560 | } | 814 | } |
561 | QString src_targ = target; | 815 | |
562 | if(!destdir.isEmpty()) | 816 | if(!resource && project->isActiveConfig("compile_libtool")) { |
563 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | 817 | QString src_targ = target; |
564 | QString dst_targ = root + fileFixify(targetdir + target); | 818 | if(src_targ == "$(TARGET)") |
565 | if(!ret.isEmpty()) | 819 | src_targ = "$(TARGETL)"; |
566 | ret += "\n\t"; | 820 | QString dst_dir = fileFixify(targetdir); |
567 | ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" + | 821 | if(QDir::isRelativePath(dst_dir)) |
568 | src_targ + "\" \"" + dst_targ + "\""; | 822 | dst_dir = Option::fixPathToTargetOS(Option::output_dir + Option::dir_sep + dst_dir); |
569 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) { | 823 | ret = "-$(LIBTOOL) --mode=install cp \"" + src_targ + "\" \"" + root + dst_dir + "\""; |
570 | ret += "\n\t-" + var("QMAKE_STRIP"); | 824 | uninst.append("-$(LIBTOOL) --mode=uninstall \"" + src_targ + "\""); |
571 | if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib") | 825 | } else { |
572 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | 826 | QString src_targ = target; |
827 | if(!destdir.isEmpty()) | ||
828 | src_targ = Option::fixPathToTargetOS(destdir + target, FALSE); | ||
829 | QString dst_targ = root + fileFixify(targetdir + target, | ||
830 | QDir::currentDirPath(), Option::output_dir); | ||
831 | if(!ret.isEmpty()) | ||
832 | ret += "\n\t"; | ||
573 | if(resource) | 833 | if(resource) |
574 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; | 834 | ret += "$(DEL_FILE) -r \"" + dst_targ + "\"" + "\n\t"; |
835 | if(!ret.isEmpty()) | ||
836 | ret += "\n\t"; | ||
837 | ret += QString(resource ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" + | ||
838 | src_targ + "\" \"" + dst_targ + "\""; | ||
839 | if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP") && | ||
840 | (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("staticlib"))) { | ||
841 | ret += "\n\t-" + var("QMAKE_STRIP"); | ||
842 | if(project->first("TEMPLATE") == "lib" && !project->isEmpty("QMAKE_STRIPFLAGS_LIB")) | ||
843 | ret += " " + var("QMAKE_STRIPFLAGS_LIB"); | ||
844 | else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP")) | ||
845 | ret += " " + var("QMAKE_STRIPFLAGS_APP"); | ||
846 | if(resource) | ||
847 | ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\""; | ||
848 | else | ||
849 | ret += " \"" + dst_targ + "\""; | ||
850 | } | ||
851 | if(!uninst.isEmpty()) | ||
852 | uninst.append("\n\t"); | ||
853 | if(resource) | ||
854 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); | ||
575 | else | 855 | else |
576 | ret += " \"" + dst_targ + "\""; | 856 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); |
577 | } | 857 | if(!links.isEmpty()) { |
578 | if(!uninst.isEmpty()) | 858 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { |
579 | uninst.append("\n\t"); | 859 | if(Option::target_mode == Option::TARG_WIN_MODE || |
580 | if(resource) | 860 | Option::target_mode == Option::TARG_MAC9_MODE) { |
581 | uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\""); | 861 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || |
582 | else | 862 | Option::target_mode == Option::TARG_MACX_MODE) { |
583 | uninst.append("-$(DEL_FILE) \"" + dst_targ + "\""); | 863 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); |
584 | if(!links.isEmpty()) { | 864 | int lslash = link.findRev(Option::dir_sep); |
585 | for(QStringList::Iterator it = links.begin(); it != links.end(); it++) { | 865 | if(lslash != -1) |
586 | if(Option::target_mode == Option::TARG_WIN_MODE || | 866 | link = link.right(link.length() - (lslash + 1)); |
587 | Option::target_mode == Option::TARG_MAC9_MODE) { | 867 | QString dst_link = root + targetdir + link; |
588 | } else if(Option::target_mode == Option::TARG_UNIX_MODE || | 868 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; |
589 | Option::target_mode == Option::TARG_MACX_MODE) { | 869 | if(!uninst.isEmpty()) |
590 | QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE); | 870 | uninst.append("\n\t"); |
591 | int lslash = link.findRev(Option::dir_sep); | 871 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); |
592 | if(lslash != -1) | 872 | } |
593 | link = link.right(link.length() - (lslash + 1)); | ||
594 | QString dst_link = root + fileFixify(targetdir + link); | ||
595 | ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\""; | ||
596 | if(!uninst.isEmpty()) | ||
597 | uninst.append("\n\t"); | ||
598 | uninst.append("-$(DEL_FILE) \"" + dst_link + "\""); | ||
599 | } | 873 | } |
600 | } | 874 | } |
601 | } | 875 | } |
602 | return ret; | 876 | return ret; |
603 | } | 877 | } |
604 | |||