summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.h
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2005-05-06 18:49:38 (GMT)
committerKen Martin <ken.martin@kitware.com>2005-05-06 18:49:38 (GMT)
commit0cb20474d81c1193e0e00ed04b83e5980f9d8dc5 (patch)
tree9d71ccaf93c06fc4f931576672d34b4da3f28db9 /Source/cmLocalUnixMakefileGenerator3.h
parentdc75c22645f16f3781513e51ae6488df058d69e4 (diff)
downloadCMake-0cb20474d81c1193e0e00ed04b83e5980f9d8dc5.zip
CMake-0cb20474d81c1193e0e00ed04b83e5980f9d8dc5.tar.gz
CMake-0cb20474d81c1193e0e00ed04b83e5980f9d8dc5.tar.bz2
ENH: updates
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.h')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h236
1 files changed, 135 insertions, 101 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 7596c1b..163323a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -35,16 +35,54 @@ class cmSourceFile;
class cmLocalUnixMakefileGenerator3 : public cmLocalGenerator
{
public:
- ///! Set cache only and recurse to false by default.
cmLocalUnixMakefileGenerator3();
-
virtual ~cmLocalUnixMakefileGenerator3();
- /** Set the command used when there are no dependencies or rules for
- a target. This is used to avoid errors on some make
- implementations. */
- void SetEmptyCommand(const char* cmd);
+ /**
+ * Generate the makefile for this directory.
+ */
+ virtual void Generate();
+
+ /** creates the common disclainer text at the top of each makefile */
+ void WriteDisclaimer(std::ostream& os);
+
+ // this returns the relative path between the HomeOutputDirectory and this
+ // local generators StartOutputDirectory
+ std::string GetHomeRelativeOutputPath();
+
+ // Write out a make rule
+ void WriteMakeRule(std::ostream& os,
+ const char* comment,
+ const char* target,
+ const std::vector<std::string>& depends,
+ const std::vector<std::string>& commands);
+
+ // write the main variables used by the makefiles
+ void WriteMakeVariables(std::ostream& makefileStream);
+
+ // write a comment line #====... in the stream
+ void WriteDivider(std::ostream& os);
+
+ /**
+ * If true, then explicitly pass MAKEFLAGS on the make all target for makes
+ * that do not use environment variables.
+ *
+ */
+ void SetPassMakeflags(bool s){m_PassMakeflags = s;}
+ bool GetPassMakeflags() { return m_PassMakeflags; }
+
+ /**
+ * Set the flag used to keep the make program silent.
+ */
+ void SetMakeSilentFlag(const char* s) { m_MakeSilentFlag = s; }
+ std::string &GetMakeSilentFlag() { return m_MakeSilentFlag; }
+
+
+
+
+
+
/** Set whether the echo command needs its argument quoted. */
void SetEchoNeedsQuote(bool b) { m_EchoNeedsQuote = b; }
@@ -63,11 +101,6 @@ public:
const char *GetIncludeDirective() { return m_IncludeDirective.c_str(); }
/**
- * Set the flag used to keep the make program silent.
- */
- void SetMakeSilentFlag(const char* s) { m_MakeSilentFlag = s; }
-
- /**
* Set max makefile variable size, default is 0 which means unlimited.
*/
void SetMakefileVariableSize(int s) { m_MakefileVariableSize = s; }
@@ -78,45 +111,29 @@ public:
*/
void SetIgnoreLibPrefix(bool s) { m_IgnoreLibPrefix = s; }
- /**
- * If true, then explicitly pass MAKEFLAGS on the make all target for makes
- * that do not use environment variables.
- *
- */
- void SetPassMakeflags(bool s){m_PassMakeflags = s;}
-
- /**
- * Generate the makefile for this directory.
- */
- virtual void Generate();
-
+
+
+
+
/** Called from command-line hook to scan dependencies. */
static bool ScanDependencies(std::vector<std::string> const& args);
/** Called from command-line hook to check dependencies. */
static void CheckDependencies(cmMakefile* mf);
+
+ /** write some extra rules suahc as make test etc */
+ void WriteSpecialTargetsTop(std::ostream& makefileStream);
- void WriteDisclaimer(std::ostream& os);
- void WriteMakeRule(std::ostream& os,
- const char* comment,
- const char* target,
- const std::vector<std::string>& depends,
- const std::vector<std::string>& commands);
- void WriteAllRules(std::ostream& makefileStream);
+
+
+
void WriteTargetIncludes(std::ostream& makefileStream,const char *file,
const char *rule);
- void WriteSpecialTargetsTop(std::ostream& makefileStream);
void WriteSpecialTargetsBottom(std::ostream& makefileStream);
- void WriteMakeVariables(std::ostream& makefileStream);
std::string ConvertToRelativeOutputPath(const char* p);
- void WriteConvenienceRules(std::ostream& ruleFileStream);
std::string GetRelativeTargetDirectory(const cmTarget& target);
void WriteLocalCleanRule(std::ostream& makefileStream);
- // this returns the relative path between the HomeOutputDirectory and this
- // local generators StartOutputDirectory
- std::string GetHomeRelativeOutputPath();
-
// List the files for which to check dependency integrity. Each
// language has its own list because integrity may be checked
// differently.
@@ -126,45 +143,69 @@ public:
protected:
- void GenerateMakefile();
- void GenerateCMakefile();
- void GenerateDirectoryInformationFile();
- void GenerateTargetRuleFile(const cmTarget& target);
- void GenerateObjectRuleFile(const cmTarget& target,
- const cmSourceFile& source,
- std::vector<std::string>& objects,
- std::vector<std::string>& provides_requires);
- void GenerateObjectDependFile(const std::string& obj,
- const cmSourceFile& source,
- std::vector<std::string>& objects,
- std::vector<std::string>& provides_requires,
- const std::string& depMarkFile,
- std::vector<std::string>& depends);
- void GenerateCustomRuleFile(const cmCustomCommand& cc);
- void GenerateUtilityRuleFile(const cmTarget& target);
+ // these two methods just compute reasonable values for m_LibraryOutputPath and
+ // m_ExecutableOutputPath
+ void ConfigureOutputPaths();
+ void FormatOutputPath(std::string& path, const char* name);
+
+ // this converts a file name that is relative to the StartOuputDirectory
+ // into a full path
+ std::string ConvertToFullPath(const std::string& localPath);
+
+ // this is responsible for writing all of the rules for all this
+ // directories custom commands (but not utility targets)
+ void WriteCustomCommands();
+
+ // this method Writes the Directory informaiton files
+ void WriteDirectoryInformationFile();
+
+ // cleanup the name of a potential target
+ std::string ConvertToMakeTarget(const char* tgt);
+
+ // used in writing out Cmake files such as WriteDirectoryInformation
+ void WriteCMakeArgument(std::ostream& os, const char* s);
+
+ // write out all the rules for this target
+ void WriteTargetRuleFiles(const cmTarget& target);
+ void WriteUtilityRuleFiles(const cmTarget& target);
+
+ // create the rule files for an object
+ void WriteObjectRuleFiles(const cmTarget& target,
+ const cmSourceFile& source,
+ std::vector<std::string>& objects,
+ std::vector<std::string>& provides_requires);
+
+ // write the build rule for an object
+ void WriteObjectBuildFile(std::string &obj,
+ const char *lang,
+ const cmTarget& target,
+ const cmSourceFile& source,
+ std::vector<std::string>& depends,
+ std::string &depMakeFile,
+ std::vector<std::string>& provides_requires);
+
+ // write the depend.make file for an object
+ void WriteObjectDependFile(std::string& obj,
+ const char *lang,
+ const cmSourceFile& source,
+ std::vector<std::string>& depends,
+ std::string& depMarkFile);
+
+ // this is used only by WriteObjectDependFile
bool GenerateDependsMakeFile(const std::string& lang,
const char* objFile,
std::string& depMakeFile,
std::string& depMarkFile);
- void WriteDivider(std::ostream& os);
- void WriteRuleFileIncludes(std::ostream& makefileStream);
- void WriteSubdirRules(std::ostream& makefileStream, const char* pass);
- void WriteSubdirRule(std::ostream& makefileStream, const char* pass,
- const char* subdir, std::string& last);
- void WriteSubdirDriverRule(std::ostream& makefileStream, const char* pass,
- const char* order, const std::string& last);
- void WriteLocalRule(std::ostream& ruleFileStream, const char* pass,
- const char* dependency);
- void WriteConvenienceRule(std::ostream& ruleFileStream,
- const char* realTarget,
- const char* helpTarget);
- void WriteCustomCommands();
- void WriteExecutableRule(std::ostream& ruleFileStream,
- const char* ruleFileName,
- const cmTarget& target,
- const std::vector<std::string>& objects,
- const std::vector<std::string>& external_objects,
- const std::vector<std::string>& provides_requires);
+
+ // return the appropriate depends checker
+ static cmDepends* GetDependsChecker(const std::string& lang,
+ const char* dir,
+ const char* objFile);
+
+
+ void GenerateCustomRuleFile(const cmCustomCommand& cc);
+
+ // these three make some simple changes and then call WriteLibraryRule
void WriteStaticLibraryRule(std::ostream& ruleFileStream,
const char* ruleFileName,
const cmTarget& target,
@@ -183,6 +224,16 @@ protected:
const std::vector<std::string>& objects,
const std::vector<std::string>& external_objects,
const std::vector<std::string>& provides_requires);
+
+ // the main code for writing the Executable target rules
+ void WriteExecutableRule(std::ostream& ruleFileStream,
+ const char* ruleFileName,
+ const cmTarget& target,
+ const std::vector<std::string>& objects,
+ const std::vector<std::string>& external_objects,
+ const std::vector<std::string>& provides_requires);
+
+ // the main method for writing library rules
void WriteLibraryRule(std::ostream& ruleFileStream,
const char* ruleFileName,
const cmTarget& target,
@@ -191,6 +242,17 @@ protected:
const char* linkRuleVar,
const char* extraLinkFlags,
const std::vector<std::string>& provides_requires);
+
+
+
+
+
+
+ void WriteLocalRule(std::ostream& ruleFileStream, const char* pass,
+ const char* dependency);
+ void WriteConvenienceRule(std::ostream& ruleFileStream,
+ const char* realTarget,
+ const char* helpTarget);
void WriteObjectsVariable(std::ostream& ruleFileStream,
const cmTarget& target,
const std::vector<std::string>& objects,
@@ -205,19 +267,13 @@ protected:
const std::vector<std::string>& files,
const std::vector<std::string>& objects,
const std::vector<std::string>& external_objects);
- void WriteTargetRequiresRule(std::ostream& ruleFileStream,
- const cmTarget& target,
- const std::vector<std::string>& provides_requires);
- void WriteCMakeArgument(std::ostream& os, const char* s);
+
std::string GetTargetDirectory(const cmTarget& target);
std::string GetSubdirTargetName(const char* pass, const char* subdir);
std::string GetObjectFileName(const cmTarget& target,
const cmSourceFile& source);
const char* GetSourceFileLanguage(const cmSourceFile& source);
- std::string ConvertToFullPath(const std::string& localPath);
std::string ConvertToQuotedOutputPath(const char* p);
- void ConfigureOutputPaths();
- void FormatOutputPath(std::string& path, const char* name);
void AppendTargetDepends(std::vector<std::string>& depends,
const cmTarget& target);
@@ -240,33 +296,14 @@ protected:
//==========================================================================
bool SamePath(const char* path1, const char* path2);
- std::string ConvertToMakeTarget(const char* tgt);
std::string& CreateSafeUniqueObjectFileName(const char* sin);
std::string CreateMakeVariable(const char* sin, const char* s2in);
//==========================================================================
- std::string GetRecursiveMakeCall(const char *makefile, const char* tgt);
- void WriteJumpAndBuildRules(std::ostream& makefileStream);
-
- static cmDepends* GetDependsChecker(const std::string& lang,
- const char* dir,
- const char* objFile);
private:
- // Map from target name to build directory containing it for
- // jump-and-build targets.
- struct RemoteTarget
- {
- std::string m_BuildDirectory;
- std::string m_FilePath;
- };
- std::map<cmStdString, RemoteTarget> m_JumpAndBuild;
-
std::map<cmStdString, IntegrityCheckSet> m_CheckDependFiles;
- // Command used when a rule has no dependencies or commands.
- std::vector<std::string> m_EmptyCommands;
-
//==========================================================================
// Configuration settings.
int m_MakefileVariableSize;
@@ -283,9 +320,6 @@ private:
// Flag for whether echo command needs quotes.
bool m_EchoNeedsQuote;
- // List of make rule files that need to be included by the makefile.
- std::vector<std::string> m_IncludeRuleFiles;
-
// Set of custom rule files that have been generated.
std::set<cmStdString> m_CustomRuleFiles;