cmUnixMakefileGenerator.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2001 Insight Consortium
  8. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. * Redistributions of source code must retain the above copyright notice,
  12. this list of conditions and the following disclaimer.
  13. * Redistributions in binary form must reproduce the above copyright notice,
  14. this list of conditions and the following disclaimer in the documentation
  15. and/or other materials provided with the distribution.
  16. * The name of the Insight Consortium, nor the names of any consortium members,
  17. nor of any contributors, may be used to endorse or promote products derived
  18. from this software without specific prior written permission.
  19. * Modified source versions must be plainly marked as such, and must not be
  20. misrepresented as being the original software.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
  22. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24. ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
  25. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  27. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  28. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  29. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. =========================================================================*/
  32. #ifndef cmUnixMakefileGenerator_h
  33. #define cmUnixMakefileGenerator_h
  34. #include "cmMakefile.h"
  35. #include "cmMakefileGenerator.h"
  36. /** \class cmUnixMakefileGenerator
  37. * \brief Write a Unix makefiles.
  38. *
  39. * cmUnixMakefileGenerator produces a Unix makefile from its
  40. * member m_Makefile.
  41. */
  42. class cmUnixMakefileGenerator : public cmMakefileGenerator
  43. {
  44. public:
  45. ///! Set cache only and recurse to false by default.
  46. cmUnixMakefileGenerator();
  47. //! just sets the Cache Only and Recurse flags
  48. virtual void SetLocal(bool local);
  49. /**
  50. * If cache only is on.
  51. * and only stub makefiles are generated, and no depends, for speed.
  52. * The default is OFF.
  53. **/
  54. void SetCacheOnlyOn() {m_CacheOnly = true;}
  55. void SetCacheOnlyOff() {m_CacheOnly = false;}
  56. /**
  57. * If recurse is on, then all the makefiles below this one are parsed as well.
  58. */
  59. void SetRecurseOn() {m_Recurse = true;}
  60. void SetRecurseOff() {m_Recurse = false;}
  61. /**
  62. * Produce the makefile (in this case a Unix makefile).
  63. */
  64. 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.
  69. */
  70. void OutputObjectDepends(std::ostream&);
  71. /**
  72. * Try to determine system infomation such as shared library
  73. * extension, pthreads, byte order etc.
  74. */
  75. virtual void ComputeSystemInfo();
  76. private:
  77. void RecursiveGenerateCacheOnly();
  78. void ProcessDepends(const cmMakeDepend &md);
  79. void GenerateCacheOnly();
  80. void OutputMakefile(const char* file);
  81. void OutputMakeFlags(std::ostream&);
  82. void OutputTargetRules(std::ostream& fout);
  83. void OutputLinkLibraries(std::ostream&, const char*, const cmTarget &);
  84. void OutputTargets(std::ostream&);
  85. void OutputSubDirectoryRules(std::ostream&);
  86. void OutputDependInformation(std::ostream&);
  87. void OutputDependencies(std::ostream&);
  88. void OutputCustomRules(std::ostream&);
  89. void OutputMakeVariables(std::ostream&);
  90. void OutputMakeRules(std::ostream&);
  91. void OutputInstallRules(std::ostream&);
  92. void OutputSubDirectoryVars(std::ostream& fout,
  93. const char* var,
  94. const char* target,
  95. const char* target1,
  96. const char* target2,
  97. const std::vector<std::string>& SubDirectories);
  98. void OutputMakeRule(std::ostream&,
  99. const char* comment,
  100. const char* target,
  101. const char* depends,
  102. const char* command);
  103. private:
  104. bool m_CacheOnly;
  105. bool m_Recurse;
  106. std::string m_ExecutableOutputPath;
  107. std::string m_LibraryOutputPath;
  108. };
  109. #endif