Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmGlobalUnixMakefileGenerator3.h
blobd7698518f4f093b5033183438af2ba1d99b0974d
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator3
4 Module: $RCSfile: cmGlobalUnixMakefileGenerator3.h,v $
5 Language: C++
6 Date: $Date: 2009-02-09 21:45:18 $
7 Version: $Revision: 1.57 $
9 Copyright (c) 2005 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmGlobalUnixMakefileGenerator3_h
18 #define cmGlobalUnixMakefileGenerator3_h
20 #include "cmGlobalGenerator.h"
22 class cmGeneratedFileStream;
23 class cmLocalUnixMakefileGenerator3;
25 /** \class cmGlobalUnixMakefileGenerator3
26 * \brief Write a Unix makefiles.
28 * cmGlobalUnixMakefileGenerator3 manages UNIX build process for a tree
31 The basic approach of this generator is to produce Makefiles that will all
32 be run with the current working directory set to the Home Output
33 directory. The one exception to this is the subdirectory Makefiles which are
34 created as a convenience and just cd up to the Home Output directory and
35 invoke the main Makefiles.
37 The make process starts with Makefile. Makefile should only contain the
38 targets the user is likely to invoke directly from a make command line. No
39 internal targets should be in this file. Makefile2 contains the internal
40 targets that are required to make the process work.
42 Makefile2 in turn will recursively make targets in the correct order. Each
43 target has its own directory <target>.dir and its own makefile build.make in
44 that directory. Also in that directory is a couple makefiles per source file
45 used by the target. Typically these are named source.obj.build.make and
46 source.obj.build.depend.make. The source.obj.build.make contains the rules
47 for building, cleaning, and computing dependencies for the given source
48 file. The build.depend.make contains additional dependencies that were
49 computed during dependency scanning. An additional file called
50 source.obj.depend is used as a marker to indicate when dependencies must be
51 rescanned.
53 Rules for custom commands follow the same model as rules for source files.
57 class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator
59 public:
60 cmGlobalUnixMakefileGenerator3();
61 static cmGlobalGenerator* New() {
62 return new cmGlobalUnixMakefileGenerator3; }
64 ///! Get the name for the generator.
65 virtual const char* GetName() const {
66 return cmGlobalUnixMakefileGenerator3::GetActualName();}
67 static const char* GetActualName() {return "Unix Makefiles";}
69 /** Get the documentation entry for this generator. */
70 virtual void GetDocumentation(cmDocumentationEntry& entry) const;
72 ///! Create a local generator appropriate to this Global Generator3
73 virtual cmLocalGenerator *CreateLocalGenerator();
75 /**
76 * Try to determine system infomation such as shared library
77 * extension, pthreads, byte order etc.
79 virtual void EnableLanguage(std::vector<std::string>const& languages,
80 cmMakefile *, bool optional);
82 /**
83 * Generate the all required files for building this project/tree. This
84 * basically creates a series of LocalGenerators for each directory and
85 * requests that they Generate.
87 virtual void Generate();
90 void WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream,
91 std::vector<cmLocalGenerator *> &);
93 // write out the help rule listing the valid targets
94 void WriteHelpRule(std::ostream& ruleFileStream,
95 cmLocalUnixMakefileGenerator3 *);
97 // write the top lvel target rules
98 void WriteConvenienceRules(std::ostream& ruleFileStream,
99 std::set<cmStdString> &emitted);
101 /** Get the command to use for a target that has no rule. This is
102 used for multiple output dependencies and for cmake_force. */
103 std::string GetEmptyRuleHackCommand() { return this->EmptyRuleHackCommand; }
105 /** Get the fake dependency to use when a rule has no real commands
106 or dependencies. */
107 std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; }
109 // change the build command for speed
110 virtual std::string GenerateBuildCommand
111 (const char* makeProgram,
112 const char *projectName, const char* additionalOptions,
113 const char *targetName,
114 const char* config, bool ignoreErrors, bool fast);
116 // returns some progress informaiton
117 int GetTargetTotalNumberOfActions(cmTarget & target,
118 std::set<cmTarget *> &emitted);
119 unsigned long GetNumberOfProgressActionsInAll
120 (cmLocalUnixMakefileGenerator3 *lg);
123 * If true, the CMake variable CMAKE_VERBOSE_MAKEFILES doesn't have effect
124 * anymore. Set it to true when writing a generator where short output
125 * doesn't make sense, e.g. because the full output is parsed by an
126 * IDE/editor.
128 bool GetForceVerboseMakefiles() { return this->ForceVerboseMakefiles; }
129 void SetForceVerboseMakefiles(bool enable)
130 {this->ForceVerboseMakefiles=enable;}
132 protected:
133 void WriteMainMakefile2();
134 void WriteMainCMakefile();
136 void WriteConvenienceRules2(std::ostream& ruleFileStream,
137 cmLocalUnixMakefileGenerator3*);
139 void WriteDirectoryRule2(std::ostream& ruleFileStream,
140 cmLocalUnixMakefileGenerator3* lg,
141 const char* pass, bool check_all,
142 bool check_relink);
143 void WriteDirectoryRules2(std::ostream& ruleFileStream,
144 cmLocalUnixMakefileGenerator3* lg);
146 void AppendGlobalTargetDepends(std::vector<std::string>& depends,
147 cmTarget& target);
149 // does this generator need a requires step for any of its targets
150 bool NeedRequiresStep(cmTarget const&);
152 // Setup target names
153 virtual const char* GetAllTargetName() { return "all"; }
154 virtual const char* GetInstallTargetName() { return "install"; }
155 virtual const char* GetInstallLocalTargetName() { return "install/local"; }
156 virtual const char* GetInstallStripTargetName() { return "install/strip"; }
157 virtual const char* GetPreinstallTargetName() { return "preinstall"; }
158 virtual const char* GetTestTargetName() { return "test"; }
159 virtual const char* GetPackageTargetName() { return "package"; }
160 virtual const char* GetPackageSourceTargetName(){ return "package_source"; }
161 virtual const char* GetEditCacheTargetName() { return "edit_cache"; }
162 virtual const char* GetRebuildCacheTargetName() { return "rebuild_cache"; }
163 virtual const char* GetCleanTargetName() { return "clean"; }
165 virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { return true; }
167 // Some make programs (Borland) do not keep a rule if there are no
168 // dependencies or commands. This is a problem for creating rules
169 // that might not do anything but might have other dependencies
170 // added later. If non-empty this variable holds a fake dependency
171 // that can be added.
172 std::string EmptyRuleHackDepends;
174 // Some make programs (Watcom) do not like rules with no commands.
175 // If non-empty this variable holds a bogus command that may be put
176 // in the rule to satisfy the make program.
177 std::string EmptyRuleHackCommand;
179 bool ForceVerboseMakefiles;
182 #endif