summaryrefslogtreecommitdiff
path: root/qmake/generators/makefile.h
Unidiff
Diffstat (limited to 'qmake/generators/makefile.h') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/makefile.h173
1 files changed, 173 insertions, 0 deletions
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
new file mode 100644
index 0000000..1d19d98
--- a/dev/null
+++ b/qmake/generators/makefile.h
@@ -0,0 +1,173 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of ________ class.
5**
6** Created : 970521
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the network module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition licenses may use this
22** file in accordance with the Qt Commercial License Agreement provided
23** with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37#ifndef __MAKEFILE_H__
38#define __MAKEFILE_H__
39
40#include "option.h"
41#include "project.h"
42#include <qtextstream.h>
43
44class MakefileGenerator
45{
46 QString spec;
47 bool init_opath_already, init_already, moc_aware, no_io;
48 QStringList createObjectList(const QString &var);
49 QString build_args();
50 QMap<QString, QString> depHeuristics, depKeyMap;
51 QMap<QString, QString> mocablesToMOC, mocablesFromMOC;
52 QMap<QString, QStringList> depends;
53
54protected:
55 void writeObj(QTextStream &, const QString &obj, const QString &src);
56 void writeUicSrc(QTextStream &, const QString &ui);
57 void writeMocObj(QTextStream &, const QString &obj, const QString &src);
58 void writeMocSrc(QTextStream &, const QString &src);
59 void writeLexSrc(QTextStream &, const QString &lex);
60 void writeYaccSrc(QTextStream &, const QString &yac);
61 void writeInstalls(QTextStream &t, const QString &installs);
62 void writeImageObj(QTextStream &t, const QString &obj);
63 void writeImageSrc(QTextStream &t, const QString &images);
64
65protected:
66
67 QMakeProject *project;
68
69 class MakefileDependDir {
70 public:
71 MakefileDependDir(QString r, QString l) : real_dir(r), local_dir(l) { }
72 QString real_dir, local_dir;
73 };
74 bool generateDependencies(QPtrList<MakefileDependDir> &dirs, QString x, bool recurse);
75
76 QString buildArgs();
77
78 QString specdir();
79 QString cleanFilePath(const QString &file) const;
80 bool generateMocList(QString fn);
81
82 QString findMocSource(const QString &moc_file) const;
83 QString findMocDestination(const QString &src_file) const;
84 QStringList &findDependencies(const QString &file);
85
86 void setNoIO(bool o);
87 bool noIO() const;
88
89 void setMocAware(bool o);
90 bool mocAware() const;
91 void logicWarn(const QString &, const QString &);
92
93 virtual bool doDepends() const { return Option::mkfile::do_deps; }
94 bool writeHeader(QTextStream &);
95 virtual bool writeMakefile(QTextStream &);
96 virtual bool writeMakeQmake(QTextStream &);
97 void initOutPaths();
98 virtual void init();
99
100 //for installs
101 virtual QString defaultInstall(const QString &);
102
103 //for prl
104 bool processPrlFile(QString &);
105 virtual void processPrlVariable(const QString &, const QStringList &);
106 virtual void processPrlFiles();
107 virtual void writePrlFile(QTextStream &);
108
109 //make sure libraries are found
110 virtual bool findLibraries();
111
112 QString var(const QString &var);
113 QString varGlue(const QString &var, const QString &before, const QString &glue, const QString &after);
114 QString varList(const QString &var);
115 QString val(const QStringList &varList);
116 QString valGlue(const QStringList &varList, const QString &before, const QString &glue, const QString &after);
117 QString valList(const QStringList &varList);
118
119
120 QString fileFixify(const QString& file, const QString &out_dir=QString::null,
121 const QString &in_dir=QString::null, bool force_fix=FALSE) const;
122 QStringList fileFixify(const QStringList& files, const QString &out_dir=QString::null,
123 const QString &in_dir=QString::null, bool force_fix=FALSE) const;
124public:
125 MakefileGenerator(QMakeProject *p);
126 virtual ~MakefileGenerator();
127
128 static MakefileGenerator *create(QMakeProject *);
129 bool write();
130 virtual bool openOutput(QFile &) const;
131};
132
133inline QString MakefileGenerator::findMocSource(const QString &moc_file) const
134{
135 QString tmp = cleanFilePath(moc_file);
136 if (mocablesFromMOC.contains(tmp))
137 return mocablesFromMOC[tmp];
138 else
139 return QString("");
140}
141
142inline QString MakefileGenerator::findMocDestination(const QString &src_file) const
143{
144 QString tmp = cleanFilePath(src_file);
145 if (mocablesToMOC.contains(tmp))
146 return mocablesToMOC[tmp];
147 else
148 return QString("");
149}
150
151inline void MakefileGenerator::setMocAware(bool o)
152{ moc_aware = o; }
153
154inline bool MakefileGenerator::mocAware() const
155{ return moc_aware; }
156
157inline void MakefileGenerator::setNoIO(bool o)
158{ no_io = o; }
159
160inline bool MakefileGenerator::noIO() const
161{ return no_io; }
162
163inline QString MakefileGenerator::defaultInstall(const QString &)
164{ return QString(""); }
165
166inline bool MakefileGenerator::findLibraries()
167{ return TRUE; }
168
169inline MakefileGenerator::~MakefileGenerator()
170{ }
171
172
173#endif /* __MAKEFILE_H__ */