| 409 | } |
| 410 | |
| 411 | void cmMakefileTargetGenerator::WriteCommonCodeRules() |
| 412 | { |
| 413 | char const* root = (this->Makefile->IsOn("CMAKE_MAKE_INCLUDE_FROM_ROOT") |
| 414 | ? "$(CMAKE_BINARY_DIR)/" |
| 415 | : ""); |
| 416 | |
| 417 | // Include the dependencies for the target. |
| 418 | std::string dependFileNameFull = |
| 419 | cmStrCat(this->TargetBuildDirectoryFull, "/depend.make"); |
| 420 | *this->BuildFileStream |
| 421 | << "# Include any dependencies generated for this target.\n" |
| 422 | << this->GlobalGenerator->IncludeDirective << " " << root |
| 423 | << cmSystemTools::ConvertToOutputPath( |
| 424 | this->LocalGenerator->MaybeRelativeToTopBinDir(dependFileNameFull)) |
| 425 | << "\n"; |
| 426 | |
| 427 | // Scan any custom commands to check if DEPFILE option is specified |
| 428 | bool ccGenerateDeps = false; |
| 429 | std::vector<cmSourceFile const*> customCommands; |
| 430 | this->GeneratorTarget->GetCustomCommands(customCommands, |
| 431 | this->GetConfigName()); |
| 432 | for (cmSourceFile const* sf : customCommands) { |
| 433 | if (!sf->GetCustomCommand()->GetDepfile().empty()) { |
| 434 | ccGenerateDeps = true; |
| 435 | break; |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | std::string depsUseCompiler = "CMAKE_DEPENDS_USE_COMPILER"; |
| 440 | bool compilerGenerateDeps = |
| 441 | this->GlobalGenerator->SupportsCompilerDependencies() && |
| 442 | (!this->Makefile->IsDefinitionSet(depsUseCompiler) || |
| 443 | this->Makefile->IsOn(depsUseCompiler)); |
| 444 | bool linkerGenerateDeps = |
| 445 | this->GeneratorTarget->HasLinkDependencyFile(this->GetConfigName()); |
| 446 | |
| 447 | if (compilerGenerateDeps || linkerGenerateDeps || ccGenerateDeps) { |
| 448 | std::string const compilerDependFile = |
| 449 | cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.make"); |
| 450 | *this->BuildFileStream << "# Include any dependencies generated by the " |
| 451 | "compiler for this target.\n" |
| 452 | << this->GlobalGenerator->IncludeDirective << " " |
| 453 | << root |
| 454 | << cmSystemTools::ConvertToOutputPath( |
| 455 | this->LocalGenerator->MaybeRelativeToTopBinDir( |
| 456 | compilerDependFile)) |
| 457 | << "\n\n"; |
| 458 | |
| 459 | // Write an empty dependency file. |
| 460 | cmGeneratedFileStream depFileStream( |
| 461 | compilerDependFile, false, this->GlobalGenerator->GetMakefileEncoding()); |
| 462 | depFileStream << "# Empty compiler generated dependencies file for " |
| 463 | << this->GeneratorTarget->GetName() << ".\n" |
| 464 | << "# This may be replaced when dependencies are built.\n"; |
| 465 | // remove internal dependency file |
| 466 | cmSystemTools::RemoveFile( |
| 467 | cmStrCat(this->TargetBuildDirectoryFull, "/compiler_depend.internal")); |
| 468 |
no test coverage detected