| 177 | } |
| 178 | |
| 179 | void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() |
| 180 | { |
| 181 | // Open the output file. This should not be copy-if-different |
| 182 | // because the check-build-system step compares the makefile time to |
| 183 | // see if the build system must be regenerated. |
| 184 | std::string makefileName = |
| 185 | cmStrCat(this->GetCMakeInstance()->GetHomeOutputDirectory(), |
| 186 | "/CMakeFiles/Makefile2"); |
| 187 | cmGeneratedFileStream makefileStream(makefileName, false, |
| 188 | this->GetMakefileEncoding()); |
| 189 | if (!makefileStream) { |
| 190 | return; |
| 191 | } |
| 192 | |
| 193 | // The global dependency graph is expressed via the root local generator. |
| 194 | auto& rootLG = cm::static_reference_cast<cmLocalUnixMakefileGenerator3>( |
| 195 | this->LocalGenerators[0]); |
| 196 | |
| 197 | // Write the do not edit header. |
| 198 | rootLG.WriteDisclaimer(makefileStream); |
| 199 | |
| 200 | // Write the main entry point target. This must be the VERY first |
| 201 | // target so that make with no arguments will run it. |
| 202 | // Just depend on the all target to drive the build. |
| 203 | std::vector<std::string> depends; |
| 204 | std::vector<std::string> no_commands; |
| 205 | depends.emplace_back("all"); |
| 206 | |
| 207 | // Write the rule. |
| 208 | rootLG.WriteMakeRule(makefileStream, |
| 209 | "Default target executed when no arguments are " |
| 210 | "given to make.", |
| 211 | "default_target", depends, no_commands, true); |
| 212 | |
| 213 | depends.clear(); |
| 214 | |
| 215 | // The all and preinstall rules might never have any dependencies |
| 216 | // added to them. |
| 217 | if (!this->EmptyRuleHackDepends.empty()) { |
| 218 | depends.push_back(this->EmptyRuleHackDepends); |
| 219 | } |
| 220 | |
| 221 | // Write out the "special" stuff |
| 222 | rootLG.WriteSpecialTargetsTop(makefileStream); |
| 223 | |
| 224 | // Write the directory level rules. |
| 225 | for (auto const& it : this->ComputeDirectoryTargets()) { |
| 226 | this->WriteDirectoryRules2(makefileStream, rootLG, it.second); |
| 227 | } |
| 228 | |
| 229 | // Write the target convenience rules |
| 230 | for (auto const& localGen : this->LocalGenerators) { |
| 231 | this->WriteConvenienceRules2( |
| 232 | makefileStream, rootLG, |
| 233 | cm::static_reference_cast<cmLocalUnixMakefileGenerator3>(localGen)); |
| 234 | } |
| 235 | |
| 236 | // Write special bottom targets |
no test coverage detected