| 368 | } |
| 369 | |
| 370 | void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( |
| 371 | std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3& rootLG, |
| 372 | DirectoryTarget const& dt, char const* pass, bool check_all, |
| 373 | bool check_relink, std::vector<std::string> const& commands) |
| 374 | { |
| 375 | auto* lg = static_cast<cmLocalUnixMakefileGenerator3*>(dt.LG); |
| 376 | std::string makeTarget = |
| 377 | cmStrCat(lg->GetCurrentBinaryDirectory(), '/', pass); |
| 378 | |
| 379 | // The directory-level rule should depend on the target-level rules |
| 380 | // for all targets in the directory. |
| 381 | std::vector<std::string> depends; |
| 382 | for (DirectoryTarget::Target const& t : dt.Targets) { |
| 383 | // Add this to the list of depends rules in this directory. |
| 384 | if ((!check_all || t.ExcludedFromAllInConfigs.empty()) && |
| 385 | (!check_relink || |
| 386 | t.GT->NeedRelinkBeforeInstall(lg->GetConfigName()))) { |
| 387 | // The target may be from a different directory; use its local gen. |
| 388 | auto const* tlg = static_cast<cmLocalUnixMakefileGenerator3 const*>( |
| 389 | t.GT->GetLocalGenerator()); |
| 390 | std::string tname = |
| 391 | cmStrCat(tlg->GetRelativeTargetDirectory(t.GT), '/', pass); |
| 392 | depends.push_back(std::move(tname)); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | // The directory-level rule should depend on the directory-level |
| 397 | // rules of the subdirectories. |
| 398 | for (DirectoryTarget::Dir const& d : dt.Children) { |
| 399 | if (check_all && d.ExcludeFromAll) { |
| 400 | continue; |
| 401 | } |
| 402 | std::string subdir = cmStrCat(d.Path, '/', pass); |
| 403 | depends.push_back(std::move(subdir)); |
| 404 | } |
| 405 | |
| 406 | // Work-around for makes that drop rules that have no dependencies |
| 407 | // or commands. |
| 408 | if (depends.empty() && !this->EmptyRuleHackDepends.empty()) { |
| 409 | depends.push_back(this->EmptyRuleHackDepends); |
| 410 | } |
| 411 | |
| 412 | // Write the rule. |
| 413 | std::string doc; |
| 414 | if (lg->IsRootMakefile()) { |
| 415 | doc = cmStrCat("The main recursive \"", pass, "\" target."); |
| 416 | } else { |
| 417 | doc = cmStrCat("Recursive \"", pass, "\" directory target."); |
| 418 | } |
| 419 | |
| 420 | rootLG.WriteMakeRule(ruleFileStream, doc.c_str(), makeTarget, depends, |
| 421 | commands, true); |
| 422 | } |
| 423 | |
| 424 | void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2( |
| 425 | std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3& rootLG, |
no test coverage detected