author | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-15 17:36:57 (UTC) |
commit | 323e9a7472a110b4befba7320540263147505bae (patch) (unidiff) | |
tree | 14c810bdb9c0603a30356b17b4bdf9ccb72741c6 /qmake/option.cpp | |
parent | aa292b322f1ecb43dd8f4e3cd295855730dd9f59 (diff) | |
download | opie-323e9a7472a110b4befba7320540263147505bae.zip opie-323e9a7472a110b4befba7320540263147505bae.tar.gz opie-323e9a7472a110b4befba7320540263147505bae.tar.bz2 |
Manually updatet to qmake1.06a which includes support for precompiled
headers.
Opies 'PRO' keyword was already reintroduced
-rw-r--r-- | qmake/option.cpp | 101 |
1 files changed, 71 insertions, 30 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp index 8b7e5e8..e6928fa 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp | |||
@@ -1,12 +1,10 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** |
3 | ** | 3 | ** |
4 | ** Definition of ________ class. | 4 | ** Implementation of Option 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 |
@@ -45,7 +43,10 @@ | |||
45 | QString Option::prf_ext; | 43 | QString Option::prf_ext; |
46 | QString Option::prl_ext; | 44 | QString Option::prl_ext; |
45 | QString Option::libtool_ext; | ||
46 | QString Option::pkgcfg_ext; | ||
47 | QString Option::ui_ext; | 47 | QString Option::ui_ext; |
48 | QStringList Option::h_ext; | 48 | QStringList Option::h_ext; |
49 | QString Option::moc_ext; | 49 | QString Option::cpp_moc_ext; |
50 | QString Option::h_moc_ext; | ||
50 | QStringList Option::cpp_ext; | 51 | QStringList Option::cpp_ext; |
51 | QString Option::obj_ext; | 52 | QString Option::obj_ext; |
@@ -53,5 +54,6 @@ QString Option::lex_ext; | |||
53 | QString Option::yacc_ext; | 54 | QString Option::yacc_ext; |
54 | QString Option::dir_sep; | 55 | QString Option::dir_sep; |
55 | QString Option::moc_mod; | 56 | QString Option::h_moc_mod; |
57 | QString Option::cpp_moc_mod; | ||
56 | QString Option::yacc_mod; | 58 | QString Option::yacc_mod; |
57 | QString Option::lex_mod; | 59 | QString Option::lex_mod; |
@@ -81,4 +83,7 @@ Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE; | |||
81 | #endif | 83 | #endif |
82 | 84 | ||
85 | //QMAKE_*_PROPERTY stuff | ||
86 | QStringList Option::prop::properties; | ||
87 | |||
83 | //QMAKE_GENERATE_PROJECT stuff | 88 | //QMAKE_GENERATE_PROJECT stuff |
84 | bool Option::projfile::do_pwd = TRUE; | 89 | bool Option::projfile::do_pwd = TRUE; |
@@ -105,4 +110,6 @@ static Option::QMAKE_MODE default_mode(QString progname) | |||
105 | if(progname == "qmakegen") | 110 | if(progname == "qmakegen") |
106 | return Option::QMAKE_GENERATE_PROJECT; | 111 | return Option::QMAKE_GENERATE_PROJECT; |
112 | else if(progname == "qt-config") | ||
113 | return Option::QMAKE_QUERY_PROPERTY; | ||
107 | return Option::QMAKE_GENERATE_MAKEFILE; | 114 | return Option::QMAKE_GENERATE_MAKEFILE; |
108 | } | 115 | } |
@@ -162,5 +169,10 @@ bool usage(const char *a0) | |||
162 | } | 169 | } |
163 | 170 | ||
164 | bool | 171 | enum { |
172 | QMAKE_CMDLINE_SUCCESS, | ||
173 | QMAKE_CMDLINE_SHOW_USAGE, | ||
174 | QMAKE_CMDLINE_BAIL | ||
175 | }; | ||
176 | int | ||
165 | Option::internalParseCommandLine(int argc, char **argv, int skip) | 177 | Option::internalParseCommandLine(int argc, char **argv, int skip) |
166 | { | 178 | { |
@@ -179,4 +191,8 @@ Option::internalParseCommandLine(int argc, char **argv, int skip) | |||
179 | Option::mkfile::do_mocs = FALSE; | 191 | Option::mkfile::do_mocs = FALSE; |
180 | Option::qmake_mode = Option::QMAKE_GENERATE_PRL; | 192 | Option::qmake_mode = Option::QMAKE_GENERATE_PRL; |
193 | } else if(opt == "set") { | ||
194 | Option::qmake_mode = Option::QMAKE_SET_PROPERTY; | ||
195 | } else if(opt == "query") { | ||
196 | Option::qmake_mode = Option::QMAKE_QUERY_PROPERTY; | ||
181 | } else if(opt == "makefile") { | 197 | } else if(opt == "makefile") { |
182 | Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; | 198 | Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; |
@@ -209,7 +225,7 @@ Option::internalParseCommandLine(int argc, char **argv, int skip) | |||
209 | fprintf(stderr, "Qmake version: %s (Qt %s)\n", qmake_version(), QT_VERSION_STR); | 225 | fprintf(stderr, "Qmake version: %s (Qt %s)\n", qmake_version(), QT_VERSION_STR); |
210 | fprintf(stderr, "Qmake is free software from Trolltech AS.\n"); | 226 | fprintf(stderr, "Qmake is free software from Trolltech AS.\n"); |
211 | return FALSE; | 227 | return QMAKE_CMDLINE_BAIL; |
212 | } else if(opt == "h" || opt == "help") { | 228 | } else if(opt == "h" || opt == "help") { |
213 | return FALSE; | 229 | return QMAKE_CMDLINE_SHOW_USAGE; |
214 | } else if(opt == "Wall") { | 230 | } else if(opt == "Wall") { |
215 | Option::warn_level |= WarnAll; | 231 | Option::warn_level |= WarnAll; |
@@ -240,5 +256,5 @@ Option::internalParseCommandLine(int argc, char **argv, int skip) | |||
240 | } else { | 256 | } else { |
241 | fprintf(stderr, "***Unknown option -%s\n", opt.latin1()); | 257 | fprintf(stderr, "***Unknown option -%s\n", opt.latin1()); |
242 | return usage(argv[0]); | 258 | return QMAKE_CMDLINE_SHOW_USAGE; |
243 | } | 259 | } |
244 | } else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { | 260 | } else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { |
@@ -251,5 +267,5 @@ Option::internalParseCommandLine(int argc, char **argv, int skip) | |||
251 | } else { | 267 | } else { |
252 | fprintf(stderr, "***Unknown option -%s\n", opt.latin1()); | 268 | fprintf(stderr, "***Unknown option -%s\n", opt.latin1()); |
253 | return FALSE; | 269 | return QMAKE_CMDLINE_SHOW_USAGE; |
254 | } | 270 | } |
255 | } | 271 | } |
@@ -263,16 +279,26 @@ Option::internalParseCommandLine(int argc, char **argv, int skip) | |||
263 | Option::after_user_vars.append(arg); | 279 | Option::after_user_vars.append(arg); |
264 | } else { | 280 | } else { |
265 | QFileInfo fi(arg); | 281 | bool handled = TRUE; |
266 | if(!fi.convertToAbs()) //strange | 282 | if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || |
267 | arg = fi.filePath(); | 283 | Option::qmake_mode == Option::QMAKE_SET_PROPERTY) { |
268 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | 284 | Option::prop::properties.append(arg); |
269 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) | 285 | } else { |
270 | Option::mkfile::project_files.append(arg); | 286 | QFileInfo fi(arg); |
271 | else | 287 | if(!fi.convertToAbs()) //strange |
272 | Option::projfile::project_dirs.append(arg); | 288 | arg = fi.filePath(); |
289 | if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || | ||
290 | Option::qmake_mode == Option::QMAKE_GENERATE_PRL) | ||
291 | Option::mkfile::project_files.append(arg); | ||
292 | else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) | ||
293 | Option::projfile::project_dirs.append(arg); | ||
294 | else | ||
295 | handled = FALSE; | ||
296 | } | ||
297 | if(!handled) | ||
298 | return QMAKE_CMDLINE_SHOW_USAGE; | ||
273 | } | 299 | } |
274 | } | 300 | } |
275 | } | 301 | } |
276 | return TRUE; | 302 | return QMAKE_CMDLINE_SUCCESS; |
277 | } | 303 | } |
278 | 304 | ||
@@ -281,12 +307,16 @@ bool | |||
281 | Option::parseCommandLine(int argc, char **argv) | 307 | Option::parseCommandLine(int argc, char **argv) |
282 | { | 308 | { |
283 | Option::moc_mod = "moc_"; | 309 | Option::cpp_moc_mod = ""; |
310 | Option::h_moc_mod = "moc_"; | ||
284 | Option::lex_mod = "_lex"; | 311 | Option::lex_mod = "_lex"; |
285 | Option::yacc_mod = "_yacc"; | 312 | Option::yacc_mod = "_yacc"; |
286 | Option::prl_ext = ".prl"; | 313 | Option::prl_ext = ".prl"; |
314 | Option::libtool_ext = ".la"; | ||
315 | Option::pkgcfg_ext = ".pc"; | ||
287 | Option::prf_ext = ".prf"; | 316 | Option::prf_ext = ".prf"; |
288 | Option::ui_ext = ".ui"; | 317 | Option::ui_ext = ".ui"; |
289 | Option::h_ext << ".h" << ".hpp" << ".hh" << ".H" << ".hxx"; | 318 | Option::h_ext << ".h" << ".hpp" << ".hh" << ".H" << ".hxx"; |
290 | Option::moc_ext = ".moc"; | 319 | Option::cpp_moc_ext = ".moc"; |
320 | Option::h_moc_ext = ".cpp"; | ||
291 | Option::cpp_ext << ".cpp" << ".cc" << ".cxx" << ".C"; | 321 | Option::cpp_ext << ".cpp" << ".cc" << ".cxx" << ".C"; |
292 | Option::lex_ext = ".l"; | 322 | Option::lex_ext = ".l"; |
@@ -335,6 +365,9 @@ Option::parseCommandLine(int argc, char **argv) | |||
335 | free(env_argv); | 365 | free(env_argv); |
336 | } | 366 | } |
337 | if(!internalParseCommandLine(argc, argv, 1)) | 367 | { |
338 | return usage(argv[0]); | 368 | int ret = internalParseCommandLine(argc, argv, 1); |
369 | if(ret != QMAKE_CMDLINE_SUCCESS) | ||
370 | return ret == QMAKE_CMDLINE_SHOW_USAGE ? usage(argv[0]) : FALSE; | ||
371 | } | ||
339 | 372 | ||
340 | //last chance for defaults | 373 | //last chance for defaults |
@@ -382,4 +415,8 @@ bool Option::postProcessProject(QMakeProject *project) | |||
382 | h_ext << ".h"; | 415 | h_ext << ".h"; |
383 | 416 | ||
417 | if(!project->isEmpty("QMAKE_EXT_PKGCONFIG")) | ||
418 | Option::pkgcfg_ext = project->first("QMAKE_EXT_PKGCONFIG"); | ||
419 | if(!project->isEmpty("QMAKE_EXT_LIBTOOL")) | ||
420 | Option::libtool_ext = project->first("QMAKE_EXT_LIBTOOL"); | ||
384 | if(!project->isEmpty("QMAKE_EXT_PRL")) | 421 | if(!project->isEmpty("QMAKE_EXT_PRL")) |
385 | Option::prl_ext = project->first("QMAKE_EXT_PRL"); | 422 | Option::prl_ext = project->first("QMAKE_EXT_PRL"); |
@@ -388,6 +425,8 @@ bool Option::postProcessProject(QMakeProject *project) | |||
388 | if(!project->isEmpty("QMAKE_EXT_UI")) | 425 | if(!project->isEmpty("QMAKE_EXT_UI")) |
389 | Option::ui_ext = project->first("QMAKE_EXT_UI"); | 426 | Option::ui_ext = project->first("QMAKE_EXT_UI"); |
390 | if(!project->isEmpty("QMAKE_EXT_MOC")) | 427 | if(!project->isEmpty("QMAKE_EXT_CPP_MOC")) |
391 | Option::moc_ext = project->first("QMAKE_EXT_MOC"); | 428 | Option::cpp_moc_ext = project->first("QMAKE_EXT_CPP_MOC"); |
429 | if(!project->isEmpty("QMAKE_EXT_H_MOC")) | ||
430 | Option::h_moc_ext = project->first("QMAKE_EXT_H_MOC"); | ||
392 | if(!project->isEmpty("QMAKE_EXT_LEX")) | 431 | if(!project->isEmpty("QMAKE_EXT_LEX")) |
393 | Option::lex_ext = project->first("QMAKE_EXT_LEX"); | 432 | Option::lex_ext = project->first("QMAKE_EXT_LEX"); |
@@ -396,6 +435,8 @@ bool Option::postProcessProject(QMakeProject *project) | |||
396 | if(!project->isEmpty("QMAKE_EXT_OBJ")) | 435 | if(!project->isEmpty("QMAKE_EXT_OBJ")) |
397 | Option::obj_ext = project->first("QMAKE_EXT_OBJ"); | 436 | Option::obj_ext = project->first("QMAKE_EXT_OBJ"); |
398 | if(!project->isEmpty("QMAKE_MOD_MOC")) | 437 | if(!project->isEmpty("QMAKE_H_MOD_MOC")) |
399 | Option::moc_mod = project->first("QMAKE_MOD_MOC"); | 438 | Option::h_moc_mod = project->first("QMAKE_H_MOD_MOC"); |
439 | if(!project->isEmpty("QMAKE_CPP_MOD_MOC")) | ||
440 | Option::cpp_moc_mod = project->first("QMAKE_CPP_MOD_MOC"); | ||
400 | if(!project->isEmpty("QMAKE_MOD_LEX")) | 441 | if(!project->isEmpty("QMAKE_MOD_LEX")) |
401 | Option::lex_mod = project->first("QMAKE_MOD_LEX"); | 442 | Option::lex_mod = project->first("QMAKE_MOD_LEX"); |