cmGlobalBorlandMakefileGenerator.cxx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file LICENSE.rst or https://cmake.org/licensing for details. */
  3. #include "cmGlobalBorlandMakefileGenerator.h"
  4. #include <ostream>
  5. #include <utility>
  6. #include <cm/memory>
  7. #include "cmDocumentationEntry.h"
  8. #include "cmGlobalGenerator.h"
  9. #include "cmLocalGenerator.h"
  10. #include "cmLocalUnixMakefileGenerator3.h"
  11. #include "cmMakefile.h"
  12. #include "cmState.h"
  13. #include "cmake.h"
  14. cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator(cmake* cm)
  15. : cmGlobalUnixMakefileGenerator3(cm)
  16. {
  17. this->EmptyRuleHackDepends = "NUL";
  18. this->FindMakeProgramFile = "CMakeBorlandFindMake.cmake";
  19. this->ForceUnixPaths = false;
  20. this->ToolSupportsColor = true;
  21. this->UseLinkScript = false;
  22. cm->GetState()->SetWindowsShell(true);
  23. cm->GetState()->SetBorlandMake(true);
  24. this->IncludeDirective = "!include";
  25. this->DefineWindowsNULL = true;
  26. this->PassMakeflags = true;
  27. this->UnixCD = false;
  28. /*
  29. * Borland Make does not support long line depend rule, as we have tested
  30. * generate one source file includes 40000 header files, and generate
  31. * depend.make in one line(use line continued tag), and error occurred:
  32. * ** Fatal CMakeFiles\main.dir\depend.make 1224: Rule line too long **
  33. * we disable long line dependencies rule generation for Borland make
  34. */
  35. this->ToolSupportsLongLineDependencies = false;
  36. }
  37. void cmGlobalBorlandMakefileGenerator::EnableLanguage(
  38. std::vector<std::string> const& l, cmMakefile* mf, bool optional)
  39. {
  40. std::string outdir = this->CMakeInstance->GetHomeOutputDirectory();
  41. mf->AddDefinition("BORLAND", "1");
  42. mf->AddDefinition("CMAKE_GENERATOR_CC", "bcc32");
  43. mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32");
  44. this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
  45. }
  46. //! Create a local generator appropriate to this Global Generator
  47. std::unique_ptr<cmLocalGenerator>
  48. cmGlobalBorlandMakefileGenerator::CreateLocalGenerator(cmMakefile* mf)
  49. {
  50. auto lg = cm::make_unique<cmLocalUnixMakefileGenerator3>(this, mf);
  51. lg->SetMakefileVariableSize(32);
  52. lg->SetMakeCommandEscapeTargetTwice(true);
  53. lg->SetBorlandMakeCurlyHack(true);
  54. return std::unique_ptr<cmLocalGenerator>(std::move(lg));
  55. }
  56. cmDocumentationEntry cmGlobalBorlandMakefileGenerator::GetDocumentation()
  57. {
  58. return { cmGlobalBorlandMakefileGenerator::GetActualName(),
  59. "Generates Borland makefiles." };
  60. }
  61. std::vector<cmGlobalGenerator::GeneratedMakeCommand>
  62. cmGlobalBorlandMakefileGenerator::GenerateBuildCommand(
  63. std::string const& makeProgram, std::string const& projectName,
  64. std::string const& projectDir, std::vector<std::string> const& targetNames,
  65. std::string const& config, int /*jobs*/, bool verbose,
  66. cmBuildOptions buildOptions, std::vector<std::string> const& makeOptions)
  67. {
  68. return this->cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
  69. makeProgram, projectName, projectDir, targetNames, config,
  70. cmake::NO_BUILD_PARALLEL_LEVEL, verbose, buildOptions, makeOptions);
  71. }
  72. std::string cmGlobalBorlandMakefileGenerator::GetShortBinaryOutputDir() const
  73. {
  74. return "_o";
  75. }
  76. void cmGlobalBorlandMakefileGenerator::PrintBuildCommandAdvice(
  77. std::ostream& os, int jobs) const
  78. {
  79. if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
  80. // Borland's make does not support parallel builds
  81. // see http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Make
  82. /* clang-format off */
  83. os <<
  84. "Warning: Borland's make does not support parallel builds. "
  85. "Ignoring parallel build command line option.\n";
  86. /* clang-format on */
  87. }
  88. this->cmGlobalUnixMakefileGenerator3::PrintBuildCommandAdvice(
  89. os, cmake::NO_BUILD_PARALLEL_LEVEL);
  90. }