MCPcopy Create free account
hub / github.com/Kitware/CMake / WriteLocalAllRules

Method WriteLocalAllRules

Source/cmLocalUnixMakefileGenerator3.cxx:1679–1888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1677}
1678
1679void 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());

Callers 1

WriteLocalMakefileMethod · 0.95

Calls 15

WriteDisclaimerMethod · 0.95
WriteMakeRuleMethod · 0.95
WriteDividerMethod · 0.95
AppendEchoMethod · 0.95
AppendCustomDependsMethod · 0.95
AppendCustomCommandsMethod · 0.95
ConvertToFullPathMethod · 0.95
GetRecursiveMakeCallMethod · 0.95
CreateCDCommandMethod · 0.95
moveFunction · 0.85

Tested by

no test coverage detected