~ubuntu-branches/ubuntu/jaunty/cmake/jaunty-security

« back to all changes in this revision

Viewing changes to Source/cmLocalUnixMakefileGenerator.h

  • Committer: Bazaar Package Importer
  • Author(s): A. Maitland Bottoms
  • Date: 2005-03-02 09:22:44 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050302092244-y6o9j8wr27vqcqvx
Tags: 2.0.5-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=========================================================================
 
2
 
 
3
  Program:   CMake - Cross-Platform Makefile Generator
 
4
  Module:    $RCSfile: cmLocalUnixMakefileGenerator.h,v $
 
5
  Language:  C++
 
6
  Date:      $Date: 2004/04/28 14:15:40 $
 
7
  Version:   $Revision: 1.26 $
 
8
 
 
9
  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
 
10
  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
 
11
 
 
12
     This software is distributed WITHOUT ANY WARRANTY; without even 
 
13
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 
14
     PURPOSE.  See the above copyright notices for more information.
 
15
 
 
16
=========================================================================*/
 
17
#ifndef cmLocalUnixMakefileGenerator_h
 
18
#define cmLocalUnixMakefileGenerator_h
 
19
 
 
20
#include "cmLocalGenerator.h"
 
21
 
 
22
class cmDependInformation;
 
23
class cmMakeDepend;
 
24
class cmTarget;
 
25
class cmSourceFile;
 
26
 
 
27
/** \class cmLocalUnixMakefileGenerator
 
28
 * \brief Write a LocalUnix makefiles.
 
29
 *
 
30
 * cmLocalUnixMakefileGenerator produces a LocalUnix makefile from its
 
31
 * member m_Makefile.
 
32
 */
 
33
class cmLocalUnixMakefileGenerator : public cmLocalGenerator
 
34
{
 
35
public:
 
36
  ///! Set cache only and recurse to false by default.
 
37
  cmLocalUnixMakefileGenerator();
 
38
 
 
39
  virtual ~cmLocalUnixMakefileGenerator();
 
40
  
 
41
  /**
 
42
   * Generate the makefile for this directory. fromTheTop indicates if this
 
43
   * is being invoked as part of a global Generate or specific to this
 
44
   * directory. The difference is that when done from the Top we might skip
 
45
   * some steps to save time, such as dependency generation for the
 
46
   * makefiles. This is done by a direct invocation from make. 
 
47
   */
 
48
  virtual void Generate(bool fromTheTop);
 
49
 
 
50
  /**
 
51
   * Output the depend information for all the classes 
 
52
   * in the makefile.  These would have been generated
 
53
   * by the class cmMakeDepend.
 
54
   */
 
55
  virtual bool OutputObjectDepends(std::ostream&);
 
56
 
 
57
  /**
 
58
   * Output the check depend information for all the classes 
 
59
   * in the makefile.  These would have been generated
 
60
   * by the class cmMakeDepend.
 
61
   */
 
62
  virtual void OutputCheckDepends(std::ostream&);
 
63
 
 
64
  /**
 
65
   * Set to true if the shell being used is the windows shell.
 
66
   * This controls if statements in the makefile and the SHELL variable.
 
67
   * The default is false.
 
68
   */
 
69
  void SetWindowsShell(bool v)  {m_WindowsShell = v;}
 
70
 
 
71
  ///! Set the string used to include one makefile into another default is include.
 
72
  void SetIncludeDirective(const char* s) { m_IncludeDirective = s; }
 
73
 
 
74
  ///! Set the flag used to keep the make program silent.
 
75
  void SetMakeSilentFlag(const char* s) { m_MakeSilentFlag = s; }
 
76
 
 
77
  ///! Set max makefile variable size, default is 0 which means unlimited.
 
78
  void SetMakefileVariableSize(int s) { m_MakefileVariableSize = s; }
 
79
 
 
80
  ///! If ignore lib prefix is true, then do not strip lib from the name of a library.
 
81
  void SetIgnoreLibPrefix(bool s) { m_IgnoreLibPrefix = s; }
 
82
 
 
83
  /**
 
84
   * If true, then explicitly pass MAKEFLAGS on the make all target for makes
 
85
   * that do not use environment variables.
 
86
   *
 
87
   */
 
88
  void SetPassMakeflags(bool s){m_PassMakeflags = s;}
 
89
  
 
90
protected:
 
91
  void AddDependenciesToSourceFile(cmDependInformation const*info,
 
92
                                   cmSourceFile *i,
 
93
                                   std::set<cmDependInformation const*> *visited);
 
94
  virtual void ProcessDepends(const cmMakeDepend &md);
 
95
  virtual void OutputMakefile(const char* file, bool withDepends);
 
96
  virtual void OutputTargetRules(std::ostream& fout);
 
97
  virtual void OutputLinkLibraries(std::ostream&, const char* name, const cmTarget &);
 
98
  void OutputLibraryRule(std::ostream& fout,  
 
99
                         const char* name, 
 
100
                         const cmTarget &t,
 
101
                         const char* createRule,
 
102
                         const char* comment,
 
103
                         const char* linkFlags
 
104
    );
 
105
  void ExpandRuleVariables(std::string& string,
 
106
                           const char* objects=0,
 
107
                           const char* target=0,
 
108
                           const char* linkLibs=0,
 
109
                           const char* source=0,
 
110
                           const char* object =0,
 
111
                           const char* flags = 0,
 
112
                           const char* objectsquoted = 0,
 
113
                           const char* targetBase = 0,
 
114
                           const char* targetSOName = 0,
 
115
                           const char* linkFlags = 0);
 
116
  virtual void OutputSharedLibraryRule(std::ostream&, const char* name,
 
117
                                       const cmTarget &);
 
118
  virtual void OutputModuleLibraryRule(std::ostream&, const char* name, 
 
119
                                       const cmTarget &);
 
120
  virtual void OutputStaticLibraryRule(std::ostream&, const char* name,
 
121
                                       const cmTarget &);
 
122
  virtual void OutputExecutableRule(std::ostream&, const char* name,
 
123
                                    const cmTarget &);
 
124
  virtual void OutputUtilityRule(std::ostream&, const char* name,
 
125
                                 const cmTarget &);
 
126
  
 
127
  virtual void OutputTargets(std::ostream&);
 
128
  virtual void OutputSubDirectoryRules(std::ostream&);
 
129
  virtual void OutputDependLibs(std::ostream&);
 
130
  virtual void OutputLibDepend(std::ostream&, const char*);
 
131
  virtual void OutputExeDepend(std::ostream&, const char*);
 
132
  virtual void OutputCustomRules(std::ostream&);
 
133
  virtual void OutputMakeVariables(std::ostream&);
 
134
  virtual void OutputMakeRules(std::ostream&);
 
135
  virtual void OutputSourceObjectBuildRules(std::ostream& fout);
 
136
  virtual void OutputBuildObjectFromSource(std::ostream& fout,
 
137
                                           const char* shortName,
 
138
                                           const cmSourceFile& source,
 
139
                                           const char* extraCompileFlags,
 
140
                                           bool sharedTarget);
 
141
  
 
142
  virtual void BuildInSubDirectory(std::ostream& fout,
 
143
                                   const char* directory,
 
144
                                   const char* target1,
 
145
                                   const char* target2,
 
146
                                   bool silent = false);
 
147
 
 
148
  virtual void BuildInSubDirectoryWindows(std::ostream& fout,
 
149
                                          const char* directory,
 
150
                                          const char* target1,
 
151
                                          const char* target2,
 
152
                                          bool silent = false);
 
153
  ///! order == 0, then all subdirs are output, 1 = post order, 2 = preorder
 
154
  virtual void OutputSubDirectoryVars(std::ostream& fout,
 
155
                                      const char* var,
 
156
                                      const char* target,
 
157
                                      const char* target1,
 
158
                                      const char* target2,
 
159
                                      const char* depend,
 
160
                                      const std::vector<std::pair<cmStdString, bool> >&
 
161
                                      SubDirectories,
 
162
                                      bool silent = false, int order = 0);
 
163
 
 
164
  virtual void OutputMakeRule(std::ostream&, 
 
165
                              const char* comment,
 
166
                              const char* target,
 
167
                              const char* depends, 
 
168
                              const std::vector<std::string>& commands);
 
169
 
 
170
  virtual void OutputMakeRule(std::ostream&, 
 
171
                              const char* comment,
 
172
                              const char* target,
 
173
                              const std::vector<std::string>& depends,
 
174
                              const char* command);
 
175
 
 
176
  virtual void OutputMakeRule(std::ostream&, 
 
177
                              const char* comment,
 
178
                              const char* target,
 
179
                              const std::vector<std::string>& depends,
 
180
                              const std::vector<std::string>& commands);
 
181
 
 
182
  virtual void OutputMakeRule(std::ostream&, 
 
183
                              const char* comment,
 
184
                              const char* target,
 
185
                              const char* depends, 
 
186
                              const char* command,
 
187
                              const char* command2 = 0,
 
188
                              const char* command3 = 0,
 
189
                              const char* command4 = 0);
 
190
  virtual void OutputBuildTargetInDirWindows(std::ostream& fout,
 
191
                                      const char* path,
 
192
                                      const char* library,
 
193
                                      const char* fullpath);
 
194
  virtual void OutputBuildTargetInDir(std::ostream& fout,
 
195
                                      const char* path,
 
196
                                      const char* library,
 
197
                                      const char* fullpath);
 
198
 
 
199
  ///! return true if the two paths are the same
 
200
  virtual bool SamePath(const char* path1, const char* path2);
 
201
  virtual std::string GetOutputExtension(const char* sourceExtension);
 
202
  std::string CreatePreBuildRules(const cmTarget &target,
 
203
                                  const char* targetName);
 
204
  std::string CreatePreLinkRules(const cmTarget &target,
 
205
                                 const char* targetName);
 
206
  std::string CreatePostBuildRules(const cmTarget &target,
 
207
                                   const char* targetName);
 
208
  virtual std::string CreateMakeVariable(const char* s, const char* s2);
 
209
  
 
210
  ///! if the OS is case insensitive then return a lower case of the path.
 
211
  virtual std::string LowerCasePath(const char* path);
 
212
 
 
213
  ///! for existing files convert to output path and short path if spaces
 
214
  std::string ConvertToOutputForExisting(const char*);
 
215
 
 
216
  /** Convert path to a format vaild for the left or right side of a
 
217
      target: dependencies line in a makefile.  */
 
218
  virtual std::string ConvertToMakeTarget(const char*);
 
219
 
 
220
  /** Get the full name of the target's file, without path.  */
 
221
  std::string GetFullTargetName(const char* n, const cmTarget& t);
 
222
 
 
223
  /** Get the base name of the target's file, without path or extension.  */
 
224
  std::string GetBaseTargetName(const char* n, const cmTarget& t);
 
225
 
 
226
  /** Get the names associated with a library target.  */
 
227
  void GetLibraryNames(const char* n, const cmTarget& t,
 
228
                       std::string& name,
 
229
                       std::string& soName,
 
230
                       std::string& realName,
 
231
                       std::string& baseName);
 
232
 
 
233
  /** Output an echo command to the Makefile */
 
234
  void OutputEcho(std::ostream& fout, const char *msg);
 
235
  
 
236
  /**
 
237
   * Convert source file name to a safe object file name. Safe here means that
 
238
   * it will not clash with compilers or linkers.
 
239
   */
 
240
  std::string& CreateSafeUniqueObjectFileName(const char* sin);
 
241
 
 
242
  ///! final processing for a path to be put in a makefile
 
243
protected:
 
244
  int m_MakefileVariableSize;
 
245
  std::map<cmStdString, cmStdString> m_MakeVariableMap;
 
246
  std::map<cmStdString, cmStdString> m_ShortMakeVariableMap;
 
247
  std::map<cmStdString, cmStdString> m_UniqueObjectNamesMap;
 
248
  bool m_IgnoreLibPrefix;
 
249
  std::string m_IncludeDirective;
 
250
  std::string m_MakeSilentFlag;
 
251
  std::string m_ExecutableOutputPath;
 
252
  std::string m_LibraryOutputPath;
 
253
  bool m_WindowsShell;
 
254
  bool m_UseRelativePaths;
 
255
  bool m_PassMakeflags;
 
256
private:
 
257
};
 
258
 
 
259
#endif