ENH: add make silent flag for nmake and move .SILENT: directive to top of makefile

This commit is contained in:
Bill Hoffman 2001-12-20 15:46:37 -05:00
parent 9c0eb4eeb8
commit 9402460977
2 changed files with 10 additions and 9 deletions

View File

@ -145,6 +145,7 @@ void cmNMakeMakefileGenerator::OutputMakeVariables(std::ostream& fout)
"# general variables used in the makefile\n" "# general variables used in the makefile\n"
"\n" "\n"
"# Path to cmake\n" "# Path to cmake\n"
"MAKESILENT = /nologo\n"
"CMAKE_STANDARD_WINDOWS_LIBRARIES = @CMAKE_STANDARD_WINDOWS_LIBRARIES@\n" "CMAKE_STANDARD_WINDOWS_LIBRARIES = @CMAKE_STANDARD_WINDOWS_LIBRARIES@\n"
"CMAKE_C_FLAGS = @CMAKE_C_FLAGS@ @BUILD_FLAGS@\n" "CMAKE_C_FLAGS = @CMAKE_C_FLAGS@ @BUILD_FLAGS@\n"
"CMAKE_C_LINK_EXECUTABLE_FLAG = @CMAKE_C_LINK_EXECUTABLE_FLAG@\n" "CMAKE_C_LINK_EXECUTABLE_FLAG = @CMAKE_C_LINK_EXECUTABLE_FLAG@\n"
@ -242,15 +243,15 @@ void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
dir = cmSystemTools::EscapeSpaces(dir.c_str()); dir = cmSystemTools::EscapeSpaces(dir.c_str());
fout << "\tif not exist " << dir fout << "\tif not exist " << dir
<< " " << " "
<< "$(MAKE) rebuild_cache\n" << "$(MAKE) $(MAKESILENT) rebuild_cache\n"
<< "\techo Building " << target1 << " in directory " << directory << "\n" << "\techo Building " << target1 << " in directory " << directory << "\n"
<< "\tcd " << dir << "\n" << "\tcd " << dir << "\n"
<< "\t$(MAKE) -$(MAKEFLAGS) " << target1 << "\n"; << "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) " << target1 << "\n";
} }
if(target2) if(target2)
{ {
fout << "\techo Building " << target2 << " in directory " << directory << "\n"; fout << "\techo Building " << target2 << " in directory " << directory << "\n";
fout << "\t$(MAKE) -$(MAKEFLAGS) " << target2 << "\n"; fout << "\t$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) " << target2 << "\n";
} }
std::string currentDir = m_Makefile->GetCurrentOutputDirectory(); std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
cmSystemTools::ConvertToWindowsSlashes(currentDir); cmSystemTools::ConvertToWindowsSlashes(currentDir);
@ -699,7 +700,7 @@ void cmNMakeMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout,
cmSystemTools::ConvertToWindowsSlashes(currentDir); cmSystemTools::ConvertToWindowsSlashes(currentDir);
fout << cmSystemTools::EscapeSpaces(fullpath) fout << cmSystemTools::EscapeSpaces(fullpath)
<< ":\n\tcd " << cmSystemTools::EscapeSpaces(path) << ":\n\tcd " << cmSystemTools::EscapeSpaces(path)
<< "\n\t$(MAKE) " << cmSystemTools::EscapeSpaces(fullpath) << "\n\t$(MAKE) $(MAKESILENT) " << cmSystemTools::EscapeSpaces(fullpath)
<< "\n\tcd " << << "\n\tcd " <<
cmSystemTools::EscapeSpaces(currentDir.c_str()) << "\n"; cmSystemTools::EscapeSpaces(currentDir.c_str()) << "\n";
} }

View File

@ -229,6 +229,8 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
fout << "# " << i->c_str() << "\n"; fout << "# " << i->c_str() << "\n";
} }
fout << "\n\n"; fout << "\n\n";
fout << "# Suppresses display of executed commands\n";
fout << ".SILENT:\n";
// create a make variable with all of the sources for this Makefile // create a make variable with all of the sources for this Makefile
// for depend purposes. // for depend purposes.
fout << "CMAKE_MAKEFILE_SOURCES = "; fout << "CMAKE_MAKEFILE_SOURCES = ";
@ -249,8 +251,8 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
"Default target executed when no arguments are given to make", "Default target executed when no arguments are given to make",
"default_target", "default_target",
0, 0,
"$(MAKE) -$(MAKEFLAGS) cmake.depends_mark", "$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) cmake.depends_mark",
"$(MAKE) -$(MAKEFLAGS) all"); "$(MAKE) -$(MAKEFLAGS) $(MAKESILENT) all");
this->OutputTargetRules(fout); this->OutputTargetRules(fout);
this->OutputDependLibs(fout); this->OutputDependLibs(fout);
@ -876,7 +878,7 @@ void cmUnixMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout,
} }
fout << cmSystemTools::EscapeSpaces(fullpath) fout << cmSystemTools::EscapeSpaces(fullpath)
<< ":\n\tcd " << cmSystemTools::EscapeSpaces(path) << ":\n\tcd " << cmSystemTools::EscapeSpaces(path)
<< "; $(MAKE) " << makeTarget << "\n\n"; << "; $(MAKE) $(MAKESILENT) " << makeTarget << "\n\n";
} }
bool cmUnixMakefileGenerator::SamePath(const char* path1, const char* path2) bool cmUnixMakefileGenerator::SamePath(const char* path1, const char* path2)
@ -1504,8 +1506,6 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
"-@ $(RM) $(CLEAN_OBJECT_FILES) $(EXECUTABLES)" "-@ $(RM) $(CLEAN_OBJECT_FILES) $(EXECUTABLES)"
" $(TARGETS)"); " $(TARGETS)");
} }
fout << "# Suppresses display of executed commands\n";
fout << ".SILENT:\n";
fout << "\n#Rule to build the cmake.depends and Makefile as side effect\n"; fout << "\n#Rule to build the cmake.depends and Makefile as side effect\n";
fout << "cmake.depends_mark: $(CMAKE_MAKEFILE_SOURCES)\n"; fout << "cmake.depends_mark: $(CMAKE_MAKEFILE_SOURCES)\n";
this->BuildInSubDirectory(fout, this->BuildInSubDirectory(fout,