cmLocalUnixMakefileGenerator.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmLocalUnixMakefileGenerator_h
  14. #define cmLocalUnixMakefileGenerator_h
  15. #include "cmLocalGenerator.h"
  16. class cmMakeDepend;
  17. class cmTarget;
  18. class cmSourceFile;
  19. /** \class cmLocalUnixMakefileGenerator
  20. * \brief Write a LocalUnix makefiles.
  21. *
  22. * cmLocalUnixMakefileGenerator produces a LocalUnix makefile from its
  23. * member m_Makefile.
  24. */
  25. class cmLocalUnixMakefileGenerator : public cmLocalGenerator
  26. {
  27. public:
  28. ///! Set cache only and recurse to false by default.
  29. cmLocalUnixMakefileGenerator();
  30. virtual ~cmLocalUnixMakefileGenerator();
  31. /**
  32. * Generate the makefile for this directory. fromTheTop indicates if this
  33. * is being invoked as part of a global Generate or specific to this
  34. * directory. The difference is that when done from the Top we might skip
  35. * some steps to save time, such as dependency generation for the
  36. * makefiles. This is done by a direct invocation from make.
  37. */
  38. virtual void Generate(bool fromTheTop);
  39. /**
  40. * Output the depend information for all the classes
  41. * in the makefile. These would have been generated
  42. * by the class cmMakeDepend.
  43. */
  44. virtual bool OutputObjectDepends(std::ostream&);
  45. /**
  46. * Output the check depend information for all the classes
  47. * in the makefile. These would have been generated
  48. * by the class cmMakeDepend.
  49. */
  50. virtual void OutputCheckDepends(std::ostream&);
  51. protected:
  52. virtual void ProcessDepends(const cmMakeDepend &md);
  53. virtual void OutputMakefile(const char* file, bool withDepends);
  54. virtual void OutputTargetRules(std::ostream& fout);
  55. virtual void OutputLinkLibraries(std::ostream&, const char* name, const cmTarget &);
  56. virtual void OutputSharedLibraryRule(std::ostream&, const char* name,
  57. const cmTarget &);
  58. virtual void OutputModuleLibraryRule(std::ostream&, const char* name,
  59. const cmTarget &);
  60. virtual void OutputStaticLibraryRule(std::ostream&, const char* name,
  61. const cmTarget &);
  62. virtual void OutputExecutableRule(std::ostream&, const char* name,
  63. const cmTarget &);
  64. virtual void OutputUtilityRule(std::ostream&, const char* name,
  65. const cmTarget &);
  66. virtual void OutputTargets(std::ostream&);
  67. virtual void OutputSubDirectoryRules(std::ostream&);
  68. virtual void OutputDependLibs(std::ostream&);
  69. virtual void OutputLibDepend(std::ostream&, const char*);
  70. virtual void OutputExeDepend(std::ostream&, const char*);
  71. virtual void OutputCustomRules(std::ostream&);
  72. virtual void OutputMakeVariables(std::ostream&);
  73. virtual void OutputMakeRules(std::ostream&);
  74. virtual void OutputInstallRules(std::ostream&);
  75. virtual void OutputSourceObjectBuildRules(std::ostream& fout);
  76. virtual void OutputBuildObjectFromSource(std::ostream& fout,
  77. const char* shortName,
  78. const cmSourceFile& source,
  79. const char* extraCompileFlags,
  80. bool sharedTarget);
  81. virtual void BuildInSubDirectory(std::ostream& fout,
  82. const char* directory,
  83. const char* target1,
  84. const char* target2,
  85. bool silent = false);
  86. virtual void OutputSubDirectoryVars(std::ostream& fout,
  87. const char* var,
  88. const char* target,
  89. const char* target1,
  90. const char* target2,
  91. const char* depend,
  92. const std::vector<std::string>&
  93. SubDirectories,
  94. bool silent = false);
  95. virtual void OutputMakeRule(std::ostream&,
  96. const char* comment,
  97. const char* target,
  98. const char* depends,
  99. const char* command,
  100. const char* command2 = 0,
  101. const char* command3 = 0,
  102. const char* command4 = 0);
  103. virtual void OutputBuildTargetInDir(std::ostream& fout,
  104. const char* path,
  105. const char* library,
  106. const char* fullpath,
  107. const char* outputPath);
  108. ///! return true if the two paths are the same
  109. virtual bool SamePath(const char* path1, const char* path2);
  110. virtual std::string GetOutputExtension(const char* sourceExtension);
  111. virtual void OutputIncludeMakefile(std::ostream&, const char* file);
  112. void SetObjectFileExtension(const char* e) { m_ObjectFileExtension = e;}
  113. void SetExecutableExtension(const char* e) { m_ExecutableExtension = e;}
  114. void SetStaticLibraryExtension(const char* e) {m_StaticLibraryExtension = e;}
  115. void SetSharedLibraryExtension(const char* e) {m_SharedLibraryExtension = e;}
  116. void SetLibraryPrefix(const char* e) { m_LibraryPrefix = e;}
  117. std::string CreateTargetRules(const cmTarget &target,
  118. const char* targetName);
  119. virtual std::string CreateMakeVariable(const char* s, const char* s2)
  120. {
  121. return std::string(s) + std::string(s2);
  122. }
  123. ///! if the OS is case insensitive then return a lower case of the path.
  124. virtual std::string LowerCasePath(const char* path)
  125. {
  126. return std::string(path);
  127. }
  128. protected:
  129. std::string m_ExecutableOutputPath;
  130. std::string m_LibraryOutputPath;
  131. std::string m_SharedLibraryExtension;
  132. std::string m_ObjectFileExtension;
  133. std::string m_ExecutableExtension;
  134. std::string m_StaticLibraryExtension;
  135. std::string m_LibraryPrefix;
  136. private:
  137. };
  138. #endif