-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 557 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.h | 24 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 648 |
3 files changed, 995 insertions, 234 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,22 +1,20 @@ | |||
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 |
@@ -69,51 +67,64 @@ UnixMakefileGenerator::init() | |||
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"]; |
@@ -128,131 +139,163 @@ UnixMakefileGenerator::init() | |||
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"]; |
@@ -274,97 +317,231 @@ UnixMakefileGenerator::init() | |||
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")) { |
@@ -391,25 +568,25 @@ UnixMakefileGenerator::findLibraries() | |||
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 + |
@@ -422,93 +599,122 @@ UnixMakefileGenerator::findLibraries() | |||
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) |
@@ -528,77 +734,144 @@ UnixMakefileGenerator::defaultInstall(const QString &t) | |||
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 | |||
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index 3d00214..91ec3b1 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h | |||
@@ -1,22 +1,20 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Definition of UnixMakefileGenerator class. |
5 | ** | 5 | ** |
6 | ** Created : 970521 | 6 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved. |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** This file is part of qmake. |
9 | ** | ||
10 | ** This file is part of the network module of the Qt GUI Toolkit. | ||
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 |
@@ -25,46 +23,58 @@ | |||
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 | **********************************************************************/ |
35 | |||
37 | #ifndef __UNIXMAKE_H__ | 36 | #ifndef __UNIXMAKE_H__ |
38 | #define __UNIXMAKE_H__ | 37 | #define __UNIXMAKE_H__ |
39 | 38 | ||
40 | #include "makefile.h" | 39 | #include "makefile.h" |
41 | 40 | ||
42 | class UnixMakefileGenerator : public MakefileGenerator | 41 | class UnixMakefileGenerator : public MakefileGenerator |
43 | { | 42 | { |
44 | bool init_flag, include_deps; | 43 | bool init_flag, include_deps; |
45 | bool writeMakefile(QTextStream &); | 44 | bool writeMakefile(QTextStream &); |
46 | QStringList uniqueSetLFlags(const QStringList &list1, QStringList &list2); | 45 | void writeExtraVariables(QTextStream &); |
46 | QString libtoolFileName(); | ||
47 | void writeLibtoolFile(); // for libtool | ||
48 | QString pkgConfigPrefix() const; | ||
49 | QString pkgConfigFileName(); | ||
50 | QString pkgConfigFixPath(QString) const; | ||
51 | void writePkgConfigFile(); // for pkg-config | ||
52 | QStringList combineSetLFlags(const QStringList &list1, const QStringList &list2); | ||
53 | void writePrlFile(QTextStream &); | ||
47 | 54 | ||
48 | public: | 55 | public: |
49 | UnixMakefileGenerator(QMakeProject *p); | 56 | UnixMakefileGenerator(QMakeProject *p); |
50 | ~UnixMakefileGenerator(); | 57 | ~UnixMakefileGenerator(); |
51 | 58 | ||
52 | protected: | 59 | protected: |
60 | virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); } | ||
53 | virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); } | 61 | virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); } |
54 | virtual QString defaultInstall(const QString &); | 62 | virtual QString defaultInstall(const QString &); |
55 | virtual void processPrlVariable(const QString &, const QStringList &); | 63 | virtual void processPrlVariable(const QString &, const QStringList &); |
56 | virtual void processPrlFiles(); | 64 | virtual void processPrlFiles(); |
57 | 65 | ||
58 | virtual bool findLibraries(); | 66 | virtual bool findLibraries(); |
67 | virtual QString findDependency(const QString &); | ||
68 | virtual QStringList &findDependencies(const QString &); | ||
59 | virtual void init(); | 69 | virtual void init(); |
60 | 70 | ||
61 | void writeMakeParts(QTextStream &); | 71 | void writeMakeParts(QTextStream &); |
62 | void writeSubdirs(QTextStream &, bool=TRUE); | 72 | void writeSubdirs(QTextStream &, bool=TRUE); |
63 | 73 | ||
64 | private: | 74 | private: |
65 | void init2(); | 75 | void init2(); |
66 | }; | 76 | }; |
67 | 77 | ||
68 | inline UnixMakefileGenerator::~UnixMakefileGenerator() | 78 | inline UnixMakefileGenerator::~UnixMakefileGenerator() |
69 | { } | 79 | { } |
70 | 80 | ||
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index d8a4a0d..21348a6 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp | |||
@@ -1,22 +1,20 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | ||
3 | ** | 2 | ** |
4 | ** Definition of ________ class. | ||
5 | ** | 3 | ** |
6 | ** Created : 970521 | 4 | ** Implementation of UnixMakefileGenerator class. |
7 | ** | 5 | ** |
8 | ** Copyright (C) 1992-2002 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 |
@@ -28,67 +26,115 @@ | |||
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" |
38 | #include "meta.h" | ||
40 | #include <qregexp.h> | 39 | #include <qregexp.h> |
41 | #include <qfile.h> | 40 | #include <qfile.h> |
42 | #include <qdir.h> | 41 | #include <qdir.h> |
43 | #include <time.h> | 42 | #include <time.h> |
44 | 43 | ||
44 | QString mkdir_p_asstring(const QString &dir); | ||
45 | 45 | ||
46 | UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE) | 46 | UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE) |
47 | { | 47 | { |
48 | 48 | ||
49 | } | 49 | } |
50 | 50 | ||
51 | void | ||
52 | UnixMakefileGenerator::writePrlFile(QTextStream &t) | ||
53 | { | ||
54 | MakefileGenerator::writePrlFile(t); | ||
55 | // libtool support | ||
56 | if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib") { //write .la | ||
57 | if(project->isActiveConfig("compile_libtool")) | ||
58 | warn_msg(WarnLogic, "create_libtool specified with compile_libtool can lead to conflicting .la\n" | ||
59 | "formats, create_libtool has been disabled\n"); | ||
60 | else | ||
61 | writeLibtoolFile(); | ||
62 | } | ||
63 | // pkg-config support | ||
64 | if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") | ||
65 | writePkgConfigFile(); | ||
66 | } | ||
67 | |||
51 | bool | 68 | bool |
52 | UnixMakefileGenerator::writeMakefile(QTextStream &t) | 69 | UnixMakefileGenerator::writeMakefile(QTextStream &t) |
53 | { | 70 | { |
71 | |||
54 | writeHeader(t); | 72 | writeHeader(t); |
55 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { | 73 | if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { |
56 | t << "all clean:" << "\n\t" | 74 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
75 | { //write the extra unix targets.. | ||
76 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | ||
77 | for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) | ||
78 | t << *it << " "; | ||
79 | } | ||
80 | t << "all clean install distclean mocables uninstall uicables:" << "\n\t" | ||
57 | << "@echo \"Some of the required modules (" | 81 | << "@echo \"Some of the required modules (" |
58 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" | 82 | << var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t" |
59 | << "@echo \"Skipped.\"" << endl << endl; | 83 | << "@echo \"Skipped.\"" << endl << endl; |
60 | writeMakeQmake(t); | 84 | writeMakeQmake(t); |
61 | return TRUE; | 85 | return TRUE; |
62 | } | 86 | } |
63 | 87 | ||
64 | if (project->variables()["TEMPLATE"].first() == "app" || | 88 | if (project->variables()["TEMPLATE"].first() == "app" || |
65 | project->variables()["TEMPLATE"].first() == "lib") { | 89 | project->variables()["TEMPLATE"].first() == "lib") { |
66 | writeMakeParts(t); | 90 | writeMakeParts(t); |
67 | return MakefileGenerator::writeMakefile(t); | 91 | return MakefileGenerator::writeMakefile(t); |
68 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { | 92 | } else if(project->variables()["TEMPLATE"].first() == "subdirs") { |
69 | writeSubdirs(t); | 93 | writeSubdirs(t); |
70 | return TRUE; | 94 | return TRUE; |
71 | } | 95 | } |
72 | return FALSE; | 96 | return FALSE; |
73 | } | 97 | } |
74 | 98 | ||
75 | void | 99 | void |
100 | UnixMakefileGenerator::writeExtraVariables(QTextStream &t) | ||
101 | { | ||
102 | bool first = TRUE; | ||
103 | QMap<QString, QStringList> &vars = project->variables(); | ||
104 | QStringList &exports = project->variables()["QMAKE_EXTRA_UNIX_VARIABLES"]; | ||
105 | for(QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) { | ||
106 | for(QStringList::Iterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) { | ||
107 | QRegExp rx((*exp_it), FALSE, TRUE); | ||
108 | if(rx.exactMatch(it.key())) { | ||
109 | if(first) { | ||
110 | t << "\n####### Custom Variables" << endl; | ||
111 | first = FALSE; | ||
112 | } | ||
113 | t << "EXPORT_" << it.key() << " = " << it.data().join(" ") << endl; | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | if(!first) | ||
118 | t << endl; | ||
119 | } | ||
120 | |||
121 | void | ||
76 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) | 122 | UnixMakefileGenerator::writeMakeParts(QTextStream &t) |
77 | { | 123 | { |
78 | QString deps = fileFixify(Option::output.name()), prl; | 124 | QString deps = fileFixify(Option::output.name()), target_deps, prl; |
79 | bool do_incremental = (project->isActiveConfig("incremental") && | 125 | bool do_incremental = (project->isActiveConfig("incremental") && |
80 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && | 126 | !project->variables()["QMAKE_INCREMENTAL"].isEmpty() && |
81 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || | 127 | (!project->variables()["QMAKE_APP_FLAG"].isEmpty() || |
82 | !project->isActiveConfig("staticlib"))), | 128 | !project->isActiveConfig("staticlib"))), |
83 | src_incremental=FALSE, moc_incremental=FALSE; | 129 | src_incremental=FALSE, moc_incremental=FALSE; |
84 | 130 | ||
85 | t << "####### Compiler, tools and options" << endl << endl; | 131 | t << "####### Compiler, tools and options" << endl << endl; |
86 | t << "CC = "; | 132 | t << "CC = "; |
87 | if (project->isActiveConfig("thread") && | 133 | if (project->isActiveConfig("thread") && |
88 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) | 134 | ! project->variables()["QMAKE_CC_THREAD"].isEmpty()) |
89 | t << var("QMAKE_CC_THREAD") << endl; | 135 | t << var("QMAKE_CC_THREAD") << endl; |
90 | else | 136 | else |
91 | t << var("QMAKE_CC") << endl; | 137 | t << var("QMAKE_CC") << endl; |
92 | 138 | ||
93 | t << "CXX = "; | 139 | t << "CXX = "; |
94 | if (project->isActiveConfig("thread") && | 140 | if (project->isActiveConfig("thread") && |
@@ -126,27 +172,32 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
126 | 172 | ||
127 | t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; | 173 | t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; |
128 | t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; | 174 | t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl; |
129 | } | 175 | } |
130 | 176 | ||
131 | t << "AR = " << var("QMAKE_AR") << endl; | 177 | t << "AR = " << var("QMAKE_AR") << endl; |
132 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; | 178 | t << "RANLIB = " << var("QMAKE_RANLIB") << endl; |
133 | t << "MOC = " << var("QMAKE_MOC") << endl; | 179 | t << "MOC = " << var("QMAKE_MOC") << endl; |
134 | t << "UIC = "<< var("QMAKE_UIC") << endl; | 180 | t << "UIC = "<< var("QMAKE_UIC") << endl; |
135 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; | 181 | t << "QMAKE = "<< (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl; |
136 | t << "TAR = "<< var("QMAKE_TAR") << endl; | 182 | t << "TAR = "<< var("QMAKE_TAR") << endl; |
137 | t << "GZIP = " << var("QMAKE_GZIP") << endl; | 183 | t << "GZIP = " << var("QMAKE_GZIP") << endl; |
184 | if(project->isActiveConfig("compile_libtool")) | ||
185 | t << "LIBTOOL= " << var("QMAKE_LIBTOOL") << endl; | ||
138 | t << "COPY = " << var("QMAKE_COPY") << endl; | 186 | t << "COPY = " << var("QMAKE_COPY") << endl; |
139 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; | 187 | t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl; |
140 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; | 188 | t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; |
189 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
190 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
191 | |||
141 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 192 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
142 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; | 193 | t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; |
143 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; | 194 | t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; |
144 | t << "MOVE = " << var("QMAKE_MOVE") << endl; | 195 | t << "MOVE = " << var("QMAKE_MOVE") << endl; |
145 | t << "PRO = " << fileFixify(project->projectFile() )<< endl; | 196 | t << "PRO = " << fileFixify(project->projectFile() )<< endl; |
146 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; | 197 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; |
147 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; | 198 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; |
148 | t << endl; | 199 | t << endl; |
149 | 200 | ||
150 | t << "####### Output directory" << endl << endl; | 201 | t << "####### Output directory" << endl << endl; |
151 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) | 202 | if (! project->variables()["OBJECTS_DIR"].isEmpty()) |
152 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; | 203 | t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl; |
@@ -211,138 +262,154 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
211 | } else if(!incrs_out.count()) { | 262 | } else if(!incrs_out.count()) { |
212 | t << endl; | 263 | t << endl; |
213 | } else { | 264 | } else { |
214 | moc_incremental = TRUE; | 265 | moc_incremental = TRUE; |
215 | t << endl; | 266 | t << endl; |
216 | t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; | 267 | t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl; |
217 | } | 268 | } |
218 | } else { | 269 | } else { |
219 | t << "OBJMOC = " << objMoc << endl; | 270 | t << "OBJMOC = " << objMoc << endl; |
220 | } | 271 | } |
221 | if(do_incremental && !moc_incremental && !src_incremental) | 272 | if(do_incremental && !moc_incremental && !src_incremental) |
222 | do_incremental = FALSE; | 273 | do_incremental = FALSE; |
274 | if(!project->isEmpty("QMAKE_EXTRA_UNIX_COMPILERS")) { | ||
275 | t << "OBJCOMP = " << varList("OBJCOMP") << endl; | ||
276 | target_deps += " $(OBJCOMP)"; | ||
277 | |||
278 | QStringList &comps = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
279 | for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) { | ||
280 | QStringList &vars = project->variables()[(*compit) + ".variables"]; | ||
281 | for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) { | ||
282 | QStringList vals = project->variables()[(*varit)]; | ||
283 | if(!vals.isEmpty()) | ||
284 | t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl; | ||
285 | } | ||
286 | } | ||
287 | } | ||
223 | t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl; | 288 | t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl; |
224 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; | 289 | t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl; |
225 | t << "DESTDIR = " << var("DESTDIR") << endl; | 290 | t << "DESTDIR = " << var("DESTDIR") << endl; |
291 | if(project->isActiveConfig("compile_libtool")) | ||
292 | t << "TARGETL= " << var("TARGET_la") << endl; | ||
226 | t << "TARGET = " << var("TARGET") << endl; | 293 | t << "TARGET = " << var("TARGET") << endl; |
227 | if(project->isActiveConfig("plugin") ) { | 294 | if(project->isActiveConfig("plugin") ) { |
228 | t << "TARGETD = " << var("TARGET") << endl; | 295 | t << "TARGETD = " << var("TARGET") << endl; |
229 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 296 | } else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
230 | t << "TARGETA= " << var("TARGETA") << endl; | 297 | t << "TARGETA= " << var("TARGETA") << endl; |
231 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) { | 298 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) { |
232 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; | 299 | t << "TARGETD= " << var("TARGET_x.y.z") << endl; |
233 | t << "TARGET0= " << var("TARGET_") << endl; | 300 | t << "TARGET0= " << var("TARGET_") << endl; |
234 | t << "TARGET1= " << var("TARGET_x") << endl; | 301 | t << "TARGET1= " << var("TARGET_x") << endl; |
235 | t << "TARGET2= " << var("TARGET_x.y") << endl; | 302 | t << "TARGET2= " << var("TARGET_x.y") << endl; |
236 | } else { | 303 | } else { |
237 | t << "TARGETD= " << var("TARGET_x") << endl; | 304 | t << "TARGETD= " << var("TARGET_x") << endl; |
238 | t << "TARGET0= " << var("TARGET_") << endl; | 305 | t << "TARGET0= " << var("TARGET_") << endl; |
239 | } | 306 | } |
240 | } | 307 | } |
308 | writeExtraVariables(t); | ||
241 | t << endl; | 309 | t << endl; |
242 | 310 | ||
243 | // blasted incldues | 311 | // blasted includes |
244 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; | 312 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; |
245 | QStringList::Iterator it; | 313 | QStringList::Iterator it; |
246 | for( it = qeui.begin(); it != qeui.end(); ++it) | 314 | for( it = qeui.begin(); it != qeui.end(); ++it) |
247 | t << "include " << (*it) << endl; | 315 | t << "include " << (*it) << endl; |
248 | 316 | ||
249 | /* rules */ | 317 | /* rules */ |
250 | t << "first: all" << endl; | 318 | t << "first: all" << endl; |
251 | t << "####### Implicit rules" << endl << endl; | 319 | t << "####### Implicit rules" << endl << endl; |
252 | t << ".SUFFIXES: .c"; | 320 | t << ".SUFFIXES: .c " << Option::obj_ext; |
253 | QStringList::Iterator cppit; | 321 | QStringList::Iterator cppit; |
254 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 322 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
255 | t << " " << (*cppit); | 323 | t << " " << (*cppit); |
256 | t << endl << endl; | 324 | t << endl << endl; |
257 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) | 325 | for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) |
258 | t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; | 326 | t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl; |
259 | t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; | 327 | t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl; |
260 | 328 | ||
261 | if(include_deps) { | 329 | if(include_deps) { |
262 | QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; | 330 | QString cmd=var("QMAKE_CFLAGS_DEPS") + " "; |
263 | cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); | 331 | cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D",""); |
264 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) | 332 | if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH")) |
265 | cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; | 333 | cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " "; |
266 | cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); | 334 | cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", ""); |
267 | QString odir; | 335 | QString odir; |
268 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) | 336 | if(!project->variables()["OBJECTS_DIR"].isEmpty()) |
269 | odir = project->first("OBJECTS_DIR"); | 337 | odir = project->first("OBJECTS_DIR"); |
270 | t << "###### Dependencies" << endl << endl; | 338 | t << "###### Dependencies" << endl << endl; |
271 | t << odir << ".deps/%.d: %.cpp\n\t" | 339 | t << odir << ".deps/%.d: %.cpp\n\t" |
272 | << "@echo Creating depend for $<" << "\n\t" | 340 | << "@echo Creating depend for $<" << "\n\t" |
273 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" | 341 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" |
274 | << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; | 342 | << "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; |
275 | 343 | ||
276 | t << odir << ".deps/%.d: %.c\n\t" | 344 | t << odir << ".deps/%.d: %.c\n\t" |
277 | << "@echo Creating depend for $<" << "\n\t" | 345 | << "@echo Creating depend for $<" << "\n\t" |
278 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" | 346 | << "@test -d $(@D) || mkdir -p $(@D)" << "\n\t" |
279 | << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; | 347 | << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl; |
280 | 348 | ||
281 | |||
282 | QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; | 349 | QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null }; |
283 | for(int x = 0; !src[x].isNull(); x++) { | 350 | for(int x = 0; !src[x].isNull(); x++) { |
284 | QStringList &l = project->variables()[src[x]]; | 351 | QStringList &l = project->variables()[src[x]]; |
285 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 352 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
286 | if(!(*it).isEmpty()) { | 353 | if(!(*it).isEmpty()) { |
287 | QString d_file; | 354 | QString d_file; |
288 | if((*it).endsWith(".c")) { | 355 | if((*it).endsWith(".c")) { |
289 | d_file = (*it).left((*it).length() - 2); | 356 | d_file = (*it).left((*it).length() - 2); |
290 | } else { | 357 | } else { |
291 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); | 358 | for(QStringList::Iterator cppit = Option::cpp_ext.begin(); |
292 | cppit != Option::cpp_ext.end(); ++cppit) { | 359 | cppit != Option::cpp_ext.end(); ++cppit) { |
293 | if((*it).endsWith((*cppit))) { | 360 | if((*it).endsWith((*cppit))) { |
294 | d_file = (*it).left((*it).length() - (*cppit).length()); | 361 | d_file = (*it).left((*it).length() - (*cppit).length()); |
295 | break; | 362 | break; |
296 | } | 363 | } |
297 | } | 364 | } |
298 | } | 365 | } |
299 | if(!d_file.isEmpty()) { | 366 | if(!d_file.isEmpty()) { |
300 | d_file = odir + ".deps/" + d_file + ".d"; | 367 | d_file = odir + ".deps/" + d_file + ".d"; |
301 | QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$")); | 368 | QStringList deps = findDependencies((*it)).grep(QRegExp(Option::cpp_moc_ext + "$")); |
302 | if(!deps.isEmpty()) | 369 | if(!deps.isEmpty()) |
303 | t << d_file << ": " << deps.join(" ") << endl; | 370 | t << d_file << ": " << deps.join(" ") << endl; |
304 | t << "-include " << d_file << endl; | 371 | t << var("QMAKE_CFLAGS_USE_PRECOMPILE") << " " << d_file << endl; |
305 | } | 372 | } |
306 | } | 373 | } |
307 | } | 374 | } |
308 | } | 375 | } |
309 | } | 376 | } |
310 | 377 | ||
311 | t << "####### Build rules" << endl << endl; | 378 | t << "####### Build rules" << endl << endl; |
312 | if(!project->variables()["SUBLIBS"].isEmpty()) { | 379 | if(!project->variables()["SUBLIBS"].isEmpty()) { |
313 | QString libdir = "tmp/"; | 380 | QString libdir = "tmp/"; |
314 | if(!project->isEmpty("SUBLIBS_DIR")) | 381 | if(!project->isEmpty("SUBLIBS_DIR")) |
315 | libdir = project->first("SUBLIBS_DIR"); | 382 | libdir = project->first("SUBLIBS_DIR"); |
316 | t << "SUBLIBS= "; | 383 | t << "SUBLIBS= "; |
317 | QStringList &l = project->variables()["SUBLIBS"]; | 384 | QStringList &l = project->variables()["SUBLIBS"]; |
318 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) | 385 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) |
319 | t << libdir << "lib" << (*it) << ".a "; | 386 | t << libdir << "lib" << (*it) << ".a "; |
320 | t << endl << endl; | 387 | t << endl << endl; |
321 | } | 388 | } |
322 | if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { | 389 | if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { |
323 | QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; | 390 | QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"]; |
324 | QStringList::Iterator it; | 391 | QStringList::Iterator it; |
325 | for(it = l.begin(); it != l.end(); ++it) { | 392 | for(it = l.begin(); it != l.end(); ++it) { |
326 | QMakeProject proj; | 393 | QMakeMetaInfo libinfo; |
327 | if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) { | 394 | if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) { |
328 | QString dir; | 395 | QString dir; |
329 | int slsh = (*it).findRev(Option::dir_sep); | 396 | int slsh = (*it).findRev(Option::dir_sep); |
330 | if(slsh != -1) | 397 | if(slsh != -1) |
331 | dir = (*it).left(slsh + 1); | 398 | dir = (*it).left(slsh + 1); |
332 | QString targ = dir + proj.first("QMAKE_PRL_TARGET"); | 399 | QString targ = dir + libinfo.first("QMAKE_PRL_TARGET"); |
333 | deps += " " + targ; | 400 | deps += " " + targ; |
334 | t << targ << ":" << "\n\t" | 401 | t << targ << ":" << "\n\t" |
335 | << "@echo \"Creating '" << targ << "'\"" << "\n\t" | 402 | << "@echo \"Creating '" << targ << "'\"" << "\n\t" |
336 | << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";" | 403 | << "(cd " << libinfo.first("QMAKE_PRL_BUILD_DIR") << ";" |
337 | << "$(MAKE) )" << endl; | 404 | << "$(MAKE) )" << endl; |
338 | } | 405 | } |
339 | } | 406 | } |
340 | } | 407 | } |
341 | if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { | 408 | if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) { |
342 | QString destdir = project->first("DESTDIR"); | 409 | QString destdir = project->first("DESTDIR"); |
343 | if(do_incremental) { | 410 | if(do_incremental) { |
344 | //incremental target | 411 | //incremental target |
345 | QString incr_target = var("TARGET") + "_incremental"; | 412 | QString incr_target = var("TARGET") + "_incremental"; |
346 | if(incr_target.find(Option::dir_sep) != -1) | 413 | if(incr_target.find(Option::dir_sep) != -1) |
347 | incr_target = incr_target.right(incr_target.length() - | 414 | incr_target = incr_target.right(incr_target.length() - |
348 | (incr_target.findRev(Option::dir_sep) + 1)); | 415 | (incr_target.findRev(Option::dir_sep) + 1)); |
@@ -383,45 +450,45 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
383 | incr_objs += "-L" + QDir::currentDirPath(); | 450 | incr_objs += "-L" + QDir::currentDirPath(); |
384 | } | 451 | } |
385 | if(!incr_objs.isEmpty()) | 452 | if(!incr_objs.isEmpty()) |
386 | incr_objs += " "; | 453 | incr_objs += " "; |
387 | incr_objs += " -l" + incr_target; | 454 | incr_objs += " -l" + incr_target; |
388 | deps.prepend(incr_target_dir + " "); | 455 | deps.prepend(incr_target_dir + " "); |
389 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 456 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
390 | } | 457 | } |
391 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" | 458 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" |
392 | << endl << endl; | 459 | << endl << endl; |
393 | 460 | ||
394 | //real target | 461 | //real target |
395 | t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps | 462 | t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps << " " << target_deps |
396 | << " " << var("POST_TARGETDEPS") << "\n\t"; | 463 | << " " << var("POST_TARGETDEPS") << "\n\t"; |
397 | if(!destdir.isEmpty()) | 464 | if(!destdir.isEmpty()) |
398 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 465 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
399 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 466 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
400 | t << var("QMAKE_PRE_LINK") << "\n\t"; | 467 | t << var("QMAKE_PRE_LINK") << "\n\t"; |
401 | t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)"; | 468 | t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)"; |
402 | if(!project->isEmpty("QMAKE_POST_LINK")) | 469 | if(!project->isEmpty("QMAKE_POST_LINK")) |
403 | t << "\n\t" << var("QMAKE_POST_LINK"); | 470 | t << "\n\t" << var("QMAKE_POST_LINK"); |
404 | t << endl << endl; | 471 | t << endl << endl; |
405 | } else { | 472 | } else { |
406 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" | 473 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" |
407 | << endl << endl; | 474 | << endl << endl; |
408 | 475 | ||
409 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " | 476 | t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " |
410 | << var("POST_TARGETDEPS") << "\n\t"; | 477 | << target_deps << " " << var("POST_TARGETDEPS") << "\n\t"; |
411 | if(!destdir.isEmpty()) | 478 | if(!destdir.isEmpty()) |
412 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 479 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
413 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 480 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
414 | t << var("QMAKE_PRE_LINK") << "\n\t"; | 481 | t << var("QMAKE_PRE_LINK") << "\n\t"; |
415 | t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"; | 482 | t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)"; |
416 | if(!project->isEmpty("QMAKE_POST_LINK")) | 483 | if(!project->isEmpty("QMAKE_POST_LINK")) |
417 | t << "\n\t" << var("QMAKE_POST_LINK"); | 484 | t << "\n\t" << var("QMAKE_POST_LINK"); |
418 | t << endl << endl; | 485 | t << endl << endl; |
419 | } | 486 | } |
420 | } else if(!project->isActiveConfig("staticlib")) { | 487 | } else if(!project->isActiveConfig("staticlib")) { |
421 | QString destdir = project->first("DESTDIR"), incr_deps; | 488 | QString destdir = project->first("DESTDIR"), incr_deps; |
422 | if(do_incremental) { | 489 | if(do_incremental) { |
423 | QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); | 490 | QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first(); |
424 | QString incr_target = var("QMAKE_ORIG_TARGET").replace( | 491 | QString incr_target = var("QMAKE_ORIG_TARGET").replace( |
425 | QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; | 492 | QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental"; |
426 | if(incr_target.find(Option::dir_sep) != -1) | 493 | if(incr_target.find(Option::dir_sep) != -1) |
427 | incr_target = incr_target.right(incr_target.length() - | 494 | incr_target = incr_target.right(incr_target.length() - |
@@ -459,38 +526,42 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
459 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; | 526 | QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"]; |
460 | if(!destdir.isEmpty()) | 527 | if(!destdir.isEmpty()) |
461 | cmd.append(" -L" + destdir); | 528 | cmd.append(" -L" + destdir); |
462 | cmd.append(" -l" + incr_target); | 529 | cmd.append(" -l" + incr_target); |
463 | deps.prepend(incr_target_dir + " "); | 530 | deps.prepend(incr_target_dir + " "); |
464 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 531 | incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)"; |
465 | } | 532 | } |
466 | 533 | ||
467 | t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") | 534 | t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","") |
468 | << " " << var("DESTDIR_TARGET") << endl << endl; | 535 | << " " << var("DESTDIR_TARGET") << endl << endl; |
469 | 536 | ||
470 | //real target | 537 | //real target |
471 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " | 538 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " " |
472 | << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS"); | 539 | << incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS"); |
473 | } else { | 540 | } else { |
474 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << | 541 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " << |
475 | var("DESTDIR_TARGET") << endl << endl; | 542 | var("DESTDIR_TARGET") << endl << endl; |
476 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") | 543 | t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") |
477 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS"); | 544 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) " << target_deps |
545 | << " " << var("POST_TARGETDEPS"); | ||
478 | } | 546 | } |
479 | if(!destdir.isEmpty()) | 547 | if(!destdir.isEmpty()) |
480 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; | 548 | t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir; |
481 | if(!project->isEmpty("QMAKE_PRE_LINK")) | 549 | if(!project->isEmpty("QMAKE_PRE_LINK")) |
482 | t << "\n\t" << var("QMAKE_PRE_LINK"); | 550 | t << "\n\t" << var("QMAKE_PRE_LINK"); |
483 | 551 | ||
484 | if(project->isActiveConfig("plugin")) { | 552 | if(project->isActiveConfig("compile_libtool")) { |
553 | t << "\n\t" | ||
554 | << var("QMAKE_LINK_SHLIB_CMD"); | ||
555 | } else if(project->isActiveConfig("plugin")) { | ||
485 | t << "\n\t" | 556 | t << "\n\t" |
486 | << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 557 | << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
487 | << var("QMAKE_LINK_SHLIB_CMD"); | 558 | << var("QMAKE_LINK_SHLIB_CMD"); |
488 | if(!destdir.isEmpty()) | 559 | if(!destdir.isEmpty()) |
489 | t << "\n\t" | 560 | t << "\n\t" |
490 | << "-$(MOVE) $(TARGET) " << var("DESTDIR"); | 561 | << "-$(MOVE) $(TARGET) " << var("DESTDIR"); |
491 | if(!project->isEmpty("QMAKE_POST_LINK")) | 562 | if(!project->isEmpty("QMAKE_POST_LINK")) |
492 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; | 563 | t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t"; |
493 | t << endl << endl; | 564 | t << endl << endl; |
494 | } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { | 565 | } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) { |
495 | t << "\n\t" | 566 | t << "\n\t" |
496 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" | 567 | << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t" |
@@ -517,166 +588,194 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
517 | t << "\n\t" | 588 | t << "\n\t" |
518 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" | 589 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t" |
519 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" | 590 | << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t" |
520 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); | 591 | << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR"); |
521 | if(!project->isEmpty("QMAKE_POST_LINK")) | 592 | if(!project->isEmpty("QMAKE_POST_LINK")) |
522 | t << "\n\t" << var("QMAKE_POST_LINK"); | 593 | t << "\n\t" << var("QMAKE_POST_LINK"); |
523 | t << endl << endl; | 594 | t << endl << endl; |
524 | } | 595 | } |
525 | t << endl << endl; | 596 | t << endl << endl; |
526 | 597 | ||
527 | if (! project->isActiveConfig("plugin")) { | 598 | if (! project->isActiveConfig("plugin")) { |
528 | t << "staticlib: $(TARGETA)" << endl << endl; | 599 | t << "staticlib: $(TARGETA)" << endl << endl; |
529 | t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)"; | 600 | t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)"; |
530 | if(do_incremental) | 601 | if(do_incremental) |
531 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 602 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
532 | t << var("POST_TARGETDEPS") << "\n\t" | 603 | t << var("POST_TARGETDEPS") << "\n\t" |
533 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" | 604 | << "-$(DEL_FILE) $(TARGETA) " << "\n\t" |
534 | << var("QMAKE_AR_CMD"); | 605 | << var("QMAKE_AR_CMD"); |
535 | if(do_incremental) | 606 | if(do_incremental) |
536 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; | 607 | t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)"; |
537 | if(!project->isEmpty("QMAKE_RANLIB")) | 608 | if(!project->isEmpty("QMAKE_RANLIB")) |
538 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; | 609 | t << "\n\t" << "$(RANLIB) $(TARGETA)"; |
539 | t << endl << endl; | 610 | t << endl << endl; |
540 | } | 611 | } |
541 | } else { | 612 | } else { |
542 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " | 613 | t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) " |
543 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" | 614 | << varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n" |
544 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; | 615 | << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n"; |
545 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { | 616 | if(project->isEmpty("QMAKE_AR_SUBLIBS")) { |
546 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") | 617 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
547 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t"; | 618 | << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) " << var("POST_TARGETDEPS") << "\n\t"; |
548 | if(!project->isEmpty("DESTDIR")) { | 619 | if(!project->isEmpty("DESTDIR")) { |
549 | QString destdir = project->first("DESTDIR"); | 620 | QString destdir = project->first("DESTDIR"); |
550 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 621 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
551 | } | 622 | } |
552 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" | 623 | t << "-$(DEL_FILE) $(TARGET)" << "\n\t" |
553 | << var("QMAKE_AR_CMD") << "\n"; | 624 | << var("QMAKE_AR_CMD") << "\n"; |
554 | if(!project->isEmpty("QMAKE_POST_LINK")) | 625 | if(!project->isEmpty("QMAKE_POST_LINK")) |
555 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 626 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
556 | if(!project->isEmpty("QMAKE_RANLIB")) | 627 | if(!project->isEmpty("QMAKE_RANLIB")) |
557 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; | 628 | t << "\t" << "$(RANLIB) $(TARGET)" << "\n"; |
558 | if(!project->isEmpty("DESTDIR")) | 629 | if(!project->isEmpty("DESTDIR")) |
559 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" | 630 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n" |
560 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; | 631 | << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n"; |
561 | } else { | 632 | } else { |
562 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); | 633 | int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt(); |
563 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"], | 634 | QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"] + |
635 | project->variables()["OBJCOMP"], | ||
564 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; | 636 | libs = project->variables()["QMAKE_AR_SUBLIBS"]; |
565 | libs.prepend("$(TARGET)"); | 637 | libs.prepend("$(TARGET)"); |
566 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); | 638 | for(QStringList::Iterator libit = libs.begin(), objit = objs.begin(); |
567 | libit != libs.end(); ++libit) { | 639 | libit != libs.end(); ++libit) { |
568 | QStringList build; | 640 | QStringList build; |
569 | for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) | 641 | for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++) |
570 | build << (*objit); | 642 | build << (*objit); |
571 | QString ar; | 643 | QString ar; |
572 | if((*libit) == "$(TARGET)") { | 644 | if((*libit) == "$(TARGET)") { |
573 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") | 645 | t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS") |
574 | << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; | 646 | << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t"; |
575 | ar = project->variables()["QMAKE_AR_CMD"].first(); | 647 | ar = project->variables()["QMAKE_AR_CMD"].first(); |
576 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", | 648 | ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)", |
577 | build.join(" ")); | 649 | build.join(" ")); |
578 | } else { | 650 | } else { |
579 | t << (*libit) << ": " << valList(build) << "\n\t"; | 651 | t << (*libit) << ": " << valList(build) << "\n\t"; |
580 | ar = "$(AR) " + (*libit) + " " + build.join(" "); | 652 | ar = "$(AR) " + (*libit) + " " + build.join(" "); |
581 | } | 653 | } |
582 | if(!project->isEmpty("DESTDIR")) { | 654 | if(!project->isEmpty("DESTDIR")) { |
583 | QString destdir = project->first("DESTDIR"); | 655 | QString destdir = project->first("DESTDIR"); |
584 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 656 | t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
585 | } | 657 | } |
586 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" | 658 | t << "-$(DEL_FILE) " << (*libit) << "\n\t" |
587 | << ar << "\n"; | 659 | << ar << "\n"; |
588 | if(!project->isEmpty("QMAKE_POST_LINK")) | 660 | if(!project->isEmpty("QMAKE_POST_LINK")) |
589 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; | 661 | t << "\t" << var("QMAKE_POST_LINK") << "\n"; |
590 | if(!project->isEmpty("QMAKE_RANLIB")) | 662 | if(!project->isEmpty("QMAKE_RANLIB")) |
591 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; | 663 | t << "\t" << "$(RANLIB) " << (*libit) << "\n"; |
592 | if(!project->isEmpty("DESTDIR")) | 664 | if(!project->isEmpty("DESTDIR")) |
593 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" | 665 | t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n" |
594 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; | 666 | << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n"; |
595 | } | 667 | } |
596 | } | 668 | } |
597 | t << endl << endl; | 669 | t << endl << endl; |
598 | } | 670 | } |
599 | 671 | ||
600 | t << "mocables: $(SRCMOC)" << endl << endl; | 672 | t << "mocables: $(SRCMOC)" << endl |
673 | << "uicables: $(UICDECLS) $(UICIMPLS)" << endl << endl; | ||
601 | 674 | ||
602 | if(!project->isActiveConfig("no_mocdepend")) { | 675 | if(!project->isActiveConfig("no_mocdepend")) { |
603 | //this is an implicity depend on moc, so it will be built if necesary, however | 676 | //this is an implicity depend on moc, so it will be built if necesary, however |
604 | //moc itself shouldn't have this dependency - this is a little kludgy but it is | 677 | //moc itself shouldn't have this dependency - this is a little kludgy but it is |
605 | //better than the alternative for now. | 678 | //better than the alternative for now. |
606 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"); | 679 | QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"), |
680 | moc_dir = "$(QTDIR)/src/moc"; | ||
681 | if(!project->isEmpty("QMAKE_MOC_SRC")) | ||
682 | moc_dir = project->first("QMAKE_MOC_SRC"); | ||
607 | fixEnvVariables(target); | 683 | fixEnvVariables(target); |
608 | fixEnvVariables(moc); | 684 | fixEnvVariables(moc); |
609 | if(target != moc) | 685 | if(target != moc) |
610 | t << "$(MOC): \n\t" | 686 | t << "$(MOC): \n\t" |
611 | << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl; | 687 | << "( cd " << moc_dir << " && $(MAKE) )" << endl << endl; |
612 | } | 688 | } |
613 | 689 | ||
614 | writeMakeQmake(t); | 690 | writeMakeQmake(t); |
691 | if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake")) { | ||
692 | QString meta_files; | ||
693 | if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib" && | ||
694 | !project->isActiveConfig("compile_libtool")) { //libtool | ||
695 | if(!meta_files.isEmpty()) | ||
696 | meta_files += " "; | ||
697 | meta_files += libtoolFileName(); | ||
698 | } | ||
699 | if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") { //pkg-config | ||
700 | if(!meta_files.isEmpty()) | ||
701 | meta_files += " "; | ||
702 | meta_files += pkgConfigFileName(); | ||
703 | } | ||
704 | if(!meta_files.isEmpty()) { | ||
705 | QStringList files = fileFixify(Option::mkfile::project_files); | ||
706 | t << meta_files << ": " << "\n\t" | ||
707 | << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl; | ||
708 | } | ||
709 | } | ||
615 | 710 | ||
616 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { | 711 | if(!project->first("QMAKE_PKGINFO").isEmpty()) { |
617 | QString pkginfo = project->first("QMAKE_PKGINFO"); | 712 | QString pkginfo = project->first("QMAKE_PKGINFO"); |
618 | QString destdir = project->first("DESTDIR"); | 713 | QString destdir = project->first("DESTDIR"); |
619 | t << pkginfo << ": " << "\n\t"; | 714 | t << pkginfo << ": " << "\n\t"; |
620 | if(!destdir.isEmpty()) | 715 | if(!destdir.isEmpty()) |
621 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 716 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
622 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" | 717 | t << "@$(DEL_FILE) " << pkginfo << "\n\t" |
623 | << "@echo \"APPL????\" >" << pkginfo << endl; | 718 | << "@echo \"APPL????\" >" << pkginfo << endl; |
624 | } | 719 | } |
625 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { | 720 | if(!project->first("QMAKE_INFO_PLIST").isEmpty()) { |
626 | QString info_plist = project->first("QMAKE_INFO_PLIST"), | 721 | QString info_plist = project->first("QMAKE_INFO_PLIST"), |
627 | info_plist_out = project->first("QMAKE_INFO_PLIST_OUT"); | 722 | info_plist_out = project->first("QMAKE_INFO_PLIST_OUT"); |
628 | QString destdir = project->first("DESTDIR"); | 723 | QString destdir = project->first("DESTDIR"); |
629 | t << info_plist_out << ": " << "\n\t"; | 724 | t << info_plist_out << ": " << "\n\t"; |
630 | if(!destdir.isEmpty()) | 725 | if(!destdir.isEmpty()) |
631 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; | 726 | t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t"; |
632 | t << "@$(DEL_FILE) " << info_plist_out << "\n\t" | 727 | t << "@$(DEL_FILE) " << info_plist_out << "\n\t" |
633 | << "@cp \"" << info_plist << "\" \"" << info_plist_out << "\"" << endl; | 728 | << "@sed -e \"s,@ICON@,application.icns,g\" -e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") |
729 | << ",g\" \"" << info_plist << "\" >\"" << info_plist_out << "\"" << endl; | ||
634 | if(!project->first("RC_FILE").isEmpty()) { | 730 | if(!project->first("RC_FILE").isEmpty()) { |
635 | QString dir = destdir + "../Resources/"; | 731 | QString dir = destdir + "../Resources/"; |
636 | t << dir << "application.icns:" << "\n\t" | 732 | t << dir << "application.icns: " << var("RC_FILE") << "\n\t" |
637 | << "@test -d " << dir << " || mkdir -p " << dir << "\n\t" | 733 | << "@test -d " << dir << " || mkdir -p " << dir << "\n\t" |
638 | << "@cp " << var("RC_FILE") << " " << dir << "application.icns" << endl; | 734 | << "@$(DEL_FILE) " << dir << "application.icns" << "\n\t" |
735 | << "@$(COPY_FILE) " << var("RC_FILE") << " " << dir << "application.icns" << endl; | ||
639 | } | 736 | } |
640 | } | 737 | } |
641 | 738 | ||
642 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : | 739 | QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") : |
643 | project->first("QMAKE_DISTDIR"); | 740 | project->first("QMAKE_DISTDIR"); |
644 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : | 741 | QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") : |
645 | project->first("OBJECTS_DIR")) + ddir); | 742 | project->first("OBJECTS_DIR")) + ddir); |
646 | t << "dist: " << "\n\t" | 743 | t << "dist: " << "\n\t" |
647 | << "@mkdir -p " << ddir_c << " && " | 744 | << "@mkdir -p " << ddir_c << " && " |
648 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; | 745 | << "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && "; |
649 | if(!project->isEmpty("TRANSLATIONS")) | 746 | if(!project->isEmpty("TRANSLATIONS")) |
650 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; | 747 | t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; |
748 | if(!project->isEmpty("IMAGES")) | ||
749 | t << "$(COPY_FILE) --parents " << var("IMAGES") << " " << ddir_c << Option::dir_sep << " && "; | ||
651 | if(!project->isEmpty("FORMS")) { | 750 | if(!project->isEmpty("FORMS")) { |
652 | QStringList &forms = project->variables()["FORMS"], ui_headers; | 751 | QStringList &forms = project->variables()["FORMS"], ui_headers; |
653 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { | 752 | for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { |
654 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); | 753 | QString ui_h = fileFixify((*formit) + Option::h_ext.first()); |
655 | if(QFile::exists(ui_h) ) | 754 | if(QFile::exists(ui_h) ) |
656 | ui_headers << ui_h; | 755 | ui_headers << ui_h; |
657 | } | 756 | } |
658 | if(!ui_headers.isEmpty()) | 757 | if(!ui_headers.isEmpty()) |
659 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; | 758 | t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && "; |
660 | } | 759 | } |
661 | t << "( cd `dirname " << ddir_c << "` && " | 760 | t << "( cd `dirname " << ddir_c << "` && " |
662 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " | 761 | << "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && " |
663 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " | 762 | << "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && " |
664 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " | 763 | << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && " |
665 | << "$(DEL_FILE) -r " << ddir_c | 764 | << "$(DEL_FILE) -r " << ddir_c |
666 | << endl << endl; | 765 | << endl << endl; |
667 | 766 | ||
668 | QString clean_targets; | 767 | QString clean_targets; |
768 | t << "mocclean:" << "\n"; | ||
669 | if(mocAware()) { | 769 | if(mocAware()) { |
670 | t << "mocclean:" << "\n"; | ||
671 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { | 770 | if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) { |
672 | if(!objMoc.isEmpty()) | 771 | if(!objMoc.isEmpty()) |
673 | t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; | 772 | t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n'; |
674 | if(!srcMoc.isEmpty()) | 773 | if(!srcMoc.isEmpty()) |
675 | t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; | 774 | t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n'; |
676 | if(moc_incremental) | 775 | if(moc_incremental) |
677 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; | 776 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; |
678 | clean_targets += " mocclean"; | 777 | clean_targets += " mocclean"; |
679 | } | 778 | } |
680 | t << endl; | 779 | t << endl; |
681 | } | 780 | } |
682 | t << "uiclean:" << "\n"; | 781 | t << "uiclean:" << "\n"; |
@@ -688,64 +787,74 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
688 | 787 | ||
689 | t << "yaccclean:" << "\n"; | 788 | t << "yaccclean:" << "\n"; |
690 | if(!var("YACCSOURCES").isEmpty()) { | 789 | if(!var("YACCSOURCES").isEmpty()) { |
691 | QStringList clean, &l = project->variables()["YACCSOURCES"]; | 790 | QStringList clean, &l = project->variables()["YACCSOURCES"]; |
692 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 791 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
693 | QFileInfo fi((*it)); | 792 | QFileInfo fi((*it)); |
694 | QString dir; | 793 | QString dir; |
695 | if(fi.dirPath() != ".") | 794 | if(fi.dirPath() != ".") |
696 | dir = fi.dirPath() + Option::dir_sep; | 795 | dir = fi.dirPath() + Option::dir_sep; |
697 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 796 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
698 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 797 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
699 | dir += Option::dir_sep; | 798 | dir += Option::dir_sep; |
700 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first(); | 799 | clean << ( dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first() ); |
701 | clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first(); | 800 | clean << ( dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first() ); |
702 | } | 801 | } |
703 | if(!clean.isEmpty()) { | 802 | if(!clean.isEmpty()) { |
704 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | 803 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; |
705 | clean_targets += " yaccclean"; | 804 | clean_targets += " yaccclean"; |
706 | } | 805 | } |
707 | } | 806 | } |
708 | 807 | ||
709 | t << "lexclean:" << "\n"; | 808 | t << "lexclean:" << "\n"; |
710 | if(!var("LEXSOURCES").isEmpty()) { | 809 | if(!var("LEXSOURCES").isEmpty()) { |
711 | QStringList clean, &l = project->variables()["LEXSOURCES"]; | 810 | QStringList clean, &l = project->variables()["LEXSOURCES"]; |
712 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { | 811 | for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { |
713 | QFileInfo fi((*it)); | 812 | QFileInfo fi((*it)); |
714 | QString dir; | 813 | QString dir; |
715 | if(fi.dirPath() != ".") | 814 | if(fi.dirPath() != ".") |
716 | dir = fi.dirPath() + Option::dir_sep; | 815 | dir = fi.dirPath() + Option::dir_sep; |
717 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); | 816 | dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir); |
718 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) | 817 | if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep) |
719 | dir += Option::dir_sep; | 818 | dir += Option::dir_sep; |
720 | clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first(); | 819 | clean << ( dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first() ); |
721 | } | 820 | } |
722 | if(!clean.isEmpty()) { | 821 | if(!clean.isEmpty()) { |
723 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; | 822 | t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n"; |
724 | clean_targets += " lexclean"; | 823 | clean_targets += " lexclean"; |
725 | } | 824 | } |
726 | } | 825 | } |
727 | 826 | ||
728 | if(do_incremental) { | 827 | if(do_incremental) { |
729 | t << "incrclean:" << "\n"; | 828 | t << "incrclean:" << "\n"; |
730 | if(src_incremental) | 829 | if(src_incremental) |
731 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; | 830 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n"; |
732 | if(moc_incremental) | 831 | if(moc_incremental) |
733 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; | 832 | t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n'; |
734 | t << endl; | 833 | t << endl; |
735 | } | 834 | } |
736 | 835 | ||
737 | t << "clean:" << clean_targets << "\n\t"; | 836 | t << "clean:" << clean_targets << "\n\t"; |
738 | if(!project->isEmpty("OBJECTS")) | 837 | if(!project->isEmpty("OBJECTS")) { |
739 | t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t"; | 838 | if(project->isActiveConfig("compile_libtool")) |
839 | t << "-$(LIBTOOL) --mode=clean $(DEL_FILE) $(OBJECTS)" << "\n\t"; | ||
840 | else | ||
841 | t << "-$(DEL_FILE) $(OBJECTS)" << "\n\t"; | ||
842 | } | ||
843 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) { | ||
844 | QString header_prefix = project->first("QMAKE_PRECOMP_PREFIX"); | ||
845 | QString precomph_out_dir = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep; | ||
846 | t << "-$(DEL_FILE) " << precomph_out_dir << header_prefix + "c " | ||
847 | << precomph_out_dir << header_prefix << "c++" << "\n\t"; | ||
848 | } | ||
740 | if(!project->isEmpty("IMAGES")) | 849 | if(!project->isEmpty("IMAGES")) |
741 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; | 850 | t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t"; |
742 | if(src_incremental) | 851 | if(src_incremental) |
743 | t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; | 852 | t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t"; |
744 | t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") | 853 | t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t") |
745 | << "-$(DEL_FILE) *~ core *.core" << "\n" | 854 | << "-$(DEL_FILE) *~ core *.core" << "\n" |
746 | << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; | 855 | << varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl; |
747 | t << "####### Sub-libraries" << endl << endl; | 856 | t << "####### Sub-libraries" << endl << endl; |
748 | if ( !project->variables()["SUBLIBS"].isEmpty() ) { | 857 | if ( !project->variables()["SUBLIBS"].isEmpty() ) { |
749 | QString libdir = "tmp/"; | 858 | QString libdir = "tmp/"; |
750 | if(!project->isEmpty("SUBLIBS_DIR")) | 859 | if(!project->isEmpty("SUBLIBS_DIR")) |
751 | libdir = project->first("SUBLIBS_DIR"); | 860 | libdir = project->first("SUBLIBS_DIR"); |
@@ -753,94 +862,176 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) | |||
753 | for(it = l.begin(); it != l.end(); ++it) | 862 | for(it = l.begin(); it != l.end(); ++it) |
754 | t << libdir << "lib" << (*it) << ".a" << ":\n\t" | 863 | t << libdir << "lib" << (*it) << ".a" << ":\n\t" |
755 | << var(QString("MAKELIB") + (*it)) << endl << endl; | 864 | << var(QString("MAKELIB") + (*it)) << endl << endl; |
756 | } | 865 | } |
757 | 866 | ||
758 | QString destdir = project->first("DESTDIR"); | 867 | QString destdir = project->first("DESTDIR"); |
759 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) | 868 | if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep) |
760 | destdir += Option::dir_sep; | 869 | destdir += Option::dir_sep; |
761 | t << "distclean: " << "clean\n"; | 870 | t << "distclean: " << "clean\n"; |
762 | if(project->first("TEMPLATE") == "app" && | 871 | if(project->first("TEMPLATE") == "app" && |
763 | project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) | 872 | project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) |
764 | t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n"; | 873 | t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n"; |
874 | else if(project->isActiveConfig("compile_libtool")) | ||
875 | t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) " << "$(TARGET)" << "\n"; | ||
765 | else | 876 | else |
766 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; | 877 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n"; |
767 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && | 878 | if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() && |
768 | !project->isActiveConfig("plugin")) | 879 | !project->isActiveConfig("plugin") && !project->isActiveConfig("compile_libtool")) |
769 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " | 880 | t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) " |
770 | << destdir << "$(TARGET2) $(TARGETA)" << "\n"; | 881 | << destdir << "$(TARGET2) $(TARGETA)" << "\n"; |
771 | t << endl << endl; | 882 | t << endl << endl; |
772 | 883 | ||
773 | if ( !project->isEmpty("PRECOMPH") ) { | 884 | if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER") ) { |
885 | QString precomph = fileFixify(project->first("PRECOMPILED_HEADER")); | ||
886 | t << "###### Prefix headers" << endl; | ||
887 | QString comps[] = { "C", "CXX", QString::null }; | ||
888 | for(int i = 0; !comps[i].isNull(); i++) { | ||
889 | QString flags = var("QMAKE_" + comps[i] + "FLAGS_PRECOMPILE"); | ||
890 | flags += " $(" + comps[i] + "FLAGS)"; | ||
891 | |||
892 | QString header_prefix = project->first("QMAKE_PRECOMP_PREFIX"); | ||
893 | QString outdir = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep, outfile = outdir; | ||
894 | QString compiler; | ||
895 | if(comps[i] == "C") { | ||
896 | outfile += header_prefix + "c"; | ||
897 | compiler = "$(CC) "; | ||
898 | } else { | ||
899 | outfile += header_prefix + "c++"; | ||
900 | compiler = "$(CXX) "; | ||
901 | } | ||
902 | t << outfile << ": " << precomph << " " << findDependencies(precomph).join(" \\\n\t\t") | ||
903 | << "\n\t" << "test -d " << outdir << " || mkdir -p " << outdir | ||
904 | << "\n\t" << compiler << flags << " $(INCPATH) " << precomph << " -o " << outfile << endl << endl; | ||
905 | } | ||
906 | } | ||
907 | if(!project->isEmpty("ALLMOC_HEADER")) { | ||
774 | QString outdir = project->first("MOC_DIR"); | 908 | QString outdir = project->first("MOC_DIR"); |
775 | QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH")); | 909 | QString precomph = fileFixify(project->first("ALLMOC_HEADER")); |
776 | t << "###### Combined headers" << endl << endl; | 910 | t << "###### Combined headers" << endl << endl |
777 | //XXX | 911 | << outdir << "allmoc.cpp: " << precomph << " " |
778 | t << outdir << "allmoc.cpp: " << qt_dot_h << " " | ||
779 | << varList("HEADERS_ORIG") << "\n\t" | 912 | << varList("HEADERS_ORIG") << "\n\t" |
780 | << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t" | 913 | << "echo '#include \"" << precomph << "\"' >" << outdir << "allmoc.cpp" << "\n\t" |
781 | << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " | 914 | << "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h " |
782 | << outdir << "allmoc.cpp" << "\n\t" | 915 | << outdir << "allmoc.cpp" << "\n\t" |
783 | << "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t" | 916 | << "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t" |
784 | << "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \"" | 917 | << "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \"" |
785 | << qt_dot_h << "\"}' " << outdir << "allmoc.cpp" << "\n\t" | 918 | << precomph << "\"}' " << outdir << "allmoc.cpp" << "\n\t" |
786 | << "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl; | 919 | << "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl; |
787 | } | 920 | } |
788 | 921 | ||
789 | // blasted user defined targets | 922 | // user defined targets |
790 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | 923 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; |
791 | for(it = qut.begin(); it != qut.end(); ++it) { | 924 | for(it = qut.begin(); it != qut.end(); ++it) { |
792 | QString targ = var((*it) + ".target"), | 925 | QString targ = var((*it) + ".target"), |
793 | cmd = var((*it) + ".commands"), deps; | 926 | cmd = var((*it) + ".commands"), deps; |
794 | if(targ.isEmpty()) | 927 | if(targ.isEmpty()) |
795 | targ = (*it); | 928 | targ = (*it); |
796 | QStringList &deplist = project->variables()[(*it) + ".depends"]; | 929 | QStringList &deplist = project->variables()[(*it) + ".depends"]; |
797 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | 930 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { |
798 | QString dep = var((*dep_it) + ".target"); | 931 | QString dep = var((*dep_it) + ".target"); |
799 | if(dep.isEmpty()) | 932 | if(dep.isEmpty()) |
800 | dep = (*dep_it); | 933 | dep = (*dep_it); |
801 | deps += " " + dep; | 934 | deps += " " + dep; |
802 | } | 935 | } |
936 | if(project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1) | ||
937 | deps += QString(" ") + "FORCE"; | ||
803 | t << targ << ":" << deps << "\n\t" | 938 | t << targ << ":" << deps << "\n\t" |
804 | << cmd << endl << endl; | 939 | << cmd << endl << endl; |
805 | } | 940 | } |
941 | // user defined compilers | ||
942 | QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
943 | for(it = quc.begin(); it != quc.end(); ++it) { | ||
944 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
945 | QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" "); | ||
946 | QString tmp_dep = project->variables()[(*it) + ".depends"].join(" "); | ||
947 | QStringList &vars = project->variables()[(*it) + ".variables"]; | ||
948 | if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) | ||
949 | continue; | ||
950 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
951 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
952 | QStringList &inputs = project->variables()[(*it2)]; | ||
953 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
954 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
955 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
956 | out = tmp_out, cmd = tmp_cmd, deps; | ||
957 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
958 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
959 | cmd.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
960 | cmd.replace("${QMAKE_FILE_OUT}", out); | ||
961 | cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
962 | for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3) | ||
963 | cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")"); | ||
964 | if(!tmp_dep.isEmpty()) { | ||
965 | char buff[256]; | ||
966 | QString dep_cmd = tmp_dep; | ||
967 | dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
968 | if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) { | ||
969 | while(!feof(proc)) { | ||
970 | int read_in = int(fread(buff, 1, 255, proc)); | ||
971 | if(!read_in) | ||
972 | break; | ||
973 | int l = 0; | ||
974 | for(int i = 0; i < read_in; i++) { | ||
975 | if(buff[i] == '\n' || buff[i] == ' ') { | ||
976 | deps += " " + QCString(buff+l, (i - l) + 1); | ||
977 | l = i; | ||
978 | } | ||
979 | } | ||
980 | } | ||
981 | fclose(proc); | ||
982 | } | ||
983 | } | ||
984 | t << out << ": " << in << deps << "\n\t" | ||
985 | << cmd << endl << endl; | ||
986 | } | ||
987 | } | ||
988 | } | ||
806 | t <<"FORCE:" << endl << endl; | 989 | t <<"FORCE:" << endl << endl; |
807 | } | 990 | } |
808 | 991 | ||
809 | struct SubDir | 992 | struct SubDir |
810 | { | 993 | { |
811 | QString directory, profile, target, makefile; | 994 | QString directory, profile, target, makefile; |
812 | }; | 995 | }; |
813 | 996 | ||
814 | void | 997 | void |
815 | UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | 998 | UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) |
816 | { | 999 | { |
1000 | // blasted includes | ||
1001 | QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"]; | ||
1002 | for(QStringList::Iterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it) | ||
1003 | t << "include " << (*qeui_it) << endl; | ||
1004 | writeExtraVariables(t); | ||
1005 | |||
817 | QPtrList<SubDir> subdirs; | 1006 | QPtrList<SubDir> subdirs; |
818 | { | 1007 | { |
819 | QStringList subdirs_in = project->variables()["SUBDIRS"]; | 1008 | QStringList subdirs_in = project->variables()["SUBDIRS"]; |
820 | for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { | 1009 | for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) { |
821 | QString file = (*it); | 1010 | QString file = (*it); |
822 | fileFixify(file); | 1011 | fileFixify(file); |
823 | SubDir *sd = new SubDir; | 1012 | SubDir *sd = new SubDir; |
824 | subdirs.append(sd); | 1013 | subdirs.append(sd); |
825 | sd->makefile = "$(MAKEFILE)"; | 1014 | sd->makefile = "$(MAKEFILE)"; |
826 | if((*it).right(4) == ".pro") { | 1015 | if((*it).right(4) == ".pro") { |
827 | int slsh = file.findRev(Option::dir_sep); | 1016 | int slsh = file.findRev(Option::dir_sep); |
828 | if(slsh != -1) { | 1017 | if(slsh != -1) { |
829 | sd->directory = file.left(slsh+1); | 1018 | sd->directory = file.left(slsh+1); |
830 | sd->profile = file.mid(slsh+1); | 1019 | sd->profile = file.mid(slsh+1); |
831 | } else { | 1020 | } else { |
832 | sd->profile = file; | 1021 | sd->profile = file; |
833 | } | 1022 | } |
834 | } else { | 1023 | } else { |
1024 | if(!file.isEmpty()) | ||
1025 | sd->profile = file.section(Option::dir_sep, -1) + ".pro"; | ||
835 | sd->directory = file; | 1026 | sd->directory = file; |
836 | } | 1027 | } |
837 | while(sd->directory.right(1) == Option::dir_sep) | 1028 | while(sd->directory.right(1) == Option::dir_sep) |
838 | sd->directory = sd->directory.left(sd->directory.length() - 1); | 1029 | sd->directory = sd->directory.left(sd->directory.length() - 1); |
839 | if(!sd->profile.isEmpty()) { | 1030 | if(!sd->profile.isEmpty()) { |
840 | QString basename = sd->directory; | 1031 | QString basename = sd->directory; |
841 | int new_slsh = basename.findRev(Option::dir_sep); | 1032 | int new_slsh = basename.findRev(Option::dir_sep); |
842 | if(new_slsh != -1) | 1033 | if(new_slsh != -1) |
843 | basename = basename.mid(new_slsh+1); | 1034 | basename = basename.mid(new_slsh+1); |
844 | if(sd->profile != basename + ".pro") | 1035 | if(sd->profile != basename + ".pro") |
845 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro | 1036 | sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro |
846 | } | 1037 | } |
@@ -848,98 +1039,147 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct) | |||
848 | sd->target.replace('/', '-'); | 1039 | sd->target.replace('/', '-'); |
849 | sd->target.replace('.', '_'); | 1040 | sd->target.replace('.', '_'); |
850 | } | 1041 | } |
851 | } | 1042 | } |
852 | QPtrListIterator<SubDir> it(subdirs); | 1043 | QPtrListIterator<SubDir> it(subdirs); |
853 | 1044 | ||
854 | QString ofile = Option::output.name(); | 1045 | QString ofile = Option::output.name(); |
855 | if(ofile.findRev(Option::dir_sep) != -1) | 1046 | if(ofile.findRev(Option::dir_sep) != -1) |
856 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); | 1047 | ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1); |
857 | t << "MAKEFILE =" << var("MAKEFILE") << endl; | 1048 | t << "MAKEFILE =" << var("MAKEFILE") << endl; |
858 | t << "QMAKE =" << var("QMAKE") << endl; | 1049 | t << "QMAKE =" << var("QMAKE") << endl; |
859 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; | 1050 | t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; |
1051 | t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; | ||
1052 | t << "MKDIR = " << var("QMAKE_MKDIR") << endl; | ||
1053 | t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl; | ||
1054 | t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; | ||
860 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory | 1055 | t << "SUBTARGETS ="; // subdirectory targets are sub-directory |
861 | for( it.toFirst(); it.current(); ++it) | 1056 | for( it.toFirst(); it.current(); ++it) |
862 | t << " \\\n\t\t" << it.current()->target; | 1057 | t << " \\\n\t\t" << it.current()->target; |
863 | t << endl << endl; | 1058 | t << endl << endl; |
864 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; | 1059 | t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl; |
865 | 1060 | ||
866 | // generate target rules | 1061 | // generate target rules |
867 | for( it.toFirst(); it.current(); ++it) { | 1062 | for( it.toFirst(); it.current(); ++it) { |
868 | bool have_dir = !(*it)->directory.isEmpty(); | 1063 | bool have_dir = !(*it)->directory.isEmpty(); |
869 | QString mkfile = (*it)->makefile, out; | 1064 | QString mkfile = (*it)->makefile, out; |
870 | if(have_dir) | 1065 | if(have_dir) |
871 | mkfile.prepend((*it)->directory + Option::dir_sep); | 1066 | mkfile.prepend((*it)->directory + Option::dir_sep); |
872 | if(direct || (*it)->makefile != "$(MAKEFILE)") | 1067 | if(direct || (*it)->makefile != "$(MAKEFILE)") |
873 | out = " -o " + (*it)->makefile; | 1068 | out = " -o " + (*it)->makefile; |
874 | //qmake it | 1069 | //qmake it |
875 | t << mkfile << ": " << "\n\t"; | 1070 | t << mkfile << ": " << "\n\t"; |
876 | if(have_dir) | 1071 | if(have_dir) |
877 | t << "cd " << (*it)->directory << " && "; | 1072 | t << mkdir_p_asstring((*it)->directory) << "\n\t" |
878 | t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl; | 1073 | << "cd " << (*it)->directory << " && "; |
1074 | QString profile = fileFixify((*it)->profile, (*it)->directory, (*it)->directory); | ||
1075 | t << "$(QMAKE) " << profile << buildArgs() << out << endl; | ||
879 | //actually compile | 1076 | //actually compile |
880 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; | 1077 | t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t"; |
881 | if(have_dir) | 1078 | if(have_dir) |
882 | t << "cd " << (*it)->directory << " && "; | 1079 | t << "cd " << (*it)->directory << " && "; |
883 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; | 1080 | t << "$(MAKE) -f " << (*it)->makefile << endl << endl; |
884 | } | 1081 | } |
885 | 1082 | ||
886 | if (project->isActiveConfig("ordered")) { // generate dependencies | 1083 | if (project->isActiveConfig("ordered")) { // generate dependencies |
887 | for( it.toFirst(); it.current(); ) { | 1084 | for( it.toFirst(); it.current(); ) { |
888 | QString tar = it.current()->target; | 1085 | QString tar = it.current()->target; |
889 | ++it; | 1086 | ++it; |
890 | if (it.current()) | 1087 | if (it.current()) |
891 | t << it.current()->target << ": " << tar << endl; | 1088 | t << it.current()->target << ": " << tar << endl; |
892 | } | 1089 | } |
893 | t << endl; | 1090 | t << endl; |
894 | } | 1091 | } |
895 | 1092 | ||
896 | writeMakeQmake(t); | 1093 | writeMakeQmake(t); |
897 | 1094 | ||
898 | if(project->isEmpty("SUBDIRS")) { | 1095 | if(project->isEmpty("SUBDIRS")) { |
899 | t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl; | 1096 | t << "all qmake_all distclean uicables mocables install_subdirs uninstall_subdirs" |
1097 | << " uiclean mocclean lexclean yaccclean clean " << var("SUBDIR_TARGETS") << ": FORCE" << endl; | ||
900 | } else { | 1098 | } else { |
901 | t << "all: $(SUBTARGETS)" << endl; | 1099 | t << "all: $(SUBTARGETS)" << endl; |
902 | t << "qmake_all:"; | 1100 | t << "qmake_all:"; |
903 | for( it.toFirst(); it.current(); ++it) { | 1101 | for( it.toFirst(); it.current(); ++it) { |
904 | t << " "; | 1102 | t << " "; |
905 | if(!(*it)->directory.isEmpty()) | 1103 | if(!(*it)->directory.isEmpty()) |
906 | t << (*it)->directory << Option::dir_sep; | 1104 | t << (*it)->directory << Option::dir_sep; |
907 | t << (*it)->makefile; | 1105 | t << (*it)->makefile; |
908 | } | 1106 | } |
909 | for( it.toFirst(); it.current(); ++it) { | 1107 | for( it.toFirst(); it.current(); ++it) { |
910 | t << "\n\t ( "; | 1108 | t << "\n\t ( "; |
911 | if(!(*it)->directory.isEmpty()) | 1109 | if(!(*it)->directory.isEmpty()) |
912 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 1110 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
913 | t << "grep \"^qmake_all:\" " << (*it)->makefile | 1111 | t << "grep \"^qmake_all:\" " << (*it)->makefile |
914 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; | 1112 | << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true"; |
915 | } | 1113 | } |
916 | t << endl; | 1114 | t << endl; |
917 | t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE"; | 1115 | t << "clean uicables mocables uiclean mocclean lexclean yaccclean " |
1116 | << var("SUBDIR_TARGETS") << ": qmake_all FORCE"; | ||
918 | for( it.toFirst(); it.current(); ++it) { | 1117 | for( it.toFirst(); it.current(); ++it) { |
919 | t << "\n\t ( "; | 1118 | t << "\n\t ( "; |
920 | if(!(*it)->directory.isEmpty()) | 1119 | if(!(*it)->directory.isEmpty()) |
921 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 1120 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
922 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; | 1121 | t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true"; |
923 | } | 1122 | } |
924 | t << endl; | 1123 | t << endl; |
1124 | t << "uninstall_subdirs: qmake_all FORCE"; | ||
1125 | for( it.toFirst(); it.current(); ++it) { | ||
1126 | t << "\n\t ( "; | ||
1127 | if(!(*it)->directory.isEmpty()) | ||
1128 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | ||
1129 | t << "$(MAKE) -f " << (*it)->makefile << " uninstall" << "; ) || true"; | ||
1130 | } | ||
1131 | t << endl; | ||
1132 | t << "install_subdirs: qmake_all FORCE"; | ||
1133 | for( it.toFirst(); it.current(); ++it) { | ||
1134 | t << "\n\t ( "; | ||
1135 | if(!(*it)->directory.isEmpty()) | ||
1136 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | ||
1137 | t << "$(MAKE) -f " << (*it)->makefile << " install" << "; ) || true"; | ||
1138 | } | ||
1139 | t << endl; | ||
925 | t << "distclean: qmake_all FORCE"; | 1140 | t << "distclean: qmake_all FORCE"; |
926 | for( it.toFirst(); it.current(); ++it) { | 1141 | for( it.toFirst(); it.current(); ++it) { |
927 | t << "\n\t ( "; | 1142 | t << "\n\t ( "; |
928 | if(!(*it)->directory.isEmpty()) | 1143 | if(!(*it)->directory.isEmpty()) |
929 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; | 1144 | t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; "; |
930 | t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; | 1145 | t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true"; |
931 | } | 1146 | } |
932 | t << endl << endl; | 1147 | t << endl << endl; |
933 | } | 1148 | } |
1149 | |||
1150 | //installations | ||
1151 | project->variables()["INSTALLDEPS"] += "install_subdirs"; | ||
1152 | project->variables()["UNINSTALLDEPS"] += "uninstall_subdirs"; | ||
1153 | writeInstalls(t, "INSTALLS"); | ||
1154 | |||
1155 | // user defined targets | ||
1156 | QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"]; | ||
1157 | for(QStringList::Iterator qut_it = qut.begin(); qut_it != qut.end(); ++qut_it) { | ||
1158 | QString targ = var((*qut_it) + ".target"), | ||
1159 | cmd = var((*qut_it) + ".commands"), deps; | ||
1160 | if(targ.isEmpty()) | ||
1161 | targ = (*qut_it); | ||
1162 | QStringList &deplist = project->variables()[(*qut_it) + ".depends"]; | ||
1163 | for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { | ||
1164 | QString dep = var((*dep_it) + ".target"); | ||
1165 | if(dep.isEmpty()) | ||
1166 | dep = (*dep_it); | ||
1167 | deps += " " + dep; | ||
1168 | } | ||
1169 | if(project->variables()[(*qut_it) + ".CONFIG"].findIndex("phony") != -1) | ||
1170 | deps += QString(" ") + "FORCE"; | ||
1171 | t << targ << ":" << deps << "\n\t" | ||
1172 | << cmd << endl << endl; | ||
1173 | } | ||
934 | t <<"FORCE:" << endl << endl; | 1174 | t <<"FORCE:" << endl << endl; |
935 | } | 1175 | } |
936 | 1176 | ||
937 | void UnixMakefileGenerator::init2() | 1177 | void UnixMakefileGenerator::init2() |
938 | { | 1178 | { |
939 | //version handling | 1179 | //version handling |
940 | if(project->variables()["VERSION"].isEmpty()) | 1180 | if(project->variables()["VERSION"].isEmpty()) |
941 | project->variables()["VERSION"].append("1.0." + | 1181 | project->variables()["VERSION"].append("1.0." + |
942 | (project->isEmpty("VER_PAT") ? QString("0") : | 1182 | (project->isEmpty("VER_PAT") ? QString("0") : |
943 | project->first("VER_PAT")) ); | 1183 | project->first("VER_PAT")) ); |
944 | QStringList l = QStringList::split('.', project->first("VERSION")); | 1184 | QStringList l = QStringList::split('.', project->first("VERSION")); |
945 | l << "0" << "0"; //make sure there are three | 1185 | l << "0" << "0"; //make sure there are three |
@@ -958,50 +1198,56 @@ void UnixMakefileGenerator::init2() | |||
958 | } | 1198 | } |
959 | #endif | 1199 | #endif |
960 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); | 1200 | project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); |
961 | if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() ) | 1201 | if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() ) |
962 | project->variables()["TARGET_EXT"].append(".exe"); | 1202 | project->variables()["TARGET_EXT"].append(".exe"); |
963 | } else if ( project->isActiveConfig("staticlib") ) { | 1203 | } else if ( project->isActiveConfig("staticlib") ) { |
964 | project->variables()["TARGET"].first().prepend("lib"); | 1204 | project->variables()["TARGET"].first().prepend("lib"); |
965 | project->variables()["TARGET"].first() += ".a"; | 1205 | project->variables()["TARGET"].first() += ".a"; |
966 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) | 1206 | if(project->variables()["QMAKE_AR_CMD"].isEmpty()) |
967 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); | 1207 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)"); |
968 | } else { | 1208 | } else { |
969 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); | 1209 | project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a"); |
1210 | if( project->isActiveConfig("compile_libtool") ) | ||
1211 | project->variables()["TARGET_la"] = project->first("DESTDIR") + "lib" + project->first("TARGET") + Option::libtool_ext; | ||
1212 | |||
970 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) | 1213 | if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() ) |
971 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); | 1214 | project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)"); |
972 | else | 1215 | else |
973 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); | 1216 | project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)"); |
974 | if( project->isActiveConfig("plugin") ) { | 1217 | if( project->isActiveConfig("compile_libtool") ) { |
1218 | project->variables()["TARGET"] = project->variables()["TARGET_la"]; | ||
1219 | } else if( project->isActiveConfig("plugin") ) { | ||
975 | project->variables()["TARGET_x.y.z"].append("lib" + | 1220 | project->variables()["TARGET_x.y.z"].append("lib" + |
976 | project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB")); | 1221 | project->first("TARGET") + "." + |
1222 | project->first("QMAKE_EXTENSION_PLUGIN")); | ||
977 | if(project->isActiveConfig("lib_version_first")) | 1223 | if(project->isActiveConfig("lib_version_first")) |
978 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1224 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
979 | project->first("VER_MAJ") + "." + | 1225 | project->first("VER_MAJ") + "." + |
980 | project->first("QMAKE_EXTENSION_SHLIB")); | 1226 | project->first("QMAKE_EXTENSION_PLUGIN")); |
981 | else | 1227 | else |
982 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1228 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
983 | project->first("QMAKE_EXTENSION_SHLIB") + | 1229 | project->first("QMAKE_EXTENSION_PLUGIN") + |
984 | "." + project->first("VER_MAJ")); | 1230 | "." + project->first("VER_MAJ")); |
985 | 1231 | ||
986 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; | 1232 | project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"]; |
987 | if(project->isActiveConfig("qt")) | 1233 | if(project->isActiveConfig("qt")) |
988 | project->variables()["DEFINES"].append("QT_PLUGIN"); | 1234 | project->variables()["DEFINES"].append("QT_PLUGIN"); |
989 | } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) { | 1235 | } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) { |
990 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); | 1236 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl"); |
991 | if(project->isActiveConfig("lib_version_first")) | 1237 | if(project->isActiveConfig("lib_version_first")) |
992 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + | 1238 | project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." + |
993 | project->first("TARGET")); | 1239 | project->first("TARGET")); |
994 | else | 1240 | else |
995 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1241 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
996 | project->first("VER_MAJ")); | 1242 | project->first("VER_MAJ")); |
997 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; | 1243 | project->variables()["TARGET"] = project->variables()["TARGET_x"]; |
998 | } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) { | 1244 | } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) { |
999 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); | 1245 | project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a"); |
1000 | if(project->isActiveConfig("lib_version_first")) { | 1246 | if(project->isActiveConfig("lib_version_first")) { |
1001 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + | 1247 | project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." + |
1002 | project->first("VER_MAJ") + "." + | 1248 | project->first("VER_MAJ") + "." + |
1003 | project->first("QMAKE_EXTENSION_SHLIB")); | 1249 | project->first("QMAKE_EXTENSION_SHLIB")); |
1004 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + | 1250 | project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." + |
1005 | project->first("VER_MAJ") + | 1251 | project->first("VER_MAJ") + |
1006 | "." + project->first("VER_MIN") + "." + | 1252 | "." + project->first("VER_MIN") + "." + |
1007 | project->first("QMAKE_EXTENSION_SHLIB")); | 1253 | project->first("QMAKE_EXTENSION_SHLIB")); |
@@ -1066,45 +1312,277 @@ void UnixMakefileGenerator::init2() | |||
1066 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); | 1312 | project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR")); |
1067 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) { | 1313 | if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) { |
1068 | if(project->isActiveConfig("plugin")) { | 1314 | if(project->isActiveConfig("plugin")) { |
1069 | if(!project->variables()["TARGET"].isEmpty() ) | 1315 | if(!project->variables()["TARGET"].isEmpty() ) |
1070 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); | 1316 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET"); |
1071 | } else { | 1317 | } else { |
1072 | if(!project->variables()["TARGET_x"].isEmpty() ) | 1318 | if(!project->variables()["TARGET_x"].isEmpty() ) |
1073 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); | 1319 | project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x"); |
1074 | } | 1320 | } |
1075 | } | 1321 | } |
1076 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) | 1322 | if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() ) |
1077 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( | 1323 | project->variables()["QMAKE_LINK_SHLIB_CMD"].append( |
1078 | "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)"); | 1324 | "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)"); |
1079 | } | 1325 | } |
1080 | if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) | 1326 | if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) |
1081 | project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); | 1327 | project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf"); |
1082 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { | 1328 | if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { |
1083 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"]; | 1329 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_APP"]; |
1330 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_APP"]; | ||
1331 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_APP"]; | ||
1084 | } else if ( project->isActiveConfig("dll") ) { | 1332 | } else if ( project->isActiveConfig("dll") ) { |
1085 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; | 1333 | if( !project->isActiveConfig("plugin") || !project->isActiveConfig("plugin_no_share_shlib_cflags")) { |
1086 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; | 1334 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"]; |
1335 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"]; | ||
1336 | } | ||
1087 | if ( project->isActiveConfig("plugin") ) { | 1337 | if ( project->isActiveConfig("plugin") ) { |
1338 | project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_PLUGIN"]; | ||
1339 | project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_PLUGIN"]; | ||
1088 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; | 1340 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"]; |
1089 | if( !project->isActiveConfig("plugin_no_soname") ) | 1341 | if( project->isActiveConfig("plugin_with_soname") && !project->isActiveConfig("compile_libtool")) |
1090 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | 1342 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; |
1091 | } else { | 1343 | } else { |
1092 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; | 1344 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"]; |
1093 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | 1345 | if(!project->isEmpty("QMAKE_LFLAGS_COMPAT_VERSION")) { |
1346 | if(project->isEmpty("COMPAT_VERSION")) | ||
1347 | project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_COMPAT_VERSION") + | ||
1348 | project->first("VER_MAJ") + "." + | ||
1349 | project->first("VER_MIN")); | ||
1350 | else | ||
1351 | project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_COMPAT_VERSION") + | ||
1352 | project->first("COMPATIBILITY_VERSION")); | ||
1353 | } | ||
1354 | if(!project->isEmpty("QMAKE_LFLAGS_VERSION")) { | ||
1355 | project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_VERSION") + | ||
1356 | project->first("VER_MAJ") + "." + | ||
1357 | project->first("VER_MIN") + "." + | ||
1358 | project->first("VER_PAT")); | ||
1359 | } | ||
1360 | if(!project->isActiveConfig("compile_libtool")) | ||
1361 | project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"]; | ||
1094 | } | 1362 | } |
1095 | QString destdir = project->first("DESTDIR"); | 1363 | QString destdir = project->first("DESTDIR"); |
1096 | if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) { | 1364 | if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) { |
1097 | QString rpath_destdir = destdir; | 1365 | QString rpath_destdir = destdir; |
1098 | if(QDir::isRelativePath(rpath_destdir)) { | 1366 | if(QDir::isRelativePath(rpath_destdir)) { |
1099 | QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir)); | 1367 | QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir)); |
1100 | if(fi.convertToAbs()) //strange, shouldn't really happen | 1368 | if(fi.convertToAbs()) //strange, shouldn't really happen |
1101 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); | 1369 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); |
1102 | else | 1370 | else |
1103 | rpath_destdir = fi.filePath(); | 1371 | rpath_destdir = fi.filePath(); |
1104 | } else { | 1372 | } else { |
1105 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); | 1373 | rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE); |
1106 | } | 1374 | } |
1107 | project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir; | 1375 | project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir; |
1108 | } | 1376 | } |
1109 | } | 1377 | } |
1378 | QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"]; | ||
1379 | for(QStringList::Iterator it = quc.begin(); it != quc.end(); ++it) { | ||
1380 | QString tmp_out = project->variables()[(*it) + ".output"].first(); | ||
1381 | if(tmp_out.isEmpty()) | ||
1382 | continue; | ||
1383 | QStringList &tmp = project->variables()[(*it) + ".input"]; | ||
1384 | for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { | ||
1385 | QStringList &inputs = project->variables()[(*it2)]; | ||
1386 | for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { | ||
1387 | QFileInfo fi(Option::fixPathToLocalOS((*input))); | ||
1388 | QString in = Option::fixPathToTargetOS((*input), FALSE), | ||
1389 | out = tmp_out; | ||
1390 | out.replace("${QMAKE_FILE_BASE}", fi.baseName()); | ||
1391 | out.replace("${QMAKE_FILE_NAME}", fi.fileName()); | ||
1392 | if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1) | ||
1393 | project->variables()["OBJCOMP"] += out; | ||
1394 | } | ||
1395 | } | ||
1396 | } | ||
1397 | } | ||
1398 | |||
1399 | QString | ||
1400 | UnixMakefileGenerator::libtoolFileName() | ||
1401 | { | ||
1402 | QString ret = var("TARGET"); | ||
1403 | int slsh = ret.findRev(Option::dir_sep); | ||
1404 | if(slsh != -1) | ||
1405 | ret = ret.right(ret.length() - slsh); | ||
1406 | int dot = ret.find('.'); | ||
1407 | if(dot != -1) | ||
1408 | ret = ret.left(dot); | ||
1409 | ret += Option::libtool_ext; | ||
1410 | if(!project->isEmpty("DESTDIR")) | ||
1411 | ret.prepend(var("DESTDIR")); | ||
1412 | return ret; | ||
1413 | } | ||
1414 | |||
1415 | void | ||
1416 | UnixMakefileGenerator::writeLibtoolFile() | ||
1417 | { | ||
1418 | QString fname = libtoolFileName(), lname = fname; | ||
1419 | int slsh = lname.findRev(Option::dir_sep); | ||
1420 | if(slsh != -1) | ||
1421 | lname = lname.right(lname.length() - slsh - 1); | ||
1422 | QFile ft(fname); | ||
1423 | if(!ft.open(IO_WriteOnly)) | ||
1424 | return; | ||
1425 | project->variables()["ALL_DEPS"].append(fname); | ||
1426 | |||
1427 | QTextStream t(&ft); | ||
1428 | t << "# " << lname << " - a libtool library file\n"; | ||
1429 | time_t now = time(NULL); | ||
1430 | t << "# Generated by qmake/libtool (" << qmake_version() << ") (Qt " | ||
1431 | << QT_VERSION_STR << ") on: " << ctime(&now) << "\n"; | ||
1432 | |||
1433 | t << "# The name that we can dlopen(3).\n" | ||
1434 | << "dlname='" << var(project->isActiveConfig("plugin") ? "TARGET" : "TARGET_x") | ||
1435 | << "'\n\n"; | ||
1436 | |||
1437 | t << "# Names of this library.\n"; | ||
1438 | t << "library_names='"; | ||
1439 | if(project->isActiveConfig("plugin")) { | ||
1440 | t << var("TARGET"); | ||
1441 | } else { | ||
1442 | if (project->isEmpty("QMAKE_HPUX_SHLIB")) | ||
1443 | t << var("TARGET_x.y.z") << " "; | ||
1444 | t << var("TARGET_x") << " " << var("TARGET_"); | ||
1445 | } | ||
1446 | t << "'\n\n"; | ||
1447 | |||
1448 | t << "# The name of the static archive.\n" | ||
1449 | << "old_library='" << lname.left(lname.length()-Option::libtool_ext.length()) << ".a'\n\n"; | ||
1450 | |||
1451 | t << "# Libraries that this one depends upon.\n"; | ||
1452 | QStringList libs; | ||
1453 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | ||
1454 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; | ||
1455 | else | ||
1456 | libs << "QMAKE_LIBS"; //obvious one | ||
1457 | t << "dependency_libs='"; | ||
1458 | for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) | ||
1459 | t << project->variables()[(*it)].join(" ") << " "; | ||
1460 | t << "'\n\n"; | ||
1461 | |||
1462 | t << "# Version information for " << lname << "\n"; | ||
1463 | int maj = project->first("VER_MAJ").toInt(); | ||
1464 | int min = project->first("VER_MIN").toInt(); | ||
1465 | int pat = project->first("VER_PAT").toInt(); | ||
1466 | t << "current=" << (10*maj + min) << "\n" // best I can think of | ||
1467 | << "age=0\n" | ||
1468 | << "revision=" << pat << "\n\n"; | ||
1469 | |||
1470 | t << "# Is this an already installed library.\n" | ||
1471 | "installed=yes\n\n"; // ### | ||
1472 | |||
1473 | t << "# Files to dlopen/dlpreopen.\n" | ||
1474 | "dlopen=''\n" | ||
1475 | "dlpreopen=''\n\n"; | ||
1476 | |||
1477 | QString install_dir = project->first("target.path"); | ||
1478 | if(install_dir.isEmpty()) | ||
1479 | install_dir = project->first("DESTDIR"); | ||
1480 | t << "# Directory that this library needs to be installed in:\n" | ||
1481 | "libdir='" << Option::fixPathToTargetOS(install_dir, FALSE) << "'\n"; | ||
1482 | } | ||
1483 | |||
1484 | QString | ||
1485 | UnixMakefileGenerator::pkgConfigFileName() | ||
1486 | { | ||
1487 | QString ret = var("TARGET"); | ||
1488 | int slsh = ret.findRev(Option::dir_sep); | ||
1489 | if(slsh != -1) | ||
1490 | ret = ret.right(ret.length() - slsh); | ||
1491 | if(ret.startsWith("lib")) | ||
1492 | ret = ret.mid(3); | ||
1493 | int dot = ret.find('.'); | ||
1494 | if(dot != -1) | ||
1495 | ret = ret.left(dot); | ||
1496 | ret += Option::pkgcfg_ext; | ||
1497 | if(!project->isEmpty("DESTDIR")) { | ||
1498 | ret.prepend(var("DESTDIR")); | ||
1499 | ret = Option::fixPathToLocalOS(fileFixify(ret,QDir::currentDirPath(), Option::output_dir)); | ||
1500 | } | ||
1501 | return ret; | ||
1502 | } | ||
1503 | |||
1504 | QString | ||
1505 | UnixMakefileGenerator::pkgConfigPrefix() const | ||
1506 | { | ||
1507 | if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX")) | ||
1508 | return project->first("QMAKE_PKGCONFIG_PREFIX"); | ||
1509 | return qInstallPath(); | ||
1510 | } | ||
1511 | |||
1512 | QString | ||
1513 | UnixMakefileGenerator::pkgConfigFixPath(QString path) const | ||
1514 | { | ||
1515 | QString prefix = pkgConfigPrefix(); | ||
1516 | if(path.startsWith(prefix)) | ||
1517 | path = path.replace(prefix, "${prefix}"); | ||
1518 | return path; | ||
1519 | } | ||
1520 | |||
1521 | void | ||
1522 | UnixMakefileGenerator::writePkgConfigFile() // ### does make sense only for libqt so far | ||
1523 | { | ||
1524 | QString fname = pkgConfigFileName(), lname = fname; | ||
1525 | int slsh = lname.findRev(Option::dir_sep); | ||
1526 | if(slsh != -1) | ||
1527 | lname = lname.right(lname.length() - slsh - 1); | ||
1528 | QFile ft(fname); | ||
1529 | if(!ft.open(IO_WriteOnly)) | ||
1530 | return; | ||
1531 | project->variables()["ALL_DEPS"].append(fname); | ||
1532 | QTextStream t(&ft); | ||
1533 | |||
1534 | QString prefix = pkgConfigPrefix(); | ||
1535 | QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR"); | ||
1536 | if(libDir.isEmpty()) | ||
1537 | libDir = prefix + "/lib"; | ||
1538 | QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR"); | ||
1539 | if(includeDir.isEmpty()) | ||
1540 | includeDir = prefix + "/include"; | ||
1541 | |||
1542 | t << "prefix=" << prefix << endl; | ||
1543 | t << "exec_prefix=${prefix}\n" | ||
1544 | << "libdir=" << pkgConfigFixPath(libDir) << "\n" | ||
1545 | << "includedir=" << pkgConfigFixPath(includeDir) << endl; | ||
1546 | // non-standard entry. Provides useful info normally only | ||
1547 | // contained in the internal .qmake.cache file | ||
1548 | t << varGlue("CONFIG", "qt_config=", " ", "") << endl << endl; | ||
1549 | |||
1550 | t << "Name: Qt" << endl; | ||
1551 | QString desc = project->first("QMAKE_PKGCONFIG_DESCRIPTION"); | ||
1552 | if(desc.isEmpty()) { | ||
1553 | desc = project->first("TARGET").lower(); | ||
1554 | desc.replace(0, 1, desc[0].upper()); | ||
1555 | if(project->first("TEMPLATE") == "lib") { | ||
1556 | if(project->isActiveConfig("plugin")) | ||
1557 | desc += " Plugin"; | ||
1558 | else | ||
1559 | desc += " Library"; | ||
1560 | } else if(project->first("TEMPLATE") == "app") { | ||
1561 | desc += " Application"; | ||
1562 | } | ||
1563 | } | ||
1564 | t << "Description: " << desc << endl; | ||
1565 | t << "Version: " << project->first("VERSION") << endl; | ||
1566 | |||
1567 | // libs | ||
1568 | QStringList libs; | ||
1569 | if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) | ||
1570 | libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"]; | ||
1571 | else | ||
1572 | libs << "QMAKE_LIBS"; //obvious one | ||
1573 | if(project->isActiveConfig("thread")) | ||
1574 | libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? | ||
1575 | t << "Libs: -L${libdir} -l" << lname.left(lname.length()-Option::libtool_ext.length()) << " "; | ||
1576 | for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) | ||
1577 | t << project->variables()[(*it)].join(" ") << " "; | ||
1578 | t << endl; | ||
1579 | |||
1580 | // flags | ||
1581 | // ### too many | ||
1582 | t << "Cflags: " | ||
1583 | // << var("QMAKE_CXXFLAGS") << " " | ||
1584 | << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ") | ||
1585 | << project->variables()["PRL_EXPORT_CXXFLAGS"].join(" ") | ||
1586 | // << varGlue("DEFINES","-D"," -D"," ") | ||
1587 | << " -I${includedir}"; | ||
1110 | } | 1588 | } |