FIX: stupid pb fixed (close to being medieval'ed by The Ken)
[cmake.git] / Source / cmUnixMakefileGenerator.h
blobffefc8831ffe462740d606bd99731ef432bbd4cb
1 /*=========================================================================
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: cmUnixMakefileGenerator.h,v $
5 Language: C++
6 Date: $Date: 2002-07-31 17:45:07 $
7 Version: $Revision: 1.48 $
9 Copyright (c) 2002 Insight Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
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.
16 =========================================================================*/
17 #ifndef cmUnixMakefileGenerator_h
18 #define cmUnixMakefileGenerator_h
20 #include "cmMakefile.h"
21 #include "cmMakefileGenerator.h"
23 /** \class cmUnixMakefileGenerator
24 * \brief Write a Unix makefiles.
26 * cmUnixMakefileGenerator produces a Unix makefile from its
27 * member m_Makefile.
29 class cmUnixMakefileGenerator : public cmMakefileGenerator
31 public:
32 ///! Set cache only and recurse to false by default.
33 cmUnixMakefileGenerator();
35 virtual ~cmUnixMakefileGenerator();
37 ///! Get the name for the generator.
38 virtual const char* GetName() {return "Unix Makefiles";}
40 ///! virtual copy constructor
41 virtual cmMakefileGenerator* CreateObject()
42 { return new cmUnixMakefileGenerator;}
44 //! just sets the Cache Only and Recurse flags
45 virtual void SetLocal(bool local);
47 /**
48 * If cache only is on.
49 * and only stub makefiles are generated, and no depends, for speed.
50 * The default is OFF.
51 **/
52 void SetCacheOnlyOn() {m_CacheOnly = true;}
53 void SetCacheOnlyOff() {m_CacheOnly = false;}
54 /**
55 * If recurse is on, then all the makefiles below this one are parsed as well.
57 void SetRecurseOn() {m_Recurse = true;}
58 void SetRecurseOff() {m_Recurse = false;}
60 /**
61 * Produce the makefile (in this case a Unix makefile).
63 virtual void GenerateMakefile();
65 /**
66 * Output the depend information for all the classes
67 * in the makefile. These would have been generated
68 * by the class cmMakeDepend.
70 virtual bool OutputObjectDepends(std::ostream&);
72 /**
73 * Output the check depend information for all the classes
74 * in the makefile. These would have been generated
75 * by the class cmMakeDepend.
77 virtual void OutputCheckDepends(std::ostream&);
79 /**
80 * Try to determine system infomation such as shared library
81 * extension, pthreads, byte order etc.
83 virtual void EnableLanguage(const char*);
85 protected:
86 virtual void RecursiveGenerateCacheOnly();
87 virtual void ProcessDepends(const cmMakeDepend &md);
88 virtual void GenerateCacheOnly();
89 virtual void OutputMakefile(const char* file);
90 virtual void OutputTargetRules(std::ostream& fout);
91 virtual void OutputLinkLibraries(std::ostream&, const char* name, const cmTarget &);
93 virtual void OutputSharedLibraryRule(std::ostream&, const char* name,
94 const cmTarget &);
95 virtual void OutputModuleLibraryRule(std::ostream&, const char* name,
96 const cmTarget &);
97 virtual void OutputStaticLibraryRule(std::ostream&, const char* name,
98 const cmTarget &);
99 virtual void OutputExecutableRule(std::ostream&, const char* name,
100 const cmTarget &);
101 virtual void OutputUtilityRule(std::ostream&, const char* name,
102 const cmTarget &);
104 virtual void OutputTargets(std::ostream&);
105 virtual void OutputSubDirectoryRules(std::ostream&);
106 virtual void OutputDependLibs(std::ostream&);
107 virtual void OutputLibDepend(std::ostream&, const char*);
108 virtual void OutputExeDepend(std::ostream&, const char*);
109 virtual void OutputCustomRules(std::ostream&);
110 virtual void OutputMakeVariables(std::ostream&);
111 virtual void OutputMakeRules(std::ostream&);
112 virtual void OutputInstallRules(std::ostream&);
113 virtual void OutputSourceObjectBuildRules(std::ostream& fout);
114 virtual void OutputBuildObjectFromSource(std::ostream& fout,
115 const char* shortName,
116 const cmSourceFile& source,
117 const char* extraCompileFlags,
118 bool sharedTarget);
120 virtual void BuildInSubDirectory(std::ostream& fout,
121 const char* directory,
122 const char* target1,
123 const char* target2,
124 bool silent = false);
126 virtual void OutputSubDirectoryVars(std::ostream& fout,
127 const char* var,
128 const char* target,
129 const char* target1,
130 const char* target2,
131 const char* depend,
132 const std::vector<std::string>&
133 SubDirectories,
134 bool silent = false);
136 virtual void OutputMakeRule(std::ostream&,
137 const char* comment,
138 const char* target,
139 const char* depends,
140 const char* command,
141 const char* command2 = 0,
142 const char* command3 = 0,
143 const char* command4 = 0);
144 virtual void OutputBuildTargetInDir(std::ostream& fout,
145 const char* path,
146 const char* library,
147 const char* fullpath,
148 const char* outputPath);
149 ///! return true if the two paths are the same
150 virtual bool SamePath(const char* path1, const char* path2);
151 virtual std::string GetOutputExtension(const char* sourceExtension);
152 virtual void OutputIncludeMakefile(std::ostream&, const char* file);
153 void SetObjectFileExtension(const char* e) { m_ObjectFileExtension = e;}
154 void SetExecutableExtension(const char* e) { m_ExecutableExtension = e;}
155 void SetStaticLibraryExtension(const char* e) {m_StaticLibraryExtension = e;}
156 void SetSharedLibraryExtension(const char* e) {m_SharedLibraryExtension = e;}
157 void SetLibraryPrefix(const char* e) { m_LibraryPrefix = e;}
158 // convert a path to an output path for unix this will call
159 // ConvertToUnixOutputPath
160 virtual std::string ConvertToOutputPath(const char* s)
161 { return cmSystemTools::ConvertToOutputPath(s); }
162 std::string CreateTargetRules(const cmTarget &target,
163 const char* targetName);
164 virtual std::string CreateMakeVariable(const char* s, const char* s2)
166 return std::string(s) + std::string(s2);
169 ///! if the OS is case insensitive then return a lower case of the path.
170 virtual std::string LowerCasePath(const char* path)
172 return std::string(path);
176 protected:
177 std::string m_ExecutableOutputPath;
178 std::string m_LibraryOutputPath;
179 std::string m_SharedLibraryExtension;
180 std::string m_ObjectFileExtension;
181 std::string m_ExecutableExtension;
182 std::string m_StaticLibraryExtension;
183 std::string m_LibraryPrefix;
184 private:
185 bool m_CacheOnly;
186 bool m_Recurse;
189 #endif