-rw-r--r-- | qmake/generators/makefile.h | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 4fdabe8..e818089 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h | |||
@@ -1,22 +1,20 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | ||
3 | ** | 2 | ** |
4 | ** Definition of ________ class. | ||
5 | ** | 3 | ** |
6 | ** Created : 970521 | 4 | ** Definition of MakefileGenerator 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 |
@@ -32,31 +30,39 @@ | |||
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 | #ifndef __MAKEFILE_H__ | 35 | #ifndef __MAKEFILE_H__ |
38 | #define __MAKEFILE_H__ | 36 | #define __MAKEFILE_H__ |
39 | 37 | ||
40 | #include "option.h" | 38 | #include "option.h" |
41 | #include "project.h" | 39 | #include "project.h" |
42 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
43 | 41 | ||
42 | #ifdef Q_OS_WIN32 | ||
43 | #define QT_POPEN _popen | ||
44 | #else | ||
45 | #define QT_POPEN popen | ||
46 | #endif | ||
47 | |||
44 | class MakefileGenerator | 48 | class MakefileGenerator |
45 | { | 49 | { |
46 | QString spec; | 50 | QString spec; |
47 | bool init_opath_already, init_already, moc_aware, no_io; | 51 | bool init_opath_already, init_already, moc_aware, no_io; |
48 | QStringList createObjectList(const QString &var); | 52 | QStringList createObjectList(const QString &var); |
49 | QString build_args(); | 53 | QString build_args(); |
50 | QMap<QString, QString> depHeuristics, depKeyMap, fileFixed; | 54 | QString dependencyKey(const QString &file) const; |
55 | QMap<QString, bool> depProcessed; | ||
56 | QMap<QString, QString> depHeuristics, fileFixed; | ||
51 | QMap<QString, QString> mocablesToMOC, mocablesFromMOC; | 57 | QMap<QString, QString> mocablesToMOC, mocablesFromMOC; |
52 | QMap<QString, QStringList> depends; | 58 | QMap<QString, QStringList> depends; |
53 | 59 | ||
54 | protected: | 60 | protected: |
55 | void writeObj(QTextStream &, const QString &obj, const QString &src); | 61 | void writeObj(QTextStream &, const QString &obj, const QString &src); |
56 | void writeUicSrc(QTextStream &, const QString &ui); | 62 | void writeUicSrc(QTextStream &, const QString &ui); |
57 | void writeMocObj(QTextStream &, const QString &obj, const QString &src); | 63 | void writeMocObj(QTextStream &, const QString &obj, const QString &src); |
58 | void writeMocSrc(QTextStream &, const QString &src); | 64 | void writeMocSrc(QTextStream &, const QString &src); |
59 | void writeLexSrc(QTextStream &, const QString &lex); | 65 | void writeLexSrc(QTextStream &, const QString &lex); |
60 | void writeYaccSrc(QTextStream &, const QString &yac); | 66 | void writeYaccSrc(QTextStream &, const QString &yac); |
61 | void writeInstalls(QTextStream &t, const QString &installs); | 67 | void writeInstalls(QTextStream &t, const QString &installs); |
62 | void writeImageObj(QTextStream &t, const QString &obj); | 68 | void writeImageObj(QTextStream &t, const QString &obj); |
@@ -72,70 +78,77 @@ protected: | |||
72 | QString real_dir, local_dir; | 78 | QString real_dir, local_dir; |
73 | }; | 79 | }; |
74 | bool generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &x, bool recurse); | 80 | bool generateDependencies(QPtrList<MakefileDependDir> &dirs, const QString &x, bool recurse); |
75 | 81 | ||
76 | QString buildArgs(); | 82 | QString buildArgs(); |
77 | 83 | ||
78 | QString specdir(); | 84 | QString specdir(); |
79 | QString cleanFilePath(const QString &file) const; | 85 | QString cleanFilePath(const QString &file) const; |
80 | bool generateMocList(const QString &fn); | 86 | bool generateMocList(const QString &fn); |
81 | 87 | ||
82 | QString findMocSource(const QString &moc_file) const; | 88 | QString findMocSource(const QString &moc_file) const; |
83 | QString findMocDestination(const QString &src_file) const; | 89 | QString findMocDestination(const QString &src_file) const; |
84 | QStringList &findDependencies(const QString &file); | 90 | virtual QStringList &findDependencies(const QString &file); |
85 | 91 | ||
86 | void setNoIO(bool o); | 92 | void setNoIO(bool o); |
87 | bool noIO() const; | 93 | bool noIO() const; |
88 | 94 | ||
89 | void setMocAware(bool o); | 95 | void setMocAware(bool o); |
90 | bool mocAware() const; | 96 | bool mocAware() const; |
91 | void logicWarn(const QString &, const QString &); | 97 | void logicWarn(const QString &, const QString &); |
92 | 98 | ||
93 | virtual bool doDepends() const { return Option::mkfile::do_deps; } | 99 | virtual bool doDepends() const { return Option::mkfile::do_deps; } |
94 | bool writeHeader(QTextStream &); | 100 | bool writeHeader(QTextStream &); |
95 | virtual bool writeMakefile(QTextStream &); | 101 | virtual bool writeMakefile(QTextStream &); |
96 | virtual bool writeMakeQmake(QTextStream &); | 102 | virtual bool writeMakeQmake(QTextStream &); |
97 | void initOutPaths(); | 103 | void initOutPaths(); |
98 | virtual void init(); | 104 | virtual void init(); |
99 | 105 | ||
106 | //for cross-platform dependent directories | ||
107 | virtual void usePlatformDir(); | ||
108 | |||
100 | //for installs | 109 | //for installs |
101 | virtual QString defaultInstall(const QString &); | 110 | virtual QString defaultInstall(const QString &); |
102 | 111 | ||
103 | //for prl | 112 | //for prl |
104 | bool processPrlFile(QString &); | 113 | bool processPrlFile(QString &); |
105 | virtual void processPrlVariable(const QString &, const QStringList &); | 114 | virtual void processPrlVariable(const QString &, const QStringList &); |
106 | virtual void processPrlFiles(); | 115 | virtual void processPrlFiles(); |
107 | virtual void writePrlFile(QTextStream &); | 116 | virtual void writePrlFile(QTextStream &); |
108 | 117 | ||
109 | //make sure libraries are found | 118 | //make sure libraries are found |
110 | virtual bool findLibraries(); | 119 | virtual bool findLibraries(); |
120 | virtual QString findDependency(const QString &); | ||
121 | |||
122 | void setProcessedDependencies(const QString &file, bool b); | ||
123 | bool processedDependencies(const QString &file); | ||
111 | 124 | ||
112 | QString var(const QString &var); | 125 | virtual QString var(const QString &var); |
113 | QString varGlue(const QString &var, const QString &before, const QString &glue, const QString &after); | 126 | QString varGlue(const QString &var, const QString &before, const QString &glue, const QString &after); |
114 | QString varList(const QString &var); | 127 | QString varList(const QString &var); |
115 | QString val(const QStringList &varList); | 128 | QString val(const QStringList &varList); |
116 | QString valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after); | 129 | QString valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after); |
117 | QString valList(const QStringList &varList); | 130 | QString valList(const QStringList &varList); |
118 | 131 | ||
119 | 132 | ||
120 | QString fileFixify(const QString& file, const QString &out_dir=QString::null, | 133 | QString fileFixify(const QString& file, const QString &out_dir=QString::null, |
121 | const QString &in_dir=QString::null, bool force_fix=FALSE) const; | 134 | const QString &in_dir=QString::null, bool force_fix=FALSE, bool canon=TRUE) const; |
122 | QStringList fileFixify(const QStringList& files, const QString &out_dir=QString::null, | 135 | QStringList fileFixify(const QStringList& files, const QString &out_dir=QString::null, |
123 | const QString &in_dir=QString::null, bool force_fix=FALSE) const; | 136 | const QString &in_dir=QString::null, bool force_fix=FALSE, bool canon=TRUE) const; |
124 | public: | 137 | public: |
125 | MakefileGenerator(QMakeProject *p); | 138 | MakefileGenerator(QMakeProject *p); |
126 | virtual ~MakefileGenerator(); | 139 | virtual ~MakefileGenerator(); |
127 | 140 | ||
128 | static MakefileGenerator *create(QMakeProject *); | 141 | static MakefileGenerator *create(QMakeProject *); |
129 | bool write(); | 142 | virtual bool write(); |
130 | virtual bool openOutput(QFile &) const; | 143 | virtual bool openOutput(QFile &) const; |
131 | }; | 144 | }; |
132 | 145 | ||
133 | inline QString MakefileGenerator::findMocSource(const QString &moc_file) const | 146 | inline QString MakefileGenerator::findMocSource(const QString &moc_file) const |
134 | { | 147 | { |
135 | QString tmp = cleanFilePath(moc_file); | 148 | QString tmp = cleanFilePath(moc_file); |
136 | if (mocablesFromMOC.contains(tmp)) | 149 | if (mocablesFromMOC.contains(tmp)) |
137 | return mocablesFromMOC[tmp]; | 150 | return mocablesFromMOC[tmp]; |
138 | else | 151 | else |
139 | return QString(""); | 152 | return QString(""); |
140 | } | 153 | } |
141 | 154 | ||
@@ -157,17 +170,21 @@ inline bool MakefileGenerator::mocAware() const | |||
157 | inline void MakefileGenerator::setNoIO(bool o) | 170 | inline void MakefileGenerator::setNoIO(bool o) |
158 | { no_io = o; } | 171 | { no_io = o; } |
159 | 172 | ||
160 | inline bool MakefileGenerator::noIO() const | 173 | inline bool MakefileGenerator::noIO() const |
161 | { return no_io; } | 174 | { return no_io; } |
162 | 175 | ||
163 | inline QString MakefileGenerator::defaultInstall(const QString &) | 176 | inline QString MakefileGenerator::defaultInstall(const QString &) |
164 | { return QString(""); } | 177 | { return QString(""); } |
165 | 178 | ||
166 | inline bool MakefileGenerator::findLibraries() | 179 | inline bool MakefileGenerator::findLibraries() |
167 | { return TRUE; } | 180 | { return TRUE; } |
168 | 181 | ||
182 | inline QString MakefileGenerator::findDependency(const QString &) | ||
183 | { return QString(""); } | ||
184 | |||
169 | inline MakefileGenerator::~MakefileGenerator() | 185 | inline MakefileGenerator::~MakefileGenerator() |
170 | { } | 186 | { } |
171 | 187 | ||
188 | QString mkdir_p_asstring(const QString &dir); | ||
172 | 189 | ||
173 | #endif /* __MAKEFILE_H__ */ | 190 | #endif /* __MAKEFILE_H__ */ |