123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #include "cmMakefileUtilityTargetGenerator.h"
- #include <ostream>
- #include <string>
- #include <utility>
- #include <vector>
- #include "cmGeneratedFileStream.h"
- #include "cmGeneratorTarget.h"
- #include "cmGlobalUnixMakefileGenerator3.h"
- #include "cmLocalUnixMakefileGenerator3.h"
- #include "cmMakefile.h"
- #include "cmOSXBundleGenerator.h"
- #include "cmSystemTools.h"
- cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator(
- cmGeneratorTarget* target)
- : cmMakefileTargetGenerator(target)
- {
- this->CustomCommandDriver = OnUtility;
- this->OSXBundleGenerator =
- new cmOSXBundleGenerator(target, this->ConfigName);
- this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
- }
- cmMakefileUtilityTargetGenerator::~cmMakefileUtilityTargetGenerator()
- {
- delete this->OSXBundleGenerator;
- }
- void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
- {
- this->CreateRuleFile();
- *this->BuildFileStream << "# Utility rule file for "
- << this->GeneratorTarget->GetName() << ".\n\n";
- if (!this->NoRuleMessages) {
- const char* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT")
- ? "$(CMAKE_BINARY_DIR)/"
- : "");
-
- *this->BuildFileStream
- << "# Include the progress variables for this target.\n"
- << this->GlobalGenerator->IncludeDirective << " " << root
- << cmSystemTools::ConvertToOutputPath(
- this->LocalGenerator->MaybeConvertToRelativePath(
- this->LocalGenerator->GetBinaryDirectory(),
- this->ProgressFileNameFull))
- << "\n\n";
- }
-
- this->WriteTargetBuildRules();
-
- std::vector<std::string> commands;
- std::vector<std::string> depends;
-
- this->LocalGenerator->AppendCustomDepends(
- depends, this->GeneratorTarget->GetPreBuildCommands());
- this->LocalGenerator->AppendCustomDepends(
- depends, this->GeneratorTarget->GetPostBuildCommands());
- this->LocalGenerator->AppendCustomCommands(
- commands, this->GeneratorTarget->GetPreBuildCommands(),
- this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
-
- this->DriveCustomCommands(depends);
- this->LocalGenerator->AppendCustomCommands(
- commands, this->GeneratorTarget->GetPostBuildCommands(),
- this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
-
- this->AppendTargetDepends(depends);
-
- this->LocalGenerator->AppendRuleDepend(depends,
- this->BuildFileNameFull.c_str());
-
-
- if (depends.empty() && commands.empty()) {
- std::string hack = this->GlobalGenerator->GetEmptyRuleHackDepends();
- if (!hack.empty()) {
- depends.push_back(std::move(hack));
- }
- }
-
- this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, nullptr,
- this->GeneratorTarget->GetName(),
- depends, commands, true);
-
- this->WriteTargetDriverRule(this->GeneratorTarget->GetName(), false);
-
- this->WriteTargetCleanRules();
-
-
- this->WriteTargetDependRules();
-
- this->CloseFileStreams();
- }
|