| 1677 | } |
| 1678 | |
| 1679 | void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( |
| 1680 | std::ostream& ruleFileStream) |
| 1681 | { |
| 1682 | this->WriteDisclaimer(ruleFileStream); |
| 1683 | |
| 1684 | // Write the main entry point target. This must be the VERY first |
| 1685 | // target so that make with no arguments will run it. |
| 1686 | { |
| 1687 | // Just depend on the all target to drive the build. |
| 1688 | std::vector<std::string> depends; |
| 1689 | std::vector<std::string> no_commands; |
| 1690 | depends.emplace_back("all"); |
| 1691 | |
| 1692 | // Write the rule. |
| 1693 | this->WriteMakeRule(ruleFileStream, |
| 1694 | "Default target executed when no arguments are " |
| 1695 | "given to make.", |
| 1696 | "default_target", depends, no_commands, true); |
| 1697 | |
| 1698 | // Help out users that try "gmake target1 target2 -j". |
| 1699 | cmGlobalUnixMakefileGenerator3* gg = |
| 1700 | static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); |
| 1701 | if (gg->AllowNotParallel()) { |
| 1702 | std::vector<std::string> no_depends; |
| 1703 | this->WriteMakeRule(ruleFileStream, |
| 1704 | "Allow only one \"make -f " |
| 1705 | "Makefile2\" at a time, but pass " |
| 1706 | "parallelism.", |
| 1707 | ".NOTPARALLEL", no_depends, no_commands, false); |
| 1708 | } |
| 1709 | } |
| 1710 | |
| 1711 | this->WriteSpecialTargetsTop(ruleFileStream); |
| 1712 | |
| 1713 | // Include the progress variables for the target. |
| 1714 | // Write all global targets |
| 1715 | this->WriteDivider(ruleFileStream); |
| 1716 | ruleFileStream << "# Targets provided globally by CMake.\n" |
| 1717 | "\n"; |
| 1718 | auto const& targets = this->GetGeneratorTargets(); |
| 1719 | for (auto const& gt : targets) { |
| 1720 | if (gt->GetType() == cmStateEnums::GLOBAL_TARGET) { |
| 1721 | std::string targetString = |
| 1722 | "Special rule for the target " + gt->GetName(); |
| 1723 | std::vector<std::string> commands; |
| 1724 | std::vector<std::string> depends; |
| 1725 | |
| 1726 | cmValue p = gt->GetProperty("EchoString"); |
| 1727 | char const* text = p ? p->c_str() : "Running external command ..."; |
| 1728 | depends.reserve(gt->GetUtilities().size()); |
| 1729 | for (BT<std::pair<std::string, bool>> const& u : gt->GetUtilities()) { |
| 1730 | depends.push_back(u.Value.first); |
| 1731 | } |
| 1732 | this->AppendEcho(commands, text, |
| 1733 | cmLocalUnixMakefileGenerator3::EchoGlobal); |
| 1734 | |
| 1735 | // Global targets store their rules in pre- and post-build commands. |
| 1736 | this->AppendCustomDepends(depends, gt->GetPreBuildCommands()); |
no test coverage detected